Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r2235 - in trunk: Model/Readers scenes/csafe/python scenes/csafe/src


Chronological Thread 
  • From: brownlee@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r2235 - in trunk: Model/Readers scenes/csafe/python scenes/csafe/src
  • Date: Thu, 1 May 2008 05:59:47 -0600 (MDT)

Author: brownlee
Date: Thu May  1 05:59:47 2008
New Revision: 2235

Modified:
   trunk/Model/Readers/UDAReader.cc
   trunk/Model/Readers/UDAReader.h
   trunk/scenes/csafe/python/csafe_demo.py
   trunk/scenes/csafe/src/CDTest.h
Log:
fixing warnings

Modified: trunk/Model/Readers/UDAReader.cc
==============================================================================
--- trunk/Model/Readers/UDAReader.cc    (original)
+++ trunk/Model/Readers/UDAReader.cc    Thu May  1 05:59:47 2008
@@ -83,8 +83,8 @@
     
     void UDAReader::parseTimestepFile(string filename)
     {
-      _timesteps.push_back(Timestep());
-        UDAReader::Timestep& timestep = _timesteps[_timesteps.size()-1];
+      timesteps.push_back(Timestep());
+        UDAReader::Timestep& timestep = timesteps[timesteps.size()-1];
        timestep.dir = parseDirectory(filename);
         cout << "Parsing Timestep: " << filename << "\n";
         xmlDocPtr doc; 
@@ -160,7 +160,7 @@
                }
              numSphereVars = max(numSphereVars, tempSphereVars);
          }
-        timestep.volume->resize(timestep.indices[0]+1, 
timestep.indices[1]+1, timestep.indices[2]+1);
+        timestep.volume->resize(int(timestep.indices[0]+1), 
int(timestep.indices[1]+1), int(timestep.indices[2]+1));
          timestep.numSphereVars = numSphereVars;
          timestep.numSpheres = numSpheres;
          cout  << "numSphereVars: " << timestep.numSphereVars << endl;
@@ -208,23 +208,23 @@
                    _c = *++_p; *_p = _p[1]; _p[1] = _c; }
 
 
-static void swapbytes(bool&) { }
+/*static void swapbytes(bool&) { }
 static void swapbytes(int8_t&) { }
 static void swapbytes(uint8_t&) { }
 static void swapbytes(int16_t& i) { SWAP_2(i); }
 static void swapbytes(uint16_t& i) { SWAP_2(i); }
-static void swapbytes(int32_t& i) { SWAP_4(i); }
+static void swapbytes(int32_t& i) { SWAP_4(i); }*/
 static void swapbytes(uint32_t& i) { SWAP_4(i); }
-static void swapbytes(int64_t& i) { SWAP_8(i); }
+//static void swapbytes(int64_t& i) { SWAP_8(i); }
 static void swapbytes(uint64_t& i) { SWAP_8(i); }
-static void swapbytes(float& i){SWAP_4(i);}
+/*static void swapbytes(float& i){SWAP_4(i);}
 static void swapbytes(double& i){SWAP_8(i);}
 //void swapbytes(Point &i){ // probably dangerous, but effective
 //    double* p = (double *)(&i);
 //    SWAP_8(*p); SWAP_8(*++p); SWAP_8(*++p); }
 static void swapbytes(Vector &i){ // probably dangerous, but effective
      double* p = (double *)(&i);
-     SWAP_8(*p); SWAP_8(*++p); SWAP_8(*++p); }
+     SWAP_8(*p); SWAP_8(*++p); SWAP_8(*++p); }*/
 
 
 
@@ -394,13 +394,14 @@
          cout << "l: " << l[0] << " " << l[1] << " " << l[2] <<
            "\nh: " << h[0] << " " << h[1] << " " << h[2] << endl;
          cout << "data size: " << bufferStr.length()/4 << endl;
