[cig-commits] r9043 - cs/benchmark/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Mon Jan 14 21:28:14 PST 2008


Author: luis
Date: 2008-01-14 21:28:13 -0800 (Mon, 14 Jan 2008)
New Revision: 9043

Modified:
   cs/benchmark/cigma/trunk/src/VtkUgMeshPart.cpp
   cs/benchmark/cigma/trunk/src/VtkUgMeshPart.h
Log:
Moved dimension variables to base class

Modified: cs/benchmark/cigma/trunk/src/VtkUgMeshPart.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/VtkUgMeshPart.cpp	2008-01-15 05:28:12 UTC (rev 9042)
+++ cs/benchmark/cigma/trunk/src/VtkUgMeshPart.cpp	2008-01-15 05:28:13 UTC (rev 9043)
@@ -12,12 +12,12 @@
 
     points = 0;
 
-    nno = 0;
-    nsd = 0;
+    //nno = 0;
+    //nsd = 0;
     coordsArray = 0;
 
-    nel = 0;
-    ndofs = 0;
+    //nel = 0;
+    //ndofs = 0;
     cellArray = 0;
 }
 
@@ -84,6 +84,7 @@
 bool cigma::VtkUgMeshPart::
 find_cell(double globalPoint[3], int *cellIndex)
 {
+    /*
     vtkTetra *cell = vtkTetra::New();
 
     double tol2 = 1e-6;
@@ -91,10 +92,56 @@
     double pcoords[3];
     int subId;
 
-    grid->FindCell(globalPoint, cell, 0, tol2, subId, pcoords, weights);
+    //grid->FindCell(globalPoint, cell, 0, tol2, subId, pcoords, weights);
 
     std::cout << "ID = " << subId << std::endl;
     std::cout << "REFCOORDS = " << pcoords[0] << " " << pcoords[0] << " " << pcoords[0] << std::endl;
 
+    // */
+
+    //*
+    const bool verbose = false;
+    if (verbose)
+    {
+        std::cout << "Searching for cell containing (" << globalPoint[0] << ", " << globalPoint[1] << ", " << globalPoint[2] << ") ";
+    }
+
+
+    static int last_e = -1;
+    *cellIndex = -1;
+
+    //*
+    if ((0 <= last_e) && (last_e < nel))
+    {
+        double uvw[3];
+        get_cell_coords(last_e, cell->globverts);
+        cell->xyz2uvw(globalPoint, uvw);
+        if (cell->interior(uvw[0], uvw[1], uvw[2]))
+        {
+            if (verbose) { std::cout << last_e << std::endl; }
+            *cellIndex = last_e;
+            return true;
+        }
+    } // */
+
+    for (int e = 0; e < nel; e++)
+    {
+        double uvw[3];
+        get_cell_coords(e, cell->globverts);
+        cell->xyz2uvw(globalPoint, uvw);
+        if (cell->interior(uvw[0], uvw[1], uvw[2]))
+        {
+            if (verbose) { std::cout << e << std::endl; }
+            *cellIndex = e;
+            last_e = e;
+            return true;
+        }
+    } // */
+    if (verbose) { std::cout << " -> not found!\n"; }
     return false;
+
+    /*
+    *cellIndex = 0;
+    return true;
+    // */
 }

Modified: cs/benchmark/cigma/trunk/src/VtkUgMeshPart.h
===================================================================
--- cs/benchmark/cigma/trunk/src/VtkUgMeshPart.h	2008-01-15 05:28:12 UTC (rev 9042)
+++ cs/benchmark/cigma/trunk/src/VtkUgMeshPart.h	2008-01-15 05:28:13 UTC (rev 9043)
@@ -1,6 +1,8 @@
 #ifndef __VTK_UG_MESH_PART_H__
 #define __VTK_UG_MESH_PART_H__
 
+#include "MeshPart.h"
+
 #include "vtkUnstructuredGrid.h"
 #include "vtkPoints.h"
 #include "vtkCellType.h"
@@ -11,18 +13,26 @@
 #include "vtkTetra.h"
 #include "vtkHexahedron.h"
 
+
 namespace cigma
 {
     class VtkUgMeshPart;
 }
 
-class cigma::VtkUgMeshPart
+
+class cigma::VtkUgMeshPart : public MeshPart
 {
 public:
     VtkUgMeshPart();
     ~VtkUgMeshPart();
 
 public:
+    //int n_nodes() { return nno; }
+    //int n_nsd()   { return nsd; }
+    //int n_nel()   { return nel; }
+    //int n_ndofs() { return ndofs; }
+
+public:
     void initialize();
     void set_coordinates(double *coordinates, int nno, int nsd);
     void set_connectivity(int *connectivity, int nel, int ndofs);
@@ -31,8 +41,8 @@
     bool find_cell(double globalPoint[3], int *cellIndex);
 
 public:
-    int nno, nsd;
-    int nel, ndofs;
+    //int nno, nsd;
+    //int nel, ndofs;
     vtkUnstructuredGrid *grid;
     vtkPoints *points;
     vtkDoubleArray *coordsArray;



More information about the cig-commits mailing list