Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1558 - in trunk: DynLT scenes


Chronological Thread 
  • From: cgribble@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1558 - in trunk: DynLT scenes
  • Date: Thu, 26 Jul 2007 09:41:06 -0600 (MDT)

Author: cgribble
Date: Thu Jul 26 09:41:04 2007
New Revision: 1558

Modified:
   trunk/DynLT/DynLTParticles.cc
   trunk/DynLT/DynLTParticles.h
   trunk/scenes/dynlt.cc
Log:
Some minor cleanup of DynLT particles and scene in preparation for 
benchmarking

Modified: trunk/DynLT/DynLTParticles.cc
==============================================================================
--- trunk/DynLT/DynLTParticles.cc       (original)
+++ trunk/DynLT/DynLTParticles.cc       Thu Jul 26 09:41:04 2007
@@ -17,9 +17,11 @@
 
 using namespace Manta;
 
-DynLTParticles::DynLTParticles(const string& filename, int ncells, int depth,
-                               Real radius, int ridx, RegularColorMap* cmap,
-                               int cidx, DynLTQueue* queue, int min, int 
max, int textureMode) :
+DynLTParticles::DynLTParticles(const string& type, const string& filename,
+                               int ncells, int depth, Real radius, int ridx,
+                               RegularColorMap* cmap, int cidx,
+                               DynLTQueue* queue, int min, int max,
+                               int textureMode) :
   tstep(0)
 {
   // Check for a single timestep
@@ -27,56 +29,16 @@
                  filename.find(".nhdr", 0) != string::npos);
   if (isNrrd) {
     ParticleNRRD pnrrd(filename);
-    add(new DynLTGridSpheres(queue, pnrrd.getParticleData(),
-                             pnrrd.getNParticles(), pnrrd.getNVars(), ncells,
-                             depth, radius, ridx, cmap, cidx, textureMode));
-    return;
-  }
-
-  // Load multiple timesteps
-  ifstream in(filename.c_str());
-  if (!in.is_open())
-    throw InputError("Failed to open \"" + filename + "\" for reading\n");
-
-  string fname;
-  unsigned int nskipped=0;
-  unsigned int nloaded=0;
-  while (!in.eof() && min + nloaded < max) {
-    // Read the timestep filename
-    in>>fname;
-
-    // Ignore timesteps below the minimum
-    if (nskipped<min) {
-      ++nskipped;
-      continue;
+    if (type == "gspheres") {
+      add(new DynLTGridSpheres(queue, pnrrd.getParticleData(),
+                               pnrrd.getNParticles(), pnrrd.getNVars(), 
ncells,
+                               depth, radius, ridx, cmap, cidx, 
textureMode));
+    } else {
+      add(new DynLTCGT(pnrrd, queue, pnrrd.getParticleData(),
+                       pnrrd.getNParticles(), pnrrd.getNVars(), ncells,
+                       depth, radius, ridx, cmap, cidx, textureMode));
     }
 
-    // Load the particle data
-    ParticleNRRD pnrrd(fname);
-    add(new DynLTGridSpheres(queue, pnrrd.getParticleData(),
-                             pnrrd.getNParticles(), pnrrd.getNVars(), ncells,
-                             depth, radius, ridx, cmap, cidx, textureMode));
-
-    ++nloaded;
-  }
-
-  in.close();
-}
-
-//overloaded constructor to use CGT instead of gridspheres
-DynLTParticles::DynLTParticles(int type, const string& filename, int ncells, 
int depth,
-Real radius, int ridx, RegularColorMap* cmap,
-                               int cidx, DynLTQueue* queue, int min, int 
max, int textureMode) :
-  tstep(0)
-{
-  // Check for a single timestep
-  bool isNrrd = (filename.find(".nrrd", 0) != string::npos ||
-                 filename.find(".nhdr", 0) != string::npos);
-  if (isNrrd) {
-    ParticleNRRD pnrrd(filename);
-    add(new DynLTCGT(pnrrd, queue, pnrrd.getParticleData(),
-                             pnrrd.getNParticles(), pnrrd.getNVars(), ncells,
-                             depth, radius, ridx, cmap, cidx, textureMode));
     return;
   }
 
@@ -100,16 +62,21 @@
 
     // Load the particle data
     ParticleNRRD pnrrd(fname);
-    add(new DynLTCGT(pnrrd, queue, pnrrd.getParticleData(),
-                             pnrrd.getNParticles(), pnrrd.getNVars(), ncells,
-                             depth, radius, ridx, cmap, cidx, textureMode));
+    if (type == "gspheres") {
+      add(new DynLTGridSpheres(queue, pnrrd.getParticleData(),
+                               pnrrd.getNParticles(), pnrrd.getNVars(), 
ncells,
+                               depth, radius, ridx, cmap, cidx, 
textureMode));
+    } else {
+      add(new DynLTCGT(pnrrd, queue, pnrrd.getParticleData(),
+                       pnrrd.getNParticles(), pnrrd.getNVars(), ncells,
+                       depth, radius, ridx, cmap, cidx, textureMode));
+    }
 
     ++nloaded;
   }
 
   in.close();
 }
