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

luis at geodynamics.org luis at geodynamics.org
Wed Jan 30 19:10:28 PST 2008


Author: luis
Date: 2008-01-30 19:10:27 -0800 (Wed, 30 Jan 2008)
New Revision: 9201

Modified:
   cs/benchmark/cigma/trunk/src/Misc.cpp
   cs/benchmark/cigma/trunk/src/Misc.h
Log:
Fixed build problems with QuadratureIO::load().
Removed some comments as well.

Modified: cs/benchmark/cigma/trunk/src/Misc.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/Misc.cpp	2008-01-31 00:18:58 UTC (rev 9200)
+++ cs/benchmark/cigma/trunk/src/Misc.cpp	2008-01-31 03:10:27 UTC (rev 9201)
@@ -171,6 +171,7 @@
 
 // ---------------------------------------------------------------------------
 
+/*
 void read_double_dset(HdfReader *reader, double **data, int *num, int *dim)
 {
 }
@@ -208,9 +209,11 @@
     }
 
 }
+*/
 
 // ---------------------------------------------------------------------------
 
+/*
 void read_int_dset(HdfReader *reader, int **data, int *num, int *dim)
 {
 }
@@ -248,11 +251,13 @@
     }
 
 }
+*/
 
 
 // ---------------------------------------------------------------------------
 
 
+/*
 void read_coords(Reader *reader, double **coords, int *nno, int *nsd)
 {
     read_double_dset(reader, coords, nno, nsd);
@@ -267,6 +272,7 @@
 {
     read_double_dset(reader, dofs, nno, valdim);
 }
+*/
 
 
 
@@ -285,17 +291,8 @@
     }
 }
 
-/*
-void MeshIO::configure(AnyOption *opt, const char *cmd, const char *name)
-{
-    configure_mesh(opt, this, name);
-    // check for required options
-}*/
-
 void MeshIO::load()
 {
-    const bool debug = true;
-
     string mesh_loc, mesh_file, mesh_ext;
     string coords_loc, coords_file, coords_ext;
     string connect_loc, connect_file, connect_ext;
@@ -323,7 +320,7 @@
         if (coords_reader->getType() == Reader::HDF_READER)
         {
             HdfReader *hdfReader = static_cast<HdfReader*>(coords_reader);
-            hdfReader->get_coordinates(coords_loc, &coords, &nno, &nsd);
+            hdfReader->get_coordinates(coords_loc.c_str(), &coords, &nno, &nsd);
             hdfReader->close();
         }
         else if (coords_reader->getType() == Reader::TXT_READER)
@@ -354,7 +351,7 @@
         if (connect_reader->getType() == Reader::HDF_READER)
         {
             HdfReader *hdfReader = static_cast<HdfReader*>(connect_reader);
-            hdfReader->get_coordinates(coords_loc, &coords, &nno, &nsd);
+            hdfReader->get_coordinates(coords_loc.c_str(), &coords, &nno, &nsd);
             hdfReader->close();
         }
         else if (connect_reader->getType() == Reader::TXT_READER)
@@ -384,8 +381,8 @@
             coords_loc = mesh_loc + "/coordinates";
             connect_loc = mesh_loc + "/connectivity";
             HdfReader *hdfReader = static_cast<HdfReader*>(mesh_reader);
-            hdfReader->get_coordinates(coords_loc, &coords, &nno, &nsd);
-            hdfReader->get_connectivity(connect_loc, &connect, &nel, &ndofs);
+            hdfReader->get_coordinates(coords_loc.c_str(), &coords, &nno, &nsd);
+            hdfReader->get_connectivity(connect_loc.c_str(), &connect, &nel, &ndofs);
         }
         else if (mesh_reader->getType() == Reader::TXT_READER)
         {
@@ -486,21 +483,10 @@
     }
 }
 
