[cig-commits] r13174 - in cs/cigma/trunk: src tests/pytests

luis at geodynamics.org luis at geodynamics.org
Wed Oct 29 15:11:47 PDT 2008


Author: luis
Date: 2008-10-29 15:11:47 -0700 (Wed, 29 Oct 2008)
New Revision: 13174

Modified:
   cs/cigma/trunk/src/Cell.cpp
   cs/cigma/trunk/src/Cell.h
   cs/cigma/trunk/src/Numeric.cpp
   cs/cigma/trunk/src/Quadrature.h
   cs/cigma/trunk/src/fe_hex8.cpp
   cs/cigma/trunk/src/fe_hex8.h
   cs/cigma/trunk/src/fe_quad4.cpp
   cs/cigma/trunk/src/fe_quad4.h
   cs/cigma/trunk/src/fe_tet4.cpp
   cs/cigma/trunk/src/fe_tet4.h
   cs/cigma/trunk/src/fe_tri3.cpp
   cs/cigma/trunk/src/fe_tri3.h
   cs/cigma/trunk/src/py_Cell.cpp
   cs/cigma/trunk/tests/pytests/test_cell.py
Log:
Try and do without refverts and Cell::n_dim

Modified: cs/cigma/trunk/src/Cell.cpp
===================================================================
--- cs/cigma/trunk/src/Cell.cpp	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/src/Cell.cpp	2008-10-29 22:11:47 UTC (rev 13174)
@@ -9,7 +9,7 @@
 Cell::Cell()
 {
     //cout << "Calling Cell()" << endl;
-    refverts = 0;
+    //refverts = 0;
     globverts = 0;
 }
 
@@ -17,10 +17,11 @@
 Cell::~Cell()
 {
     //cout << "Calling ~Cell()" << endl;
+    /*
     if (refverts != 0)
     {
         delete [] refverts;
-    }
+    } */
     if (globverts != 0)
     {
         delete [] globverts;
@@ -29,6 +30,7 @@
 }
 
 
+/*
 void Cell::set_reference_vertices(double *vertices)
 {
     //
@@ -62,7 +64,7 @@
     }
 
     return;
-}
+} */
 
 
 void Cell::set_global_vertices(double *vertices, int vdim)
@@ -71,17 +73,17 @@
     int i,j;
     const int nno = n_nodes();
     const int celldim = n_celldim();
-    const int dim = n_dim();
+    //const int dim = n_dim();
     assert(vdim == celldim);
     for (i = 0; i < nno; i++)
     {
         for (j = 0; j < vdim; j++)
         {
-            globverts[dim*i + j] = vertices[vdim*i + j];
+            globverts[celldim*i + j] = vertices[vdim*i + j];
         }
-        for (j = vdim; j < dim; j++)
+        for (j = vdim; j < celldim; j++)
         {
-            globverts[dim*i + j] = 0.0;
+            globverts[celldim*i + j] = 0.0;
         }
     }
 }
@@ -394,7 +396,8 @@
 void Cell::bbox(double *min, double *max)
 {
     const int nno = n_nodes();
-    const int nsd = n_dim();
+    //const int nsd = n_dim();
+    const int nsd = n_celldim();
     minmax(globverts, nno, nsd, min, max);
 }
 
@@ -402,7 +405,8 @@
 void Cell::centroid(double c[3])
 {
     const int nno = n_nodes();
-    const int nsd = n_dim();
+    //const int nsd = n_dim();
+    const int nsd = n_celldim();
     cigma::centroid(globverts, nno, nsd, c);
 }
 

Modified: cs/cigma/trunk/src/Cell.h
===================================================================
--- cs/cigma/trunk/src/Cell.h	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/src/Cell.h	2008-10-29 22:11:47 UTC (rev 13174)
@@ -17,7 +17,7 @@
     
     virtual int n_nodes() const = 0;
     virtual int n_celldim() const = 0;
-    virtual int n_dim() const = 0;
+    //virtual int n_dim() const = 0;
 
     virtual void shape(int num, double *points, double *values) = 0;
     virtual void grad_shape(int num, double *points, double *values) = 0;
@@ -31,19 +31,18 @@
     virtual void xyz2uvw(double xyz[3], double uvw[3]);
     void uvw2xyz(double uvw[3], double xyz[3]);
     
-public:
+    /*
     typedef enum {
         POINT = 0,
         TRIANGLE,
         QUADRANGLE,
         TETRAHEDRON,
         HEXAHEDRON
-    } Geometry;
-
-    virtual Geometry geometry() = 0;
+    } Geometry;*/
+    //virtual Geometry geometry() = 0;
     virtual boost::shared_ptr<Quadrature> default_quadrature() = 0;
 
-    void set_reference_vertices(double *vertices);
+    //void set_reference_vertices(double *vertices);
     void set_global_vertices(double *vertices, int vdim);
 
     virtual double volume() = 0;
@@ -56,7 +55,7 @@
     void centroid(double c[3]);
 
 public:
-    double *refverts;   // [nno x celldim]
+    //double *refverts;   // [nno x celldim]
     double *globverts;  // [nno x nsd]
 
 };