-         for( int x = l[0]; x < h[0]; x++)
+         int l0 = int(l[0]), l1 = int(l[1]), l2 = int(l[2]), h0 = int(h[0]), 
h1 = int(h[1]), h2 = int(h[2]);
+         for( int x = l0; x < h0; x++)
            {
-             for(int y = l[1]; y < h[1]; y++)
+             for(int y = l1; y < h1; y++)
                {
-                 for(int z = l[2]; z < h[2]; z++)
+                 for(int z = l2; z < h2; z++)
                    {
-                     float value;
+                     float value = 0;
                      if (var.dataType == floatT)
                        {
                        value = readFloat(bufferP);

Modified: trunk/Model/Readers/UDAReader.h
==============================================================================
--- trunk/Model/Readers/UDAReader.h     (original)
+++ trunk/Model/Readers/UDAReader.h     Thu May  1 05:59:47 2008
@@ -56,14 +56,14 @@
     void readUDA(std::string directory, std::string volumeVarName);
     void parseTimestepFile(std::string filename);
     void parseDataFile(std::string file, Timestep& t);
-
+    std::vector<Timestep> timesteps;
 private:
     std::string _volumeVarName;
     std::string _directory;
     void readData(std::string filename, Timestep& t);
     Vector readPoint(char* p);
     float readFloat(char* p);
-    std::vector<Timestep> _timesteps;
+
 };
 
 }

Modified: trunk/scenes/csafe/python/csafe_demo.py
==============================================================================
--- trunk/scenes/csafe/python/csafe_demo.py     (original)
+++ trunk/scenes/csafe/python/csafe_demo.py     Thu May  1 05:59:47 2008
@@ -73,6 +73,7 @@
         menuFile.Append(102, "&Save", "")
         menuFile.Append(103, "Save As...", "")
         menuFile.Append(104, "Load", "")
+        menuFile.Append(110, "Load UDA", "Uintah Dataset")
        menuFile.Append(107, "Import NrrdList")
        menuFile.Append(108, "Export NrrdList")
        menuFile.Append(106, "Import Transfer Function")
@@ -104,8 +105,26 @@
        self.Bind(wx.EVT_MENU, self.Menu109, id=109)
        self.Bind(wx.EVT_MENU, self.Menu203, id=203)
        self.Bind(wx.EVT_MENU, self.Menu204, id=204)
+        self.Bind(wx.EVT_MENU, self.Menu110, id=110)
        self.SetBackgroundColour(self.scene.bgColor)
 
+    def Menu110(self, evt):
+        self.SetFocus()
+       dlg = wx.FileDialog(self, message="Open UDA folder",
+               defaultDir=os.getcwd(),
+               defaultFile="",
+               wildcard="*",
+               style=wx.OPEN|wx.CHANGE_DIR)
+       if dlg.ShowModal() == wx.ID_OK:
+            filename = dlg.GetPath()
+            dlg2 = wx.TextEntryDialog(self, 'Name of Volume Value (must be 
CCVariable, float):', 'Vol', 'Vol')
+            dlg2.SetValue('tempIN')
+            if dlg2.ShowModal() == wx.ID_OK:
+                volName = dlg2.GetValue()
+                self.scene.test.loadUDA(filename, volName)
+                self.BuildScene()
+                self.scene.mantaFrame.StartEngine()
+            
     def Menu101(self, evt):
         info = wx.AboutDialogInfo()
         info.Name = "Manta - CSAFE Demo"

Modified: trunk/scenes/csafe/src/CDTest.h
==============================================================================
--- trunk/scenes/csafe/src/CDTest.h     (original)
+++ trunk/scenes/csafe/src/CDTest.h     Thu May  1 05:59:47 2008
@@ -76,7 +76,7 @@
                        _manta_interface = interface;
                        _forceDataMin = -FLT_MAX;
                        _forceDataMax = -FLT_MAX;
-            _useAO = false;
+                       _useAO = false;
                }
                
                //! sets the scene object, necessary for initializing scene 
and loading spheres/volume
@@ -288,6 +288,54 @@
                        if (_clipFrames && _endFrame < int(_vols.size()))
                                _volAnimation->clipFrames(_startFrame, 
_endFrame);
                }
+
+               void loadUDA(string file, string volName)
+                 {
+                   //TODO: clear out existing data
+                       LightSet* lights = _scene->getLights();
+                       PreprocessContext context(_manta_interface, 0, 1, 
lights);
+                   uda.readUDA(file, volName);
+                   for (std::vector<UDAReader::Timestep>::iterator itr =  
uda.timesteps.begin(); itr != uda.timesteps.end(); itr++)
+                     {
+                       Group* group = new Group();
+                               RGBAColorMap* cmap = new RGBAColorMap(1);
+                               CDGridSpheres* grid = new 
CDGridSpheres(itr->sphereData, itr->numSpheres, itr->numSphereVars, 6, 
2,_radius, _ridx, cmap , _cidx); 
+                               group->add(grid);
+                               _sphereGrids.push_back(grid);
+                               if (itr->numSphereVars > _sphereMins.size())
+                               {
+                                       for(size_t j = _sphereMins.size(); j 
< itr->numSphereVars; j++)
+                                       {
+                                               
_sphereMins.push_back(FLT_MAX);
+                                               
_sphereMaxs.push_back(-FLT_MAX);
+                                       }
+                               }
+                               for(int j = 0; j < int(_sphereMins.size()); 
j++)
+                               {
+                                       float min,max;
+                                       grid->getMinMax(j, min, max);
+                                       if (_sphereMins[j] > min)
+                                               _sphereMins[j] = min;
+                                       if (_sphereMaxs[j] < max)
+                                               _sphereMaxs[j] = max;
+                               }
+                               _sphereAnimation->push_back(group);
+                               numFrames1++;
+
+                               Group* group2 = new Group();
+                               Volume<float>* mat = new 
Volume<float>(itr->volume, _volCMap, _minBound, _maxBound, 0.00125, 10, 3, 
_forceDataMin, _forceDataMax);
+                               Primitive* vol = new Cube(mat, _minBound - 
Vector(0.001, 0.001, 0.001), _maxBound + Vector(0.001, 0.001, 0.001));
+                               group->add(vol);
+                               _volAnimation->push_back(group2);
+                               _vols.push_back(mat);
+                               numFrames2++;
+                     }  
+                       updateFrames();
+                       if (_clipFrames && _endFrame < int(_vols.size()))
+                               _volAnimation->clipFrames(_startFrame, 
_endFrame);      
+                       if (_clipFrames && _endFrame < 
int(_sphereGrids.size()))
+                               _sphereAnimation->clipFrames(_startFrame, 
_endFrame);
+                }
         
         //! calls destructors on all loaded data, then reloads sphere and 
volume files
         /*!
@@ -696,7 +744,8 @@
                KeyFrameAnimation* _sphereAnimation;
                KeyFrameAnimation* _volAnimation;
                int _startFrame, _endFrame, _clipFrames;
-        bool _useAO;
+               bool _useAO;
+               UDAReader uda;
        };
 
 #endif




  • [Manta] r2235 - in trunk: Model/Readers scenes/csafe/python scenes/csafe/src, brownlee, 05/01/2008

Archive powered by MHonArc 2.6.16.

Top of page