[cig-commits] r13041 - in cs/cigma/trunk: . pysrc pysrc/cigma pysrc/tests src tests tests/libcigma

luis at geodynamics.org luis at geodynamics.org
Wed Oct 15 02:07:31 PDT 2008


Author: luis
Date: 2008-10-15 02:07:31 -0700 (Wed, 15 Oct 2008)
New Revision: 13041

Added:
   cs/cigma/trunk/pysrc/Py_ElementBlock.cpp
   cs/cigma/trunk/pysrc/Py_FileReader.cpp
   cs/cigma/trunk/pysrc/Py_FileWriter.cpp
   cs/cigma/trunk/pysrc/Py_Locator.cpp
   cs/cigma/trunk/pysrc/Py_MeshPart.cpp
   cs/cigma/trunk/pysrc/Py_Points.cpp
   cs/cigma/trunk/pysrc/cigma/
   cs/cigma/trunk/pysrc/cigma/Locator.py
   cs/cigma/trunk/pysrc/cigma/__init__.py
   cs/cigma/trunk/pysrc/quux.cpp
   cs/cigma/trunk/pysrc/tests/runner.py
   cs/cigma/trunk/pysrc/tests/test_locator.py
   cs/cigma/trunk/src/AnnLocator.cpp
   cs/cigma/trunk/src/AnnLocator.h
   cs/cigma/trunk/src/Cell.cpp
   cs/cigma/trunk/src/Cell.h
   cs/cigma/trunk/src/ElementBlock.cpp
   cs/cigma/trunk/src/ElementBlock.h
   cs/cigma/trunk/src/Function.cpp
   cs/cigma/trunk/src/Function.h
   cs/cigma/trunk/src/FunctionRegistry.h
   cs/cigma/trunk/src/Locator.cpp
   cs/cigma/trunk/src/Locator.h
   cs/cigma/trunk/src/MeshPart.cpp
   cs/cigma/trunk/src/MeshPart.h
   cs/cigma/trunk/src/NodeCoordinates.cpp
   cs/cigma/trunk/src/NodeCoordinates.h
   cs/cigma/trunk/src/Point.cpp
   cs/cigma/trunk/src/Point.h
   cs/cigma/trunk/src/Points.cpp
   cs/cigma/trunk/src/Points.h
   cs/cigma/trunk/src/README
   cs/cigma/trunk/src/Residuals.cpp
   cs/cigma/trunk/src/Residuals.h
   cs/cigma/trunk/src/cli_compare_cmd.cpp
   cs/cigma/trunk/src/cli_compare_cmd.h
   cs/cigma/trunk/src/cli_eval_cmd.cpp
   cs/cigma/trunk/src/cli_eval_cmd.h
   cs/cigma/trunk/src/cli_extract_cmd.cpp
   cs/cigma/trunk/src/cli_extract_cmd.h
   cs/cigma/trunk/src/cli_info_cmd.cpp
   cs/cigma/trunk/src/cli_info_cmd.h
   cs/cigma/trunk/src/core_compare_op.cpp
   cs/cigma/trunk/src/core_compare_op.h
   cs/cigma/trunk/src/core_eval_op.cpp
   cs/cigma/trunk/src/core_eval_op.h
   cs/cigma/trunk/src/core_extract_op.cpp
   cs/cigma/trunk/src/core_extract_op.h
   cs/cigma/trunk/src/eb_array.cpp
   cs/cigma/trunk/src/eb_array.h
   cs/cigma/trunk/src/fn_zero.cpp
   cs/cigma/trunk/src/fn_zero.h
   cs/cigma/trunk/src/io_exo_reader.cpp
   cs/cigma/trunk/src/io_exo_reader.h
   cs/cigma/trunk/src/io_file_reader.cpp
   cs/cigma/trunk/src/io_file_reader.h
   cs/cigma/trunk/src/io_file_writer.cpp
   cs/cigma/trunk/src/io_file_writer.h
   cs/cigma/trunk/src/io_hdf5_reader.cpp
   cs/cigma/trunk/src/io_hdf5_reader.h
   cs/cigma/trunk/src/io_hdf5_writer.cpp
   cs/cigma/trunk/src/io_hdf5_writer.h
   cs/cigma/trunk/src/io_null_reader.cpp
   cs/cigma/trunk/src/io_null_reader.h
   cs/cigma/trunk/src/io_null_writer.cpp
   cs/cigma/trunk/src/io_null_writer.h
   cs/cigma/trunk/src/io_text_reader.cpp
   cs/cigma/trunk/src/io_text_reader.h
   cs/cigma/trunk/src/io_text_writer.cpp
   cs/cigma/trunk/src/io_text_writer.h
   cs/cigma/trunk/src/io_ucd_reader.cpp
   cs/cigma/trunk/src/io_ucd_reader.h
   cs/cigma/trunk/src/io_vtk_reader.cpp
   cs/cigma/trunk/src/io_vtk_reader.h
   cs/cigma/trunk/src/io_vtk_writer.cpp
   cs/cigma/trunk/src/io_vtk_writer.h
   cs/cigma/trunk/src/nc_array.cpp
   cs/cigma/trunk/src/nc_array.h
   cs/cigma/trunk/tests/libcigma/MiscTest.cpp
   cs/cigma/trunk/tests/libcigma/MiscTest.h
   cs/cigma/trunk/tests/libcigma/PointsTest.cpp
   cs/cigma/trunk/tests/libcigma/PointsTest.h
   cs/cigma/trunk/tests/libcigma/SkelTest.cpp
   cs/cigma/trunk/tests/libcigma/SkelTest.h
Modified:
   cs/cigma/trunk/Makefile.am
   cs/cigma/trunk/pysrc/Py_Misc.cpp
   cs/cigma/trunk/pysrc/_cigma_module.cpp
   cs/cigma/trunk/pysrc/setup.py
   cs/cigma/trunk/tests/test_registry.cpp
Log:
Test python bindings to Locator, MeshPart, NodeCoordinates

Modified: cs/cigma/trunk/Makefile.am
===================================================================
--- cs/cigma/trunk/Makefile.am	2008-10-15 09:07:28 UTC (rev 13040)
+++ cs/cigma/trunk/Makefile.am	2008-10-15 09:07:31 UTC (rev 13041)
@@ -94,10 +94,32 @@
 	src/Common.h \
 	src/Numeric.h \
 	src/Numeric.cpp \
+	src/DataPath.h \
+	src/DataPath.cpp \
+	src/Point.h \
+	src/Point.cpp \
+	src/Points.h \
+	src/Points.cpp \
+	src/Locator.h \
+	src/Locator.cpp \
+	src/AnnLocator.h \
+	src/AnnLocator.cpp \
+	src/MeshPart.h \
+	src/MeshPart.cpp \
+	src/ElementBlock.h \
+	src/ElementBlock.cpp \
 	src/NodeCoordinates.h \
 	src/NodeCoordinates.cpp \
-	src/DataPath.h \
-	src/DataPath.cpp \
+	src/io_file_reader.h \
+	src/io_file_reader.cpp \
+	src/io_null_reader.h \
+	src/io_null_reader.cpp \
+	src/io_text_reader.h \
+	src/io_text_reader.cpp \
+	src/io_file_writer.h \
+	src/io_file_writer.cpp \
+	src/io_null_writer.h \
+	src/io_null_writer.cpp \
 	src/core_base_op.h \
 	src/core_base_op.cpp \
 	src/core_list_op.h \
@@ -183,6 +205,10 @@
 	pysrc/numpy_util.h \
 	pysrc/numpy_util.cpp \
 	pysrc/Py_DataPath.cpp \
+	pysrc/Py_Points.cpp \
+	pysrc/Py_Locator.cpp \
+	pysrc/Py_MeshPart.cpp \
+	pysrc/Py_ElementBlock.cpp \
 	pysrc/Py_NodeCoordinates.cpp \
 	pysrc/Py_Misc.cpp \
 	pysrc/_cigma_module.cpp
@@ -218,8 +244,12 @@
 	tests/simple/SimpleTest.cpp \
 	tests/libcigma/DataPathTest.h \
 	tests/libcigma/DataPathTest.cpp \
+	tests/libcigma/PointsTest.h \
+	tests/libcigma/PointsTest.cpp \
 	tests/libcigma/NodeCoordinatesTest.h \
 	tests/libcigma/NodeCoordinatesTest.cpp \
+	tests/libcigma/MiscTest.h \
+	tests/libcigma/MiscTest.cpp \
 	tests/test_registry.cpp \
 	tests/main.cpp
 

Added: cs/cigma/trunk/pysrc/Py_ElementBlock.cpp
===================================================================
--- cs/cigma/trunk/pysrc/Py_ElementBlock.cpp	                        (rev 0)
+++ cs/cigma/trunk/pysrc/Py_ElementBlock.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,12 @@
+#include "ElementBlock.h"
+#include <boost/python.hpp>
+
+void export_ElementBlock()
+{
+    using namespace cigma;
+    using namespace boost::python;
+
+    class_<ElementBlock, boost::noncopyable>("ElementBlock", no_init)
+        ;
+}
+

Added: cs/cigma/trunk/pysrc/Py_FileReader.cpp
===================================================================
--- cs/cigma/trunk/pysrc/Py_FileReader.cpp	                        (rev 0)
+++ cs/cigma/trunk/pysrc/Py_FileReader.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,89 @@
+#include "io_file_reader.h"
+#include "io_null_reader.h"
+#include "io_text_reader.h"
+
+#ifdef HAVE_HDF5
+#include "io_hdf5_reader.h"
+#endif
+
+#ifdef HAVE_VTK
+#include "io_vtk_reader.h"
+#include "io_ucd_reader.h"
+#endif
+
+#include <boost/python.hpp>
+
+using namespace boost::python;
+
+struct pyFileReader : FileReader, wrapper<FileReader>
+{
+};
+
+class pyNullReader : NullReader
+{
+};
+
+class pyTextReader : TextReader
+{
+};
+
+/* Wrap the HDF5 reader */
+#ifdef HAVE_HDF5
+class pyHDF5Reader : HDF5_Reader
+{
+};
+#endif
+
+/* Wrap the VTK reader */
+#ifdef HAVE_VTK
+class pyVTKReader : VtkReader
+{
+};
+class pyUCDReader : UCD_Reader
+{
+};
+#endif
+
+
+void export_FileReader()
+{
+    using namespace boost::python;
+
+
+    class_<pyNullReader>("NullReader")
+        .def(init<std::string>())
+        .def("open", &pyNullReader::open)
+        .def("close", &pyVtkReader::close)
+        ;
+
+    class_<pyTextReader>("TextReader")
+        .def(init<std::string>())
+        .def("open", &pyTextReader::open)
+        .def("close", &pyTextReader::close)
+        ;
+
+/* Class definitions for HDF5 */
+#ifdef HAVE_HDF5
+    class_<pyHDF5Reader>("HDF5Reader")
+        .def(init<std::string>())
+        .def("open", &pyHDF5Reader::open)
+        .def("close", &pyHDF5Reader::close)
+        ;
+#endif
+
+/* Class definitions for VTK readers */
+#ifdef HAVE_VTK
+    class_<pyVTKReader>("VTKReader")
+        .def(init<std::string>())
+        .def("open", &pyVTKReader::open)
+        .def("close", &pyVTKReader::close)
+        ;
+    class_<pyUCDReader>("UCDReader")
+        .def(init<std::string())
+        .def("open", &pyUCDReader::open)
+        .def("close", &pyUCDReader::close)
+        ;
+#endif
+
+
+}

Added: cs/cigma/trunk/pysrc/Py_FileWriter.cpp
===================================================================
--- cs/cigma/trunk/pysrc/Py_FileWriter.cpp	                        (rev 0)
+++ cs/cigma/trunk/pysrc/Py_FileWriter.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,71 @@
+#include "io_file_writer.h"
+#include "io_null_writer.h"
+#include "io_text_writer.h"
+
+#ifdef HAVE_HDF5
+#include "io_hdf5_writer.h"
+#endif
+
+#ifdef HAVE_VTK
+#include "io_vtk_writer.h"
+#endif
+
+#include <boost/python.hpp>
+
+class pyNullWriter : public NullWriter
+{
+};
+
+class pyTextWriter : public TextWriter
+{
+};
+
+/* Wrapper for HDF5 */
+#ifdef HAVE_HDF5
+class pyHDF5Writer : public HDF5_Writer
+{
+};
+#endif
+
+/* Wrapper for VTK */
+#ifdef HAVE_VTK
+class pyVTKWriter : public VtkWriter
+{
+};
+#endif
+
+
+void export_FileWriter
+{
+    using namespace boost::python;
+
+    class_<pyNullWriter, bases<NullWriter> >("NullWriter")
+        .def(init<std::string>())
+        .def("open", &pyNullWriter::open)
+        .def("close", &pyNullWriter::close)
+        ;
+
+    class_<pyTextWriter, bases<TextWriter> >("TextWriter")
+        .def(init<std::string>())
+        .def("open", &pyTextWriter::open)
+        .def("close", &pyTextWriter::close)
+        ;
+
+#ifdef HAVE_HDF5
+    class_<pyHDF5Writer, bases<HDF5_Writer> >("HDF5Writer")
+        .def(init<std::string>())
+        .def("open", &pyHDF5Writer::open)
+        .def("close", &pyHDF5Writer::close)
+        ;
+#endif
+
+#ifdef HAVE_VTK
+    class_<pyVTKWriter, bases<VtkWriter> >("VTKWriter")
+        .def(init<std::string>())
+        .def("open", &pyVTKWriter::open)
+        .def("close", &pyVTKWriter::close)
+        ;
+#endif
+
+}
+

Added: cs/cigma/trunk/pysrc/Py_Locator.cpp
===================================================================
--- cs/cigma/trunk/pysrc/Py_Locator.cpp	                        (rev 0)
+++ cs/cigma/trunk/pysrc/Py_Locator.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,60 @@
+#include "Locator.h"
+#include "AnnLocator.h"
+#include <boost/python.hpp>
+
+using namespace cigma;
+using namespace boost::python;
+
+struct pyLocator : Locator, wrapper<Locator>
+{
+    int n_dim() const
+    {
+        return this->get_override("n_dim")();
+    }
+
+    int n_idx() const
+    {
+        return this->get_override("n_idx")();
+    }
+
+    int idx(int i) const
+    {
+        return this->get_override("idx")(i);
+    }
+
+    void searchBoundingBox(double *bbox)
+    {
+        this->get_override("searchBoundingBox")(bbox);
+    }
+
+    bool check_idx(int i) const
+    {
+        if (override c = this->get_override("check_idx"))
+        {
+            return c(i);
+        }
+        return Locator::check_idx(i);
+    }
+};
+
+void export_Locator()
+{
+    using namespace cigma;
+    using namespace boost::python;
+
+    class_<pyLocator, boost::noncopyable>("Locator")
+        .def("n_dim", pure_virtual(&Locator::n_dim))
+        .def("n_idx", pure_virtual(&Locator::n_idx))
+        .def("idx", pure_virtual(&Locator::idx))
+        //.def("search_bbox", pure_virtual(&Locator::searchBoundingBox))
+        .def("check_idx", &pyLocator::check_idx)
+        ;
+
+    class_<AnnLocator>("AnnLocator")
+        .def("n_dim", &AnnLocator::n_dim)
+        .def("n_idx", &AnnLocator::n_idx)
+        .def("idx", &AnnLocator::idx)
+        ;
+
+}
+

