[cig-commits] r14076 - cs/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Wed Feb 18 08:14:24 PST 2009


Author: luis
Date: 2009-02-18 08:14:24 -0800 (Wed, 18 Feb 2009)
New Revision: 14076

Modified:
   cs/cigma/trunk/src/core_readers.cpp
   cs/cigma/trunk/src/io_hdf5_reader.cpp
   cs/cigma/trunk/src/io_vtk_reader.cpp
Log:
Initialize mesh with KdtreeLocator

Modified: cs/cigma/trunk/src/core_readers.cpp
===================================================================
--- cs/cigma/trunk/src/core_readers.cpp	2009-02-18 16:14:22 UTC (rev 14075)
+++ cs/cigma/trunk/src/core_readers.cpp	2009-02-18 16:14:24 UTC (rev 14076)
@@ -5,7 +5,8 @@
 #include "Cell.h"
 #include "nc_array.h"
 #include "eb_array.h"
-#include "AnnLocator.h"
+#include "loc_bbox.h"
+#include "loc_kdtree.h"
 
 #include "io_file_reader.h"
 #include "io_text_reader.h"
@@ -123,7 +124,6 @@
     TRI_LOG_STR("cigma::ReadMeshPart()");
 
     shared_ptr<MeshPart> mesh;
-    shared_ptr<AnnLocator> locator;
 
     Cell::type celltype = Cell::NONE;
     if (mesh_info.cell_type_name != "")
@@ -174,10 +174,14 @@
 
     if (mesh && mesh_info.use_locator)
     {
-        // XXX: is there a better way to initialize? inheritance on MeshPart perhaps?
-        locator = shared_ptr<AnnLocator>(new AnnLocator);
-        locator->init(*mesh);
-        mesh->setLocator(locator);
+        if (mesh->n_cells() > KdtreeLocator::nnk)
+        {
+            // XXX: is there a better way to initialize? inheritance on MeshPart perhaps?
+            //shared_ptr<BoundingBoxLocator> locator(new BoundingBoxLocator);
+            shared_ptr<KdtreeLocator> locator(new KdtreeLocator);
+            locator->init(*mesh);
+            mesh->setLocator(locator);
+        }
     }
 
     return mesh;

Modified: cs/cigma/trunk/src/io_hdf5_reader.cpp
===================================================================
--- cs/cigma/trunk/src/io_hdf5_reader.cpp	2009-02-18 16:14:22 UTC (rev 14075)
+++ cs/cigma/trunk/src/io_hdf5_reader.cpp	2009-02-18 16:14:24 UTC (rev 14076)
@@ -7,7 +7,8 @@
 #include "io_hdf5.h"
 #include "nc_array.h"
 #include "eb_array.h"
-#include "AnnLocator.h"
+#include "loc_bbox.h"
+#include "loc_kdtree.h"
 
 using namespace std;
 using namespace boost;
@@ -142,6 +143,7 @@
 {
     TRI_LOG_STR("HDF5_Reader::getDoubleArray()");
     int status = get_full_dataset<double>(file, loc, &(A._data), &(A.npts), &(A.ndim));
+    TRI_LOG(status);
     if (status < 0)
     {
         std::ostringstream stream;
@@ -238,10 +240,14 @@
 
         if (true)
         {
-            // XXX: move this to a method in MeshPart
-            shared_ptr<AnnLocator> locator(new AnnLocator);
-            locator->init(*mesh);
-            mesh->setLocator(locator);
+            if (mesh->n_cells() > KdtreeLocator::nnk)
+            {
+                // XXX: move this to a method in MeshPart
+                //shared_ptr<BoundingBoxLocator> locator(new BoundingBoxLocator);
+                shared_ptr<KdtreeLocator> locator(new KdtreeLocator);
+                locator->init(*mesh);
+                mesh->setLocator(locator);
+            }
         }
     }
     else

Modified: cs/cigma/trunk/src/io_vtk_reader.cpp
===================================================================
--- cs/cigma/trunk/src/io_vtk_reader.cpp	2009-02-18 16:14:22 UTC (rev 14075)
+++ cs/cigma/trunk/src/io_vtk_reader.cpp	2009-02-18 16:14:24 UTC (rev 14076)
@@ -12,7 +12,8 @@
 #include "nc_array.h"
 #include "eb_array.h"
 #include "core_array.h"
-#include "AnnLocator.h"
+#include "loc_bbox.h"
+#include "loc_kdtree.h"
 
 #include "vtkUnstructuredGridReader.h"
 #include "vtkStructuredGridReader.h"
@@ -286,12 +287,16 @@
     mesh->connect   = this->getElementBlock(0);
     mesh->cell_type = this->getCellType(0);
 
+    // XXX: move following block to a method in MeshPart
     if (true)
     {
-        // XXX: move this to a method in MeshPart
-        shared_ptr<AnnLocator> locator(new AnnLocator);
-        locator->init(*mesh);
-        mesh->setLocator(locator);
+        if (mesh->n_cells() > KdtreeLocator::nnk)
+        {
+            //shared_ptr<BoundingBoxLocator> locator(new BoundingBoxLocator);
+            shared_ptr<KdtreeLocator> locator(new KdtreeLocator);
+            locator->init(*mesh);
+            mesh->setLocator(locator);
+        }
     }
 
     return mesh;



More information about the CIG-COMMITS mailing list