-
 
 DynLTParticles::~DynLTParticles(void)
 {

Modified: trunk/DynLT/DynLTParticles.h
==============================================================================
--- trunk/DynLT/DynLTParticles.h        (original)
+++ trunk/DynLT/DynLTParticles.h        Thu Jul 26 09:41:04 2007
@@ -16,13 +16,10 @@
   class DynLTParticles : public Group
   {
   public:
-    DynLTParticles(const string& filename, int ncells, int depth, Real 
radius,
-                   int ridx, RegularColorMap* cmap, int cidx, DynLTQueue* 
queue,
-                   int min=0, int max=INT_MAX, int textureMode = 0);
-    DynLTParticles(int type, const string& filename, int ncells, int depth, 
Real radius,
-                   int ridx, RegularColorMap* cmap, int cidx, DynLTQueue* 
queue,
-                   int min=0, int max=INT_MAX, int textureMode = 0);

+    DynLTParticles(const string& type, const string& filename, int ncells,
+                   int depth, Real radius, int ridx, RegularColorMap* cmap,
+                   int cidx, DynLTQueue* queue, int min=0, int max=INT_MAX,
+                   int textureMode = 0);
    ~DynLTParticles(void);
 
     virtual void intersect(const RenderContext& context, RayPacket& rays) 
const;

Modified: trunk/scenes/dynlt.cc
==============================================================================
--- trunk/scenes/dynlt.cc       (original)
+++ trunk/scenes/dynlt.cc       Thu Jul 26 09:41:04 2007
@@ -64,7 +64,7 @@
   double lx=10.;
   double ly=10.;
   double lz=10.;
-  int gridType = 1;
+  string gridType = "spheres";
   string shadeType = "ambient";
   int shadeTypeInt = DynLTGridSpheres::AmbientOcclusion;
   string colorMapType = "InvRainbowIso";
@@ -74,243 +74,242 @@
   int argc=static_cast<int>(args.size());
   for(int i=0; i<argc; ++i) {
     string arg=args[i];
-#if 0
-    if (arg=="-bv") {
+    if (arg=="-cidx") {
+      if (!getIntArg(i, args, cidx))
+        throw IllegalArgument("scene pnrrd -cidx", i, args);
+    } else if (arg=="-depth") {
+      if (!getIntArg(i, args, depth))
+        throw IllegalArgument("scene dynlt -depth", i, args);
+    } else if (arg=="-dilate") {
+      dilate=true;
+    } else if (arg=="-fifo") {
+      fifo=true;
+      lifo=false;
+    } else if (arg=="-envmap") {
       string s;
       if (!getStringArg(i, args, s))
-        throw IllegalArgument("scene dynlt -bv", i, args);
-      world=context.manta_interface->makeGroup(s);
-#endif
-      if (arg=="-cidx") {
-        if (!getIntArg(i, args, cidx))
-          throw IllegalArgument("scene pnrrd -cidx", i, args);
-      } else if (arg=="-depth") {
-        if (!getIntArg(i, args, depth))
-          throw IllegalArgument("scene dynlt -depth", i, args);
-      } else if (arg=="-dilate") {
-        dilate=true;
-      } else if (arg=="-fifo") {
-        fifo=true;
-        lifo=false;
-      } else if (arg=="-envmap") {
-        string s;
-        if (!getStringArg(i, args, s))
-          throw IllegalArgument("scene dynlt -envmap", i, args);
+        throw IllegalArgument("scene dynlt -envmap", i, args);
 
-        if (s[0] != '-') {
-          if (s=="bg") {
-            use_envmap=true;
-            if (!getStringArg(i, args, env_fname))
-              throw IllegalArgument("scene dynlt -envmap", i, args);
-          } else {
-            env_fname=s;
-          }
+      if (s[0] != '-') {
+        if (s=="bg") {
+          use_envmap=true;
+          if (!getStringArg(i, args, env_fname))
+            throw IllegalArgument("scene dynlt -envmap", i, args);
         } else {
-          throw IllegalArgument("scene dynlt -envmap", i, args);
+          env_fname=s;
         }
-      } else if (arg=="-i") {
-        if (!getStringArg(i, args, fname))
-          throw IllegalArgument("scene dynlt -i", i, args);
-      } else if (arg=="-lifo") {
-        fifo=false;
-        lifo=true;
-      } else if (arg=="-light") {
-        if (!getDoubleArg(i, args, lx))
-          throw IllegalArgument("scene dynlt -light", i, args);
-        if (!getDoubleArg(i, args, ly))
-          throw IllegalArgument("scene dynlt -light", i, args);
-        if (!getDoubleArg(i, args, lz))
-          throw IllegalArgument("scene dynlt -light", i, args);
-      } else if (arg=="-nbounces") {
-        if (!getIntArg(i, args, max_depth))
-          throw IllegalArgument("scene dynlt -nbounces", i, args);
-        ++max_depth;
-      } else if (arg=="-ncells") {
-        if (!getIntArg(i, args, ncells))
-          throw IllegalArgument("scene dynlt -ncells", i, args);
-      } else if (arg=="-ngroups") {
-        if (!getIntArg(i, args, ngroups))
-          throw IllegalArgument("scene dynlt -ngroups", i, args);
-      } else if (arg=="-nsamples") {
-        if (!getIntArg(i, args, nsamples))
-          throw IllegalArgument("scene dynlt -nsamples", i, args);
-      } else if (arg=="-nthreads") {
-        static_threads=true;
-        if (!getIntArg(i, args, nthreads))
-          throw IllegalArgument("scene dynlt -nthreads", i, args);
-      } 
-      else if (arg=="-radius") {
-        if (!getDoubleArg(i, args, radius))
-          throw IllegalArgument("scene dynlt -radius", i, args);
-      } else if (arg=="-ridx") {
-        if (!getIntArg(i, args, ridx))
-          throw IllegalArgument("scene dynlt -ridx", i, args);
-      } else if (arg=="-qsize") {
-        if (!getIntArg(i, args, qsize))
-          throw IllegalArgument("scene dynlt -qsize", i, args);
+      } else {
+        throw IllegalArgument("scene dynlt -envmap", i, args);
+      }
+    } else if (arg=="-i") {
+      if (!getStringArg(i, args, fname))
+        throw IllegalArgument("scene dynlt -i", i, args);
+    } else if (arg=="-lifo") {
+      fifo=false;
+      lifo=true;
+    } else if (arg=="-light") {
+      if (!getDoubleArg(i, args, lx))
+        throw IllegalArgument("scene dynlt -light", i, args);
+      if (!getDoubleArg(i, args, ly))
+        throw IllegalArgument("scene dynlt -light", i, args);
+      if (!getDoubleArg(i, args, lz))
+        throw IllegalArgument("scene dynlt -light", i, args);
+    } else if (arg=="-nbounces") {
+      if (!getIntArg(i, args, max_depth))
+        throw IllegalArgument("scene dynlt -nbounces", i, args);
+      ++max_depth;
+    } else if (arg=="-ncells") {
+      if (!getIntArg(i, args, ncells))
+        throw IllegalArgument("scene dynlt -ncells", i, args);
+    } else if (arg=="-ngroups") {
+      if (!getIntArg(i, args, ngroups))
+        throw IllegalArgument("scene dynlt -ngroups", i, args);
+    } else if (arg=="-nsamples") {
+      if (!getIntArg(i, args, nsamples))
+        throw IllegalArgument("scene dynlt -nsamples", i, args);
+    } else if (arg=="-nthreads") {
+      static_threads=true;
+      if (!getIntArg(i, args, nthreads))
+        throw IllegalArgument("scene dynlt -nthreads", i, args);
+    } else if (arg=="-radius") {
+      if (!getDoubleArg(i, args, radius))
+        throw IllegalArgument("scene dynlt -radius", i, args);
+    } else if (arg=="-ridx") {
+      if (!getIntArg(i, args, ridx))
+        throw IllegalArgument("scene dynlt -ridx", i, args);
+    } else if (arg=="-qsize") {
+      if (!getIntArg(i, args, qsize))
+        throw IllegalArgument("scene dynlt -qsize", i, args);
 #ifdef USE_STATS_COLLECTOR
-      } else if (arg=="-stats") {
-        stats=true;
+    } else if (arg=="-stats") {
+      stats=true;
 #endif
-      } else if (arg=="-timed") {
-        string s;
-        if (getStringArg(i, args, s)) {
-          if (s[0] != '-') {
-            runtime=atof(s.c_str());
-            if (getStringArg(i, args, s)) {
-              minproc=atoi(s.c_str());
-              if (!getIntArg(i, args, maxproc))
-                throw IllegalArgument("scene dynlt -nthreads", i, args);
-            }
+    } else if (arg=="-timed") {
+      string s;
+      if (getStringArg(i, args, s)) {
+        if (s[0] != '-') {
+          runtime=atof(s.c_str());
+          if (getStringArg(i, args, s)) {
+            minproc=atoi(s.c_str());
+            if (!getIntArg(i, args, maxproc))
+              throw IllegalArgument("scene dynlt -nthreads", i, args);
           }
         }
-      } else if (arg=="-gridtype") {
-       if (!getIntArg(i, args, gridType))
-         throw IllegalArgument("scene dynlt -gridtype", i, args);
-      } else if (arg=="-shadetype") {
-       if (!getStringArg(i, args, shadeType))
-               throw IllegalArgument("scene dynlt -shadetype", i , args);
-      } else if (arg=="-colormap") {
-       if (!getStringArg(i, args, colorMapType))
-               throw IllegalArgument("scene dynlt -colormap", i, args);      
  
-       } else {
-        cerr<<"Valid options for scene dynlt:\n";
-        // cerr<<"  -bv <string>                     bounding volume 
{bvh|grid|group}\n";
-        cerr<<"  -cidx <int>                       data value index for 
color mapping\n";
-        cerr<<"  -depth <int>                      grid depth\n";
-        cerr<<"  -dilate                           dilate textures during 
generation\n";
-        cerr<<"  -fifo                             use fifo queue for 
texture requests\n";
-        cerr<<"  -envmap [bg] <string>             environment map 
filename\n";
-        cerr<<"  -i <string>                       particle data filename\n";
-        cerr<<"  -lifo                             use lifo queue for 
texture requests\n";
-        cerr<<"  -light <x> <y> <z>                light position\n";
-        cerr<<"  -nbounces <int>                   number of indirect 
nbounces\n";
-        cerr<<"  -ncells <int>                     grid resolution\n";
-        cerr<<"  -ngroups <int>                    number of sample 
groups\n";
-        cerr<<"  -nsamples <int>                   number of 
samples/texel\n";
-        cerr<<"  -nthreads <int>                   number of static dynlt 
workers\n";
-        cerr<<"  -qsize <int>                      maximum queue qsize\n";
-        cerr<<"  -radius <float>                   particle radius\n";
-        cerr<<"  -ridx <int>                       radius index\n";
+      }
+    } else if (arg=="-gridtype") {
+      if (!getStringArg(i, args, gridType))
+        throw IllegalArgument("scene dynlt -gridtype", i, args);
+    } else if (arg=="-shadetype") {
+      if (!getStringArg(i, args, shadeType))
+        throw IllegalArgument("scene dynlt -shadetype", i , args);
+    } else if (arg=="-colormap") {
+      if (!getStringArg(i, args, colorMapType))
+        throw IllegalArgument("scene dynlt -colormap", i, args);       
+    } else {
+      cerr<<"Valid options for scene dynlt:\n";
+      // cerr<<"  -bv <string>                     bounding volume 
{bvh|grid|group}\n";
+      cerr<<"  -cidx <int>                       data value index for color 
mapping\n";
+      cerr<<"  -depth <int>                      grid depth\n";
+      cerr<<"  -dilate                           dilate textures during 
generation\n";
+      cerr<<"  -fifo                             use fifo queue for texture 
requests\n";
+      cerr<<"  -envmap [bg] <string>             environment map filename\n";
+      cerr<<"  -i <string>                       particle data filename\n";
+      cerr<<"  -lifo                             use lifo queue for texture 
requests\n";
+      cerr<<"  -light <x> <y> <z>                light position\n";
+      cerr<<"  -nbounces <int>                   number of indirect 
nbounces\n";
+      cerr<<"  -ncells <int>                     grid resolution\n";
+      cerr<<"  -ngroups <int>                    number of sample groups\n";
+      cerr<<"  -nsamples <int>                   number of samples/texel\n";
+      cerr<<"  -nthreads <int>                   number of static dynlt 
workers\n";
+      cerr<<"  -qsize <int>                      maximum queue qsize\n";
+      cerr<<"  -radius <float>                   particle radius\n";
+      cerr<<"  -ridx <int>                       radius index\n";
 #ifdef USE_STATS_COLLECTOR
-        cerr<<"  -stats                            dump summary stats on 
exit\n";
+      cerr<<"  -stats                            dump summary stats on 
exit\n";
 #endif
-        cerr<<"  -timed [<double> [<int> <int>]]   texgen thread range and 
runtime (in seconds)\n";
-       cerr<<"  -gridtype <int>                   1 for default, 2 for CGT";
-       cerr<<"  -shadetype <string>               type of shading 
{ambient|global}\n";
-       cerr<<"   -colormap <string>                type of colormap, 
InvRainbowIso, \
+      cerr<<"  -timed [<double> [<int> <int>]]   texgen thread range and run 
time (in seconds)\n";
+      cerr<<"  -gridtype <string>                type of grid { gspheres | 
pcgt }";
+      cerr<<"  -shadetype <string>               type of shading { ambient | 
global }\n";
+      cerr<<"   -colormap <string>                type of colormap:  
InvRainbowIso, \
       InvRainbow, \
       Rainbow, \
       InvGreyScale, \
       InvBlackBody, \
       BlackBody, \
       GreyScale\n";
-      }
-    }
-    if (shadeType == "ambient")
-       shadeTypeInt = DynLTGridSpheres::AmbientOcclusion;
-    else
-       shadeTypeInt = DynLTGridSpheres::GlobalIllumination;
-    
-    if (!world)
-      world=new Group();
-
-    // Create a scene
-    Scene* scene=new Scene();
-
-    // Create DynLT work queue
-    DynLTQueue* queue;
-    if (fifo) {
-      queue=new DynLTFifoQ(nthreads*qsize);
-      cerr<<"Using FIFO Queue\n";
-    } else if (lifo) {
-      queue=new DynLTLifoQ(nthreads*qsize);
-      cerr<<"Using LIFO Queue\n";
-    } else {
-      queue=new DynLTPriorityQ(nthreads*qsize);
-      cerr<<"Using Priority Queue\n";
     }
-    Background* bg=0;
-    if (env_fname != "")
-      bg=new EnvMapBackground(env_fname);
-    else
-      bg=new ConstantBackground(Color(RGB(0, 0, 0)));
-    if (static_threads) {
-      // Static thread scheduling --> create DynLTWorker threads
-      DynLTContext* dpltctx=new DynLTContext(context.manta_interface,
-                                             queue, scene, ngroups, nsamples,
-                                             max_depth, dilate, bg /*, 
runtime,
-                                                                     
minproc, maxproc, kd, ka */);
-      for (unsigned int i=0; i<nthreads; ++i) {
-        ostringstream name;
-        name<<"DynLT Worker "<<i;
-        DynLTWorker* worker=new DynLTWorker(dpltctx, i);
-        Thread* thread=new Thread(worker, name.str().c_str(), 0,
-                                  Thread::NotActivated);
-        thread->setStackSize(WORKER_THREAD_STACKSIZE);
-        thread->activate(false);
-      
-        // Register termination callback
-        
context.manta_interface->registerTerminationCallback(Callback::create(worker, 
&DynLTWorker::terminate));
-      }
-    } else {
-      // Dynamic thread scheduling --> register timed texgen function
-      DynLTContext* dpltctx=new DynLTContext(context.manta_interface,
-                                             queue, scene, ngroups, nsamples,
-                                             max_depth, dilate, bg, runtime,
-                                             minproc, maxproc , kd, ka );
+  }
 
-      DynLTWorker* worker=new DynLTWorker(dpltctx, 0);
-      
context.manta_interface->registerParallelPreRenderCallback(Callback::create(worker,
 &DynLTWorker::timedRun));
+  if (gridType == "gspheres")
+    cerr<<"Using GridSpheres\n";
+  else if (gridType == "pcgt")
+    cerr<<"Using ParticleCGT\n";
+  else {
+    gridType = "gspheres";
+    cerr<<"Invalid grid type:  using GridSpheres\n";
+  }
+
+  if (shadeType == "ambient") {
+    shadeTypeInt = DynLTGridSpheres::AmbientOcclusion;
+    cerr<<"Using Ambient Occlusion\n";
+  } else if (shadeType == "global") {
+    shadeTypeInt = DynLTGridSpheres::GlobalIllumination;
+    cerr<<"Using Global Illumination\n";
+  } else {
+    shadeTypeInt = DynLTGridSpheres::AmbientOcclusion;
+    cerr<<"Invalid shade type:  using Ambient Occlusion\n";
+  }
+
+  if (!world)
+    world=new Group();
+
+  // Create a scene
+  Scene* scene=new Scene();
+
+  // Create DynLT work queue
+  DynLTQueue* queue;
+  if (fifo) {
+    queue=new DynLTFifoQ(nthreads*qsize);
+    cerr<<"Using FIFO Queue\n";
+  } else if (lifo) {
+    queue=new DynLTLifoQ(nthreads*qsize);
+    cerr<<"Using LIFO Queue\n";
+  } else {
+    queue=new DynLTPriorityQ(nthreads*qsize);
+    cerr<<"Using Priority Queue\n";
+  }
+
+  Background* bg=0;
+  if (env_fname != "")
+    bg=new EnvMapBackground(env_fname);
+  else
+    bg=new ConstantBackground(Color(RGB(0, 0, 0)));
+  if (static_threads) {
+    // Static thread scheduling --> create DynLTWorker threads
+    DynLTContext* dpltctx=new DynLTContext(context.manta_interface,
+                                           queue, scene, ngroups, nsamples,
+                                           max_depth, dilate, bg /*, runtime,
+                                           minproc, maxproc, kd, ka */);
+    for (unsigned int i=0; i<nthreads; ++i) {
+      ostringstream name;
+      name<<"DynLT Worker "<<i;
+      DynLTWorker* worker=new DynLTWorker(dpltctx, i);
+      Thread* thread=new Thread(worker, name.str().c_str(), 0,
+                                Thread::NotActivated);
+      thread->setStackSize(WORKER_THREAD_STACKSIZE);
+      thread->activate(false);
+      
+      // Register termination callback
+      
context.manta_interface->registerTerminationCallback(Callback::create(worker, 
&DynLTWorker::terminate));
     }
+  } else {
+    // Dynamic thread scheduling --> register timed texgen function
+    DynLTContext* dpltctx=new DynLTContext(context.manta_interface,
+                                           queue, scene, ngroups, nsamples,
+                                           max_depth, dilate, bg, runtime,
+                                           minproc, maxproc , kd, ka );
+
+    DynLTWorker* worker=new DynLTWorker(dpltctx, 0);
+    
context.manta_interface->registerParallelPreRenderCallback(Callback::create(worker,
 &DynLTWorker::timedRun));
+  }
 
 #ifdef USE_STATS_COLLECTOR
-    //Register DynLTStatsCollector::resetPerFrameStats to reset per-frame 
stats
-    
context.manta_interface->registerSerialPreRenderCallback(Callback::create(DynLTStatsCollector::resetPerFrameStats));
 
+  // Register DynLTStatsCollector::resetPerFrameStats to reset per-frame 
stats
+  
context.manta_interface->registerSerialPreRenderCallback(Callback::create(DynLTStatsCollector::resetPerFrameStats));
 
 
-    if (stats) {
-      // Register DynLTStatsCollector::dump to output statistics on exit
-      
context.manta_interface->registerTerminationCallback(Callback::create(DynLTStatsCollector::dump));
-    }
+  if (stats) {
+    // Register DynLTStatsCollector::dump to output statistics on exit
+    
context.manta_interface->registerTerminationCallback(Callback::create(DynLTStatsCollector::dump));
+  }
 #else
-    if (stats)
-      cerr<<"Warning:  USE_STATS_COLLECTOR not defined\n";
+  if (stats)
+    cerr<<"Warning:  USE_STATS_COLLECTOR not defined\n";
 #endif
 
-    // Create color map
-    unsigned int type=RegularColorMap::parseType(colorMapType.c_str());
-    RegularColorMap* cmap=new RegularColorMap(type);
-    Object* tsteps = NULL;
-
-    if (gridType == 1) //Default grid
-      {
-    // Load particle data, add particles to group
-    tsteps=new DynLTParticles(fname, ncells, depth, radius,
-                                              ridx, cmap, cidx, queue, 0, 
INT_MAX, shadeTypeInt);
-    queue->resizeHeapIdx(((DynLTParticles*)tsteps)->getNParticles(0));
-    }
-    else //CGT
-   {
-     //TODO: insert CGT grid stuff here
-       tsteps = new DynLTParticles(1, fname, ncells, depth, radius, ridx, 
cmap, cidx, queue, 0, INT_MAX, shadeTypeInt);
-       queue->resizeHeapIdx(((DynLTParticles*)tsteps)->getNParticles(0));
-   }
-
-    // Initialize the scene
-    if (env_fname != "" && use_envmap)
-      scene->setBackground(bg);
-    else
-      // scene->setBackground(new ConstantBackground(Color(RGB(0, 0, 0))));
-     scene->setBackground(new ConstantBackground(Color(RGB(0.3, 0.3, 0.3))));
-    scene->setObject(tsteps);
-
-    // Add lights
-    LightSet* lights=new LightSet();
-    lights->add(new PointLight(Vector(lx, ly, lz), Color(RGB(1, 1, 1))));
-    lights->add(new PointLight(Vector(-lx, -ly, -lz), 
Color(RGB(.0,0.1,0.9))));
-    lights->add(new 
PointLight(Cross(Vector(lx,ly,lz),(Vector(-lx,-ly,-lz))), 
Color(RGB(0.5,0.6,0.0))));
-    lights->setAmbientLight(new ConstantAmbient(Color(RGB(0.6, 0.7, 0.8))));
-    scene->setLights(lights);
+  // Create color map
+  unsigned int type=RegularColorMap::parseType(colorMapType.c_str());
+  RegularColorMap* cmap=new RegularColorMap(type);
+  Object* tsteps = NULL;
+
+  tsteps = new DynLTParticles(gridType, fname, ncells, depth, radius, ridx,
+                              cmap, cidx, queue, 0, INT_MAX, shadeTypeInt);
+  queue->resizeHeapIdx(((DynLTParticles*)tsteps)->getNParticles(0));
+
+  // Initialize the scene
+  if (env_fname != "" && use_envmap)
+    scene->setBackground(bg);
+  else
+    // scene->setBackground(new ConstantBackground(Color(RGB(0, 0, 0))));
+    scene->setBackground(new ConstantBackground(Color(RGB(0.3, 0.3, 0.3))));
+  scene->setObject(tsteps);
+
+  // Add lights
+  LightSet* lights=new LightSet();
+  lights->add(new PointLight(Vector(lx, ly, lz), Color(RGB(1, 1, 1))));
+  lights->add(new PointLight(Vector(-lx, -ly, -lz), Color(RGB(.0,0.1,0.9))));
+  lights->add(new PointLight(Cross(Vector(lx,ly,lz),(Vector(-lx,-ly,-lz))), 
Color(RGB(0.5,0.6,0.0))));
+  lights->setAmbientLight(new ConstantAmbient(Color(RGB(0.6, 0.7, 0.8))));
+  scene->setLights(lights);
 
     // Dissertation --> Figure 6.14
     // bin/manta -np 8 -res 768x768 -scene "lib/libscene_dynlt.so(-i 
/home/sci/cgribble/csafe/particle/data/cylinder/spheredata022-crop.nrrd 
-radius 0.0005 -depth 2 -ncells 4 -cidx 6 -light 0.00382502 0.00941466 
0.0387222 -timed 0.5)" -imagedisplay "file(-prefix dlt -fps)" -imagetype rgb8
@@ -355,5 +354,5 @@
       Vector(-0.0890283, -0.13761, 0.986477), 0.204219);
     */
 
-    return scene;
-  }
+  return scene;
+}




  • [MANTA] r1558 - in trunk: DynLT scenes, cgribble, 07/26/2007

Archive powered by MHonArc 2.6.16.

Top of page