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

luis at geodynamics.org luis at geodynamics.org
Tue Dec 9 18:12:35 PST 2008


Author: luis
Date: 2008-12-09 18:12:34 -0800 (Tue, 09 Dec 2008)
New Revision: 13495

Modified:
   cs/cigma/trunk/src/MeshPart.cpp
   cs/cigma/trunk/src/MeshPart.h
Log:
Updates to cigma::MeshPart

Modified: cs/cigma/trunk/src/MeshPart.cpp
===================================================================
--- cs/cigma/trunk/src/MeshPart.cpp	2008-12-10 02:12:33 UTC (rev 13494)
+++ cs/cigma/trunk/src/MeshPart.cpp	2008-12-10 02:12:34 UTC (rev 13495)
@@ -1,9 +1,11 @@
 #include "MeshPart.h"
+#include <cassert>
 using namespace cigma;
 using boost::shared_ptr;
 
 MeshPart::MeshPart()
 {
+    cell_type = Cell::NONE;
 }
 
 MeshPart::~MeshPart()
@@ -27,6 +29,7 @@
 
 void MeshPart::setLocator(const shared_ptr<Locator>& loc)
 {
+    assert(loc->n_dim() > 0);
     this->locator = loc;
 }
 
@@ -36,9 +39,9 @@
     this->getCellCoords(e, cell->globverts, cell->n_celldim());
 }
 
-void MeshPart::getCell(int e, Cell& cell) const
+void MeshPart::getCell(int e, Cell& c) const
 {
-    this->getCellCoords(e, cell.globverts, cell.n_celldim());
+    this->getCellCoords(e, c.globverts, c.n_celldim());
 }
 
 void MeshPart::getBoundingBox(double *minpt, double *maxpt) const
@@ -73,8 +76,13 @@
     }
 }
 
+bool MeshPart::findCell(double globalPoint[3], int *cellIndex)
+{
+    double uvw[3];
+    return this->findCell2(globalPoint, uvw, cellIndex);
+}
 
-bool MeshPart::findCell(double globalPoint[3], double uvw[3], int *cellIndex)
+bool MeshPart::findCell2(double globalPoint[3], double uvw[3], int *cellIndex)
 {
     assert(coords);
     assert(connect);
@@ -92,8 +100,9 @@
         for (i = 0; i < locator->n_idx(); i++)
         {
             e = locator->idx(i);
+            assert((0 <= e) && (e < nel));
 
-            selectCell(e);
+            this->selectCell(e);
             if (cell->global_interior(globalPoint))
             {
                 *cellIndex = e;

Modified: cs/cigma/trunk/src/MeshPart.h
===================================================================
--- cs/cigma/trunk/src/MeshPart.h	2008-12-10 02:12:33 UTC (rev 13494)
+++ cs/cigma/trunk/src/MeshPart.h	2008-12-10 02:12:34 UTC (rev 13495)
@@ -21,6 +21,9 @@
     MeshPart();
     ~MeshPart();
 
+    int n_cells() const;
+    int n_dim() const;
+
     void setCell(const boost::shared_ptr<Cell>& cell); /* XXX: setCellType(...) */
     void setNodeCoordinates(const boost::shared_ptr<NodeCoordinates>& nc);
     void setElementBlock(const boost::shared_ptr<ElementBlock>& eb);
@@ -31,13 +34,19 @@
     void getCell(int e, Cell &cell) const; // XXX
     void getBoundingBox(double *minpt, double *maxpt) const;
     void getCellCoords(int cellIndex, double *globalCoords, int dim) const;
-    bool findCell(double globalPoint[3], double uvw[3], int *cellIndex);
 
+    bool findCell(double globalPoint[3], int *cellIndex);
+    bool findCell2(double globalPoint[3], double uvw[3], int *cellIndex);
+
 public:
     boost::shared_ptr<ElementBlock> connect;
     boost::shared_ptr<NodeCoordinates> coords;
     boost::shared_ptr<Locator> locator;
     boost::shared_ptr<Cell> cell; // XXX: only need to save the Cell::type
+    Cell::type cell_type;
 };
 
+inline int cigma::MeshPart::n_cells() const { return connect->n_cells(); }
+inline int cigma::MeshPart::n_dim() const { return coords->n_dim(); }
+
 #endif



More information about the CIG-COMMITS mailing list