Added: cs/cigma/trunk/pysrc/Py_MeshPart.cpp
===================================================================
--- cs/cigma/trunk/pysrc/Py_MeshPart.cpp	                        (rev 0)
+++ cs/cigma/trunk/pysrc/Py_MeshPart.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,11 @@
+#include "MeshPart.h"
+#include <boost/python.hpp>
+
+void export_MeshPart()
+{
+    using namespace cigma;
+    using namespace boost::python;
+
+    class_<MeshPart>("MeshPart")
+        ;
+}

Modified: cs/cigma/trunk/pysrc/Py_Misc.cpp
===================================================================
--- cs/cigma/trunk/pysrc/Py_Misc.cpp	2008-10-15 09:07:28 UTC (rev 13040)
+++ cs/cigma/trunk/pysrc/Py_Misc.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -1,6 +1,6 @@
 #include "numpy_util.h"
+#include "/usr/include/python2.5/numpy/ndarrayobject.h"
 #include <boost/python.hpp>
-#include "/usr/include/python2.5/numpy/ndarrayobject.h"
 
 using namespace boost::python;
 

Added: cs/cigma/trunk/pysrc/Py_Points.cpp
===================================================================
--- cs/cigma/trunk/pysrc/Py_Points.cpp	                        (rev 0)
+++ cs/cigma/trunk/pysrc/Py_Points.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,32 @@
+#include "Points.h"
+#include <boost/python.hpp>
+
+void export_Points()
+{
+    using namespace cigma;
+    using namespace boost::python;
+
+    typedef Points<float,2> Points2f;
+    class_<Points2f,boost::noncopyable>("Points2f", no_init)
+        .def("n_points", &Points2f::n_points)
+        .def("n_dim", &Points2f::n_dim)
+        ;
+
+    typedef Points<float,3> Points3f;
+    class_<Points3f,boost::noncopyable>("Points3f", no_init)
+        .def("n_points", &Points3f::n_points)
+        .def("n_dim", &Points3f::n_dim)
+        ;
+
+    typedef Points<double,2> Points2d;
+    class_<Points2d,boost::noncopyable>("Points2d", no_init)
+        .def("n_points", &Points2d::n_points)
+        .def("n_dim", &Points2d::n_dim)
+        ;
+
+    typedef Points<double,3> Points3d;
+    class_<Points3d,boost::noncopyable>("Points3d", no_init)
+        .def("n_points", &Points3d::n_points)
+        .def("n_dim", &Points3d::n_dim)
+        ;
+}

Modified: cs/cigma/trunk/pysrc/_cigma_module.cpp
===================================================================
--- cs/cigma/trunk/pysrc/_cigma_module.cpp	2008-10-15 09:07:28 UTC (rev 13040)
+++ cs/cigma/trunk/pysrc/_cigma_module.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -6,6 +6,10 @@
 extern void export_Exception();
 extern void export_Hello();
 extern void export_DataPath();
+extern void export_Points();
+extern void export_Locator();
+extern void export_MeshPart();
+extern void export_ElementBlock();
 extern void export_NodeCoordinates();
 extern void export_Misc();
 
@@ -20,6 +24,10 @@
 
     export_Hello();
     export_DataPath();
+    export_Points();
+    export_Locator();
+    export_MeshPart();
+    export_ElementBlock();
     export_NodeCoordinates();
     export_Misc();
 }

Added: cs/cigma/trunk/pysrc/cigma/Locator.py
===================================================================
--- cs/cigma/trunk/pysrc/cigma/Locator.py	                        (rev 0)
+++ cs/cigma/trunk/pysrc/cigma/Locator.py	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+import _cigma
+class Locator(_cigma.Locator):
+    def __init__(self):
+        _cigma.Locator.__init__(self)
+

Added: cs/cigma/trunk/pysrc/cigma/__init__.py
===================================================================
--- cs/cigma/trunk/pysrc/cigma/__init__.py	                        (rev 0)
+++ cs/cigma/trunk/pysrc/cigma/__init__.py	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,2 @@
+__version__ = '1.0.0'
+

Added: cs/cigma/trunk/pysrc/quux.cpp
===================================================================
--- cs/cigma/trunk/pysrc/quux.cpp	                        (rev 0)
+++ cs/cigma/trunk/pysrc/quux.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,62 @@
+/*
+
+URLs
+
+    num_util: helper functions for boost::python::numeric arrays
+    http://www.eos.ubc.ca/research/clouds/software/pythonlibs/num_util/
+
+    http://www.nabble.com/boost.python-and-numpy.int32-on-64-bit-system-td16741503.html
+    
+    http://www.google.com/search?q=num_util+2008&btnG=Search&hl=en&safe=off&sa=2
+
+    Re: how to return arbitrary (python-)objects from boost?    <-- good thread!
+    http://article.gmane.org/gmane.comp.python.c%2B%2B/12505
+    http://www.nabble.com/how-to-return-arbitrary-(python-)objects-from-boost--td16853297.html
+
+
+    http://osdir.com/ml/python.c++/2003-03/msg00035.html
+    http://www.gamedev.net/community/forums/topic.asp?topic_id=491860
+    
+    -------------------------------------------------------------
+
+    http://www.google.com/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=en&q=boost+python&btnG=Google+Search
+    http://www.boost.org/doc/libs/1_36_0/libs/python/doc/index.html
+    http://www.boost.org/doc/libs/1_36_0/libs/python/doc/v2/faq.html
+    http://www.boost.org/doc/libs/1_36_0/libs/python/doc/tutorial/doc/html/index.html
+    http://www.boost.org/doc/libs/1_36_0/libs/python/doc/v2/numeric.html#array-spec
+    http://www.boost.org/doc/libs/1_36_0/libs/python/doc/v2/pickle.html
+    http://www.boost.org/doc/libs/1_36_0/libs/python/test/pickle1.cpp
+    http://www.boost.org/doc/libs/1_36_0/libs/python/doc/v2/indexing.html
+    http://wiki.python.org/moin/boost.python/FAQ
+    http://wiki.python.org/moin/boost.python/BuildingExtensions
+    http://www.boost.org/users/download/
+
+*/
+
+
+#include <boost/python/numeric.hpp>
+#include <boost/python/tuple.hpp>
+
+using namespace boost::python;
+
+// sets the first element in a 2d numeric array
+void set_first_element(numeric::array &y, double value)
+{
+    y[make_tuple(0,0)] = value;
+}
+
+// ---------------------------------------------------
+
+BOOST_PYTHON_MODULE(quux)
+{
+    import_array();
+    numeric::array::set_module_and_type("numpy", "ndarray");
+
+    class_<QuuxWrap>("Quux", init<QuuxConfiguration>())
+        .def("foo", &QuuxWrap::foo)
+        .def("bar", &QuuxWrap::bar)
+        .
+        .
+        .
+        ;
+}

Modified: cs/cigma/trunk/pysrc/setup.py
===================================================================
--- cs/cigma/trunk/pysrc/setup.py	2008-10-15 09:07:28 UTC (rev 13040)
+++ cs/cigma/trunk/pysrc/setup.py	2008-10-15 09:07:31 UTC (rev 13041)
@@ -15,6 +15,10 @@
     'Py_Exception.cpp',
     'Py_Hello.cpp',
     'Py_DataPath.cpp',
+    'Py_Points.cpp',
+    'Py_Locator.cpp',
+    'Py_MeshPart.cpp',
+    'Py_ElementBlock.cpp',
     'Py_NodeCoordinates.cpp',
     'Py_Misc.cpp',
 ]

Added: cs/cigma/trunk/pysrc/tests/runner.py
===================================================================
--- cs/cigma/trunk/pysrc/tests/runner.py	                        (rev 0)
+++ cs/cigma/trunk/pysrc/tests/runner.py	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+
+if __name__ == '__main__':
+
+
+    import os
+    from os.path import abspath, dirname, splitext
+    rootdir = dirname(abspath(__file__))
+    testfiles = [fname for fname in os.listdir(rootdir)
+                    if fname.startswith('test_') and fname.endswith('.py')]
+    modules = [__import__(splitext(t)[0]) for t in testfiles]
+
+    import unittest
+    suite = unittest.TestSuite()
+    for mod in modules:
+        suite.addTest(mod.create_suite())
+    runner = unittest.TextTestRunner(verbosity=2)
+    runner.run(suite)
+


Property changes on: cs/cigma/trunk/pysrc/tests/runner.py
___________________________________________________________________
Name: svn:executable
   + *

Added: cs/cigma/trunk/pysrc/tests/test_locator.py
===================================================================
--- cs/cigma/trunk/pysrc/tests/test_locator.py	                        (rev 0)
+++ cs/cigma/trunk/pysrc/tests/test_locator.py	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+from _cigma import Locator
+class MyLocator(Locator):
+    def __init__(self, n):
+        Locator.__init__(self)
+        self.pts = range(n)
+    def n_dim(self):
+        return 3
+    def n_idx(self):
+        return len(self.pts)
+    def idx(self, i):
+        return self.pts[i]
+
+import unittest
+class LocatorTest(unittest.TestCase):
+    def __init__(self, *args):
+        unittest.TestCase.__init__(self, *args)
+    def setUp(self):
+        self.loc = MyLocator(8)
+    def tearDown(self):
+        del self.loc
+    def test_n_dim(self):
+        self.assertEqual(self.loc.n_dim(), 3)
+    def test_n_idx(self):
+        self.assertEqual(self.loc.n_idx(), 8)
+    def test_check_idx(self):
+        loc = self.loc
+        n = loc.n_idx()
+        self.assert_(loc.check_idx(0))
+        self.assert_(loc.check_idx(1))
+        self.assert_(loc.check_idx(n-1))
+        self.assert_(not loc.check_idx(n))
+
+def create_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(unittest.makeSuite(LocatorTest))
+    return suite
+
+