Modified: cs/cigma/trunk/src/Numeric.cpp
===================================================================
--- cs/cigma/trunk/src/Numeric.cpp	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/src/Numeric.cpp	2008-10-29 22:11:47 UTC (rev 13174)
@@ -120,7 +120,7 @@
 void cigma::centroid(double *points, int npts, int nsd, double c[3])
 {
     int i, j;
-    const double oc = 1.0 / (double)npts;
+    const double oc = 1.0 / ((double) npts);
 
     #define PT(i,j)  points[nsd*(i) + (j)]
 

Modified: cs/cigma/trunk/src/Quadrature.h
===================================================================
--- cs/cigma/trunk/src/Quadrature.h	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/src/Quadrature.h	2008-10-29 22:11:47 UTC (rev 13174)
@@ -32,7 +32,6 @@
     int ndim;
     double *points;
     double *weights;
-    //cigma::Cell *cell; // XXX: reference to parent cell?
 };
 
 inline int cigma::Quadrature::n_points() const { return npts; }

Modified: cs/cigma/trunk/src/fe_hex8.cpp
===================================================================
--- cs/cigma/trunk/src/fe_hex8.cpp	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/src/fe_hex8.cpp	2008-10-29 22:11:47 UTC (rev 13174)
@@ -62,6 +62,7 @@
 
 hex8::hex8()
 {
+    /*
     const int nno = 8;
     const int celldim = 3;
     double verts[nno*celldim] = {
@@ -75,6 +76,8 @@
         -1.0, +1.0, +1.0
     };
     set_reference_vertices(verts);
+    */
+    globverts = new double[n_nodes() * n_celldim()];
 }
 
 hex8::~hex8()

Modified: cs/cigma/trunk/src/fe_hex8.h
===================================================================
--- cs/cigma/trunk/src/fe_hex8.h	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/src/fe_hex8.h	2008-10-29 22:11:47 UTC (rev 13174)
@@ -14,14 +14,13 @@
     hex8();
     ~hex8();
 
-public:
     int n_nodes() const { return 8; }
     int n_celldim() const { return 3; }
-    int n_dim() const { return 3; }
-    Geometry geometry() { return HEXAHEDRON; }
+    //int n_dim() const { return 3; }
+
+    //Geometry geometry() { return HEXAHEDRON; }
     boost::shared_ptr<Quadrature> default_quadrature();
 
-public:
     void shape(int num, double *points, double *values);
     void grad_shape(int num, double *points, double *values);
     bool interior(double u, double v, double w);

Modified: cs/cigma/trunk/src/fe_quad4.cpp
===================================================================
--- cs/cigma/trunk/src/fe_quad4.cpp	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/src/fe_quad4.cpp	2008-10-29 22:11:47 UTC (rev 13174)
@@ -35,6 +35,7 @@
 
 quad4::quad4()
 {
+    /*
     const int nno = 4;
     const int celldim = 2;
     double verts[nno*celldim] = {
@@ -44,6 +45,8 @@
         -1.0, +1.0
     };
     set_reference_vertices(verts);
+    */
+    globverts = new double[n_nodes() * n_celldim()];
 }
 
 quad4::~quad4()

Modified: cs/cigma/trunk/src/fe_quad4.h
===================================================================
--- cs/cigma/trunk/src/fe_quad4.h	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/src/fe_quad4.h	2008-10-29 22:11:47 UTC (rev 13174)
@@ -14,14 +14,13 @@
     quad4();
     ~quad4();
 
-public:
     int n_nodes() const { return 4; }
     int n_celldim() const { return 2; }
-    int n_dim() const { return 3; }
-    Geometry geometry() { return QUADRANGLE; }
+    //int n_dim() const { return 3; }
+
+    //Geometry geometry() { return QUADRANGLE; }
     boost::shared_ptr<Quadrature> default_quadrature();
 
-public:
     void shape(int num, double *points, double *values);
     void grad_shape(int num, double *points, double *values);
     bool interior(double u, double v, double w);

Modified: cs/cigma/trunk/src/fe_tet4.cpp
===================================================================
--- cs/cigma/trunk/src/fe_tet4.cpp	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/src/fe_tet4.cpp	2008-10-29 22:11:47 UTC (rev 13174)
@@ -42,6 +42,7 @@
 
 tet4::tet4()
 {
+    /*
     const int nno = 4;
     const int celldim = 3;
     double verts[nno*celldim] = {
@@ -51,6 +52,8 @@
         0.0, 0.0, 1.0
     };
     set_reference_vertices(verts);
+    */
+    globverts = new double[n_nodes() * n_celldim()];
 }
 
 tet4::~tet4()

Modified: cs/cigma/trunk/src/fe_tet4.h
===================================================================
--- cs/cigma/trunk/src/fe_tet4.h	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/src/fe_tet4.h	2008-10-29 22:11:47 UTC (rev 13174)
@@ -13,16 +13,14 @@
 public:
     tet4();
     ~tet4();
-    void qr_default(double **wts, double **pts, int *npts, int *ndim);
 
-public:
     int n_nodes() const { return 4; }
     int n_celldim() const { return 3; }
