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

luis at geodynamics.org luis at geodynamics.org
Wed Jan 30 16:18:58 PST 2008


Author: luis
Date: 2008-01-30 16:18:58 -0800 (Wed, 30 Jan 2008)
New Revision: 9200

Modified:
   cs/benchmark/cigma/trunk/src/CompareCmd.cpp
   cs/benchmark/cigma/trunk/src/CompareCmd.h
   cs/benchmark/cigma/trunk/src/Misc.cpp
   cs/benchmark/cigma/trunk/src/Misc.h
Log:
Improvements to MeshIO, QuadratureIO, FieldIO loader classes

Modified: cs/benchmark/cigma/trunk/src/CompareCmd.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/CompareCmd.cpp	2008-01-31 00:18:57 UTC (rev 9199)
+++ cs/benchmark/cigma/trunk/src/CompareCmd.cpp	2008-01-31 00:18:58 UTC (rev 9200)
@@ -4,20 +4,22 @@
 #include "CompareCmd.h"
 #include "StringUtils.h"
 
-//#include "VtkUgMeshPart.h"
 #include "MeshPart.h"
 #include "Tet.h"
 #include "Hex.h"
 #include "Numeric.h"
 #include "AnnLocator.h"
 
-//#include "VtkUgSimpleWriter.h"
 #include "HdfReader.h"
 #include "VtkReader.h"
+#include "VtkWriter.h"
 
 #include "Misc.h"
 
 
+using namespace std;
+
+
 
 // ---------------------------------------------------------------------------
 
@@ -70,6 +72,14 @@
     /* setup flags and options */
     opt->setFlag("help", 'h');
 
+    //meshIO.setup_options(opt, "mesh");
+    //quadratureIO.setup_options(opt, "rule");
+    //firstIO.setup_options(opt, "first");
+    //secondIO.setup_options(opt, "second");
+    //residualsIO.setup_options(opt, "output");
+
+    //* set these here
+
     // options for mesh
     opt->setOption("mesh");
     opt->setOption("mesh-coordinates");
@@ -95,10 +105,12 @@
 
     // options for output
     opt->setOption("output");
-    opt->setOption("output-frequency",'f');
 
+    // */
+
     // other options
     opt->setFlag("verbose");
+    opt->setOption("output-frequency",'f');
 }
 
 
@@ -110,27 +122,42 @@
     //std::string inputfileA, inputfileB;
     //std::string extA, extB;
 
+    string field_prefix;
     std::string inputstr;
     char *in;
 
-    bool debug = true;
 
+    /*
     in = opt->getValue("first");
     if (in == 0)
     {
-        in = (char *)"./tests/strikeslip_tet4_1000m_t0.vtk:displacements_t0"; // XXX: get rid of these defaults and the subsequent if(!debug){} construct
+        // XXX: get rid of these defaults and the subsequent if(!debug){} construct
+        in = (char *)"./tests/strikeslip_tet4_1000m_t0.vtk:displacements_t0";
         if (!debug)
         {
             std::cerr << "compare: Please specify the option --fieldA" << std::endl;
             exit(1);
         }
     }
+    firstIO.field_path = in;
+
+    in = opt->getValue("first-mesh");
+    if (in == 0) { }
+    firstIO.meshIO.mesh_path = in;
+
+    in = opt->getValue("first-mesh-coordinates");
+    if (in == 0) { }
+    firstIO.meshIO.coords_path = in;
+
+    in = opt->getValue("first-mesh-connectivity");
+    if (in == 0) { }
+    firstIO.meshIO.connect_path = in;
+    
     //inputA = in;
     //parse_dataset_path(inputA, locationA, inputfileA, extA);
     //load_reader(&readerA, extA);
     //readerA->open(inputfileA);
 
-
     in = opt->getValue("second");
     if (in == 0)
     {
@@ -141,13 +168,24 @@
             exit(1);
         }
     }
+
+    in = opt->getValue("second-mesh");
+    if (in == 0) { }
+    secondIO.meshIO.mesh_path = in;
+
+    in = opt->getValue("second-mesh-coordinates");
+    if (in == 0) { }
+    secondIO.meshIO.coords_path = in;
+
+    in = opt->getValue("second-mesh-connectivity");
+    if (in == 0) { }
+    secondIO.meshIO.connect_path = in;
+    
     //inputB = in;
     //parse_dataset_path(inputB, locationB, inputfileB, extB);
     //load_reader(&readerB, extB);
     //readerB->open(inputfileB);
 
-
-
     in = opt->getValue("output");
     if (in == 0)
     {
@@ -165,8 +203,9 @@
     //load_writer(&writer, output_ext);
     //output_name = "epsilon";
 
+    // */
 
