Text archives Help
- From: bigler@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1582 - in trunk: Core Core/Util Engine/PixelSamplers Interface Model/Groups Model/Primitives Model/Textures UserInterface scenes
- Date: Mon, 30 Jul 2007 15:23:33 -0600 (MDT)
Author: bigler
Date: Mon Jul 30 15:23:31 2007
New Revision: 1582
Added:
trunk/Core/Util/StaticCheck.h
Modified:
trunk/Core/CMakeLists.txt
trunk/Engine/PixelSamplers/TimeViewSampler.cc
trunk/Interface/RayPacket.h
trunk/Model/Groups/TimeSteppedParticles.cc
trunk/Model/Groups/TimeSteppedParticles.h
trunk/Model/Primitives/Disk.cc
trunk/Model/Primitives/Disk.h
trunk/Model/Primitives/GridSpheres.cc
trunk/Model/Primitives/HeavyTriangle.cc
trunk/Model/Primitives/Sphere.cc
trunk/Model/Primitives/Triangle.cc
trunk/Model/Textures/ColorMap.h
trunk/Model/Textures/ImageTexture.h
trunk/UserInterface/CameraPathAutomator.cc
trunk/scenes/objviewer.cc
Log:
Warning bashing.
Core/CMakeLists.txt
Added StaticCheck.h
Core/Util/StaticCheck.h
Helper macro for warningless static checking.
Engine/PixelSamplers/TimeViewSampler.cc
Model/Textures/ImageTexture.h
Initialize variables to quiet warnings.
Interface/RayPacket.h
Using MANTA_STATIC_CHECK instead of unused character array. This
fixes the warnings about unnamed being unused.
Model/Groups/TimeSteppedParticles.cc
Model/Groups/TimeSteppedParticles.h
Changed min/max to be unsigned ints.
Model/Primitives/Disk.cc
Model/Primitives/Disk.h
Model/Primitives/GridSpheres.cc
Model/Textures/ColorMap.h
UserInterface/CameraPathAutomator.cc
Reorder member variable initialization to quiet warnings.
Model/Primitives/HeavyTriangle.cc
Model/Primitives/Sphere.cc
Model/Primitives/Triangle.cc
Use size_t to iterate over vectors.
scenes/objviewer.cc
Comment out unused variable.
Modified: trunk/Core/CMakeLists.txt
==============================================================================
--- trunk/Core/CMakeLists.txt (original)
+++ trunk/Core/CMakeLists.txt Mon Jul 30 15:23:31 2007
@@ -72,6 +72,7 @@
Util/Preprocessor.h
Util/PriorityQueue.h
Util/Stat.h
+ Util/StaticCheck.h
Util/ThreadStorage.h
Util/ThreadStorage.cc
)
Added: trunk/Core/Util/StaticCheck.h
==============================================================================
--- (empty file)
+++ trunk/Core/Util/StaticCheck.h Mon Jul 30 15:23:31 2007
@@ -0,0 +1,49 @@
+#define USE_LOKI_STATIC_CHECK 1
+
+#if USE_LOKI_STATIC_CHECK
+// This version came from Loki.
+
+//
http://loki-lib.svn.sourceforge.net/viewvc/loki-lib/trunk/include/loki/static_check.h?revision=752&view=markup
+
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2001 by Andrei Alexandrescu
+// This code accompanies the book:
+// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
+// Patterns Applied". Copyright (c) 2001. Addison-Wesley.
+// Permission to use, copy, modify, distribute and sell this software for any
+// purpose is hereby granted without fee, provided that the above
copyright
+// notice appear in all copies and that both that copyright notice and
this
+// permission notice appear in supporting documentation.
+// The author or Addison-Wesley Longman make no representations about the
+// suitability of this software for any purpose. It is provided "as is"
+// without express or implied warranty.
+////////////////////////////////////////////////////////////////////////////////
+
+namespace Manta {
+
+ template<int> struct CompileTimeChecker;
+ template<> struct CompileTimeChecker<true> { };
+
+};
+
+#define MANTA_STATIC_CHECK(expr, msg) \
+ { Manta::CompileTimeChecker<((expr) != 0)> ERROR_##msg;
(void)ERROR_##msg; }
+
+#else
+
+namespace Manta {
+ // This version came from Modern C++ Design
+ template<bool> struct CompileTimeChecker
+ {
+ CompileTimeChecker(...);
+ };
+ template<> struct CompileTimeChecker<false> {};
+};
+
+#define MANTA_STATIC_CHECK(expr, msg) \
+ {\
+ class ERROR_##msg {}; \
+ (void)sizeof((Manta::CompileTimeChecker<(expr) !=
0>(ERROR_##msg())));\
+ }
+#endif
Modified: trunk/Engine/PixelSamplers/TimeViewSampler.cc
==============================================================================
--- trunk/Engine/PixelSamplers/TimeViewSampler.cc (original)
+++ trunk/Engine/PixelSamplers/TimeViewSampler.cc Mon Jul 30 15:23:31
2007
@@ -75,7 +75,7 @@
void TimeViewSampler::renderFragment(const RenderContext& context,
Fragment& fragment)
{
- double startTime;
+ double startTime = 0;
if (active) {
#if USE_SCIRUN_TIME
startTime = SCIRun::Time::currentSeconds();
Modified: trunk/Interface/RayPacket.h
==============================================================================
--- trunk/Interface/RayPacket.h (original)
+++ trunk/Interface/RayPacket.h Mon Jul 30 15:23:31 2007
@@ -37,6 +37,7 @@
#include <Core/Math/Expon.h>
#include <Core/Util/Assert.h>
#include <Core/Util/Align.h>
+#include <Core/Util/StaticCheck.h>
#include <Interface/Parameters.h>
#include <Interface/Primitive.h>
#include <Interface/TexCoordMapper.h>
@@ -774,9 +775,8 @@
// This is for the non-vertical scratchpad
template<class T> T& scratchpad(int which) {
- // This trick is from Andrew Kensler. It will trigger a compile
- // error if the type to be stored in the scratchpad is too big.
- char unnamed[ ( sizeof( T ) <= RayPacketData::MaxScratchpadSize ) ? 1
: 0 ];
+ MANTA_STATIC_CHECK( sizeof( T ) <= RayPacketData::MaxScratchpadSize,
+ Scratchpad_size_isnt_big_enough_for_conversion);
return *(T*)data->scratchpad_data[which];
}
// This will copy the contects of the scratchpad from the incoming
@@ -788,7 +788,8 @@
}
// This is for the vertical scratchpad
template<class T> T* getScratchpad(int idx) {
- char unnamed[ ( sizeof(T) == 4 || sizeof(T) == 8) ? 1 : 0 ];
+ MANTA_STATIC_CHECK ( sizeof(T) == 4 || sizeof(T) == 8,
+ size_of_type_isnt_4_or_8);
ASSERT(idx >= 0);
if(sizeof(T) == 4){
ASSERT(idx < RayPacketData::MaxScratchpad4);
Modified: trunk/Model/Groups/TimeSteppedParticles.cc
==============================================================================
--- trunk/Model/Groups/TimeSteppedParticles.cc (original)
+++ trunk/Model/Groups/TimeSteppedParticles.cc Mon Jul 30 15:23:31 2007
@@ -16,7 +16,7 @@
TimeSteppedParticles::TimeSteppedParticles(const string& filename, int
ncells,
int depth, Real radius, int ridx,
RegularColorMap* cmap, int cidx,
- int min, int max) :
+ unsigned int min, unsigned int
max) :
tstep(0)
{
// Check for a single timestep
Modified: trunk/Model/Groups/TimeSteppedParticles.h
==============================================================================
--- trunk/Model/Groups/TimeSteppedParticles.h (original)
+++ trunk/Model/Groups/TimeSteppedParticles.h Mon Jul 30 15:23:31 2007
@@ -20,7 +20,7 @@
public:
TimeSteppedParticles(const string& filename, int ncells, int depth,
Real radius, int ridx, RegularColorMap* cmap, int
cidx,
- int min=0, int max=INT_MAX);
+ unsigned int min=0, unsigned int max=UINT_MAX);
~TimeSteppedParticles(void);
void intersect(const RenderContext& context, RayPacket& rays) const;
Modified: trunk/Model/Primitives/Disk.cc
==============================================================================
--- trunk/Model/Primitives/Disk.cc (original)
+++ trunk/Model/Primitives/Disk.cc Mon Jul 30 15:23:31 2007
@@ -10,7 +10,8 @@
Disk::Disk(Material* mat, const Vector& center, const Vector& n,
Real radius, const Vector& axis)
: PrimitiveCommon(mat, this), _c(center), _n(n), _r(radius),
- _partial(false), _minTheta(0.0), _maxTheta(2.0 * M_PI)
+ _minTheta(0.0), _maxTheta(2.0 * M_PI),
+ _partial(false)
{
_n.normalize();
_d = -Dot(_n, _c);
@@ -20,7 +21,8 @@
Disk::Disk(Material* mat, const Vector& center, const Vector& n,
Real radius, const Vector& axis, Real minTheta, Real maxTheta)
: PrimitiveCommon(mat, this), _c(center), _n(n), _r(radius),
- _partial(true), _minTheta(minTheta), _maxTheta(maxTheta)
+ _minTheta(minTheta), _maxTheta(maxTheta),
+ _partial(true)
{
_n.normalize();
_d = -Dot(_n, _c);
Modified: trunk/Model/Primitives/Disk.h
==============================================================================
--- trunk/Model/Primitives/Disk.h (original)
+++ trunk/Model/Primitives/Disk.h Mon Jul 30 15:23:31 2007
@@ -23,10 +23,10 @@
virtual void computeTexCoords3(const RenderContext& context, RayPacket&
rays) const;
private:
- bool _partial;
Vector _c;
Vector _n, _u, _v;
Real _d, _r, _minTheta, _maxTheta;
+ bool _partial;
bool checkBounds(const Vector& p) const;
void setupAxes(const Vector& axis);
Modified: trunk/Model/Primitives/GridSpheres.cc
==============================================================================
--- trunk/Model/Primitives/GridSpheres.cc (original)
+++ trunk/Model/Primitives/GridSpheres.cc Mon Jul 30 15:23:31 2007
@@ -28,8 +28,9 @@
GridSpheres::GridSpheres(float* spheres, int nspheres, int nvars, int ncells,
int depth, Real radius, int ridx, RegularColorMap*
cmap,
int cidx) :
- spheres(spheres), nspheres(nspheres), nvars(nvars), ncells(ncells),
- depth(depth), radius(radius), ridx(ridx), cmap(cmap), cidx(cidx)
+ spheres(spheres), nspheres(nspheres), nvars(nvars),
+ radius(radius), ridx(ridx), ncells(ncells), depth(depth),
+ cmap(cmap), cidx(cidx)
{
cerr<<"Initializing GridSpheres\n";
Modified: trunk/Model/Primitives/HeavyTriangle.cc
==============================================================================
--- trunk/Model/Primitives/HeavyTriangle.cc (original)
+++ trunk/Model/Primitives/HeavyTriangle.cc Mon Jul 30 15:23:31 2007
@@ -150,7 +150,7 @@
edge[0] = edge[1] = Vector(0,0,0);
n[0] = n[1] = n[2] = Vector(0,0,0);
- for (int i=0; i < keyframes.size(); ++i) {
+ for (size_t i=0; i < keyframes.size(); ++i) {
HeavyTriangle *tri = dynamic_cast<HeavyTriangle*>(keyframes[i].keyframe);
if (tri == NULL)
return notInterpolable;
Modified: trunk/Model/Primitives/Sphere.cc
==============================================================================
--- trunk/Model/Primitives/Sphere.cc (original)
+++ trunk/Model/Primitives/Sphere.cc Mon Jul 30 15:23:31 2007
@@ -395,7 +395,7 @@
center = Vector(0,0,0);
radius = 0.0f;
- for (int i=0; i < keyframes.size(); ++i) {
+ for (size_t i=0; i < keyframes.size(); ++i) {
Interpolable::keyframe_t kt = keyframes[i];
Sphere *sphere = dynamic_cast<Sphere*>(keyframes[i].keyframe);
if (sphere == NULL)
Modified: trunk/Model/Primitives/Triangle.cc
==============================================================================
--- trunk/Model/Primitives/Triangle.cc (original)
+++ trunk/Model/Primitives/Triangle.cc Mon Jul 30 15:23:31 2007
@@ -102,7 +102,7 @@
p1 = Vector(0,0,0);
p2 = Vector(0,0,0);
p3 = Vector(0,0,0);
- for (int i=0; i < keyframes.size(); ++i) {
+ for (size_t i=0; i < keyframes.size(); ++i) {
Interpolable::keyframe_t kt = keyframes[i];
Triangle *tri = dynamic_cast<Triangle*>(keyframes[i].keyframe);
if (tri == NULL)
Modified: trunk/Model/Textures/ColorMap.h
==============================================================================
--- trunk/Model/Textures/ColorMap.h (original)
+++ trunk/Model/Textures/ColorMap.h Mon Jul 30 15:23:31 2007
@@ -65,8 +65,8 @@
RayPacket& rays) const;
private:
- Material* baseMaterial;
RegularColorMap cmap;
+ Material* baseMaterial;
Real min, max;
Real inv_range;
int ncolors;
Modified: trunk/Model/Textures/ImageTexture.h
==============================================================================
--- trunk/Model/Textures/ImageTexture.h (original)
+++ trunk/Model/Textures/ImageTexture.h Mon Jul 30 15:23:31 2007
@@ -259,8 +259,10 @@
for( int i = rays.begin(); i < rays.end(); ++i) {
ScalarType x = tex_coords[i].x();
ScalarType y = tex_coords[i].y();
- int x_low, y_low, x_high, y_high;
- ScalarType x_weight_high, y_weight_high;
+ // Initialize these variables to something to quiet the
+ // warnings.
+ int x_low = 0, y_low = 0, x_high = 0, y_high = 0;
+ ScalarType x_weight_high = 0, y_weight_high = 0;
BL_edge_behavior(x, u_edge, xres, x_low, x_high, x_weight_high);
BL_edge_behavior(y, v_edge, yres, y_low, y_high, y_weight_high);
Modified: trunk/UserInterface/CameraPathAutomator.cc
==============================================================================
--- trunk/UserInterface/CameraPathAutomator.cc (original)
+++ trunk/UserInterface/CameraPathAutomator.cc Mon Jul 30 15:23:31 2007
@@ -59,19 +59,18 @@
Real delta_t_, Real delta_time_ )
:
AutomatorUI( manta_interface_, warmup_frames ),
- synchronize_barrier( "sync barrier" ),
- channel( channel_ ),
- last_sync_frame( 0 ),
- last_sync_seconds( 0 ),
- average_fps( 0 ),
-
+ total_points( total_points_ ),
delta_t( delta_t_ ),
delta_time( delta_time_ ),
- total_points( total_points_ ),
+ channel( channel_ ),
+ synchronize_barrier( "sync barrier" ),
+ last_sync_seconds( 0 ),
+ last_sync_frame( 0 ),
sync_frames( 0 ),
loop_behavior( PATH_STOP ),
interval_start( 1 ),
- interval_last ( total_points-2 )
+ interval_last ( total_points-2 ),
+ average_fps( 0 )
{
eye = new Vector[total_points];
lookat = new Vector[total_points];
@@ -89,18 +88,18 @@
Real delta_t_, Real delta_time_ )
:
AutomatorUI( manta_interface_, warmup_ ),
- synchronize_barrier( "sync barrier" ),
- channel( channel_ ),
- last_sync_frame( 0 ),
- last_sync_seconds( 0 ),
- average_fps( 0 ),
+ total_points( camera_data.size() ),
delta_t( delta_t_ ),
delta_time( delta_time_ ),
- total_points( camera_data.size() ),
+ channel( channel_ ),
+ synchronize_barrier( "sync barrier" ),
+ last_sync_seconds( 0 ),
+ last_sync_frame( 0 ),
sync_frames( 0 ),
loop_behavior( PATH_STOP ),
interval_start( 1 ),
- interval_last ( camera_data.size()-2 )
+ interval_last ( camera_data.size()-2 ),
+ average_fps( 0 )
{
eye = new Vector[total_points];
@@ -124,15 +123,15 @@
int warmup_frames, const string
&file_name,
Real delta_t_, Real delta_time_ ) :
AutomatorUI( manta_interface_, warmup_frames ),
- synchronize_barrier( "sync barrier" ),
- channel( channel_ ),
- last_sync_frame( 0 ),
- last_sync_seconds( 0 ),
- average_fps( 0 ),
delta_t( delta_t_ ),
delta_time( delta_time_ ),
+ channel( channel_ ),
+ synchronize_barrier( "sync barrier" ),
+ last_sync_seconds( 0 ),
+ last_sync_frame( 0 ),
loop_behavior( PATH_STOP ),
- interval_start( 1 )
+ interval_start( 1 ),
+ average_fps( 0 )
{
total_points = 0;
@@ -299,7 +298,7 @@
Real delta_t = 0;
Real delta_time = 0;
- for (int i=0; i<args.size(); ++i) {
+ for (int i=0; i<static_cast<int>(args.size()); ++i) {
if (args[i] == "-file") {
file_name = args[++i];
}
Modified: trunk/scenes/objviewer.cc
==============================================================================
--- trunk/scenes/objviewer.cc (original)
+++ trunk/scenes/objviewer.cc Mon Jul 30 15:23:31 2007
@@ -252,10 +252,10 @@
scene->setLights( lights );
Material* red=new Lambertian(Color(RGBColor(.6,0,0)));
- Material* yellow=new Lambertian(Color(RGBColor(.6,.6,0)));
Group *manta_group = new Group();
// // Add a floor.
+// Material* yellow=new Lambertian(Color(RGBColor(.6,.6,0)));
// Parallelogram* floor = new Parallelogram(yellow,
Vector(-20,-20,bounds[0][2]),
// Vector(40,0,0),
Vector(0,40,0));
// manta_group->add( floor );
- [MANTA] r1582 - in trunk: Core Core/Util Engine/PixelSamplers Interface Model/Groups Model/Primitives Model/Textures UserInterface scenes, bigler, 07/30/2007
Archive powered by MHonArc 2.6.16.