Added: cs/cigma/trunk/src/AnnLocator.cpp
===================================================================
--- cs/cigma/trunk/src/AnnLocator.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/AnnLocator.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,77 @@
+#include "AnnLocator.h"
+#include <cassert>
+#include <iostream>
+
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+AnnLocator::AnnLocator()
+{
+    std::cout << "Calling AnnLocator()" << std::endl;
+
+    nnk = 8;
+    epsilon = 0;
+
+    npts = 0;
+    ndim = 0;
+    ndim2 = 0;
+
+/*
+    dataPoints = 0;
+    kdtree = 0;
+
+    nnIdx = 0;
+    nnDists = 0;
+*/
+    locatorType = NONE_TYPE;
+}
+
+AnnLocator::~AnnLocator()
+{
+    std::cout << "Calling ~AnnLocator()" << std::endl;
+    /*
+    if (kdtree != 0)
+    {
+        delete kdtree;
+        kdtree = 0;
+    }
+
+    if (dataPoints != 0)
+    {
+        annDeallocPts(dataPoints);
+        dataPoints = 0;
+    }
+
+    if (nnIdx != 0)
+    {
+        delete [] nnIdx;
+        nnIdx = 0;
+    }
+
+    if (nnDists != 0)
+    {
+        delete [] nnDists;
+        nnDists = 0;
+    }
+    */
+}
+
+// ----------------------------------------------------------------------------
+
+//void AnnLocator::initialize(boost::shared_ptr<MeshPart>& meshPart) {}
+
+//void AnnLocator::search_bbox(double *point)
+void AnnLocator::searchBoundingBox(double *bbox)
+{
+    /*
+    for (int i = 0; i < ndim; i++)
+    {
+        queryPoint[ndim*0 + i] = point[i];
+        queryPoint[ndim*1 + i] = point[i];
+    }
+    kdtree->annkSearch(queryPoint, nnk, nnIdx, nnDists, epsilon);
+    */
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/AnnLocator.h
===================================================================
--- cs/cigma/trunk/src/AnnLocator.h	                        (rev 0)
+++ cs/cigma/trunk/src/AnnLocator.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,82 @@
+#ifndef __CIGMA_ANN_LOCATOR_H__
+#define __CIGMA_ANN_LOCATOR_H__
+
+#include "Locator.h"
+//#include "MeshPart.h"
+//#include "Points.h"
+//#include "ANN/ANN.h"
+
+namespace cigma
+{
+    class AnnLocator;
+}
+
+class cigma::AnnLocator : public cigma::Locator
+{
+public:
+    
+    AnnLocator();
+    ~AnnLocator();
+
+    //void initialize(MeshPart *meshPart);
+    //void initialize(Points *points);
+    
+    //void search_bbox(double *point);
+    //void search_point(double *point);
+
+    //void initialize(boost::shared_ptr<MeshPart>& meshPart);
+    void searchBoundingBox(double *bbox);
+
+    int n_dim() const;
+    int n_idx() const;
+    int idx(int i) const;
+
+public:
+    int nnk;            /// number of nearest neighbors
+    int npts;           /// number of "points" (bounding boxes)
+    int ndim;           /// dimension of single point
+    int ndim2;          /// dimension of bounding box (ndim * 2)
+    double epsilon;     /// tolerance (in bbox space)
+
+    typedef enum {
+        NONE_TYPE,
+        POINT_TYPE,
+        CELL_TYPE
+    } AnnLocatorType;
+    
+    AnnLocatorType locatorType;
+
+/*
+private:
+    ANNpointArray dataPoints;
+    ANNkd_tree *kdtree;
+
+    ANNpoint queryPoint;    /// query point for search routine
+    ANNidxArray nnIdx;      /// near neighbor indices
+    ANNdistArray nnDists;   /// near neighbor distances
+*/
+};
+
+// ----------------------------------------------------------------------------
+
+inline int cigma::AnnLocator::n_dim() const
+{
+    return ndim;
+}
+
+inline int cigma::AnnLocator::n_idx() const
+{
+    return nnk;
+}
+
+inline int cigma::AnnLocator::idx(int i) const
+{
+    //assert(0 <= i);
+    //assert(i < nnk);
+    //return nnIdx[i];
+    return 0; //XXX: FIXME!!
+}
+
+// ----------------------------------------------------------------------------
+
+#endif

Added: cs/cigma/trunk/src/Cell.cpp
===================================================================
--- cs/cigma/trunk/src/Cell.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/Cell.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1 @@
+#include "Cell.h"

Added: cs/cigma/trunk/src/Cell.h
===================================================================
--- cs/cigma/trunk/src/Cell.h	                        (rev 0)
+++ cs/cigma/trunk/src/Cell.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,16 @@
+#ifndef __CIGMA_CELL_H__
+#define __CIGMA_CELL_H__
+
+namespace cigma
+{
+    class Cell;
+}
+
+class cigma::Cell
+{
+public:
+    Cell();
+    ~Cell();
+};
+
+#endif

Added: cs/cigma/trunk/src/ElementBlock.cpp
===================================================================
--- cs/cigma/trunk/src/ElementBlock.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/ElementBlock.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,22 @@
+#include "ElementBlock.h"
+#include <iostream>
+
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+ElementBlock::ElementBlock()
+{
+    std::cout << "Calling ElementBlock()" << std::endl;
+
+    // XXX: get rid of these -- use virtual functions
+    nel = 0;
+    ndofs = 0;
+}
+
+ElementBlock::~ElementBlock()
+{
+    std::cout << "Calling ~ElementBlock()" << std::endl;
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/ElementBlock.h
===================================================================
--- cs/cigma/trunk/src/ElementBlock.h	                        (rev 0)
+++ cs/cigma/trunk/src/ElementBlock.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,40 @@
+#ifndef __CIGMA_ELEMENT_BLOCK_H__
+#define __CIGMA_ELEMENT_BLOCK_H__
+
+#include <boost/noncopyable.hpp>
+
+namespace cigma
+{
+    class ElementBlock;
+}
+
+
+class cigma::ElementBlock : private boost::noncopyable
+{
+public:
+
+    ElementBlock();
+    virtual ~ElementBlock();
+
+    int n_cells() const;
+    int n_dofs() const;
+
+    virtual int getCellNodeId(int e, int i) = 0;
+
+    /* XXX: add locator instance here? */
+
+public:
+    int nel;    /* XXX: get rid of these...use virtual functions instead */
+    int ndofs;
+
+    /* XXX: keep a reference to the parent cell */
+};
+
+// ----------------------------------------------------------------------------
+
+inline int cigma::ElementBlock::n_cells() const { return nel; }
+inline int cigma::ElementBlock::n_dofs()  const { return ndofs; }
+
+// ----------------------------------------------------------------------------
+
+#endif

Added: cs/cigma/trunk/src/Function.cpp
===================================================================
--- cs/cigma/trunk/src/Function.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/Function.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,32 @@
+#include "Function.h"
+//#include "fn_zero.h"
+
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+Function::~Function() {}
+
+// ----------------------------------------------------------------------------
+
+
+boost::shared_ptr<Function> Function::New(const char *source)
+{
+    // See http://www.boost.org/doc/libs/1_35_0/libs/smart_ptr/sp_techniques.html#encapsulation
+    //
+    // XXX: now, depending on 'source', we should allocate the correct subclass
+    // of Function (Field, UserFunction, etc..). 
+    //
+    boost::shared_ptr<Function> pf;
+
+    /* // example
+    if (source indicates we should use ZeroFunction)
+    {
+        boost::shared_ptr<ZeroFunction> temp(new ZeroFunction(...))
+        pf = temp;
+    }*/
+
+    return pf;
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/Function.h
===================================================================
--- cs/cigma/trunk/src/Function.h	                        (rev 0)
+++ cs/cigma/trunk/src/Function.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,24 @@
+#ifndef __CIGMA_FUNCTION_H__
+#define __CIGMA_FUNCTION_H__
+
+#include <boost/smart_ptr.hpp>
+
+namespace cigma
+{
+    class Function;
+}
+
+class cigma::Function
+{
+public:
+
+    virtual ~Function();
+
+    virtual int n_dim() = 0;
+    virtual int n_rank() = 0;
+    virtual bool eval(double *point, double *value) = 0;
+
+    static boost::shared_ptr<Function> New(const char *source);
+};
+
+#endif

Added: cs/cigma/trunk/src/FunctionRegistry.h
===================================================================
--- cs/cigma/trunk/src/FunctionRegistry.h	                        (rev 0)
+++ cs/cigma/trunk/src/FunctionRegistry.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,29 @@
+#ifndef __FUNCTION_REGISTRY_H__
+#define __FUNCTION_REGISTRY_H__
+
+#include <map>
+#include <string>
+#include "Function.h"
+
+namespace cigma
+{
+    class FunctionRegistry
+}
+
+class cigma::FunctionRegistry
+{
+public:
+    FunctionRegistry();
+    ~FunctionRegistry();
+
+    void initialize();
+    
+    void addField(std::string name, Field *field);
+    Field *getField(std::string name);
+
+private:
+    typedef std::map<std::string,Function*> FunctionMap;
+    FunctionMap functions;
+};
+
+#endif

Added: cs/cigma/trunk/src/Locator.cpp
===================================================================
--- cs/cigma/trunk/src/Locator.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/Locator.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,22 @@
+#include "Locator.h"
+#include <iostream>
+
+using namespace cigma;
+
+/*
+Locator::Locator()
+{
+    std::cout << "Calling Locator()" << std::endl;
+}
+*/
+
+Locator::~Locator()
+{
+    //std::cout << "Calling ~Locator()" << std::endl;    
+}
+
+bool Locator::check_idx(int i) const
+{
+    return (0 <= i) && (i < n_idx());
+}
+

Added: cs/cigma/trunk/src/Locator.h
===================================================================
--- cs/cigma/trunk/src/Locator.h	                        (rev 0)
+++ cs/cigma/trunk/src/Locator.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,25 @@
+#ifndef __CIGMA_LOCATOR_H__
+#define __CIGMA_LOCATOR_H__
+
+namespace cigma
+{
+    class Locator;
+}
+
+class cigma::Locator
+{
+public:
+    //Locator();
+    virtual ~Locator();
+
+    virtual void searchBoundingBox(double *bbox) = 0;
+
+    virtual int n_dim() const = 0;
+    virtual int n_idx() const = 0;
+    virtual int idx(int i) const = 0;
+
+    virtual bool check_idx(int i) const;
+};
+
+
+#endif

Added: cs/cigma/trunk/src/MeshPart.cpp
===================================================================
--- cs/cigma/trunk/src/MeshPart.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/MeshPart.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,7 @@
+#include "MeshPart.h"
+
+using namespace cigma;
+
+MeshPart::MeshPart() {}
+MeshPart::~MeshPart() {}
+

Added: cs/cigma/trunk/src/MeshPart.h
===================================================================
--- cs/cigma/trunk/src/MeshPart.h	                        (rev 0)
+++ cs/cigma/trunk/src/MeshPart.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,21 @@
+#ifndef __CIGMA_MESH_PART_H__
+#define __CIGMA_MESH_PART_H__
+
+
+//#include "Cell.h"
+#include "Locator.h"
+
+namespace cigma
+{
+    class MeshPart;
+}
+
+
+class cigma::MeshPart
+{
+public:
+    MeshPart();
+    ~MeshPart();
+};
+
+#endif

Added: cs/cigma/trunk/src/NodeCoordinates.cpp
===================================================================
--- cs/cigma/trunk/src/NodeCoordinates.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/NodeCoordinates.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,43 @@
+#include "NodeCoordinates.h"
+#include <iostream>
+
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+NodeCoordinates::NodeCoordinates()
+{
+    //std::cout << "Calling NodeCoordinates()" << std::endl;
+
+    // XXX: don't do this..use virtual functions
+    nno = 0;
+    nsd = 0;
+    coords = 0;
+}
+
+NodeCoordinates::~NodeCoordinates()
+{
+    //std::cout << "Calling ~NodeCoordinates()" << std::endl;
+
+    if (coords != 0)
+    {
+        delete [] coords;
+        coords = 0;
+    }
+}
+
+// ----------------------------------------------------------------------------
+
+void NodeCoordinates::setCoordinates(double *coords, int nno, int nsd)
+{
+    this->nno = nno;
+    this->nsd = nsd;
+    if (this->coords)
+    {
+        delete [] this->coords;
+    }
+    this->coords = coords;
+}
+
+// ----------------------------------------------------------------------------
+

Added: cs/cigma/trunk/src/NodeCoordinates.h
===================================================================
--- cs/cigma/trunk/src/NodeCoordinates.h	                        (rev 0)
+++ cs/cigma/trunk/src/NodeCoordinates.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,46 @@
+#ifndef __CIGMA_NODE_COORDINATES_H__
+#define __CIGMA_NODE_COORDINATES_H__
+
+#include "Common.h"
+#include <boost/noncopyable.hpp>
+#include <boost/smart_ptr.hpp>
+
+namespace cigma
+{
+    class NodeCoordinates;
+}
+
+class cigma::NodeCoordinates : private boost::noncopyable
+{
+public:
+    NodeCoordinates();
+    ~NodeCoordinates();
+
+    void setCoordinates(double *coords, int nno, int nsd);
+
+    int n_points() const;
+    int n_dim() const;
+
+    double getPoint(int i, int j) const;
+    double * getPointOffset(int i);
+
+    /* XXX: add locator */
+
+public:
+    int nno;    /* XXX: Get rid of these...use pure virtual functions (cf. cigma::Cell) */
+    int nsd;
+    double *coords;
+};
+
+// ----------------------------------------------------------------------------
+
+inline int cigma::NodeCoordinates::n_points() const { return nno; }
+inline int cigma::NodeCoordinates::n_dim() const { return nsd; }
+
+inline double cigma::NodeCoordinates::getPoint(int i, int j) const { return coords[i*nsd + j]; }
+inline double * cigma::NodeCoordinates::getPointOffset(int i) { return &coords[i*nsd]; }
+
+
+// ----------------------------------------------------------------------------
+
+#endif

Added: cs/cigma/trunk/src/Point.cpp
===================================================================
--- cs/cigma/trunk/src/Point.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/Point.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,82 @@
+#include "Point.h"
+
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+template <int dim>
+Point<dim>::Point()
+{
+    zero_out();
+}
+
+template <int dim>
+Point<dim>::Point(double *x, int len)
+{
+    zero_out();
+    set_coord(x, len);
+}
+
+template <int dim>
+Point<dim>::Point(float *x, int len)
+{
+    zero_out();
+    set_coord(x, len);
+}
+
+template <int dim>
+Point<dim>::Point(const Point<dim> &pt)
+{
+    for (int i = 0; i < dim; i++)
+    {
+        coord[i] = pt.coord[i];
+    }
+}
+
+template <int dim>
+Point<dim>::~Point()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+
+template <int dim>
+void Point<dim>::set(int i, double val)
+{
+    coord[i] = val;
+}
+
+template <int dim>
+void Point<dim>::set_coord(double *x, int len)
+{
+    for (int i = 0; i < len; i++)
+    {
+        coord[i] = x[i];
+    }
+}
+
+template <int dim>
+void Point<dim>::set_coord(float *x, int len)
+{
+    for (int i = 0; i < len; i++)
+    {
+        coord[i] = x[i];
+    }
+}
+
+template <int dim>
+void Point<dim>::zero_out()
+{
+    for (int i = 0; i < dim; i++)
+    {
+        coord[i] = 0;
+    }
+}
+
+// ----------------------------------------------------------------------------
+
+template class cigma::Point<3>;
+template class cigma::Point<2>;
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/Point.h
===================================================================
--- cs/cigma/trunk/src/Point.h	                        (rev 0)
+++ cs/cigma/trunk/src/Point.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,56 @@
+#ifndef __CIGMA_POINT_H__
+#define __CIGMA_POINT_H__
+
+namespace cigma
+{
+    template <int dim> class Point;
+}
+
+template <int dim>
+class cigma::Point
+{
+public:
+
+    Point();
+    Point(const Point &pt);
+    Point(double *x, int len);
+    Point(float *x, int len);
+    ~Point();
+
+    int n_dim() const;
+    
+    double get(int i) const;
+
+    void set(int i, double val);
+    void set_coord(double *x, int len);
+    void set_coord(float *x, int len);
+    void zero_out();
+
+    double operator[](int i) const;
+
+public:
+    double coord[dim];
+};
+
+
+template <int dim>
+inline int cigma::Point<dim>::n_dim() const
+{
+    return dim;
+}
+
+template <int dim>
+inline double cigma::Point<dim>::get(int i) const
+{
+    return coord[i];
+}
+
+template <int dim>
+inline double cigma::Point<dim>::operator[](int i) const
+{
+    return coord[i];
+}
+
+
+
+#endif

Added: cs/cigma/trunk/src/Points.cpp
===================================================================
--- cs/cigma/trunk/src/Points.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/Points.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,38 @@
+#include "Points.h"
+
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+template <typename T, int dim>
+Points<T,dim>::Points()
+{
+    npts = 0;
+    data = 0;
+}
+
+template <typename T, int dim>
+Points<T,dim>::Points(int npts)
+{
+    this->npts = npts;
+    this->data = new T[npts * dim];
+}
+
+template <typename T, int dim>
+Points<T,dim>::~Points()
+{
+    if (data)
+    {
+        delete [] data;
+        data = 0;
+    }
+}
+
+// ----------------------------------------------------------------------------
+
+template class cigma::Points<double,3>;
+template class cigma::Points<double,2>;
+template class cigma::Points<float,3>;
+template class cigma::Points<float,2>;
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/Points.h
===================================================================
--- cs/cigma/trunk/src/Points.h	                        (rev 0)
+++ cs/cigma/trunk/src/Points.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,67 @@
+#ifndef __CIGMA_POINTS_H__
+#define __CIGMA_POINTS_H__
+
+#include <boost/noncopyable.hpp>
+#include "Point.h"
+
+namespace cigma
+{
+    template <typename T, int dim> class Points;
+}
+
+
+template <typename T, int dim>
+class cigma::Points
+{
+public:
+    Points();
+    Points(int npts);
+    ~Points();
+
+    int n_points() const;
+    int n_dim() const;
+    int index(int i, int j) const;
+
+    Point<dim> get(int i) const;
+    T get(int i, int j) const;
+
+    void set(int i, int j, double val);
+
+public:
+    int npts;
+    T *data;
+};
+
+
+template <typename T, int dim>
+inline int cigma::Points<T,dim>::n_points() const
+{
+    return npts;
+}
+
+template <typename T, int dim>
+inline int cigma::Points<T,dim>::n_dim() const
+{
+    return dim;
+}
+
+template <typename T, int dim>
+inline int cigma::Points<T,dim>::index(int i, int j) const
+{
+    return dim*i + j;
+}
+
+template <typename T, int dim>
+inline T cigma::Points<T,dim>::get(int i, int j) const
+{
+    return data[dim*i + j];
+}
+
+template <typename T, int dim>
+inline void cigma::Points<T,dim>::set(int i, int j, double val)
+{
+    data[dim*i+j] = val;
+}
+
+
+#endif

Added: cs/cigma/trunk/src/README
===================================================================
--- cs/cigma/trunk/src/README	                        (rev 0)
+++ cs/cigma/trunk/src/README	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,126 @@
+Source Directory
+================
+  This directory contains the C++ source code for the Cigma suite of
+benchmarking tools. A quick listing will reveal a number of files in no particular
+order. Here we give an overview of the role of each file or directory.
+
+
+Main cli application
+====================
+    cigma.cpp
+    cli_application.{h,cpp}
+    cli_command.{h,cpp}
+    cli_base_cmd.{h,cpp}
+    cli_list_cmd.{h,cpp}
+    cli_compare_cmd.{h,cpp}
+    cli_extract_cmd.{h,cpp}
+    cli_eval_cmd.{h,cpp}
+    cli_info_cmd.{h,cpp}
+    cli_skel_cmd.{h,cpp}
+
+Core operations
+===============
+    core_base_op.{h,cpp}
+    core_list_op.{h,cpp}
+    core_compare_op.{h,cpp}
+    core_extract_op.{h,cpp}
+    core_eval_op.{h,cpp}
+
+FileReader classes
+==================
+    io_file_reader.{h,cpp}
+    io_null_reader.{h,cpp}
+    io_hdf5_reader.{h,cpp}
+    io_vtk_reader.{h,cpp}
+    io_ucd_reader.{h,cpp}
+    io_exo_reader.{h,cpp}
+    io_text_reader.{h,cpp}
+
+FileWriter classes
+==================
+    io_file_writer.{h,cpp}
+    io_null_writer.{h,cpp}
+    io_hdf5_writer.{h,cpp}
+    io_vtk_writer.{h,cpp}
+    io_text_writer.{h,cpp}
+
+Core functions
+==============
+    Function.{h,cpp}
+    FunctionRegistry.{h,cpp}    -- move to Function.h and use static initialization
+    fn_zero.{h,cpp}             -- name is zero
+    fn_unit_scalar.{h,cpp}      -- name is one
+    fn_unit_vector_2d.{h,cpp}   -- name is dim2.one.{x,y}
+    fn_unit_vector_3d.{h,cpp}   -- name is dim3.one.{x,y,z}
+    fn_test_cube.{h,cpp}
+    fn_test_cylinder.{h,cpp}
+    fn_test_square.{h,cpp}
+    fn_test_circle.{h,cpp}
+    fn_okada_ss.{h,cpp}
+    fn_okada_rs.{h,cpp}
+
+Finite element classes
+======================
+    Cell.{h,cpp}
+    QPoints.{h,cpp}
+    fe_hex8.{h,cpp}
+    fe_quad4.{h,cpp}
+    fe_tet4.{h,cpp}
+    fe_tri3.{h,cpp}
+
+Geometrical classes
+===================
+    Point.{h,cpp}
+    Points.{h,cpp}
+    DofHandler.{h,cpp}
+    NodeCoordinates.{h,cpp}
+    ElementBlock.{h,cpp}
+    MeshPart.{h,cpp}
+    Locator.{h,cpp}
+    AnnLocator.{h,cpp}
+
+Core classes and functions
+==========================
+    Residuals.{h,cpp}
+    RelativeResiduals.{h,cpp}
+    Field.{h,cpp}           -- interpolator on finite element mesh
+    FE.{h,cpp}              -- shape function values
+    MeshPart.{h,cpp}
+    Quadrature.{h,cpp}
+    Numeric.{h,cpp}
+
+Core readers
+============
+    core_field_reader.{h,cpp}
+    core_mesh_part_reader.{h,cpp}
+    core_quadrature_reader.{h,cpp}
+    core_points_reader.{h,cpp}
+
+Miscellaneous headers
+=====================
+    Common.h
+    Definitions.h
+    Filesystem.h
+    Numeric.h
+
+Miscellaneous classes
+=====================
+    Exception.{h,cpp}
+    DataPath.{h,cpp}
+    ProgressTimer.{h,cpp}
+
+Logging functions
+=================
+    nullstream.hpp
+    tri_logger.hpp
+    tri_logger.cpp
+
+ANN classes for spatial searching
+=================================
+    contrib/ann/
+
+Original source for trivial c++ logger (CxxTL)
+==============================================
+    contrib/cxxtl/
+
+

Added: cs/cigma/trunk/src/Residuals.cpp
===================================================================
--- cs/cigma/trunk/src/Residuals.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/Residuals.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,19 @@
+#include "Residuals.h"
+
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+Residuals::Residuals()
+{
+}
+
+Residuals::~Residuals()
+{
+}
+
+// ----------------------------------------------------------------------------
+
+
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/Residuals.h
===================================================================
--- cs/cigma/trunk/src/Residuals.h	                        (rev 0)
+++ cs/cigma/trunk/src/Residuals.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,38 @@
+#ifndef __CIGMA_RESIDUALS_H__
+#define __CIGMA_RESIDUALS_H__
+
+#include <boost/noncopyable.hpp>
+#include <boost/smart_ptr.hpp>
+
+namespace cigma
+{
+    class Residuals;
+}
+
+class cigma::Residuals : private boost::noncopyable
+{
+public:
+    Residuals();
+    ~Residuals();
+
+    void set_mesh(MeshPart *meshPart);
+    void reset_accumulator();
+    void update(int e, double cell_residual, double cell_volume);
+
+    double L2();
+    double max();
+
+    //void write(const char *filename); // XXX
+
+public:
+    int nel;
+    double *epsilon;
+    double global_error;
+    double max_residual;
+    double total_volume;
+
+    boost::shared_ptr<MeshPart> meshPart;
+};
+
+
+#endif

Added: cs/cigma/trunk/src/cli_compare_cmd.cpp
===================================================================
--- cs/cigma/trunk/src/cli_compare_cmd.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/cli_compare_cmd.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,53 @@
+#include "CompareCmd.h"
+
+using namespace std;
+using namespace cigma;
+
+namespace po = boost::program_options;
+
+// ----------------------------------------------------------------------------
+
+CompareCmd::CompareCmd()
+{
+    name = "compare";
+    brief = "Calculate local and global residuals over two fields";
+    usage = "Usage: cigma compare <FIRST-FIELD> <SECOND-FIELD> [ -o <RESIDUAL-FILE> ]";
+}
+
+CompareCmd::~CompareCmd()
+{
+}
+
+// ----------------------------------------------------------------------------
+
+void CompareCmd::defineOptions()
+{
+    BaseCmd::defineOptions();
+    opts_section = "Compare Options: ";
+    opts.add_options()
+        ("help,h", "produce help message")
+        ("first,a", po::value<string>(&firstpath), "First field path")
+        ("second,b", po::value<string>(&secondpath), "Second field path")
+        ("output,o", po::value<string>(&outputfile), "Output file (residuals)")
+        ;
+    args.add("first", 1);
+    args.add("second", 1);
+}
+
+void CompareCmd::configure()
+{
+    BaseCmd::configure();
+}
+
+int CompareCmd::run()
+{
+    if (vm.count("help"))
+    {
+        printUsage();
+        return 1;
+    }
+
+    return 0;
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/cli_compare_cmd.h
===================================================================
--- cs/cigma/trunk/src/cli_compare_cmd.h	                        (rev 0)
+++ cs/cigma/trunk/src/cli_compare_cmd.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,31 @@
+#ifndef __CIGMA_COMPARE_CMD_H__
+#define __CIGMA_COMPARE_CMD_H__
+
+
+#include "cli_base_cmd.h"
+
+namespace cigma
+{
+    class CompareCmd;
+}
+
+class cigma::CompareCmd : public BaseCmd
+{
+public:
+    CompareCmd();
+    ~CompareCmd();
+
+public:
+    void defineOptions();
+    void configure();
+    int run();
+
+public:
+    std::string qmesh;
+    std::string qrule;
+    std::string firstpath;
+    std::string secondpath;
+    std::string outputfile;
+};
+
+#endif

Added: cs/cigma/trunk/src/cli_eval_cmd.cpp
===================================================================
--- cs/cigma/trunk/src/cli_eval_cmd.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/cli_eval_cmd.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,71 @@
+#include <iostream>
+#include "Common.h"
+#include "cli_eval_cmd.h"
+
+
+using namespace std;
+using namespace cigma;
+
+namespace po = boost::program_options;
+
+// ----------------------------------------------------------------------------
+
+EvalCmd::EvalCmd()
+{
+    name = "eval";
+    brief = "Evaluate function at specified quadrature points";
+    usage = "Usage: cigma eval <FUNC> <QPTS-IN> <QVALS-OUT>";
+    appendix = \
+        ""
+        ;
+}
+
+EvalCmd::~EvalCmd()
+{
+}
+
+// ----------------------------------------------------------------------------
+
+void EvalCmd::defineOptions()
+{
+    opts_section = "Eval Options: ";
+    opts.add_options()
+        ("help,h", "produce help message")
+        ("debug,D", "print debugging information")      /* XXX: make this a hidden option */
+        ("function,f", po::value<string>(&function), "Function <FUNC> to evaluate")
+        ("points,p", po::value<string>(&pointsfile), "Input quadrature points <QPTS-IN>")
+        ("output,o", po::value<string>(&valuesfile), "Output values of function <QVALS-OUT")
+        ;
+    args.add("function", 1);
+    args.add("points", 1);
+}
+
+void EvalCmd::configure()
+{
+    BaseCmd::configure();
+
+    if (!vm.count("debug"))
+    {
+        TRI_LOG_OFF();
+    }
+
+}
+
+int EvalCmd::run()
+{
+    if (vm.count("help"))
+    {
+        printUsage();
+        return 1;
+    }
+
+    TRI_LOG_STR("EvalCmd::run()");
+    TRI_LOG(function);
+    TRI_LOG(pointsfile);
+    TRI_LOG(valuesfile);
+
+
+    return 0;
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/cli_eval_cmd.h
===================================================================
--- cs/cigma/trunk/src/cli_eval_cmd.h	                        (rev 0)
+++ cs/cigma/trunk/src/cli_eval_cmd.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,28 @@
+#ifndef __CIGMA_EVAL_CMD_H__
+#define __CIGMA_EVAL_CMD_H__
+
+#include "cli_base_cmd.h"
+
+namespace cigma
+{
+    class EvalCmd;
+}
+
+class cigma::EvalCmd : public BaseCmd
+{
+public:
+    EvalCmd();
+    ~EvalCmd();
+
+public:
+    void defineOptions();
+    void configure();
+    int run();
+
+public:
+    std::string function;
+    std::string pointsfile;
+    std::string valuesfile;
+};
+
+#endif

Added: cs/cigma/trunk/src/cli_extract_cmd.cpp
===================================================================
--- cs/cigma/trunk/src/cli_extract_cmd.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/cli_extract_cmd.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,95 @@
+#include "cli_extract_cmd.h"
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+using namespace std;
+using namespace cigma;
+
+namespace po = boost::program_options;
+
+// ----------------------------------------------------------------------------
+
+ExtractCmd::ExtractCmd()
+{
+    name = "extract";
+    brief = "Extract quadrature points from a mesh";
+
+    usage = "Usage: cigma extract [options] <MESH-IN> <QPTS-OUT>\n";
+    appendix = "...";
+}
+
+ExtractCmd::~ExtractCmd()
+{
+}
+
+// ----------------------------------------------------------------------------
+
+
+void ExtractCmd::defineOptions()
+{
+    opts_section = "Extract Options: ";
+
+    opts.add_options()
+        ("help,h", "produce help message")
+        ("rule,r", po::value<string>(&rule), "use a specific quadrature rule")
+        ("rule-order,q", po::value<unsigned int>(&rule_order), "use a specific quadrature order")
+        ("mesh,m", po::value<string>(&meshpath), "mesh file (or path)")
+        ("output,o", po::value<string>(&pointfile), "Output HDF5 file for quadrature points")
+        ;
+
+    args.add("mesh", 1);
+    args.add("output", 1);
+
+}
+
+void ExtractCmd::configure()
+{
+    BaseCmd::configure();
+
+    if (true)
+    {
+        if (vm.count("rule"))
+        {
+            cout << "Rule: " << rule << endl;
+        }
+        if (vm.count("rule-order"))
+        {
+            cout << "Quadrature Order: " << rule_order << endl;
+        }
+        if (vm.count("mesh"))
+        {
+            cout << "Input Mesh: " << meshpath << endl;
+        }
+        if (vm.count("output"))
+        {
+            cout << "Output Points: " << pointfile << endl;
+        }
+    }
+}
+
+
+int ExtractCmd::run()
+{
+    if (vm.count("help"))
+    {
+        this->printUsage();
+        return 1;
+    }
+
+    // Defer work to the appropriate ExtractOp function
+    //  Create QuadratureRule object
+    //  Obtain specified Mesh object from disk
+    //  Output file must be an hdf5 file (emit warning if extension is not .h5)
+    //  Using a Timer object
+    //  Using a Points buffer
+    //  Call extract operation on (ptsbuffer, meshblock)
+    //      writing to a buffered hdf5 file,
+    //      until we exhaust the cell iterator
+    //  Close the hdf5 file
+
+    return 0;
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/cli_extract_cmd.h
===================================================================
--- cs/cigma/trunk/src/cli_extract_cmd.h	                        (rev 0)
+++ cs/cigma/trunk/src/cli_extract_cmd.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,33 @@
+#ifndef __CIGMA_EXTRACT_CMD_H__
+#define __CIGMA_EXTRACT_CMD_H__
+
+#include "cli_base_cmd.h"
+
+namespace cigma
+{
+    class ExtractCmd;
+}
+
+/**
+ * \brief Command for extracting quadrature points on a domain discretization.
+ */
+class cigma::ExtractCmd : public BaseCmd
+{
+public:
+    ExtractCmd();
+    ~ExtractCmd();
+
+public:
+    void defineOptions();
+    void configure();
+    int run();
+
+public:
+    std::string rule;
+    unsigned int rule_order;
+
+    std::string meshpath;
+    std::string pointfile;
+};
+
+#endif

Added: cs/cigma/trunk/src/cli_info_cmd.cpp
===================================================================
--- cs/cigma/trunk/src/cli_info_cmd.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/cli_info_cmd.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,42 @@
+#include <iostream>
+using namespace std;
+
+#include "cli_info_cmd.h"
+using namespace cigma;
+
+
+// ----------------------------------------------------------------------------
+
+InfoCmd::InfoCmd()
+{
+    name = "info";
+}
+
+InfoCmd::~InfoCmd()
+{
+}
+
+// ----------------------------------------------------------------------------
+
+void InfoCmd::defineOptions()
+{
+}
+
+void InfoCmd::configure()
+{
+}
+
+int InfoCmd::run()
+{
+    cout << "Calling InfoCmd::run()" << endl;
+    //
+    // What to do here?
+    //
+    // 'cigma info functions' should list the available functions
+    // 'cigma info <MESH>' should give statistics about the mesh
+    //
+    // Any others?
+    //
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/cli_info_cmd.h
===================================================================
--- cs/cigma/trunk/src/cli_info_cmd.h	                        (rev 0)
+++ cs/cigma/trunk/src/cli_info_cmd.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,26 @@
+#ifndef __CIGMA_INFO_CMD_H__
+#define __CIGMA_INFO_CMD_H__
+
+#include "cli_base_cmd.h"
+
+namespace cigma
+{
+    class InfoCmd;
+}
+
+class cigma::InfoCmd : public BaseCmd
+{
+public:
+    InfoCmd();
+    ~InfoCmd();
+
+public:
+    void defineOptions();
+    void configure();
+    int run();
+
+public:
+    std::string objpath; /// A path to the object we wish to query
+};
+
+#endif

Added: cs/cigma/trunk/src/core_compare_op.cpp
===================================================================
--- cs/cigma/trunk/src/core_compare_op.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/core_compare_op.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,29 @@
+#include "core_compare_op.h"
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+CompareOp::CompareOp()
+{
+    first = 0;
+    second = 0;
+    mesh = 0;
+    quadrature = 0;
+    residuals = 0;
+
+}
+
+CompareOp::~CompareOp()
+{
+    if (first)      { delete first; first = 0; }
+    if (second)     { delete second; second = 0; }
+    if (mesh)       { delete mesh; mesh = 0; }
+    if (quadrature) { delete quadrature; quadrature = 0; }
+    if (residuals)  { delete residuals; residuals = 0; }
+}
+
+// ----------------------------------------------------------------------------
+
+
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/core_compare_op.h
===================================================================
--- cs/cigma/trunk/src/core_compare_op.h	                        (rev 0)
+++ cs/cigma/trunk/src/core_compare_op.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,25 @@
+#ifndef __CIGMA_COMPARE_OP_H__
+#define __CIGMA_COMPARE_OP_H__
+
+#include "core_base_op.h"
+
+namespace cigma
+{
+    class CompareOp;
+}
+
+class cigma::CompareOp : public cigma::BaseOp
+{
+public:
+    CompareOp();
+    ~CompareOp();
+
+public:
+    Function *first;
+    Function *second;
+    MeshPart *mesh;
+    Quadrature *quadrature;
+    Residuals *residuals;
+};
+
+#endif

Added: cs/cigma/trunk/src/core_eval_op.cpp
===================================================================
--- cs/cigma/trunk/src/core_eval_op.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/core_eval_op.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,26 @@
+#include "core_eval_op.h"
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+EvalOp::EvalOp()
+{
+    field = 0;
+    coords = 0;
+}
+
+EvalOp::~EvalOp()
+{
+    if (field)  { delete field; field = 0; }
+    if (coords) { delete coords; coords = 0; }
+}
+
+// ----------------------------------------------------------------------------
+
+void EvalOp::eval()
+{
+    assert(field);
+    assert(coords);
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/core_eval_op.h
===================================================================
--- cs/cigma/trunk/src/core_eval_op.h	                        (rev 0)
+++ cs/cigma/trunk/src/core_eval_op.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,27 @@
+#ifndef __CIGMA_EVAL_OP_H__
+#define __CIGMA_EVAL_OP_H__
+
+#include "core_base_op.h"
+#include "Function.h"
+#include "NodeCoordinates.h"
+
+namespace cigma
+{
+    class EvalOp;
+}
+
+class cigma::EvalOp : public cigma::BaseOp
+{
+public:
+    EvalOp();
+    ~EvalOp();
+
+public:
+    void eval();
+
+public:
+    Function *field;
+    NodeCoordinates *coords;
+};
+
+#endif

Added: cs/cigma/trunk/src/core_extract_op.cpp
===================================================================
--- cs/cigma/trunk/src/core_extract_op.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/core_extract_op.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,30 @@
+#include "core_extract_op.h"
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+ExtractOp::ExtractOp()
+{
+    mesh = 0;
+    quadrature = 0;
+    qpoints = 0;
+}
+
+ExtractOp::~ExtractOp()
+{
+    if (coords)     { delete coords; coords = 0; }
+    if (quadrature) { delete quadrature; quadrature = 0; }
+    if (qpoints)    { delete qpoints; qpoints = 0; }
+}
+
+// ----------------------------------------------------------------------------
+
+
+void ExtractOp::extractPoints()
+{
+    assert(mesh);
+    assert(quadrature);
+    assert(qpoints);
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/core_extract_op.h
===================================================================
--- cs/cigma/trunk/src/core_extract_op.h	                        (rev 0)
+++ cs/cigma/trunk/src/core_extract_op.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,26 @@
+#ifndef __CIGMA_EXTRACT_OP_H__
+#define __CIGMA_EXTRACT_OP_H__
+
+#include "core_base_op.h"
+
+namespace cigma
+{
+    class ExtractOp;
+}
+
+class cigma::ExtractOp : public cigma::BaseOp
+{
+public:
+    ExtractOp();
+    ~ExtractOp();
+
+public:
+    void extractPoints();
+
+public:
+    MeshParth *mesh;
+    Quadrature *quadrature;
+    QPoints<float> *qpoints;
+};
+
+#endif

Added: cs/cigma/trunk/src/eb_array.cpp
===================================================================

Added: cs/cigma/trunk/src/eb_array.h
===================================================================
--- cs/cigma/trunk/src/eb_array.h	                        (rev 0)
+++ cs/cigma/trunk/src/eb_array.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,11 @@
+#ifndef __EB_ARRAY_H__
+#define __EB_ARRAY_H__
+
+class eb_array : private boost::noncopyable
+{
+public:
+    eb_array();
+    ~eb_array();
+};
+
+#endif

Added: cs/cigma/trunk/src/fn_zero.cpp
===================================================================
--- cs/cigma/trunk/src/fn_zero.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/fn_zero.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,25 @@
+#include "Zero.h"
+
+using namespace cigma;
+
+ZeroFunction::ZeroFunction()
+{
+    dim = 1;
+    rank = 1;
+}
+
+ZeroFunction::~ZeroFunction()
+{
+}
+
+
+bool ZeroFunction::eval(double *point, double *value)
+{
+    for (int i = 0; i < rank; i++)
+    {
+        value[i] = 0.0;
+    }
+    return true;
+}
+
+

Added: cs/cigma/trunk/src/fn_zero.h
===================================================================
--- cs/cigma/trunk/src/fn_zero.h	                        (rev 0)
+++ cs/cigma/trunk/src/fn_zero.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,33 @@
+#ifndef __ZERO_FUNCTION_H__
+#define __ZERO_FUNCTION_H__
+
+#include "Function.h"
+
+namespace cigma
+{
+    class ZeroFunction;
+}
+
+class cigma::ZeroFunction : public cigma::Function
+{
+public:
+    ZeroFunction();
+    ~ZeroFunction();
+
+    void setShape(int dim, int rank);
+
+    int n_dim();
+    int n_rank();
+
+    bool eval(double *point, double *value);
+
+public:
+    int dim;
+    int rank;
+};
+
+
+inline int cigma::ZeroFunction::n_dim() { return dim; }
+inline int cigma::ZeroFunction::n_rank() { return rank; }
+
+#endif

Added: cs/cigma/trunk/src/io_exo_reader.cpp
===================================================================
--- cs/cigma/trunk/src/io_exo_reader.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/io_exo_reader.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,4 @@
+#include "ExodusII_Reader.h"
+using namespace cigma;
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/io_exo_reader.h
===================================================================
--- cs/cigma/trunk/src/io_exo_reader.h	                        (rev 0)
+++ cs/cigma/trunk/src/io_exo_reader.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,15 @@
+#ifndef __CIGMA_EXODUSII_READER_H__
+#define __CIGMA_EXODUSII_READER_H__
+
+namespace cigma
+{
+    class ExodusII_Reader;
+}
+
+class cigma::ExodusII_Reader : public cigma::FileReader
+{
+public:
+    ExodusII_Reader();
+    ~ExodusII_Reader();
+};
+#endif

Added: cs/cigma/trunk/src/io_file_reader.cpp
===================================================================
--- cs/cigma/trunk/src/io_file_reader.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/io_file_reader.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,67 @@
+#include "io_file_reader.h"
+#include "Filesystem.h"
+
+// std
+#include <string>
+#include <cstdlib>
+#include <cassert>
+
+// readers
+#include "io_null_reader.h"
+//#include "io_text_reader.h"
+//#include "io_hdf5_reader.h"
+//#include "io_vtk_reader.h"
+
+
+using namespace std;
+using namespace cigma;
+namespace fs = boost::filesystem;
+
+
+// ----------------------------------------------------------------------------
+
+FileReader::FileReader()
+{
+}
+
+FileReader::~FileReader()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+
+FileReader *New(std::string filename, std::string mode)
+{
+    // XXX: return a boost::shared_ptr 
+
+    assert(filename != "");
+
+    fs::path p(filename);
+
+    if (!fs::exists(p))
+    {
+        return new NullReader();
+    }
+
+    /*
+    string ext = fs::extension(p);
+
+    if (HDF5_Extension(ext.c_str()))
+    {
+        return new HDF5_Reader();
+    }
+    else if (VtkExtension(ext.c_str()))
+    {
+        return new VtkReader();
+    }
+    else if (TextExtension(ext.c_str()))
+    {
+        return new TextReader();
+    }
+    */
+
+    return new NullReader();
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/io_file_reader.h
===================================================================
--- cs/cigma/trunk/src/io_file_reader.h	                        (rev 0)
+++ cs/cigma/trunk/src/io_file_reader.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,44 @@
+#ifndef __CIGMA_FILE_READER_H__
+#define __CIGMA_FILE_READER_H__
+
+#include <string>
+#include <boost/noncopyable.hpp>
+#include "Filesystem.h"
+
+namespace cigma
+{
+    class FileReader;
+}
+
+
+/**
+ * \brief Defines the interface for Reader objects.
+ */
+class cigma::FileReader : private boost::noncopyable
+{
+public:
+    FileReader();
+    virtual ~FileReader();
+
+    virtual int open(const char *filename) = 0;
+    virtual int close() = 0;
+
+    virtual int getDataset(const char *loc, double **data, int *num, int *dim) = 0;
+    virtual int getCoordinates(const char *loc, double **coordinates, int *nno, int *nsd) = 0;
+    virtual int getConnectivity(const char *loc, int **connectivity, int *nel, int *ndofs) = 0;
+
+    static FileReader *New(std::string filename, std::string mode);
+
+public:
+    typedef enum {
+        NULL_FILE_READER,
+        HDF5_FILE_READER,
+        VTK_FILE_READER,
+        TEXT_FILE_READER
+    } ReaderType;
+
+    virtual ReaderType getReaderType() = 0;
+
+};
+
+#endif

Added: cs/cigma/trunk/src/io_file_writer.cpp
===================================================================
--- cs/cigma/trunk/src/io_file_writer.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/io_file_writer.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,32 @@
+#include <cassert>
+#include <cstdlib>
+
+#include "Filesystem.h"
+#include "io_file_writer.h"
+//#include "io_null_writer.h"
+//#include "io_text_writer.h"
+
+/*
+#ifdef HAVE_HDF5
+#include "io_hdf5_writer.h"
+#endif
+
+#ifdef HAVE_VTK
+#include "io_vtk_writer.h"
+#endif
+*/
+
+using namespace cigma;
+
+namespace fs = boost::filesystem;
+
+// ----------------------------------------------------------------------------
+
+FileWriter *New(std::string filename, std::string mode)
+{
+    fs::path p(filename);
+    //return new NullWriter();
+    return 0;
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/io_file_writer.h
===================================================================
--- cs/cigma/trunk/src/io_file_writer.h	                        (rev 0)
+++ cs/cigma/trunk/src/io_file_writer.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,43 @@
+#ifndef __CIGMA_FILE_WRITER_H__
+#define __CIGMA_FILE_WRITER_H__
+
+#include <string>
+#include <boost/noncopyable.hpp>
+#include "Filesystem.h"
+
+namespace cigma
+{
+    class FileWriter;
+}
+
+
+/**
+ * \brief Defines the interface for file writer objects.
+ */
+class cigma::FileWriter : private boost::noncopyable
+{
+public:
+    virtual ~FileWriter();
+
+    virtual int open(const char *filename) = 0;
+    virtual int close() = 0;
+
+    virtual int writeDataset(const char *loc, double *data, int nno, int ndim) = 0;
+    virtual int writeCoordinates(const char *loc, double *coordinates, int nno, int nsd) = 0;
+    virtual int writeConnectivity(const char *loc, int *connectivity, int nel, int ndofs) = 0;
+
+    static FileWriter *New(std::string filename, std::string mode);
+
+public:
+    typedef enum {
+        NULL_FILE_WRITER,
+        HDF5_FILE_WRITER,
+        VTK_FILE_WRITER,
+        TEXT_FILE_WRITER
+    } WriterType;
+
+    virtual WriterType getWriterType() = 0;
+
+};
+
+#endif

Added: cs/cigma/trunk/src/io_hdf5_reader.cpp
===================================================================
--- cs/cigma/trunk/src/io_hdf5_reader.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/io_hdf5_reader.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,144 @@
+#include "HDF5_Reader.h"
+#include "Common.h"
+#include <iostream>
+
+using namespace std;
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+HDF5_Reader::HDF5_Reader()
+{
+    file = 0;
+}
+
+HDF5_Reader::~HDF5_Reader()
+{
+    close();
+}
+
+// ----------------------------------------------------------------------------
+
+
+int HDF5_Reader::open(const char *filename)
+{
+    TRI_LOG_STR("HDF5_Reader::open()");
+    TRI_LOG(filename);
+
+    try
+    {
+        H5::Exception::dontPrint();
+        file = new H5::H5File(filename, H5F_ACC_RDONLY);
+    }
+    catch (H5::FileIException error)
+    {
+        error.printError();
+        return -1;
+    }
+    return 0;
+}
+
+int HDF5_Reader::close()
+{
+    if (file)
+    {
+        delete file;
+        file = 0;
+    }
+    return 0;
+}
+
+
+// ----------------------------------------------------------------------------
+
+template <typename T> static H5::PredType predtype_from();
+template <> static H5::PredType predtype_from<float>() { return H5::PredType::NATIVE_FLOAT; }
+template <> static H5::PredType predtype_from<double>(){ return H5::PredType::NATIVE_DOUBLE; }
+template <> static H5::PredType predtype_from<int>()   { return H5::PredType::NATIVE_INT; }
+
+template <typename T> static H5T_class_t typeclass_from();
+template <> static H5T_class_t typeclass_from<float>()  { return H5T_FLOAT; }
+template <> static H5T_class_t typeclass_from<double>() { return H5T_FLOAT; }
+template <> static H5T_class_t typeclass_from<int>()    { return H5T_INTEGER; }
+
+template <typename MT>
+static int get_full_dataset(H5::H5File *file, const char *loc, MT **data, int *nrows, int *ncols)
+{
+    try
+    {
+        H5::DataSet dataset = file->openDataSet(loc);
+
+        H5T_class_t type_class = dataset.getTypeClass();
+        if (type_class != typeclass_from<MT>())
+        {
+            cerr << "Dataset type mismatch in read operation." << endl;
+            return -2;
+        }
+
+        H5::DataSpace dataspace = dataset.getSpace();
+        
+        int rank = dataspace.getSimpleExtentNdims();
+        if ((rank != 1) && (rank != 2))
+        {
+            cerr << "Dataset rank must be 1 or 2." << endl;
+            return -3;
+        }
+
+        hsize_t dims[2];
+        int ndims = dataspace.getSimpleExtentDims(dims, NULL);
+        int size = dataspace.getSimpleExtentNpoints();
+        MT *array = 0;
+
+        try
+        {
+            array = new MT[size];
+            dataset.read(array, predtype_from<MT>());
+        }
+        catch(H5::DataSetIException error)
+        {
+            cerr << "Dataset '" << loc << "' could not be read." << endl;
+            delete array;
+            array = 0;
+        }
+
+        if (array == 0)
+        {
+            return -1;
+        }
+
+        *nrows = dims[0];
+        *ncols = dims[1];
+        *data  = array;
+    }
+    catch (H5::DataSetIException error)
+    {
+        error.printError();
+        return -1;
+    }
+    catch (H5::DataSpaceIException error)
+    {
+        error.printError();
+        return -1;
+    }
+    return 0;
+}
+
+int HDF5_Reader::getDataset(const char *loc, double **data, int *num, int *dim)
+{
+    TRI_LOG_STR("HDF5_Reader::getDataset()");
+    return get_full_dataset<double>(file, loc, data, num, dim);
+}
+
+int HDF5_Reader::getCoordinates(const char *loc, double **coordinates, int *nno, int *nsd)
+{
+    TRI_LOG_STR("HDF5_Reader::getCoordinates()");
+    return get_full_dataset<double>(file, loc, coordinates, nno, nsd);
+}
+
+int HDF5_Reader::getConnectivity(const char *loc, int **connectivity, int *nel, int *ndofs)
+{
+    TRI_LOG_STR("HDF5_Reader::getConnectivity()");
+    return get_full_dataset<int>(file, loc, connectivity, nel, ndofs);
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/io_hdf5_reader.h
===================================================================
--- cs/cigma/trunk/src/io_hdf5_reader.h	                        (rev 0)
+++ cs/cigma/trunk/src/io_hdf5_reader.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,31 @@
+#ifndef __CIGMA_HDF5_READER_H__
+#define __CIGMA_HDF5_READER_H__
+
+#include "H5Cpp.h"
+#include "FileReader.h"
+
+namespace cigma
+{
+    class HDF5_Reader;
+}
+
+class cigma::HDF5_Reader : public cigma::FileReader
+{
+public:
+    HDF5_Reader();
+    ~HDF5_Reader();
+    
+    ReaderType getReaderType() { return HDF5_FILE_READER; }
+
+    int open(const char *filename);
+    int close();
+
+    int getDataset(const char *loc, double **data, int *num, int *dim);
+    int getCoordinates(const char *loc, double **coordinates, int *nno, int *nsd);
+    int getConnectivity(const char *loc, int **connectivity, int *nel, int *ndofs);
+    
+public:
+    H5::H5File *file;
+};
+
+#endif

Added: cs/cigma/trunk/src/io_hdf5_writer.cpp
===================================================================
--- cs/cigma/trunk/src/io_hdf5_writer.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/io_hdf5_writer.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,100 @@
+#include "HDF5_Writer.h"
+
+#include "Common.h"
+
+using namespace std;
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+HDF5_Writer::HDF5_Writer()
+{
+    file = 0;
+}
+
+HDF5_Writer::~HDF5_Writer()
+{
+    close();
+}
+
+// ----------------------------------------------------------------------------
+
+int HDF5_Writer::open(const char *filename)
+{
+    TRI_LOG_STR("HDF5_Writer::open()");
+    TRI_LOG(filename);
+
+    try
+    {
+        H5::Exception::dontPrint();
+        file = new H5::H5File(filename, H5F_ACC_TRUNC);
+    }
+    catch (H5::FileIException error)
+    {
+        error.printError();
+        return -1;
+    }
+    return 0;
+}
+
+int HDF5_Writer::close()
+{
+    if (file)
+    {
+        delete file;
+        file = 0;
+    }
+    return 0;
+}
+
+
+// ----------------------------------------------------------------------------
+
+template <typename T> static H5::PredType predtype_from();
+template <> static H5::PredType predtype_from<float>() { return H5::PredType::NATIVE_FLOAT; }
+template <> static H5::PredType predtype_from<double>(){ return H5::PredType::NATIVE_DOUBLE; }
+template <> static H5::PredType predtype_from<int>()   { return H5::PredType::NATIVE_INT; }
+
+template <typename MT, typename FT>
+static int write_dataset(H5::H5File *file, const char *loc, MT *data, int nrows, int ncols)
+{
+    try
+    {
+        hsize_t dims[2] = {nrows, ncols};
+        H5::DataSpace dataspace(2, dims);
+        H5::DataSet dataset = file->createDataSet(loc, predtype_from<FT>(), dataspace);
+        dataset.write(data, predtype_from<MT>());
+    }
+    catch (H5::DataSpaceIException error)
+    {
+        error.printError();
+        return -1;
+    }
+    catch (H5::DataSetIException error)
+    {
+        error.printError();
+        return -1;
+    }
+    return 0;
+}
+
+
+int HDF5_Writer::writeDataset(const char *loc, double *data, int nno, int ndim)
+{
+    TRI_LOG_STR("HDF5_Writer::writeDataset()");
+    return write_dataset<double,double>(file, loc, data, nno, ndim);
+}
+
+int HDF5_Writer::writeCoordinates(const char *loc, double *coordinates, int nno, int nsd)
+{
+    TRI_LOG_STR("HDF5_Writer::writeCoordinates()");
+    return write_dataset<double,double>(file, loc, coordinates, nno, nsd);
+}
+
+int HDF5_Writer::writeConnectivity(const char *loc, int *connectivity, int nel, int ndofs)
+{
+    TRI_LOG_STR("HDF5_Writer::writeConnectivity()");
+    return write_dataset<int,int>(file, loc, connectivity, nel, ndofs);
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/io_hdf5_writer.h
===================================================================
--- cs/cigma/trunk/src/io_hdf5_writer.h	                        (rev 0)
+++ cs/cigma/trunk/src/io_hdf5_writer.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,30 @@
+#ifndef __CIGMA_HDF5_WRITER_H__
+#define __CIGMA_HDF5_WRITER_H__
+
+#include "H5Cpp.h"
+#include "FileWriter.h"
+
+namespace cigma
+{
+    class HDF5_Writer;
+}
+
+class cigma::HDF5_Writer : public cigma::FileWriter
+{
+public:
+    HDF5_Writer();
+    ~HDF5_Writer();
+
+    WriterType getWriterType() { return HDF5_FILE_WRITER; }
+
+    int open(const char *filename);
+    int close();
+
+    int writeDataset(const char *loc, double *data, int nno, int ndim);
+    int writeCoordinates(const char *loc, double *coordinates, int nno, int nsd);
+    int writeConnectivity(const char *loc, int *connectivity, int nel, int ndofs);
+
+public:
+    H5::H5File *file;
+};
+#endif

Added: cs/cigma/trunk/src/io_null_reader.cpp
===================================================================
--- cs/cigma/trunk/src/io_null_reader.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/io_null_reader.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,16 @@
+#include "io_null_reader.h"
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+NullReader::NullReader() {}
+NullReader::~NullReader() {}
+
+int NullReader::open(const char *filename) { return -1; }
+int NullReader::close() { return -1; }
+
+int NullReader::getDataset(const char *loc, double **data, int *num, int *dim)             { return -1; }
+int NullReader::getCoordinates(const char *loc, double **coordinates, int *nno, int *nsd)  { return -1; }
+int NullReader::getConnectivity(const char *loc, int **connectivity, int *nel, int *ndofs) { return -1; }
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/io_null_reader.h
===================================================================
--- cs/cigma/trunk/src/io_null_reader.h	                        (rev 0)
+++ cs/cigma/trunk/src/io_null_reader.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,28 @@
+#ifndef __CIGMA_NULL_READER_H__
+#define __CIGMA_NULL_READER_H__
+
+#include "io_file_reader.h"
+
+namespace cigma
+{
+    class NullReader;
+}
+
+class cigma::NullReader : public cigma::FileReader
+{
+public:
+
+    NullReader();
+    ~NullReader();
+
+    ReaderType getReaderType() { return NULL_FILE_READER; }
+
+    int open(const char *filename);
+    int close();
+
+    int getDataset(const char *loc, double **data, int *num, int *dim);
+    int getCoordinates(const char *loc, double **coordinates, int *nno, int *nsd);
+    int getConnectivity(const char *loc, int **connectivity, int *nel, int *ndofs);
+};
+
+#endif

Added: cs/cigma/trunk/src/io_null_writer.cpp
===================================================================
--- cs/cigma/trunk/src/io_null_writer.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/io_null_writer.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,15 @@
+#include "io_null_writer.h"
+using namespace cigma;
+// ----------------------------------------------------------------------------
+
+NullWriter::NullWriter() {}
+NullWriter::~NullWriter() {}
+
+int NullWriter::open(const char *filename) { return -1; }
+int NullWriter::close() { return -1; }
+
+int NullWriter::writeDataset(const char *loc, double *data, int nno, int ndim)            { return -1; }
+int NullWriter::writeCoordinates(const char *loc, double *coordinates, int nno, int nsd)  { return -1; }
+int NullWriter::writeConnectivity(const char *loc, int *connectivity, int nel, int ndofs) { return -1; }
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/io_null_writer.h
===================================================================
--- cs/cigma/trunk/src/io_null_writer.h	                        (rev 0)
+++ cs/cigma/trunk/src/io_null_writer.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,27 @@
+#ifndef __CIGMA_NULL_WRITER_H__
+#define __CIGMA_NULL_WRITER_H__
+
+#include "io_file_writer.h"
+
+namespace cigma
+{
+    class NullWriter;
+}
+
+class cigma::NullWriter : public cigma::FileWriter
+{
+public:
+    NullWriter();
+    ~NullWriter();
+
+    WriterType getWriterType() { return NULL_FILE_WRITER; }
+
+    int open(const char *filename);
+    int close();
+
+    int writeDataset(const char *loc, double *data, int nno, int ndim);
+    int writeCoordinates(const char *loc, double *coordinates, int nno, int nsd);
+    int writeConnectivity(const char *loc, int *connectivity, int nel, int ndofs);
+};
+
+#endif

Added: cs/cigma/trunk/src/io_text_reader.cpp
===================================================================
--- cs/cigma/trunk/src/io_text_reader.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/io_text_reader.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,171 @@
+#include <cassert>
+#include <cstdlib>
+#include <cstring>
+
+#include "io_text_reader.h"
+
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+TextReader::TextReader()
+{
+    fp = NULL;
+}
+
+TextReader::~TextReader()
+{
+    close();
+}
+
+// ----------------------------------------------------------------------------
+
+int TextReader::open(const char *filename)
+{
+    if (filename == NULL)
+    {
+        return -1;
+    }
+
+    fp = fopen(filename, "r");
+
+    if (fp == NULL)
+    {
+        return -2;
+    }
+
+    return 0;
+}
+
+int TextReader::close()
+{
+    if (fp != NULL)
+    {
+        fclose(fp);
+        fp = NULL;
+    }
+    return 0;
+}
+
+// ----------------------------------------------------------------------------
+
+static FILE *get_fp(const char *loc, FILE *default_fp)
+{
+    FILE *fp = default_fp;
+    if ((loc != NULL) && (strcmp(loc, "") != 0))
+    {
+        fp = fopen(loc, "r");
+    }
+    return fp;
+}
+
+static bool read_dmat(FILE *fp, double **mat, int *rows, int *cols)
+{
+    assert(fp != NULL);
+
+    int nrows, ncols;
+    int ret;
+
+    ret = fscanf(fp, "%d", &nrows);
+    assert(ret == 1);
+    assert(nrows > 0);
+
+    ret = fscanf(fp, "%d", &ncols);
+    assert(ret == 1);
+    assert(ncols > 0);
+
+    double *m = new double[nrows * ncols];
+
+    for (int i = 0; i < nrows; i++)
+    {
+        for (int j = 0; j < ncols; j++)
+        {
+            int n = ncols*i + j;
+            ret = fscanf(fp, "%lf", &m[n]);
+            assert(ret == 1);
+        }
+    }
+
+    *mat = m;
+    *rows = nrows;
+    *cols = ncols;
+
+    return true;
+}
+
+static bool read_imat(FILE *fp, int **mat, int *rows, int *cols)
+{
+    assert(fp != NULL);
+
+    int nrows, ncols;
+    int ret;
+
+    ret = fscanf(fp, "%d", &nrows);
+    assert(ret == 1);
+    assert(nrows > 0);
+
+    ret = fscanf(fp, "%d", &ncols);
+    assert(ret == 1);
+    assert(ncols > 0);
+
+    int *m = new int[nrows * ncols];
+
+    for (int i = 0; i < nrows; i++)
+    {
+        for (int j = 0; j < ncols; j++)
+        {
+            int n = ncols*i + j;
+            ret = fscanf(fp, "%d", &m[n]);
+            assert(ret == 1);
+        }
+    }
+
+    *mat = m;
+    *rows = nrows;
+    *cols = ncols;
+
+    return true;
+}
+
+
+int TextReader::getDataset(const char *loc, double **data, int *num, int *dim)
+{
+    FILE *loc_fp = get_fp(loc, fp);
+    if (loc_fp != NULL)
+    {
+        read_dmat(loc_fp, data, num, dim);
+        return 0;
+    }
+    return -1;
+}
+
+
+int TextReader::getConnectivity(const char *loc, int **connectivity, int *nel, int *ndofs)
+{
+    // XXX: support for sections? (for reading coords/connectivity from single file)
+    FILE *loc_fp = get_fp(loc, fp);
+    assert(loc_fp != NULL);
+    if (loc_fp != NULL)
+    {
+        read_imat(loc_fp, connectivity, nel, ndofs);
+        return 0;
+    }
+    return -1;
+}
+
+int TextReader::getCoordinates(const char *loc, double **coordinates, int *nno, int *nsd)
+{
+    // XXX: support for sections? (for reading coords/connectivity from single file)
+    FILE *loc_fp = get_fp(loc, fp);
+    if (loc_fp != NULL)
+    {
+        read_dmat(loc_fp, coordinates, nno, nsd);
+        return 0;
+    }
+    return -1;
+}
+
+
+// ----------------------------------------------------------------------------
+
+

Added: cs/cigma/trunk/src/io_text_reader.h
===================================================================
--- cs/cigma/trunk/src/io_text_reader.h	                        (rev 0)
+++ cs/cigma/trunk/src/io_text_reader.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,32 @@
+#ifndef __CIGMA_TEXT_READER_H__
+#define __CIGMA_TEXT_READER_H__
+
+#include <cstdio>
+#include "io_file_reader.h"
+
+namespace cigma
+{
+    class TextReader;
+}
+
+class cigma::TextReader : public FileReader
+{
+public:
+
+    TextReader();
+    ~TextReader();
+
+    ReaderType getReaderType() { return TEXT_FILE_READER; }
+
+    int open(const char *filename);
+    int close();
+
+    int getDataset(const char *loc, double **data, int *num, int *dim);
+    int getCoordinates(const char *loc, double **coordinates, int *nno, int *nsd);
+    int getConnectivity(const char *loc, int **connectivity, int *nel, int *ndofs);
+
+public:
+    FILE *fp;
+};
+
+#endif

Added: cs/cigma/trunk/src/io_text_writer.cpp
===================================================================
--- cs/cigma/trunk/src/io_text_writer.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/io_text_writer.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,113 @@
+#include <cassert>
+#include <cstdlib>
+#include "TextWriter.h"
+
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+TextWriter::TextWriter()
+{
+    fp = NULL;
+}
+
+TextWriter::~TextWriter()
+{
+    close();
+}
+
+// ----------------------------------------------------------------------------
+
+int TextWriter::open(const char *filename)
+{
+    if (filename != NULL)
+    {
+        fp = fopen(filename, "w");
+    }
+    else
+    {
+        fp = stdout;
+    }
+
+    if (fp == NULL)
+    {
+        return -1;
+    }
+
+    return 0;
+}
+
+int TextWriter::close()
+{
+    if (fp != NULL)
+    {
+        fclose(fp);
+        fp = NULL;
+    }
+    return 0;
+}
+
+
+// ----------------------------------------------------------------------------
+
+
+
+static bool write_dmat(FILE *fp, double *mat, int rows, int cols)
+{
+    assert(fp != NULL);
+    assert(rows > 0);
+    assert(cols > 0);
+
+    fprintf(fp, "%d %d\n", rows, cols);
+    for (int i = 0; i < rows; i++)
+    {
+        for (int j = 0; j < cols; j++)
+        {
+            fprintf(fp, " %g", mat[cols*i + j]);
+        }
+        fprintf(fp, "\n");
+    }
+
+    return true;
+}
+
+static bool write_imat(FILE *fp, int *mat, int rows, int cols)
+{
+    assert(fp != NULL);
+    assert(rows > 0);
+    assert(cols > 0);
+
+    fprintf(fp, "%d %d\n", rows, cols);
+    for (int i = 0; i < rows; i++)
+    {
+        for (int j = 0; j < cols; j++)
+        {
+            fprintf(fp, " %d", mat[cols*i + j]);
+        }
+        fprintf(fp, "\n");
+    }
+
+    return true;
+}
+
+
+// ----------------------------------------------------------------------------
+
+
+int TextWriter::writeConnectivity(const char *loc, int *connectivity, int nel, int ndofs)
+{
+    write_imat(fp, connectivity, nel, ndofs);
+}
+
+int TextWriter::writeCoordinates(const char *loc, double *coordinates, int nno, int nsd)
+{
+    write_dmat(fp, coordinates, nno, nsd);
+}
+
+int TextWriter::writeDataset(const char *loc, double *data, int num, int ndim)
+{
+    write_dmat(fp, data, num, ndim);
+}
+
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/io_text_writer.h
===================================================================
--- cs/cigma/trunk/src/io_text_writer.h	                        (rev 0)
+++ cs/cigma/trunk/src/io_text_writer.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,32 @@
+#ifndef __TEXT_WRITER_H__
+#define __TEXT_WRITER_H__
+
+#include <cstdio>
+#include "FileWriter.h"
+
+namespace cigma
+{
+    class TextWriter;
+}
+
+class cigma::TextWriter : public FileWriter
+{
+public:
+
+    TextWriter();
+    ~TextWriter();
+
+    WriterType getWriterType() { return TEXT_FILE_WRITER; }
+
+    int open(const char *filename);
+    int close();
+
+    int writeConnectivity(const char *loc, int *connectivity, int nel, int ndofs);
+    int writeCoordinates(const char *loc, double *coordinates, int nno, int nsd);
+    int writeDataset(const char *loc, double *data, int nno, int ndim);
+
+public:
+    FILE *fp;
+};
+
+#endif

Added: cs/cigma/trunk/src/io_ucd_reader.cpp
===================================================================
--- cs/cigma/trunk/src/io_ucd_reader.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/io_ucd_reader.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,4 @@
+#include "UCD_Reader.h"
+using namespace cigma;
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/io_ucd_reader.h
===================================================================
--- cs/cigma/trunk/src/io_ucd_reader.h	                        (rev 0)
+++ cs/cigma/trunk/src/io_ucd_reader.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,26 @@
+#ifndef __CIGMA_UCD_READER_H__
+#define __CIGMA_UCD_READER_H__
+
+#include "FileReader.h"
+
+namespace cigma
+{
+    class UCD_Reader;
+}
+
+class cigma::UCD_Reader : public cigma::FileReader
+{
+public:
+    UCD_Reader();
+    ~UCD_Reader();
+
+    ReaderType getReaderType() { return UCD_FILE_READER; }
+    int open(const char *filename);
+    int close();
+
+    int getDataset(const char *loc, double **data, int *num, int *dim);
+    int getCoordinates(const char *loc, double **coordinates, int *nno, int *nsd);
+    int getConnectivity(const char *loc, int **connectivity, int *nel, int *ndofs);
+};
+
+#endif

Added: cs/cigma/trunk/src/io_vtk_reader.cpp
===================================================================
--- cs/cigma/trunk/src/io_vtk_reader.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/io_vtk_reader.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,355 @@
+#include "io_vtk_reader.h"
+
+#include "Common.h"
+#include "BoostFilesystem.h"
+
+#include "vtkUnstructuredGridReader.h"
+#include "vtkStructuredGridReader.h"
+#include "vtkRectilinearGridReader.h"
+
+#include "vtkXMLUnstructuredGridReader.h"
+#include "vtkXMLStructuredGridReader.h"
+#include "vtkXMLRectilinearGridReader.h"
+
+#include "vtkXMLPUnstructuredGridReader.h"
+#include "vtkXMLPStructuredGridReader.h"
+#include "vtkXMLPRectilinearGridReader.h"
+
+#include "vtkDataSet.h"
+#include "vtkPointData.h"
+
+#include "vtkDataArray.h"
+#include "vtkDataArraySelection.h"
+
+#include "vtkIdList.h"
+#include "vtkCell.h"
+#include "vtkGenericCell.h"
+
+
+using namespace std;
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+VtkReader::VtkReader()
+{
+    dataset = 0;
+    legacy_reader = 0;
+    xml_reader = 0;
+    gridType = NULL_GRID;
+}
+
+VtkReader::~VtkReader()
+{
+    close();
+}
+
+// ----------------------------------------------------------------------------
+
+int VtkReader::open(const char *filename)
+{
+    TRI_LOG_STR("VtkReader::open()");
+    TRI_LOG(filename);
+
+    string filepath = filename;
+    string ext = boost::filesystem::extension(filepath);
+    int status;
+
+
+    if (ext == ".vtk")
+    {
+
+        legacy_reader = vtkDataSetReader::New();
+        legacy_reader->SetFileName(filename);
+        gridType = VTK;
+
+        status = legacy_reader->OpenVTKFile();
+        if (status == 0)
+        {
+            cerr << "Could not read legacy VTK file " << filename << endl;
+            gridType = NULL_GRID;
+            return -1;
+        }
+
+
+        legacy_reader->Update();
+        dataset = legacy_reader->GetOutput();
+        dataset->Update();
+
+    }
+    else
+    {
+        if (ext == ".vtu")
+        {
+            xml_reader = vtkXMLUnstructuredGridReader::New();
+            gridType = VTU;
+        }
+        else if (ext == ".vts")
+        {
+            xml_reader = vtkXMLStructuredGridReader::New();
+            gridType = VTS;
+        }
+        else if (ext == ".vtr")
+        {
+            xml_reader = vtkXMLRectilinearGridReader::New();
+            gridType = VTR;
+        }
+        else if (ext == ".pvtu")
+        {
+            xml_reader = vtkXMLPUnstructuredGridReader::New();
+            gridType == PVTU;
+        }
+        else if (ext == ".pvts")
+        {
+            xml_reader = vtkXMLPStructuredGridReader::New();
+            gridType = PVTS;
+        }
+        else if (ext == ".pvtr")
+        {
+            xml_reader = vtkXMLPRectilinearGridReader::New();
+            gridType = PVTR;
+        }
+        else
+        {
+            cerr << "Unsupported VTK file (" << ext << ")" << endl;
+            return -1;
+        }
+
+        status = xml_reader->CanReadFile(filename);
+        if (status == 0)
+        {
+            cerr << "Could not read XML VTK file " << filename << endl;
+            gridType = NULL_GRID;
+            return -1;
+        }
+
+        xml_reader->SetFileName(filename);
+        xml_reader->Update();
+
+        xml_reader->GetPointDataArraySelection()->EnableAllArrays();
+
+        dataset = xml_reader->GetOutputAsDataSet();
+        dataset->Update();
+    }
+
+    return 0;
+}
+
+
+int VtkReader::close()
+{
+    gridType = NULL_GRID;
+
+    if (dataset != 0)
+    {
+        dataset = 0;
+    }
+
+    if (legacy_reader)
+    {
+        legacy_reader->Delete();
+        legacy_reader = 0;
+    }
+
+    if (xml_reader)
+    {
+        xml_reader->Delete();
+        xml_reader = 0;
+    }
+
+    return 0;
+}
+
+// ----------------------------------------------------------------------------
+
+static int GetDimensionFromCellType(int cellType)
+{
+    if ((cellType == VTK_TRIANGLE) ||
+        (cellType == VTK_QUADRATIC_TRIANGLE) ||
+        (cellType == VTK_PARAMETRIC_TRI_SURFACE) ||
+        (cellType == VTK_HIGHER_ORDER_TRIANGLE))
+    {
+        return 2;
+    }
+
+    if ((cellType == VTK_QUAD) ||
+        (cellType == VTK_QUADRATIC_QUAD) ||
+        (cellType == VTK_PARAMETRIC_QUAD_SURFACE) ||
+        (cellType == VTK_HIGHER_ORDER_QUAD))
+    {
+        return 2;
+    }
+
+    if ((cellType == VTK_TETRA) ||
+        (cellType == VTK_QUADRATIC_TETRA) ||
+        (cellType == VTK_PARAMETRIC_TETRA_REGION) ||
+        (cellType == VTK_HIGHER_ORDER_TETRAHEDRON))
+    {
+        return 3;
+    }
+
+    if ((cellType == VTK_VOXEL) ||
+        (cellType == VTK_HEXAHEDRON) ||
+        (cellType == VTK_QUADRATIC_HEXAHEDRON) ||
+        (cellType == VTK_PARAMETRIC_HEX_REGION) ||
+        (cellType == VTK_HIGHER_ORDER_HEXAHEDRON))
+    {
+        return 3;
+    }
+
+    return -1;
+}
+
+int VtkReader::getDataset(const char *loc, double **data, int *num, int *dim)
+{
+    TRI_LOG_STR("VtkReader::getDataset()");
+    
+    int i,j;
+    int n_points;
+    int rank;
+    double *array = 0;
+
+    if (dataset == 0)
+    {
+        return -1;
+    }
+
+    vtkPointData *pointData = dataset->GetPointData();
+
+    assert(pointData != 0);
+
+    if (pointData->HasArray(loc) == 1)
+    {
+        vtkDataArray *dataArray = pointData->GetArray(loc);
+        assert(dataArray != 0);
+
+        /* XXX: verify that we are loading a dataset of the correct type
+        int dataType = dataArray->GetDataType();
+        if ((dataType != VTK_DOUBLE) || (dataType != VTK_FLOAT))
+        {
+            assert(false); // XXX
+            return -1;
+        }*/
+
+        n_points = dataArray->GetNumberOfTuples();
+        rank = dataArray->GetNumberOfComponents();
+        array = new double[n_points * rank];
+
+        for (i = 0; i < n_points; i++)
+        {
+            double dofval[rank];
+            dataArray->GetTuple(i, dofval);
+            for (j = 0; j < rank; j++)
+            {
+                array[i*rank + j] = dofval[j];
+            }
+        }
+    }
+    else
+    {
+        assert(false); // XXX
+        return -1;
+    }
+
+    *data = array;
+    *num = n_points;
+    *dim = rank;
+
+    TRI_LOG(*data);
+    TRI_LOG(n_points);
+    TRI_LOG(rank);
+
+    return 0;
+}
+
+int VtkReader::getCoordinates(const char *loc, double **coordinates, int *nno, int *nsd)
+{
+    TRI_LOG_STR("VtkReader::getCoordinates()");
+
+    int i,j;
+    int n_points;
+    int n_dims;
+    double *array = 0;
+
+    if (dataset == 0)
+    {
+        return -1;
+    }
+
+    int cellType = dataset->GetCellType(0); // XXX: assumes uniform cell types
+
+    n_points = dataset->GetNumberOfPoints();
+    n_dims = GetDimensionFromCellType(cellType);
+
+    assert(n_dims <= 3);
+
+    if (n_dims < 0)
+    {
+        assert(false);
+        return -1;
+    }
+
+    array = new double[n_points * n_dims];
+
+    for (i = 0; i < n_points; i++)
+    {
+        double point[3];
+        dataset->GetPoint(i, point);
+        for (j = 0; j < n_dims; j++)
+        {
+            array[i*n_dims + j] = point[j];
+        }
+    }
+
+    *coordinates = array;
+    *nno = n_points;
+    *nsd = n_dims;
+
+    TRI_LOG(*coordinates);
+    TRI_LOG(n_points);
+    TRI_LOG(n_dims);
+
+    return 0;
+}
+
+int VtkReader::getConnectivity(const char *loc, int **connectivity, int *nel, int *ndofs)
+{
+    TRI_LOG_STR("VtkReader::getConnectivity()");
+
+    int i,j;
+    int n_cells;
+    int n_dofs;
+    int *array = 0;
+
+    if (dataset == 0)
+    {
+        return -1;
+    }
+
+    vtkCell *firstCell = dataset->GetCell(0);
+    n_cells = dataset->GetNumberOfCells();
+    n_dofs  = firstCell->GetNumberOfPoints();   // XXX: assume uniform cell types
+    array = new int[n_cells * n_dofs];
+
+    vtkGenericCell *cell = vtkGenericCell::New();
+    for (i = 0; i < n_cells; i++)
+    {
+        dataset->GetCell(i, cell);
+        for (j = 0; j < n_dofs; j++)
+        {
+            array[i * n_dofs + j] = cell->GetPointIds()->GetId(j);
+        }
+    }
+
+    *connectivity = array;
+    *nel = n_cells;
+    *ndofs = n_dofs;
+
+    TRI_LOG(*connectivity);
+    TRI_LOG(n_cells);
+    TRI_LOG(n_dofs);
+
+    return 0;
+}
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/io_vtk_reader.h
===================================================================
--- cs/cigma/trunk/src/io_vtk_reader.h	                        (rev 0)
+++ cs/cigma/trunk/src/io_vtk_reader.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,39 @@
+#ifndef __CIGMA_VTK_READER_H__
+#define __CIGMA_VTK_READER_H__
+
+#include "io_file_reader.h"
+#include "vtkDataSetReader.h"
+#include "vtkXMLDataReader.h"
+
+namespace cigma
+{
+    class VtkReader;
+}
+
+class cigma::VtkReader : public cigma::FileReader
+{
+public:
+    VtkReader();
+    ~VtkReader();
+
+    ReaderType getReaderType() { return VTK_FILE_READER; }
+
+    int open(const char *filename);
+    int close();
+
+    int getDataset(const char *loc, double **data, int *num, int *dim);
+    int getCoordinates(const char *loc, double **coordinates, int *nno, int *nsd);
+    int getConnectivity(const char *loc, int **connectivity, int *nel, int *ndofs);
+
+public:
+    typedef enum {
+        NULL_GRID, VTK, VTU, VTS, VTR, PVTU, PVTS, PVTR
+    } GridType;
+
+    GridType gridType;
+    vtkDataSetReader *legacy_reader;
+    vtkXMLReader *xml_reader;
+    vtkDataSet *dataset;
+};
+
+#endif

Added: cs/cigma/trunk/src/io_vtk_writer.cpp
===================================================================
--- cs/cigma/trunk/src/io_vtk_writer.cpp	                        (rev 0)
+++ cs/cigma/trunk/src/io_vtk_writer.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,232 @@
+#include "io_vtk_writer.h"
+#include "Common.h"
+#include <cassert>
+#include <cstdlib>
+
+using namespace std;
+using namespace cigma;
+
+// ----------------------------------------------------------------------------
+
+VtkWriter::VtkWriter()
+{
+    fp = 0;
+}
+
+VtkWriter::~VtkWriter()
+{
+    close();
+}
+
+// ----------------------------------------------------------------------------
+
+int VtkWriter::open(const char *filename)
+{
+    fp = fopen(filename, "w");
+    if (fp == 0)
+    {
+        return -1;
+    }
+    this->_writeHeader();
+    return 0;
+}
+
+int VtkWriter::close()
+{
+    if (fp != 0)
+    {
+        fclose(fp);
+        fp = 0;
+    }
+    return 0;
+}
+
+// ----------------------------------------------------------------------------
+
+void VtkWriter::_writeHeader()
+{
+    assert(fp != NULL);
+    fprintf(fp, "# vtk DataFile Version 3.0\n");
+    fprintf(fp, "This line is a comment\n");
+    fprintf(fp, "ASCII\n");
+    fprintf(fp, "DATASET UNSTRUCTURED_GRID\n");
+}
+
+void VtkWriter::_writePoints(double *points, int npts, int ndim)
+{
+    assert(fp != 0);
+    assert(ndim > 1);
+
+    fprintf(fp, "POINTS %d double\n", npts);
+    for (int i = 0; i < npts; i++)
+    {
+        fprintf(fp, " %g", points[ndim*i + 0]);
+        fprintf(fp, " %g", points[ndim*i + 1]);
+        if (ndim == 3)
+            fprintf(fp, " %g", points[ndim*i + 2]);
+        else
+            fprintf(fp, " 0.0");
+        fprintf(fp, "\n");
+    }
+
+}
+
+void VtkWriter::_writeCells(int *cells, int nel, int ndofs)
+{
+    assert(fp != NULL);
+
+    fprintf(fp, "CELLS %d %d\n", nel, nel*(1 + ndofs));
+    for (int i = 0; i < nel; i++)
+    {
+        fprintf(fp, " %d", ndofs);
+        for (int j = 0; j < ndofs; j++)
+        {
+            fprintf(fp, " %d", cells[ndofs*i + j]);
+        }
+        fprintf(fp, "\n");
+    }
+}
+
+void VtkWriter::_writeCellTypes(int nsd, int nel, int ndofs)
+{
+    assert(fp != NULL);
+
+    fprintf(fp, "CELL_TYPES %d\n", nel);
+
+    int vtkType = 0;
+    if (nsd == 3)
+    {
+        switch (ndofs)
+        {
+        case  4: vtkType = 10; break; // VTK_TETRA=10
+        case  8: vtkType = 12; break; // VTK_HEXAHEDRON=12
+        case  6: vtkType = 13; break; // VTK_WEDGE=13
+        case  5: vtkType = 14; break; // VTK_PYRAMID=14
+        case 10: vtkType = 24; break; // VTK_QUADRATIC_TETRA=24
+        case 20: vtkType = 25; break; // VTK_QUADRATIC_HEXAHEDRON=25
+        }
+    }
+    else if (nsd == 2)
+    {
+        switch (ndofs)
+        {
+        case 3: vtkType =  5; break; // VTK_TRIANGLE=5
+        case 4: vtkType =  9; break; // VTK_QUAD=9
+        case 6: vtkType = 22; break; // VTK_QUADRATIC_TRIANGLE=22
+        case 8: vtkType = 23; break; // VTK_QUADRATIC_QUAD=23
+        }
+    }
+    assert(vtkType > 0);
+
+    for (int i = 0; i < nel; i++)
+    {
+        fprintf(fp, "%d\n", vtkType);
+    }
+}
+
+void VtkWriter::_writePointData(const char *name, double *data, int nno, int nsd)
+{
+    assert(fp != NULL);
+
+    fprintf(fp, "POINT_DATA %d\n", nno);
+
+    if (ndim == 1)
+    {
+        fprintf(fp, "SCALARS %s double 1\n", name);
+        fprintf(fp, "LOOKUP_TABLE default\n");
+        for (int i = 0; i < nno; i++)
+        {
+            fprintf(fp, "%g\n", data[i]);
+        }
+        return;
+    }
+    else if ((ndim == 2) || (ndim == 3))
+    {
+        fprintf(fp, "VECTORS %s double\n", name);
+        for (int i = 0; i < nno; i++)
+        {
+            fprintf(fp, " %g", data[ndim*i + 0]);
+            fprintf(fp, " %g", data[ndim*i + 1]);
+            if (ndim == 3)
+                fprintf(fp, " %g\n", data[ndim*i + 2]);
+            else
+                fprintf(fp, " 0.0\n");
+        }
+    }
+    else if (ndim == 9)
+    {
+        fprintf(fp, "TENSORS %s double\n", name);
+        for (int i = 0; i < nno; i++)
+        {
+            for (int j = 0; j < ndim; j++)
+            {
+                fprintf(fp, " %g", data[ndim*i + j]);
+            }
+            fprintf(fp, "\n");
+        }
+    }
+}
+
+void VtkWriter::_writeCellData(const char *name, double *data, int nel, int ndofs)
+{
+    assert(fp != NULL);
+
+    fprintf(fp, "CELL_DATA %d\n", nel);
+
+    if (ndim == 1)
+    {
+        fprintf(fp, "SCALARS %s float 1\n", name);
+        fprintf(fp, "LOOKUP_TABLE default\n");
+        for (int i = 0; i < nel; i++)
+            fprintf(fp, "%g\n", data[i]);
+    }
+    else if ((ndim == 2) || (ndim == 3))
+    {
+        fprintf(fp, "VECTORS %s float\n", name);
+        for (int i = 0; i < nel; i++)
+        {
+            fprintf(fp, " %g", data[ndim*i + 0]);
+            fprintf(fp, " %g", data[ndim*i + 1]);
+            if (ndim == 3)
+                fprintf(fp, " %g\n", data[ndim*i + 2]);
+            else
+                fprintf(fp, " 0.0\n");
+        }
+    }
+    else if (ndim == 9)
+    {
+        fprintf(fp, "TENSORS %s float\n", name);
+        for (int i = 0; i < nel; i++)
+        {
+            for (int j = 0; j < ndim; j++)
+            {
+                fprintf(fp, " %g", data[ndim*i + j]);
+            }
+            fprintf(fp, "\n");
+        }
+    }
+}
+
+
+// ----------------------------------------------------------------------------
+
+int VtkWriter::writeDataset(const char *loc, double *data, int num, int ndim)
+{
+    TRI_LOG_STR("VtkWriter::writeDataset()");
+    return 0;
+}
+
+int VtkWriter::writeCoordinates(const char *loc, double *coordinates, int nno, int nsd)
+{
+    TRI_LOG_STR("VtkWriter::writeCoordinates()");
+    return 0;
+}
+
+int VtkWriter::writeConnectivity(const char *loc, int *connectivity, int nel, int ndofs)
+{
+    TRI_LOG_STR("VtkWriter::writeConnectivity()");
+    return 0;
+}
+
+
+// ----------------------------------------------------------------------------

Added: cs/cigma/trunk/src/io_vtk_writer.h
===================================================================
--- cs/cigma/trunk/src/io_vtk_writer.h	                        (rev 0)
+++ cs/cigma/trunk/src/io_vtk_writer.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,40 @@
+#ifndef __CIGMA_VTK_WRITER_H__
+#define __CIGMA_VTK_WRITER_H__
+
+#include <cstdio>
+#include "io_file_writer.h"
+
+namespace cigma
+{
+    class VtkWriter;
+}
+
+class cigma::VtkWriter : public FileWriter
+{
+public:
+
+    VtkWriter();
+    ~VtkWriter();
+
+    WriterType getWriterType() { return VTK_FILE_WRITER; }
+
+    int open(const char *filename);
+    int close();
+
+    int writeDataset(const char *loc, double *data, int num, int ndim);
+    int writeCoordinates(const char *loc, double *coordinates, int nno, int nsd);
+    int writeConnectivity(const char *loc, int *connectivity, int nel, int ndofs);
+
+private:
+    void _writeHeader();
+    void _writePoints(double *points, int npts, int ndim);
+    void _writeCells(int *cells, int nel, int ndofs);
+    void _writeCellTypes(int nsd, int nel, int ndofs);
+    void _writePointData(const char *name, double *data, int nno, int nsd);
+    void _writeCellData(const char *name, double *data, int nel, int ndofs);
+
+public:
+    FILE *fp;
+};
+
+#endif

Added: cs/cigma/trunk/src/nc_array.cpp
===================================================================

Added: cs/cigma/trunk/src/nc_array.h
===================================================================
--- cs/cigma/trunk/src/nc_array.h	                        (rev 0)
+++ cs/cigma/trunk/src/nc_array.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,12 @@
+#ifndef __NC_ARRAY_H__
+#define __NC_ARRAY_H__
+
+#include <boost/noncopyable.hpp>
+class nc_array : private boost::noncopyable
+{
+    nc_array();
+    ~nc_array();
+};
+
+#endif
+

Added: cs/cigma/trunk/tests/libcigma/MiscTest.cpp
===================================================================
--- cs/cigma/trunk/tests/libcigma/MiscTest.cpp	                        (rev 0)
+++ cs/cigma/trunk/tests/libcigma/MiscTest.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,18 @@
+#include "MiscTest.h"
+using namespace libcigma;
+
+
+MiscTest::MiscTest() {}
+MiscTest::~MiscTest() {}
+
+void MiscTest::test_000()
+{
+}
+
+void MiscTest::test_001()
+{
+}
+
+void MiscTest::test_002()
+{
+}

Added: cs/cigma/trunk/tests/libcigma/MiscTest.h
===================================================================
--- cs/cigma/trunk/tests/libcigma/MiscTest.h	                        (rev 0)
+++ cs/cigma/trunk/tests/libcigma/MiscTest.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,30 @@
+#ifndef __MISC_TEST_H__
+#define __MISC_TEST_H__
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+/* Use this class to tweak test functions before moving them
+ * into their own test fixture.
+ */
+namespace libcigma
+{
+    class MiscTest : public CPPUNIT_NS::TestFixture
+    {
+        CPPUNIT_TEST_SUITE(MiscTest);
+        CPPUNIT_TEST(test_000);
+        CPPUNIT_TEST(test_001);
+        CPPUNIT_TEST(test_002);
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+        MiscTest();
+        virtual ~MiscTest();
+
+        void test_000();
+        void test_001();
+        void test_002();
+    };
+}
+
+#endif

Added: cs/cigma/trunk/tests/libcigma/PointsTest.cpp
===================================================================
--- cs/cigma/trunk/tests/libcigma/PointsTest.cpp	                        (rev 0)
+++ cs/cigma/trunk/tests/libcigma/PointsTest.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,69 @@
+#include "PointsTest.h"
+using namespace libcigma;
+
+#include "Points.h"
+using namespace cigma;
+
+const double delta = 1e-6;
+
+PointsTest::PointsTest() {}
+PointsTest::~PointsTest() {}
+
+void PointsTest::test_constructors()
+{
+    double a[3] = {1.0, 2.0, 0.0};
+    double b[3] = {1.0, 2.0, 3.0};
+
+    Point<2> pt2(a,2);
+    Point<3> pt3(b,3);
+
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(pt2.get(0), 1.0, delta);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(pt2.get(1), 2.0, delta);
+
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(pt3.get(0), 1.0, delta);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(pt3.get(1), 2.0, delta);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(pt3.get(2), 3.0, delta);
+}
+
+void PointsTest::test_components()
+{
+    const int npts = 10;
+
+    double _p3[npts*3] = {
+       0.05948294,  0.04367307,  0.59626011,
+       0.92075017,  0.00598203,  0.0593541 ,
+       0.13122565,  0.85284401,  0.05385034,
+       0.57964303,  0.36077375,  0.73564646,
+       0.3029667 ,  0.42571961,  0.01736618,
+       0.98212496,  0.72743214,  0.80774034,
+       0.75353201,  0.81212867,  0.85836983,
+       0.20874043,  0.71121534,  0.37969285,
+       0.94725199,  0.41178354,  0.78322615,
+       0.90373656,  0.61975738,  0.81651674
+    };
+
+    Point<3> pt;
+    Points<float,3> dpts(npts);
+    Points<double,3> fpts(npts);
+
+    int i,j;
+    for (i = 0; i < npts; i++)
+    {
+        for (j = 0; j < 3; j++)
+        {
+            double val = _p3[3*i + j];
+            dpts.set(i, j, val);
+            fpts.set(i, j, val);
+        }
+    }
+
+    for (i = 0; i < npts; i++)
+    {
+        for (j = 0; j < 3; j++)
+        {
+            CPPUNIT_ASSERT_DOUBLES_EQUAL(dpts.get(i,j), _p3[3*i + j], delta);
+        }
+    }
+
+}
+

Added: cs/cigma/trunk/tests/libcigma/PointsTest.h
===================================================================
--- cs/cigma/trunk/tests/libcigma/PointsTest.h	                        (rev 0)
+++ cs/cigma/trunk/tests/libcigma/PointsTest.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,27 @@
+#ifndef __POINTS_TEST_H__
+#define __POINTS_TEST_H__
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "Points.h"
+
+namespace libcigma
+{
+    class PointsTest : public CPPUNIT_NS::TestFixture
+    {
+        CPPUNIT_TEST_SUITE(PointsTest);
+        CPPUNIT_TEST(test_constructors);
+        CPPUNIT_TEST(test_components);
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+        
+        PointsTest();
+        virtual ~PointsTest();
+
+        void test_constructors();
+        void test_components();
+    };
+}
+#endif

Added: cs/cigma/trunk/tests/libcigma/SkelTest.cpp
===================================================================
--- cs/cigma/trunk/tests/libcigma/SkelTest.cpp	                        (rev 0)
+++ cs/cigma/trunk/tests/libcigma/SkelTest.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,9 @@
+#include "SkelTest.h"
+using namespace libcigma;
+
+SkelTest::SkelTest() {}
+SkelTest::~SkelTest() {}
+
+void SkelTest::test_something()
+{
+}

Added: cs/cigma/trunk/tests/libcigma/SkelTest.h
===================================================================
--- cs/cigma/trunk/tests/libcigma/SkelTest.h	                        (rev 0)
+++ cs/cigma/trunk/tests/libcigma/SkelTest.h	2008-10-15 09:07:31 UTC (rev 13041)
@@ -0,0 +1,24 @@
+#ifndef __SKEL_TEST_H__
+#define __SKEL_TEST_H__
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+
+namespace libcigma
+{
+    class SkelTest : public CPPUNIT_NS::TestFixture
+    {
+        CPPUNIT_TEST_SUITE(SkelTest);
+        CPPUNIT_TEST(test_something);
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+        SkelTest();
+        virtual SkelTest();
+
+        void test_something();
+    };
+};
+
+#endif

Modified: cs/cigma/trunk/tests/test_registry.cpp
===================================================================
--- cs/cigma/trunk/tests/test_registry.cpp	2008-10-15 09:07:28 UTC (rev 13040)
+++ cs/cigma/trunk/tests/test_registry.cpp	2008-10-15 09:07:31 UTC (rev 13041)
@@ -9,6 +9,11 @@
 #include <libcigma/DataPathTest.h>
 CPPUNIT_TEST_SUITE_REGISTRATION(libcigma::DataPathTest);
 
+#include <libcigma/PointsTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION(libcigma::PointsTest);
+
 #include <libcigma/NodeCoordinatesTest.h>
 CPPUNIT_TEST_SUITE_REGISTRATION(libcigma::NodeCoordinatesTest);
 
+#include <libcigma/MiscTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION(libcigma::MiscTest);



More information about the cig-commits mailing list