-
+    
     verbose = opt->getFlag("verbose");
 
     in = opt->getValue("output-frequency");
@@ -197,11 +236,55 @@
      *          Load Analytic Field
      */
 
-    mesh = 0;
+    /* if no mesh specified, get it from fieldA
+     * if fieldA has no mesh (e.g. specified by analytic soln), then
+     * swap fieldA and fieldB, and try again.
+     * if fieldA still has no mesh, then produce error if no mesh
+     * was specified to begin with.
+     */
 
+    //const char *cmd_name = name.c_str();
+    //meshIO.configure(opt, cmd_name, "mesh");
+    //quadratureIO.configure(opt, cmd_name, "rule");
+    //firstIO.configure(opt, cmd_name, "first");
+    //secondIO.configure(opt, cmd_name, "second");
+    //residualsIO.configure(opt, cmd_name, "output");
 
+
+
+    configure_mesh(opt, &meshIO, "mesh");
+    configure_quadrature(opt, &quadratureIO);
+    configure_field(opt, &firstIO, "first");
+    configure_field(opt, &secondIO, "second");
+    configure_field(opt, &residualsIO, "output");
+
+
+    meshIO.load();
+    mesh = meshIO.meshPart;
+
+    firstIO.load();
+    field_a = firstIO.field;
+    if (mesh == 0)
+    {
+        mesh = firstIO.field->meshPart;
+    }
+    assert(field_a != 0);
+    assert(mesh != 0);
+
+
+    secondIO.load();
+    if (secondIO.field != 0)
+    {
+        field_b = secondIO.field;
+    }
+
+    quadratureIO.load(mesh->cell);
+    quadrature = quadratureIO.quadrature;
+
+
+    /*
     field_a = new FE_Field();
-    firstFieldIO.load(field_a);
+    firstIO.load(field_a);
     //load_field(inputfileA, locationA, readerA, field_a);
     //std::cout << "first field location = " << locationA << std::endl;
     //std::cout << "first field inputfile = " << inputfileA << std::endl;
@@ -213,7 +296,7 @@
               << field_a->n_rank() << std::endl;
 
     field_b = new FE_Field();
-    secondFieldIO.load(field_b);
+    secondIO.load(field_b);
     //load_field(inputfileB, locationB, readerB, field_b);
     //std::cout << "second field location = " << locationB << std::endl;
     //std::cout << "second field inputfile = " << inputfileB << std::endl;
@@ -226,16 +309,12 @@
 
     //std::cout << "outputfile = " << output_filename << std::endl;
 
-
-    /* if no mesh specified, get it from fieldA
-     * if fieldA has no mesh (e.g. specified by analytic soln), then
-     * swap fieldA and fieldB, and try again.
-     * if fieldA still has no mesh, then produce error if no mesh
-     * was specified to begin with.
-     */
     //mesh = field_a->meshPart;
     //quadrature = field_a->fe->quadrature;
 
+    // */
+
+
     return;
 }
 
@@ -368,23 +447,25 @@
 
 
     /* write out data */