-/*
-void QuadratureIO::configure(AnyOption *opt, const char *cmd, const char *name)
-{
-    configure_quadrature(opt, this, name);
-    // check for required options
-}*/
-
 void QuadratureIO::load(cigma::Cell *cell)
 {
     assert(cell != 0);
 
-    quadrature = new Quadrature();
-
-
-
     // XXX: change *_nsd to *_celldim since we are
     // talking about quadrature points in the appropriate
     // reference domain
@@ -561,42 +547,40 @@
     double hex_qwts[8*3] = { 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1. };
 
 
+    int nq,nd;
+    double *qx, *qw;
 
-    int order;
-    string_to_int(arg_order, order);
+    nq = 0;
+    nd = 0;
+    qx = 0;
+    qw = 0;
 
-
-    if (reader == 0)
+    if (quadrature_path != "")
     {
-        assert(cell != 0);
+        string quadrature_loc, quadrature_file, quadrature_ext;
+        parse_dataset_path(quadrature_path, quadrature_loc, quadrature_file, quadrature_ext);
+        new_reader(&reader, quadrature_ext);
 
-        if (order < 0)
+        if (reader->getType() == Reader::HDF_READER)
         {
-            // assign defaults
-            switch (cell->geometry())
-            {
-            case Cell::TRIANGLE:
-                quadrature->set_quadrature(tri_qpts, tri_qwts, tri_nno, tri_nsd);
-                quadrature->set_globaldim(tri_nsd);
-                break;
-            case Cell::QUADRANGLE:
-                quadrature->set_quadrature(quad_qpts, quad_qwts, quad_nno, quad_nsd);
-                quadrature->set_globaldim(quad_nsd);
-                break;
-            case Cell::TETRAHEDRON:
-                quadrature->set_quadrature(tet_qpts, tet_qwts, tet_nno, tet_nsd);
-                quadrature->set_globaldim(tet_nsd);
-                break;
-            case Cell::HEXAHEDRON:
-                quadrature->set_quadrature(hex_qpts, hex_qwts, hex_nno, hex_nsd);
-                quadrature->set_globaldim(hex_nsd);
-                break;
-            default:
-                break;
-            }
+
         }
-        else
+        else if (reader->getType() == Reader::TXT_READER)
         {
+
+        }
+        else if (reader->getType() == Reader::VTK_READER)
+        {
+
+        }
+    }
+    else if (quadrature_order != "")
+    {
+        int order;
+        string_to_int(quadrature_order, order);
+
+        if (order > 0)
+        {
             /* call FiatProxy
             //fiat->set(quadrature);
                 int npts,dim;
@@ -610,21 +594,42 @@
     }
     else
     {
-        switch (reader->getType())
+        // assign reasonable defaults
+        switch (cell->geometry())
         {
-        case Reader::HDF_READER:
-            assert(arg_quadrature_path != "");
+        case Cell::TRIANGLE:
+            quadrature = new Quadrature();
+            quadrature->set_quadrature(tri_qpts, tri_qwts, tri_nno, tri_nsd);
+            quadrature->set_globaldim(tri_nsd);
             break;
-
-        case Reader::TXT_READER:
-            assert(arg_points_loc != "");
-            assert(arg_weights_loc != "");
+        case Cell::QUADRANGLE:
+            quadrature = new Quadrature();
+            quadrature->set_quadrature(quad_qpts, quad_qwts, quad_nno, quad_nsd);
+            quadrature->set_globaldim(quad_nsd);
             break;
+        case Cell::TETRAHEDRON:
+            quadrature = new Quadrature();
+            quadrature->set_quadrature(tet_qpts, tet_qwts, tet_nno, tet_nsd);
+            quadrature->set_globaldim(tet_nsd);
+            break;
+        case Cell::HEXAHEDRON:
+            quadrature = new Quadrature();
+            quadrature->set_quadrature(hex_qpts, hex_qwts, hex_nno, hex_nsd);
+            quadrature->set_globaldim(hex_nsd);
+            break;
         default:
             break;
         }
     }
 
+    if ((qx != 0) && (qw != 0))
+    {
+        quadrature = new Quadrature();
+        quadrature->set_quadrature(qx, qw, nq, nd);
+        quadrature->set_globaldim(3); // XXX
+    }
+
+    assert(quadrature != 0);
     assert(quadrature->n_points() > 0);
     assert(quadrature->n_refdim() > 0);
     assert(quadrature->n_globaldim() > 0);
@@ -647,13 +652,6 @@
     }
 }
 
-/*
-void FieldIO::configure(AnyOption *opt, const char *cmd, const char *name)
-{
-    configure_field(opt, this, name);
-    // check
-}*/
-
 void FieldIO::load()
 {
 

Modified: cs/benchmark/cigma/trunk/src/Misc.h
===================================================================
--- cs/benchmark/cigma/trunk/src/Misc.h	2008-01-31 00:18:58 UTC (rev 9200)
+++ cs/benchmark/cigma/trunk/src/Misc.h	2008-01-31 03:10:27 UTC (rev 9201)
@@ -50,7 +50,6 @@
 public:
     MeshIO();
     ~MeshIO();
-    //void configure(AnyOption *opt, const char *cmd, const char *name);
     void load();
     void save();
 };
@@ -68,7 +67,6 @@
 public:
     QuadratureIO();
     ~QuadratureIO();
-    //void configure(AnyOption *opt, const char *cmd, const char *name);
     void load(cigma::Cell *cell);
     void save();
 };
@@ -86,7 +84,6 @@
 public:
     FieldIO();
     ~FieldIO();
-    //void configure(AnyOption *opt, const char *cmd, const char *name);
     void load();
     void save();
 };
@@ -106,49 +103,4 @@
 void configure_field(AnyOption *opt, FieldIO *fieldIO, const char *opt_prefix);
 
 
-/*
-void load_reader(cigma::Reader **reader, std::string ext);
-void load_writer(cigma::Writer **writer, std::string ext);
-*/
-
-
-/*
-void load_mesh();
-void load_quadrature();
-void load_quadrature(cigma::Cell *cell, cigma::Quadrature *quadrature);
-void load_field();
-void load_field(cigma::Reader *reader,
-                cigma::FE_Field *field,
-                std::string field_location);
-
-
-
-
-
-
-void load_mesh(cigma::MeshPart *meshPart,
-               cigma::Reader *reader,
-               std::string mesh_path,
-               std::string coords_loc,
-               std::string connect_loc);
-
-
-void load_quadrature(cigma::Quadrature *quadrature,
-                     cigma::Cell *cell,
-                     cigma::Reader *reader,
-                     std::string arg_quadrature_path,
-                     std::string arg_points_loc,
-                     std::string arg_weights_loc,
-                     std::string arg_order);
-
-void load_field(cigma::FE_Field *field,
-                cigma::MeshPart *meshPart,
-                cigma::Reader *fieldReader,
-                cigma::Reader *meshReader,
-                std::string field_path,
-                std::string mesh_path,
-                std::string coords_path,
-                std::string connect_path);
-*/
-
 #endif



More information about the cig-commits mailing list