-    int n_dim() const { return 3; }
-    Geometry geometry() { return TETRAHEDRON; }
+    //int n_dim() const { return 3; }
+
+    //Geometry geometry() { return TETRAHEDRON; }
     boost::shared_ptr<Quadrature> default_quadrature();
 
-public:
     void shape(int num, double *points, double *values);
     void grad_shape(int num, double *points, double *values);
     void xyz2uvw(double xyz[3], double uvw[3]);

Modified: cs/cigma/trunk/src/fe_tri3.cpp
===================================================================
--- cs/cigma/trunk/src/fe_tri3.cpp	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/src/fe_tri3.cpp	2008-10-29 22:11:47 UTC (rev 13174)
@@ -32,6 +32,7 @@
 
 tri3::tri3()
 {
+    /*
     const int nno = 3;
     const int celldim = 2;
     double verts[nno*celldim] = {
@@ -40,6 +41,8 @@
         0.0, 1.0
     };
     set_reference_vertices(verts);
+    */
+    globverts = new double[n_nodes() * n_celldim()];
 }
 
 tri3::~tri3()

Modified: cs/cigma/trunk/src/fe_tri3.h
===================================================================
--- cs/cigma/trunk/src/fe_tri3.h	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/src/fe_tri3.h	2008-10-29 22:11:47 UTC (rev 13174)
@@ -14,14 +14,13 @@
     tri3();
     ~tri3();
 
-public:
     int n_nodes() const { return 3; }
     int n_celldim() const { return 2; }
-    int n_dim() const { return 3; }
-    Geometry geometry() { return TRIANGLE; }
+    //int n_dim() const { return 3; }
+
+    //Geometry geometry() { return TRIANGLE; }
     boost::shared_ptr<Quadrature> default_quadrature();
 
-public:
     void shape(int num, double *points, double *values);
     void grad_shape(int num, double *points, double *values);
     //void xyz2uvw(double xyz[3], double uvw[3]);

Modified: cs/cigma/trunk/src/py_Cell.cpp
===================================================================
--- cs/cigma/trunk/src/py_Cell.cpp	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/src/py_Cell.cpp	2008-10-29 22:11:47 UTC (rev 13174)
@@ -98,28 +98,28 @@
     class_<py_hex8, boost::noncopyable>("hex8")
         .def("n_nodes", &py_hex8::n_nodes)
         .def("n_celldim", &py_hex8::n_celldim)
-        .def("n_dim", &py_hex8::n_dim)
+        //.def("n_dim", &py_hex8::n_dim)
         .def("default_rule", &py_hex8::default_rule)
         ;
 
     class_<py_tet4, boost::noncopyable>("tet4")
         .def("n_nodes", &py_tet4::n_nodes)
         .def("n_celldim", &py_tet4::n_celldim)
-        .def("n_dim", &py_tet4::n_dim)
+        //.def("n_dim", &py_tet4::n_dim)
         .def("default_rule", &py_tet4::default_rule)
         ;
 
     class_<py_quad4, boost::noncopyable>("quad4")
         .def("n_nodes", &py_quad4::n_nodes)
         .def("n_celldim", &py_quad4::n_celldim)
-        .def("n_dim", &py_quad4::n_dim)
+        //.def("n_dim", &py_quad4::n_dim)
         .def("default_rule", &py_quad4::default_rule)
         ;
 
     class_<py_tri3, boost::noncopyable>("tri3")
         .def("n_nodes", &py_tri3::n_nodes)
         .def("n_celldim", &py_tri3::n_celldim)
-        .def("n_dim", &py_tri3::n_dim)
+        //.def("n_dim", &py_tri3::n_dim)
         .def("default_rule", &py_tri3::default_rule)
         ;
 

Modified: cs/cigma/trunk/tests/pytests/test_cell.py
===================================================================
--- cs/cigma/trunk/tests/pytests/test_cell.py	2008-10-29 22:11:45 UTC (rev 13173)
+++ cs/cigma/trunk/tests/pytests/test_cell.py	2008-10-29 22:11:47 UTC (rev 13174)
@@ -11,22 +11,18 @@
         cell = hex8()
         self.assertEqual(cell.n_nodes(), 8)
         self.assertEqual(cell.n_celldim(), 3)
-        self.assertEqual(cell.n_dim(), 3)
     def test_cell_tet4(self):
         cell = tet4()
         self.assertEqual(cell.n_nodes(), 4)
         self.assertEqual(cell.n_celldim(), 3)
-        self.assertEqual(cell.n_dim(), 3)
     def test_cell_quad4(self):
         cell = quad4()
         self.assertEqual(cell.n_nodes(), 4)
         self.assertEqual(cell.n_celldim(), 2)
-        self.assertEqual(cell.n_dim(), 3)
     def test_cell_tri3(self):
         cell = tri3()
         self.assertEqual(cell.n_nodes(), 3)
         self.assertEqual(cell.n_celldim(), 2)
-        self.assertEqual(cell.n_dim(), 3)
 
 def create_suite():
     suite = unittest.TestSuite()



More information about the CIG-COMMITS mailing list