-    {
-        residuals = new FE_Field();
-        residuals->fe = 0;
-        residuals->meshPart = mesh;
-        residuals->dofHandler = new DofHandler();
-        residuals->dofHandler->nno = nel;
-        residuals->dofHandler->ndim = 1;
-        residuals->dofHandler->dofs = epsilon;
+    /* use residualsIO
+    residuals = new FE_Field();
+    residuals->fe = 0;
+    residuals->meshPart = mesh;
+    residuals->dofHandler = new DofHandler();
+    residuals->dofHandler->nno = nel;   //XXX: In DofHandler, rename nno to num
+    residuals->dofHandler->ndim = 1;
+    residuals->dofHandler->dofs = epsilon;
 
-        residualsIO.save(residuals);
-        //writer->open(output_filename);
-        //writer->write_field(residuals);
-        //writer->close();
-    }
+    residualsIO.field = residuals;
+    residualsIO.save();
 
+    //writer->open(output_filename);
+    //writer->write_field(residuals);
+    //writer->close();
 
-    /* write out data
+    // */
+
+    //* write out data
     {
         int nno = mesh->nno;
         int nsd = mesh->nsd;
@@ -392,10 +473,14 @@
         double *coords = mesh->coords;
         int *connect = mesh->connect;
 
+        string output_filename = residualsIO.field_path;
+        string output_name = "epsilon";
+
         // XXX: create a cell-based ResidualField class
 
-        //std::cout << "Creating file " << output_filename << std::endl;
-        VtkUgSimpleWriter *writer = new VtkUgSimpleWriter();
+        std::cout << "Creating file " << output_filename << std::endl;
+        //VtkUgSimpleWriter *writer = new VtkUgSimpleWriter();
+        VtkWriter *writer = new VtkWriter();
         writer->open(output_filename);
         writer->write_header();
         writer->write_points(coords, nno, nsd);
@@ -408,6 +493,10 @@
 
 
     /* clean up */
+    //delete residuals->dofHandler;
+    //delete residuals;
+    //residualsIO.field = 0;
+
     delete [] epsilon;
 
 

Modified: cs/benchmark/cigma/trunk/src/CompareCmd.h
===================================================================
--- cs/benchmark/cigma/trunk/src/CompareCmd.h	2008-01-31 00:18:57 UTC (rev 9199)
+++ cs/benchmark/cigma/trunk/src/CompareCmd.h	2008-01-31 00:18:58 UTC (rev 9200)
@@ -39,8 +39,8 @@
 public:
     MeshIO meshIO;
     QuadratureIO quadratureIO;
-    FieldIO firstFieldIO;
-    FieldIO secondFieldIO;
+    FieldIO firstIO;
+    FieldIO secondIO;
     FieldIO residualsIO;
 
     //Reader *readerA;

Modified: cs/benchmark/cigma/trunk/src/Misc.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/Misc.cpp	2008-01-31 00:18:57 UTC (rev 9199)
+++ cs/benchmark/cigma/trunk/src/Misc.cpp	2008-01-31 00:18:58 UTC (rev 9200)
@@ -40,7 +40,7 @@
 
 // ---------------------------------------------------------------------------
 
-void load_reader(Reader **reader, string ext)
+void new_reader(Reader **reader, string ext)
 {
     if (ext == ".h5")
     {
@@ -62,7 +62,7 @@
 
 }
 
-void load_writer(Writer **writer, string ext)
+void new_writer(Writer **writer, string ext)
 {
     if (ext == ".h5")
     {
@@ -87,35 +87,420 @@
 
 // ---------------------------------------------------------------------------
 
-void MeshIO::load(cigma::MeshPart *meshPart)
+void configure_quadrature(AnyOption *opt, QuadratureIO *quadratureIO)
 {
-    assert(meshPart != 0);
+    assert(opt != 0);
+    assert(quadratureIO != 0);
 
-    switch (reader->getType())
+    char *in;
+
+    in = opt->getValue("order");
+    if (in != 0)
     {
-    case Reader::HDF_READER:
-        break;
+        quadratureIO->quadrature_order = in;
+    }
 
-    case Reader::TXT_READER:
-        break;
+    in = opt->getValue("rule");
+    if (in != 0)
+    {
+        quadratureIO->quadrature_path = in;
+    }
 
-    case Reader::VTK_READER:
-        break;
+    in = opt->getValue("rule-points");
+    if (in != 0)
+    {
+        quadratureIO->points_path = in;
+    }
 
-    default:
-        break;
+    in = opt->getValue("rule-weights");
+    if (in != 0)
+    {
+        quadratureIO->weights_path = in;
     }
 }
 
 
+void configure_mesh(AnyOption *opt, MeshIO *meshIO, const char *opt_prefix)
+{
+    assert(opt != 0);
+    assert(meshIO != 0);
 
+    char *in;
+    string optstr;
+    string mesh_name = opt_prefix;
+
+    in = opt->getValue(mesh_name.c_str());
+    if (in != 0)
+    {
+        meshIO->mesh_path = in;
+    }
+
+    optstr = mesh_name + "-coordinates";
+    in = opt->getValue(optstr.c_str());
+    if (in != 0)
+    {
+        meshIO->coords_path = in;
+    }
+
+    optstr = mesh_name + "-connectivity";
+    in = opt->getValue(optstr.c_str());
+    if (in != 0)
+    {
+        meshIO->connect_path = in;
+    }
+}
+
+void configure_field(AnyOption *opt, FieldIO *fieldIO, const char *opt_prefix)
+{
+    assert(opt != 0);
+    assert(fieldIO != 0);
+
+    char *in;
+    string field_name = opt_prefix;
+    string mesh_name = field_name + "-mesh";
+
+    in = opt->getValue(field_name.c_str());
+    if (in != 0)
+    {
+        fieldIO->field_path = in;
+    }
+
+    configure_mesh(opt, &(fieldIO->meshIO), mesh_name.c_str());
+
+}
+
 // ---------------------------------------------------------------------------
 
-void QuadratureIO::load(cigma::Quadrature *quadrature, cigma::Cell *cell)
+void read_double_dset(HdfReader *reader, double **data, int *num, int *dim)
 {
-    assert(quadrature != 0);
+}
+
+void read_double_dset(TextReader *reader, double **data, int *num, int *dim)
+{
+}
+
+void read_double_dset(VtkReader *reader, double **data, int *num, int *dim)
+{
+}
+
+void read_double_dset(Reader *reader, double **data, int *num, int *dim)
+{
+
+    if (reader->getType() == Reader::HDF_READER)
+    {
+        meshPart = new MeshPart();
+        HdfReader *hdfReader = static_cast<HdfReader*>(reader);
+        read_double_dset(hdfReader, data, num, dim);
+
+    }
+    else if (reader->getType() == Reader::TXT_READER)
+    {
+        meshPart = new MeshPart();
+        TextReader *textReader = static_cast<TextReader*>(reader);
+        read_double_dset(textReader, data, num, dim);
+
+    }
+    else if (reader->getType() == Reader::VTK_READER)
+    {
+        meshPart = new MeshPart();
+        VtkReader *vtkReader = static_cast<VtkReader*>(reader);
+        read_double_dset(vtkReader, data, num, dim);
+    }
+
+}
+
+// ---------------------------------------------------------------------------
+
+void read_int_dset(HdfReader *reader, int **data, int *num, int *dim)
+{
+}
+
+void read_int_dset(TextReader *reader, int **data, int *num, int *dim)
+{
+}
+
+void read_int_dset(VtkReader *reader, int **data, int *num, int *dim)
+{
+}
+
+void read_int_dset(Reader *reader, int **data, int *num, int *dim)
+{
+
+    if (reader->getType() == Reader::HDF_READER)
+    {
+        meshPart = new MeshPart();
+        HdfReader *hdfReader = static_cast<HdfReader*>(reader);
+        read_int_dset(hdfReader, data, num, dim);
+
+    }
+    else if (reader->getType() == Reader::TXT_READER)
+    {
+        meshPart = new MeshPart();
+        TextReader *textReader = static_cast<TextReader*>(reader);
+        read_int_dset(textReader, data, num, dim);
+
+    }
+    else if (reader->getType() == Reader::VTK_READER)
+    {
+        meshPart = new MeshPart();
+        VtkReader *vtkReader = static_cast<VtkReader*>(reader);
+        read_int_dset(vtkReader, data, num, dim);
+    }
+
+}
+
+
+// ---------------------------------------------------------------------------
+
+
+void read_coords(Reader *reader, double **coords, int *nno, int *nsd)
+{
+    read_double_dset(reader, coords, nno, nsd);
+}
+
+void read_connect(Reader *reader, int **connect, int *nel, int *ndofs)
+{
+    read_int_dset(reader, connect, nel, ndofs);
+}
+
+void read_dofs(Reader *reader, double **dofs, int *nno, int *valdim)
+{
+    read_double_dset(reader, dofs, nno, valdim);
+}
+
+
+
+// ---------------------------------------------------------------------------
+
+MeshIO::MeshIO()
+{
+    meshPart = 0;
+}
+
+MeshIO::~MeshIO()
+{
+    if (meshPart != 0)
+    {
+        // XXX: traverse meshPart structure and delete everything
+    }
+}
+
+/*
+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;
+
+    int nno, nsd;
+    double *coords = 0;
+
+    int nel, ndofs;
+    int *connect = 0;
+
+    nno = nsd = 0;
+    nel = ndofs = 0;
+
+
+    if (coords_path != "")
+    {
+        // XXX: use auto_ptr for this local reader, so we can throw exceptions
+        Reader *coords_reader;
+        parse_dataset_path(coords_path, coords_loc, coords_file, coords_ext);
+        new_reader(&coords_reader, coords_ext);
+        coords_reader->open(coords_file);
+
+        //read_coords(coords_reader, &coords, &nno, &nsd);
+
+        if (coords_reader->getType() == Reader::HDF_READER)
+        {
+            HdfReader *hdfReader = static_cast<HdfReader*>(coords_reader);
+            hdfReader->get_coordinates(coords_loc, &coords, &nno, &nsd);
+            hdfReader->close();
+        }
+        else if (coords_reader->getType() == Reader::TXT_READER)
+        {
+            TextReader *textReader = static_cast<TextReader*>(coords_reader);
+            textReader->get_coordinates(&coords, &nno, &nsd);
+            textReader->close();
+
+        }
+        else if (coords_reader->getType() == Reader::VTK_READER)
+        {
+            VtkReader *vtkReader = static_cast<VtkReader*>(coords_reader);
+            vtkReader->get_coordinates(&coords, &nno, &nsd);
+            vtkReader->close();
+        }
+    }
+
+    if (connect_path != "")
+    {
+        // XXX: use auto_ptr for this local reader, so we can throw exceptions
+        Reader *connect_reader;
+        parse_dataset_path(connect_path, connect_loc, connect_file, connect_ext);
+        new_reader(&connect_reader, connect_ext);
+        connect_reader->open(connect_file);
+
+        //read_connect(connect_reader, &nel, &ndofs);
+
+        if (connect_reader->getType() == Reader::HDF_READER)
+        {
+            HdfReader *hdfReader = static_cast<HdfReader*>(connect_reader);
+            hdfReader->get_coordinates(coords_loc, &coords, &nno, &nsd);
+            hdfReader->close();
+        }
+        else if (connect_reader->getType() == Reader::TXT_READER)
+        {
+            TextReader *textReader = static_cast<TextReader*>(connect_reader);
+            textReader->get_coordinates(&coords, &nno, &nsd);
+            textReader->close();
+        }
+        else if (connect_reader->getType() == Reader::VTK_READER)
+        {
+            VtkReader *vtkReader = static_cast<VtkReader*>(connect_reader);
+            vtkReader->get_coordinates(&coords, &nno, &nsd);
+            vtkReader->close();
+        }
+    }
+
+    if ((mesh_path != "") && ((coords == 0) || (connect == 0)))
+    {
+        // XXX: use auto_ptr for this local reader, so we can throw exceptions
+        Reader *mesh_reader;
+        parse_dataset_path(mesh_path, mesh_loc, mesh_file, mesh_ext);
+        new_reader(&mesh_reader, mesh_ext);
+        mesh_reader->open(mesh_file);
+
+        if (mesh_reader->getType() == Reader::HDF_READER)
+        {
+            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);
+        }
+        else if (mesh_reader->getType() == Reader::TXT_READER)
+        {
+            TextReader *textReader = static_cast<TextReader*>(mesh_reader);
+            textReader->get_coordinates(&coords, &nno, &nsd);
+            textReader->get_connectivity(&connect, &nel, &ndofs);
+        }
+        else if (mesh_reader->getType() == Reader::VTK_READER)
+        {
+            // read mesh from single vtk file
+            VtkReader *vtkReader = static_cast<VtkReader*>(mesh_reader);
+            vtkReader->get_coordinates(&coords, &nno, &nsd);
+            vtkReader->get_connectivity(&connect, &nel, &ndofs);
+        }
+
+        reader->close();
+
+        /*
+        if (mesh_ext == ".h5")
+        {
+            assert(mesh_reader->getType() == Reader::HDF_READER);
+
+            HdfReader *hdfReader = static_cast<HdfReader*>(mesh_reader);
+            // open mesh_file in read only mode
+
+            // assert that mesh_path points to an HDF5 group
+
+            // read metadata from that group
+
+            // if no metadata is available, look inside group
+            // for two datasets named coordinates & connectivity
+            
+        }
+        else if (mesh_ext == ".txt")
+        {
+            assert(reader->getType() == Reader::TXT_READER);
+
+            // read mesh from single text file
+        }
+        else if (mesh_ext == ".vtk")
+        {
+            assert(reader->getType() == Reader::VTK_READER);
+
+            // read mesh from single vtk file
+            VtkReader *vtkReader = static_cast<VtkReader*>(mesh_reader);
+            vtkReader->open(mesh_file);
+            vtkReader->get_coordinates(&coords, &nno, &nsd);
+            vtkReader->get_connectivity(&connect, &nel, &ndofs);
+            vtkReader->close();
+        } */
+    }
+
+    if ((coords != 0) && (connect != 0))
+    {
+        meshPart = new MeshPart();
+
+        meshPart->nno = nno;
+        meshPart->nsd = nsd;
+        meshPart->coords = coords;
+
+        meshPart->nel = nel;
+        meshPart->ndofs = ndofs;
+        meshPart->connect = connect;
+
+    }
+    else
+    {
+        if (coords == 0)
+        {
+            cerr << "MeshIO::load() error: Could not find mesh coordinates";
+            cerr << endl;
+
+        }
+        if (connect == 0)
+        {
+            cerr << "MeshIO::load() error: Could not find mesh connectivity";
+            cerr << endl;
+        }
+    }
+
+
+}
+
+
+
+// ---------------------------------------------------------------------------
+
+QuadratureIO::QuadratureIO()
+{
+    quadrature = 0;
+}
+
+QuadratureIO::~QuadratureIO()
+{
+    if (quadrature != 0)
+    {
+        delete quadrature;
+    }
+}
+
+/*
+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
@@ -176,6 +561,7 @@
     double hex_qwts[8*3] = { 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1. };
 
 
+
     int order;
     string_to_int(arg_order, order);
 
@@ -248,9 +634,29 @@
 
 // ---------------------------------------------------------------------------
 
-void FieldIO::load(cigma::FE_Field *field)
+FieldIO::FieldIO()
 {
+    field = 0;
+}
 
+FieldIO::~FieldIO()
+{
+    if (field != 0)
+    {
+        // XXX: traverse field structure and delete everything
+    }
+}
+
+/*
+void FieldIO::configure(AnyOption *opt, const char *cmd, const char *name)
+{
+    configure_field(opt, this, name);
+    // check
+}*/
+
+void FieldIO::load()
+{
+
     int nno, nsd;
     int nel, ndofs;
     double *coords;
@@ -408,7 +814,7 @@
 
 
 
-void FieldIO::save(cigma::FE_Field *field)
+void FieldIO::save()
 {
     assert(field != 0);
 }

Modified: cs/benchmark/cigma/trunk/src/Misc.h
===================================================================
--- cs/benchmark/cigma/trunk/src/Misc.h	2008-01-31 00:18:57 UTC (rev 9199)
+++ cs/benchmark/cigma/trunk/src/Misc.h	2008-01-31 00:18:58 UTC (rev 9200)
@@ -24,6 +24,7 @@
  *
  */
 
+
 class GeneralIO
 {
 public:
@@ -41,27 +42,35 @@
 class MeshIO : public GeneralIO
 {
 public:
-    std::string filename;
     std::string mesh_path;
     std::string coords_path;
     std::string connect_path;
+    cigma::MeshPart *meshPart;
 
 public:
-    void load(cigma::MeshPart *meshPart);
+    MeshIO();
+    ~MeshIO();
+    //void configure(AnyOption *opt, const char *cmd, const char *name);
+    void load();
+    void save();
 };
 
 
 class QuadratureIO : public GeneralIO
 {
 public:
-    std::string filename;
     std::string quadrature_order;
     std::string quadrature_path;
     std::string points_path;
     std::string weights_path;
+    cigma::Quadrature *quadrature;
 
 public:
-    void load(cigma::Quadrature *quadrature, cigma::Cell *cell);
+    QuadratureIO();
+    ~QuadratureIO();
+    //void configure(AnyOption *opt, const char *cmd, const char *name);
+    void load(cigma::Cell *cell);
+    void save();
 };
 
 
@@ -69,19 +78,21 @@
 class FieldIO : public GeneralIO
 {
 public:
-    std::string filename;
-    std::string dofs_path;
-
-public:
     MeshIO meshIO;
     QuadratureIO quadratureIO;
+    std::string field_path;
+    cigma::FE_Field *field;
 
 public:
-    void load(cigma::FE_Field *field);
-    void save(cigma::FE_Field *field);
+    FieldIO();
+    ~FieldIO();
+    //void configure(AnyOption *opt, const char *cmd, const char *name);
+    void load();
+    void save();
 };
 
 
+
 /* 
  * Misc Methods
  *
@@ -90,12 +101,17 @@
 double pick_from_interval(double a, double b);
 void bbox_random_point(double minpt[3], double maxpt[3], double x[3]);
 
+void configure_quadrature(AnyOption *opt, QuadratureIO *quadratureIO);
+void configure_mesh(AnyOption *opt, MeshIO *meshIO, const char *opt_prefix);
+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();



More information about the cig-commits mailing list