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

luis at geodynamics.org luis at geodynamics.org
Wed Jan 16 17:25:16 PST 2008


Author: luis
Date: 2008-01-16 17:25:15 -0800 (Wed, 16 Jan 2008)
New Revision: 9085

Modified:
   cs/benchmark/cigma/trunk/src/CompareCmd.cpp
   cs/benchmark/cigma/trunk/src/CompareCmd.h
Log:
Temporary update to CompareCmd.cpp (move loader functions to Misc.cpp)

Modified: cs/benchmark/cigma/trunk/src/CompareCmd.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/CompareCmd.cpp	2008-01-17 01:25:12 UTC (rev 9084)
+++ cs/benchmark/cigma/trunk/src/CompareCmd.cpp	2008-01-17 01:25:15 UTC (rev 9085)
@@ -67,9 +67,31 @@
                        cigma::VtkUgReader &reader,
                        cigma::FE_Field *field)
 {
+    // XXX: change *_nsd to *_celldim since we are
+    // talking about quadrature points in the appropriate
+    // reference domain
+
+    const int tri_nno = 1;
+    const int tri_nsd = 3;
+    double tri_qpts[tri_nno * tri_nsd] = {
+        0.0, 0.0, 0.0
+    };
+    double tri_qwts[tri_nno] = {
+        0.0
+    };
+
+    const int quad_nno = 1;
+    const int quad_nsd = 3;
+    double quad_qpts[quad_nno * quad_nsd] = {
+        0.0, 0.0, 0.0
+    };
+    double quad_qwts[quad_nno] = {
+        0.0
+    };
+
     const int tet_nno = 8;
     const int tet_nsd = 3;
-    double tet_qpts[8*3] = {
+    double tet_qpts[tet_nno * tet_nsd] = {
         -0.68663473, -0.72789005, -0.75497035,
         -0.83720867, -0.85864055,  0.08830369,
         -0.86832263,  0.13186633, -0.75497035,
@@ -78,7 +100,7 @@
         -0.39245447, -0.85864055,  0.08830369,
         -0.50857335,  0.13186633, -0.75497035,
         -0.74470688, -0.4120024 ,  0.08830369 };
-    double tet_qwts[8] = {
+    double tet_qwts[tet_nno] = {
         0.29583885,  0.12821632,  0.16925605,  0.07335544,  0.29583885,
         0.12821632,  0.16925605,  0.07335544 };
     for (int i = 0; i < tet_nno; i++)
@@ -112,6 +134,22 @@
     int dofs_nno, dofs_valdim;
     double *dofs;
 
+    /* XXX: For the following two cases, I need a static initializer on
+     * Reader class that instantiates the right subclass based on the
+     * detected filetype,
+     *
+     * After that, here I also need to use a switch statement on the value
+     * of reader->getReaderType() in order to downcast the Reader
+     * object properly...
+     *
+     * Having done that, I can rely on function polymorphism to call the right
+     * routine: e.g choose between LoadField(VtkReader *reader, ...),
+     * LoadField(HdfReader *reader, ...), LoadField(TextReader *reader)
+     *
+     * For detecting the filetype, one could rely only on the extension,
+     * or possibly check for a magic number at the beginning of the file.
+     */
+    //* VtkUgReader case...
     reader.open(inputfile);
     reader.get_coordinates(&coords, &nno, &nsd);
     reader.get_connectivity(&connect, &nel, &ndofs);
@@ -119,24 +157,58 @@
     //reader.get_vector_point_data(location.c_str(), &dofs, &dofs_nno, &dofs_valdim);
     reader.get_scalar_point_data(location.c_str(), &dofs, &dofs_nno, &dofs_valdim);
     //reader.get_point_data(location.c_str(), &dofs, &dofs_nno, &dofs_valdim);
+    // */
 
+    //* HdfReader case...
+    // */
+
     field->dim = nsd;
     field->rank = dofs_valdim;
     field->meshPart = new cigma::VtkUgMeshPart();
     field->meshPart->set_coordinates(coords, nno, nsd);
     field->meshPart->set_connectivity(connect, nel, ndofs);
 
+    /* 2D case
     switch (ndofs)
     {
+    case 3:
+        field->fe = new cigma::FE();
+        field->fe->cell = new cigma::Tri();
+        field->fe->quadrature = new cigma::Quadrature();
+        field->fe->quadrature->set_quadrature(tri_qpts, tri_qwts, tri_nno, tri_nsd);
+        field->fe->quadrature->set_globaldim(tri_nsd);
+        field->fe->jxw = new double[tri_nno];
+        field->fe->basis_tab = new double[tri_nno * ndofs];
+        field->fe->basis_jet = new double[tri_nno * ndofs * tri_nsd];
+        field->meshPart->cell = field->fe->cell;
+        break;
     case 4:
         field->fe = new cigma::FE();
+        field->fe->cell = new cigma::Quad();
+        field->fe->quadrature = new cigma::Quadrature();
+        field->fe->quadrature->set_quadrature(quad_qpts, quad_qwts, quad_nno, quad_nsd);
+        field->fe->quadrature->set_globaldim(quad_nsd);
+        field->fe->jxw = new double[quad_nno];
+        field->fe->basis_tab = new double[quad_nno * ndofs];
+        field->fe->basis_jet = new double[quad_nno * ndofs * quad_nsd];
+        field->meshPart->cell = field->fe->cell;
+        break;
+        break;
+    }
+    // */
+
+    //* 3D case
+    switch (ndofs)
+    {
+    case 4:
+        field->fe = new cigma::FE();
         field->fe->cell = new cigma::Tet();
         field->fe->quadrature = new cigma::Quadrature();
         field->fe->quadrature->set_quadrature(tet_qpts, tet_qwts, tet_nno, tet_nsd);
         field->fe->quadrature->set_globaldim(3);
         field->fe->jxw = new double[tet_nno];
         field->fe->basis_tab = new double[tet_nno * ndofs];
-        field->fe->basis_jet = new double[tet_nno * ndofs * 3];
+        field->fe->basis_jet = new double[tet_nno * ndofs * tet_nsd];
         field->meshPart->cell = field->fe->cell;
         break;
     case 8:
@@ -144,13 +216,14 @@
         field->fe->cell = new cigma::Hex();
         field->fe->quadrature = new cigma::Quadrature();
         field->fe->quadrature->set_quadrature(hex_qpts, hex_qwts, hex_nno, hex_nsd);
-        field->fe->quadrature->set_globaldim(3);
+        field->fe->quadrature->set_globaldim(hex_nsd);
         field->fe->jxw = new double[hex_nno];
         field->fe->basis_tab = new double[hex_nno * ndofs];
-        field->fe->basis_jet = new double[hex_nno * ndofs * 3];
+        field->fe->basis_jet = new double[hex_nno * ndofs * hex_nsd];
         field->meshPart->cell = field->fe->cell;
         break;
-    }
+    } // */
+
     assert(field->fe != 0);
     assert(field->fe->cell != 0);
 

Modified: cs/benchmark/cigma/trunk/src/CompareCmd.h
===================================================================
--- cs/benchmark/cigma/trunk/src/CompareCmd.h	2008-01-17 01:25:12 UTC (rev 9084)
+++ cs/benchmark/cigma/trunk/src/CompareCmd.h	2008-01-17 01:25:15 UTC (rev 9085)
@@ -7,6 +7,7 @@
 #include "FE_Field.h"
 #include "Writer.h"
 #include "VtkUgReader.h"
+//#include "HdfReader.h"
 
 namespace cigma
 {
@@ -37,6 +38,7 @@
     std::string output_filename, output_name;
     std::string locationA, locationB;
     VtkUgReader readerA, readerB;
+    //HdfReader h5_readerA, h5_readerB;
 };
 
 



More information about the cig-commits mailing list