[cig-commits] r14023 - in short/3D/PyLith/branches/pylith-swig: libsrc libsrc/meshio libsrc/topology libsrc/utils modulesrc/topology pylith pylith/topology unittests/libtests/meshio unittests/libtests/topology unittests/pytests/topology

brad at geodynamics.org brad at geodynamics.org
Thu Feb 5 16:09:23 PST 2009


Author: brad
Date: 2009-02-05 16:09:22 -0800 (Thu, 05 Feb 2009)
New Revision: 14023

Added:
   short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshField.py
   short/3D/PyLith/branches/pylith-swig/pylith/topology/SubMeshField.py
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.cc
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.hh
   short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMeshField.py
Removed:
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.icc
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.icc
   short/3D/PyLith/branches/pylith-swig/pylith/topology/Field.py
   short/3D/PyLith/branches/pylith-swig/pylith/topology/FieldSubMesh.py
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh
Modified:
   short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
   short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshIO.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshIO.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.icc
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/Makefile.am
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/Mesh.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/Mesh.icc
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.icc
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/topologyfwd.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/utils/sievetypes.hh
   short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Field.i
   short/3D/PyLith/branches/pylith-swig/modulesrc/topology/SubMesh.i
   short/3D/PyLith/branches/pylith-swig/modulesrc/topology/topology.i
   short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am
   short/3D/PyLith/branches/pylith-swig/pylith/topology/SubMesh.py
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/Makefile.am
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIO.cc
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIO.hh
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIOCubit.cc
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIOLagrit.cc
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/Makefile.am
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestMesh.cc
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSubMesh.cc
   short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/testdriver.py
Log:
Switched to using a template over the mesh to avoid duplication of code.

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am	2009-02-06 00:09:22 UTC (rev 14023)
@@ -22,89 +22,87 @@
 lib_LTLIBRARIES = libpylith.la
 
 libpylith_la_SOURCES = \
-	bc/BoundaryCondition.cc \
-	bc/DirichletBC.cc \
-	bc/DirichletBoundary.cc \
-	bc/Neumann.cc \
-	faults/BruneSlipFn.cc \
-	faults/ConstRateSlipFn.cc \
-	faults/CohesiveTopology.cc \
-	faults/EqKinSrc.cc \
-	faults/Fault.cc \
-	faults/FaultCohesive.cc \
-	faults/FaultCohesiveKin.cc \
-	faults/FaultCohesiveDyn.cc \
-	faults/LiuCosSlipFn.cc \
-	faults/SlipTimeFn.cc \
-	faults/StepSlipFn.cc \
-	feassemble/CellGeometry.cc \
-	feassemble/Constraint.cc \
-	feassemble/ElasticityExplicit.cc \
-	feassemble/ElasticityImplicit.cc \
-	feassemble/GeometryPoint1D.cc \
-	feassemble/GeometryPoint2D.cc \
-	feassemble/GeometryPoint3D.cc \
-	feassemble/GeometryLine1D.cc \
-	feassemble/GeometryLine2D.cc \
-	feassemble/GeometryLine3D.cc \
-	feassemble/GeometryTri2D.cc \
-	feassemble/GeometryTri3D.cc \
-	feassemble/GeometryTet3D.cc \
-	feassemble/GeometryQuad2D.cc \
-	feassemble/GeometryQuad3D.cc \
-	feassemble/GeometryHex3D.cc \
-	feassemble/Integrator.cc \
-	feassemble/IntegratorElasticity.cc \
-	feassemble/Quadrature.cc \
-	feassemble/Quadrature0D.cc \
-	feassemble/Quadrature1D.cc \
-	feassemble/Quadrature1Din2D.cc \
-	feassemble/Quadrature1Din3D.cc \
-	feassemble/Quadrature2D.cc \
-	feassemble/Quadrature2Din3D.cc \
-	feassemble/Quadrature3D.cc \
-	materials/Material.cc \
-	materials/ElasticStress1D.cc \
-	materials/ElasticStrain1D.cc \
-	materials/ElasticIsotropic3D.cc \
-	materials/ElasticMaterial.cc \
-	materials/ElasticPlaneStrain.cc \
-	materials/ElasticPlaneStress.cc \
-	materials/MaxwellIsotropic3D.cc \
-	materials/GenMaxwellIsotropic3D.cc \
-	materials/ViscoelasticMaxwell.cc \
 	meshio/BinaryIO.cc \
-	meshio/CellFilter.cc \
-	meshio/CellFilterAvg.cc \
-	meshio/DataWriter.cc \
-	meshio/DataWriterVTK.cc \
 	meshio/GMVFile.cc \
 	meshio/GMVFileAscii.cc \
 	meshio/GMVFileBinary.cc \
+	meshio/MeshBuilder.cc \
 	meshio/MeshIO.cc \
 	meshio/MeshIOAscii.cc \
 	meshio/MeshIOLagrit.cc \
-	meshio/MeshBuilder.cc \
-	meshio/OutputManager.cc \
-	meshio/OutputSolnSubset.cc \
 	meshio/PsetFile.cc \
 	meshio/PsetFileAscii.cc \
 	meshio/PsetFileBinary.cc \
-	meshio/VertexFilter.cc \
-	meshio/VertexFilterVecNorm.cc \
-	meshio/UCDFaultFile.cc \
-	topology/Distributor.cc \
-	topology/FieldBase.cc \
-	topology/Field.cc \
-	topology/FieldSubMesh.cc \
-	topology/FieldsManager.cc \
-	topology/FieldOps.cc \
 	topology/Mesh.cc \
-	topology/MeshOps.cc \
-	topology/MeshRefiner.cc \
-	topology/SubMesh.cc \
 	utils/EventLogger.cc
 
+# 	bc/BoundaryCondition.cc \
+# 	bc/DirichletBC.cc \
+# 	bc/DirichletBoundary.cc \
+# 	bc/Neumann.cc \
+# 	faults/BruneSlipFn.cc \
+# 	faults/ConstRateSlipFn.cc \
+# 	faults/CohesiveTopology.cc \
+# 	faults/EqKinSrc.cc \
+# 	faults/Fault.cc \
+# 	faults/FaultCohesive.cc \
+# 	faults/FaultCohesiveKin.cc \
+# 	faults/FaultCohesiveDyn.cc \
+# 	faults/LiuCosSlipFn.cc \
+# 	faults/SlipTimeFn.cc \
+# 	faults/StepSlipFn.cc \
+# 	feassemble/CellGeometry.cc \
+# 	feassemble/Constraint.cc \
+# 	feassemble/ElasticityExplicit.cc \
+# 	feassemble/ElasticityImplicit.cc \
+# 	feassemble/GeometryPoint1D.cc \
+# 	feassemble/GeometryPoint2D.cc \
+# 	feassemble/GeometryPoint3D.cc \
+# 	feassemble/GeometryLine1D.cc \
+# 	feassemble/GeometryLine2D.cc \
+# 	feassemble/GeometryLine3D.cc \
+# 	feassemble/GeometryTri2D.cc \
+# 	feassemble/GeometryTri3D.cc \
+# 	feassemble/GeometryTet3D.cc \
+# 	feassemble/GeometryQuad2D.cc \
+# 	feassemble/GeometryQuad3D.cc \
+# 	feassemble/GeometryHex3D.cc \
+# 	feassemble/Integrator.cc \
+# 	feassemble/IntegratorElasticity.cc \
+# 	feassemble/Quadrature.cc \
+# 	feassemble/Quadrature0D.cc \
+# 	feassemble/Quadrature1D.cc \
+# 	feassemble/Quadrature1Din2D.cc \
+# 	feassemble/Quadrature1Din3D.cc \
+# 	feassemble/Quadrature2D.cc \
+# 	feassemble/Quadrature2Din3D.cc \
+# 	feassemble/Quadrature3D.cc \
+# 	materials/Material.cc \
+# 	materials/ElasticStress1D.cc \
+# 	materials/ElasticStrain1D.cc \
+# 	materials/ElasticIsotropic3D.cc \
+# 	materials/ElasticMaterial.cc \
+# 	materials/ElasticPlaneStrain.cc \
+# 	materials/ElasticPlaneStress.cc \
+# 	materials/MaxwellIsotropic3D.cc \
+# 	materials/GenMaxwellIsotropic3D.cc \
+# 	materials/ViscoelasticMaxwell.cc \
+# 	meshio/CellFilter.cc \
+# 	meshio/CellFilterAvg.cc \
+# 	meshio/DataWriter.cc \
+# 	meshio/DataWriterVTK.cc \
+# 	meshio/OutputManager.cc \
+# 	meshio/OutputSolnSubset.cc \
+# 	meshio/VertexFilter.cc \
+# 	meshio/VertexFilterVecNorm.cc \
+# 	meshio/UCDFaultFile.cc \
+# 	topology/Distributor.cc \
+# 	topology/FieldsManager.cc \
+# 	topology/FieldOps.cc \
+# 	topology/MeshOps.cc \
+# 	topology/MeshRefiner.cc \
+# 	topology/SubMesh.cc
+
 #	topology/RefineUniform.cc \
 #	bc/AbsorbingDampers.cc
 

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.cc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.cc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -26,6 +26,9 @@
 #include <stdexcept> // USES std::runtime_error
 
 // ----------------------------------------------------------------------
+typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+
+// ----------------------------------------------------------------------
 // Set vertices and cells in mesh.
 void
 pylith::meshio::MeshBuilder::buildMesh(topology::Mesh* mesh,

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.hh	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshBuilder.hh	2009-02-06 00:09:22 UTC (rev 14023)
@@ -21,8 +21,7 @@
                                     // string_vector
 #include "spatialdata/units/unitsfwd.hh" // USES Nondimensional
 
-#define NEWPYLITHMESH 1 
-#include "pylith/utils/sievetypes.hh" // USES Obj, PETSc Mesh
+#include "pylith/topology/Mesh.hh" // USES Mesh
 
 // MeshBuilder ----------------------------------------------------------
 class pylith::meshio::MeshBuilder
@@ -76,7 +75,7 @@
    * @param meshDim Dimension of cells in mesh.
    */
   static
-  void buildFaultMesh(const ALE::Obj<SieveMesh>& fault,
+  void buildFaultMesh(const ALE::Obj<topology::Mesh::SieveMesh>& fault,
 		      ALE::Obj<ALE::Mesh>& faultBd,
 		      const double_array& coordinates,
 		      const int numVertices,

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshIO.cc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshIO.cc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -26,6 +26,11 @@
 #include <stdexcept> // USES std::runtime_error
 
 // ----------------------------------------------------------------------
+typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+typedef pylith::topology::Mesh::RealSection RealSection;
+typedef pylith::topology::Mesh::IntSection IntSection;
+
+// ----------------------------------------------------------------------
 // Constructor
 pylith::meshio::MeshIO::MeshIO(void) :
   _mesh(0),
@@ -105,7 +110,7 @@
   const ALE::Obj<SieveMesh::label_sequence>& vertices = 
     sieveMesh->depthStratum(0);
   assert(!vertices.isNull());
-  const ALE::Obj<SieveMesh::real_section_type>& coordsField =
+  const ALE::Obj<RealSection>& coordsField =
     sieveMesh->getRealSection("coordinates");
   assert(!coordsField.isNull());
 
@@ -123,7 +128,7 @@
   for(SieveMesh::label_sequence::iterator v_iter=vertices->begin();
       v_iter != verticesEnd;
       ++v_iter) {
-    const SieveMesh::real_section_type::value_type *vertexCoords = 
+    const RealSection::value_type *vertexCoords = 
       coordsField->restrictPoint(*v_iter);
     for (int iDim=0; iDim < *spaceDim; ++iDim)
       (*coordinates)[i++] = vertexCoords[iDim];
@@ -143,6 +148,7 @@
 				  int* numCorners,
 				  int* meshDim) const
 { // _getCells
+
   assert(0 != cells);
   assert(0 != numCells);
   assert(0 != meshDim);
@@ -287,8 +293,6 @@
 				  const GroupPtType type,
 				  const int_array& points)
 { // _setGroup
-  typedef SieveMesh::int_section_type::chart_type chart_type;
-
   assert(0 != _mesh);
 
   const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
@@ -296,19 +300,19 @@
 
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
   logger.stagePush("GroupCreation");
-  const ALE::Obj<SieveMesh::int_section_type>& groupField = 
-    sieveMesh->getIntSection(name);
+  const ALE::Obj<IntSection>& groupField = sieveMesh->getIntSection(name);
   assert(!groupField.isNull());
 
   const int numPoints   = points.size();
   const int numVertices = sieveMesh->depthStratum(0)->size();
   const int numCells    = sieveMesh->heightStratum(0)->size();
   if (CELL == type) {
-    groupField->setChart(chart_type(0,numCells));
+    groupField->setChart(IntSection::chart_type(0,numCells));
     for(int i=0; i < numPoints; ++i)
       groupField->setFiberDimension(points[i], 1);
   } else if (VERTEX == type) {
-    groupField->setChart(chart_type(numCells, numCells+numVertices));
+    groupField->setChart(IntSection::chart_type(numCells, 
+						numCells+numVertices));
     for(int i=0; i < numPoints; ++i)
       groupField->setFiberDimension(numCells+points[i], 1);
   } // if/else
@@ -366,8 +370,7 @@
       name = new char[len+1];
       MPI_Bcast(name, len, MPI_CHAR, 0, sieveMesh->comm());
       name[len] = 0;
-      const ALE::Obj<SieveMesh::int_section_type>& groupField = 
-	sieveMesh->getIntSection(name);
+      const ALE::Obj<IntSection>& groupField = sieveMesh->getIntSection(name);
       assert(!groupField.isNull());
       sieveMesh->allocate(groupField);
       delete [] name;
@@ -406,8 +409,6 @@
 				  GroupPtType* type,
 				  const char *name) const
 { // _getGroup
-  typedef SieveMesh::int_section_type::chart_type chart_type;
-
   assert(0 != points);
   assert(0 != type);
   assert(0 != _mesh);
@@ -415,13 +416,12 @@
   const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
   assert(!sieveMesh.isNull());
 
-  const ALE::Obj<SieveMesh::int_section_type>& groupField = 
-    sieveMesh->getIntSection(name);
+  const ALE::Obj<IntSection>& groupField = sieveMesh->getIntSection(name);
   assert(!groupField.isNull());
-  const chart_type& chart = groupField->getChart();
+  const IntSection::chart_type& chart = groupField->getChart();
   SieveMesh::point_type firstPoint;
-  chart_type::const_iterator chartEnd = chart.end();
-  for(chart_type::const_iterator c_iter=chart.begin();
+  IntSection::chart_type::const_iterator chartEnd = chart.end();
+  for(IntSection::chart_type::const_iterator c_iter=chart.begin();
       c_iter != chartEnd;
       ++c_iter) {
     if (groupField->getFiberDimension(*c_iter)) {
@@ -443,7 +443,7 @@
   points->resize(numPoints);
   int i = 0;
 
-  for(chart_type::const_iterator c_iter=chart.begin();
+  for(IntSection::chart_type::const_iterator c_iter=chart.begin();
       c_iter != chartEnd;
       ++c_iter) {
     assert(!numbering.isNull());
@@ -454,4 +454,3 @@
 
 
 // End of file
-

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshIO.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshIO.hh	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshIO.hh	2009-02-06 00:09:22 UTC (rev 14023)
@@ -32,7 +32,7 @@
 class pylith::meshio::MeshIO
 { // MeshIO
 
-// PUBLIC TYPEDEFS //////////////////////////////////////////////////////
+// PUBLIC ENUMS /////////////////////////////////////////////////////////
 public :
 
   /// Type of points in a group.

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -14,7 +14,6 @@
 
 #include "Field.hh" // implementation of class methods
 
-#include "Mesh.hh" // HASA Mesh
 #include "pylith/utils/array.hh" // USES double_array
 
 #include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
@@ -26,21 +25,28 @@
 
 // ----------------------------------------------------------------------
 // Default constructor.
-pylith::topology::Field::Field(const Mesh& mesh) :
-  _mesh(mesh)
+template<typename mesh_type>
+pylith::topology::Field<mesh_type>::Field(const mesh_type& mesh) :
+  _scale(1.0),
+  _name("unknown"),
+  _mesh(mesh),
+  _vecFieldType(OTHER),
+  _dimensionsOkay(false)
 { // constructor
 } // constructor
 
 // ----------------------------------------------------------------------
 // Destructor.
-pylith::topology::Field::~Field(void)
+template<typename mesh_type>
+pylith::topology::Field<mesh_type>::~Field(void)
 { // destructor
 } // destructor
 
 // ----------------------------------------------------------------------
 // Get spatial dimension of domain.
+template<typename mesh_type>
 int
-pylith::topology::Field::spaceDim(void) const
+pylith::topology::Field<mesh_type>::spaceDim(void) const
 { // spaceDim
   const spatialdata::geocoords::CoordSys* cs = _mesh.coordsys();
   return (0 != cs) ? cs->spaceDim() : 0;
@@ -48,19 +54,23 @@
 
 // ----------------------------------------------------------------------
 // Create seive section.
+template<typename mesh_type>
 void
-pylith::topology::Field::newSection(void)
+pylith::topology::Field<mesh_type>::newSection(void)
 { // newSection
-  _section = new MeshRealSection(_mesh.comm(), _mesh.debug());  
+  _section = new RealSection(_mesh.comm(), _mesh.debug());  
 } // newSection
 
 // ----------------------------------------------------------------------
 // Create sieve section and set chart and fiber dimesion.
+template<typename mesh_type>
 void
-pylith::topology::Field::newSection(
-			  const ALE::Obj<SieveMesh::label_sequence>& points,
-			  const int fiberDim)
+pylith::topology::Field<mesh_type>::newSection(
+				       const ALE::Obj<label_sequence>& points,
+				       const int fiberDim)
 { // newSection
+  typedef typename mesh_type::SieveMesh::point_type point_type;
+
   if (fiberDim < 0) {
     std::ostringstream msg;
     msg
@@ -69,26 +79,27 @@
     throw std::runtime_error(msg.str());
   } // if
 
-  _section = new MeshRealSection(_mesh.comm(), _mesh.debug());
+  _section = new RealSection(_mesh.comm(), _mesh.debug());
 
-  const SieveMesh::point_type pointMin = 
+  const point_type pointMin = 
     *std::min_element(points->begin(), points->end());
-  const SieveMesh::point_type pointMax = 
+  const point_type pointMax = 
     *std::max_element(points->begin(), points->end());
-  _section->setChart(MeshRealSection::chart_type(pointMin, pointMax+1));
+  _section->setChart(chart_type(pointMin, pointMax+1));
   _section->setFiberDimension(points, fiberDim);  
 } // newSection
 
 // ----------------------------------------------------------------------
 // Create sieve section and set chart and fiber dimesion.
+template<typename mesh_type>
 void
-pylith::topology::Field::newSection(const DomainEnum domain,
+pylith::topology::Field<mesh_type>::newSection(const DomainEnum domain,
 				    const int fiberDim)
 { // newSection
   const ALE::Obj<SieveMesh>& sieveMesh = _mesh.sieveMesh();
   assert(!sieveMesh.isNull());
 
-  ALE::Obj<SieveMesh::label_sequence> points;
+  ALE::Obj<label_sequence> points;
   if (VERTICES_FIELD == domain)
     points = sieveMesh->depthStratum(0);
   else if (CELLS_FIELD == domain)
@@ -103,17 +114,18 @@
 
 // ----------------------------------------------------------------------
 // Create section given chart.
+template<typename mesh_type>
 void
-pylith::topology::Field::newSection(const MeshRealSection::chart_type& chart,
-				    const int fiberDim)
+pylith::topology::Field<mesh_type>::newSection(const chart_type& chart,
+					       const int fiberDim)
 { // newSection
   if (_section.isNull())
     newSection();
 
   _section->setChart(chart);
 
-  const MeshRealSection::chart_type::const_iterator chartEnd = chart.end();
-  for (MeshRealSection::chart_type::const_iterator c_iter = chart.begin();
+  const typename chart_type::const_iterator chartEnd = chart.end();
+  for (typename chart_type::const_iterator c_iter = chart.begin();
        c_iter != chartEnd;
        ++c_iter)
     _section->setFiberDimension(*c_iter, fiberDim);
@@ -122,12 +134,13 @@
 
 // ----------------------------------------------------------------------
 // Create section with same layout as another section.
+template<typename mesh_type>
 void
-pylith::topology::Field::newSection(const Field& src)
+pylith::topology::Field<mesh_type>::newSection(const Field& src)
 { // newSection
   _vecFieldType = src._vecFieldType;
 
-  const ALE::Obj<MeshRealSection>& srcSection = src.section();
+  const ALE::Obj<RealSection>& srcSection = src.section();
   if (!srcSection.isNull() && _section.isNull())
     newSection();
 
@@ -140,8 +153,9 @@
 
 // ----------------------------------------------------------------------
 // Clear variables associated with section.
+template<typename mesh_type>
 void
-pylith::topology::Field::clear(void)
+pylith::topology::Field<mesh_type>::clear(void)
 { // clear
   if (!_section.isNull())
     _section->clear();
@@ -153,8 +167,9 @@
 
 // ----------------------------------------------------------------------
 // Allocate Sieve section.
+template<typename mesh_type>
 void
-pylith::topology::Field::allocate(void)
+pylith::topology::Field<mesh_type>::allocate(void)
 { // allocate
   assert(!_section.isNull());
 
@@ -165,8 +180,9 @@
 
 // ----------------------------------------------------------------------
 // Zero section values.
+template<typename mesh_type>
 void
-pylith::topology::Field::zero(void)
+pylith::topology::Field<mesh_type>::zero(void)
 { // zero
   if (!_section.isNull())
     _section->zero();
@@ -174,8 +190,9 @@
 
 // ----------------------------------------------------------------------
 // Complete section by assembling across processors.
+template<typename mesh_type>
 void
-pylith::topology::Field::complete(void)
+pylith::topology::Field<mesh_type>::complete(void)
 { // complete
   const ALE::Obj<SieveMesh>& sieveMesh = _mesh.sieveMesh();
   assert(!sieveMesh.isNull());
@@ -188,8 +205,9 @@
 
 // ----------------------------------------------------------------------
 // Copy field values and metadata.
+template<typename mesh_type>
 void
-pylith::topology::Field::copy(const Field& field)
+pylith::topology::Field<mesh_type>::copy(const Field& field)
 { // copy
   // Check compatibility of sections
   const int srcSize = (!field._section.isNull()) ? field._section->size() : 0;
@@ -219,10 +237,10 @@
 
   if (!_section.isNull()) {
     // Copy values from field
-    const MeshRealSection::chart_type& chart = _section->getChart();
-    const MeshRealSection::chart_type::const_iterator chartEnd = chart.end();
+    const chart_type& chart = _section->getChart();
+    const typename chart_type::const_iterator chartEnd = chart.end();
 
-    for (MeshRealSection::chart_type::const_iterator c_iter = chart.begin();
+    for (typename chart_type::const_iterator c_iter = chart.begin();
 	 c_iter != chartEnd;
 	 ++c_iter) {
       assert(field._section->getFiberDimension(*c_iter) ==
@@ -234,8 +252,9 @@
 
 // ----------------------------------------------------------------------
 // Add two fields, storing the result in one of the fields.
+template<typename mesh_type>
 void
-pylith::topology::Field::operator+=(const Field& field)
+pylith::topology::Field<mesh_type>::operator+=(const Field& field)
 { // operator+=
   // Check compatibility of sections
   const int srcSize = (!field._section.isNull()) ? field._section->size() : 0;
@@ -265,14 +284,14 @@
 
   if (!_section.isNull()) {
     // Add values from field
-    const MeshRealSection::chart_type& chart = _section->getChart();
-    const MeshRealSection::chart_type::const_iterator chartEnd = chart.end();
+    const chart_type& chart = _section->getChart();
+    const typename chart_type::const_iterator chartEnd = chart.end();
 
     // Assume fiber dimension is uniform
     const int fiberDim = _section->getFiberDimension(*chart.begin());
     double_array values(fiberDim);
 
-    for (MeshRealSection::chart_type::const_iterator c_iter = chart.begin();
+    for (typename chart_type::const_iterator c_iter = chart.begin();
 	 c_iter != chartEnd;
 	 ++c_iter) {
       assert(fiberDim == field._section->getFiberDimension(*c_iter));
@@ -285,8 +304,9 @@
 
 // ----------------------------------------------------------------------
 // Dimensionalize field.
+template<typename mesh_type>
 void
-pylith::topology::Field::dimensionalize(void)
+pylith::topology::Field<mesh_type>::dimensionalize(void)
 { // dimensionalize
   if (!_dimensionsOkay) {
     std::ostringstream msg;
@@ -296,8 +316,8 @@
   } // if
 
   if (!_section.isNull()) {
-    const MeshRealSection::chart_type& chart = _section->getChart();
-    const MeshRealSection::chart_type::const_iterator chartEnd = chart.end();
+    const chart_type& chart = _section->getChart();
+    const typename chart_type::const_iterator chartEnd = chart.end();
 
     // Assume fiber dimension is uniform
     const int fiberDim = _section->getFiberDimension(*chart.begin());
@@ -305,7 +325,7 @@
 
     spatialdata::units::Nondimensional normalizer;
 
-    for (MeshRealSection::chart_type::const_iterator c_iter = chart.begin();
+    for (typename chart_type::const_iterator c_iter = chart.begin();
 	 c_iter != chartEnd;
 	 ++c_iter) {
       assert(fiberDim == _section->getFiberDimension(*c_iter));
@@ -319,8 +339,9 @@
 
 // ----------------------------------------------------------------------
 // Print field to standard out.
+template<typename mesh_type>
 void
-pylith::topology::Field::view(const char* label)
+pylith::topology::Field<mesh_type>::view(const char* label)
 { // view
   std::string vecFieldString;
   switch(_vecFieldType)

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh	2009-02-06 00:09:22 UTC (rev 14023)
@@ -23,13 +23,43 @@
 #define pylith_topology_field_hh
 
 // Include directives ---------------------------------------------------
-#include "FieldBase.hh" // ISA FieldBase
+#include "topologyfwd.hh" // forward declarations
 
 // Field ----------------------------------------------------------------
-class pylith::topology::Field : public FieldBase
+template<typename mesh_type>
+class pylith::topology::Field
 { // Field
-  friend class TestField; // unit testing
+  friend class TestFieldMesh; // unit testing
+  friend class TestFieldSubMesh; // unit testing
 
+// PUBLIC ENUMS /////////////////////////////////////////////////////////
+public :
+
+  enum VectorFieldEnum {
+    SCALAR=0, ///< Scalar.
+    VECTOR=1, ///< Vector.
+    TENSOR=2, ///< Tensor.
+    OTHER=3, ///< Not a scalar, vector, or tensor.
+    MULTI_SCALAR=4, ///< Scalar at multiple points.
+    MULTI_VECTOR=5, ///< Vector at multiple points.
+    MULTI_TENSOR=6, ///< Tensor at multiple points.
+    MULTI_OTHER=7, ///< Not a scalar, vector, or tensor at multiple points.
+  }; // VectorFieldEnum
+
+  enum DomainEnum {
+    VERTICES_FIELD=0, ///< FieldBase over vertices.
+    CELLS_FIELD=1, ///< FieldBase over cells.
+  }; // omainEnum
+
+// PRIVATE TYPEDEFS /////////////////////////////////////////////////////
+private:
+
+  // Convenience typedefs
+  typedef typename mesh_type::RealSection RealSection;
+  typedef typename mesh_type::SieveMesh SieveMesh;
+  typedef typename SieveMesh::label_sequence label_sequence;
+  typedef typename RealSection::chart_type chart_type;
+
 // PUBLIC MEMBERS ///////////////////////////////////////////////////////
 public :
 
@@ -37,7 +67,7 @@
    *
    * @param mesh Finite-element mesh.
    */
-  Field(const Mesh& mesh);
+  Field(const mesh_type& mesh);
 
   /// Destructor.
   ~Field(void);
@@ -46,14 +76,62 @@
    *
    * @returns Sieve section.
    */
-  const ALE::Obj<MeshRealSection>& section(void) const;
+  const ALE::Obj<RealSection>& section(void) const;
 
   /** Get mesh associated with field.
    *
    * @returns Finite-element mesh.
    */
-  const Mesh& mesh(void) const;
+  const mesh_type& mesh(void) const;
 
+  /** Set name of field.
+   *
+   * @param value Name of field.
+   */
+  void name(const char* value);
+
+  /** Get name of field.
+   *
+   * @returns Name of field.
+   */
+  const char* name(void) const;
+
+  /** Set vector field type
+   *
+   * @param value Type of vector field.
+   */
+  void vectorFieldType(const VectorFieldEnum value);
+
+  /** Get vector field type
+   *
+   * @returns Type of vector field.
+   */
+  VectorFieldEnum vectorFieldType(void) const;
+
+  /** Set scale for dimensionalizing field.
+   *
+   * @param value Scale associated with field.
+   */
+  void scale(const double value);
+
+  /** Get scale for dimensionalizing field.
+   *
+   * @returns Scale associated with field.
+   */
+  double scale(void) const;
+
+  /** Set flag indicating whether it is okay to dimensionalize field.
+   *
+   * @param value True if it is okay to dimensionalize field.
+   */
+  void addDimensionOkay(const bool value);
+
+  /** Set flag indicating whether it is okay to dimensionalize field.
+   *
+   * @param value True if it is okay to dimensionalize field.
+   */
+  bool addDimensionOkay(void) const;
+
   /** Get spatial dimension of domain.
    *
    * @returns Spatial dimension of domain.
@@ -68,7 +146,7 @@
    * @param points Points over which to define section.
    * @param dim Fiber dimension for section.
    */
-  void newSection(const ALE::Obj<SieveMesh::label_sequence>& points,
+  void newSection(const ALE::Obj<label_sequence>& points,
 		  const int fiberDim);
 
   /** Create sieve section and set chart and fiber dimesion.
@@ -85,7 +163,7 @@
    * @param chart Chart defining points over which section is defined.
    * @param fiberDim Fiber dimension.
    */
-  void newSection(const MeshRealSection::chart_type& chart,
+  void newSection(const chart_type& chart,
 		  const int fiberDim);
 
   /** Create section with same layout (fiber dimension and
@@ -132,12 +210,17 @@
    */
   void view(const char* label);
 
-// PROTECTED MEMBERS ////////////////////////////////////////////////////
-protected :
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private :
 
-  const Mesh& _mesh; ///< Mesh associated with section
-  ALE::Obj<MeshRealSection> _section; ///< Real section with data
+  double _scale; ///< Dimensional scale associated with field
+  std::string _name; ///< Name of field
+  const mesh_type& _mesh; ///< Mesh associated with section
+  ALE::Obj<RealSection> _section; ///< Real section with data
+  VectorFieldEnum _vecFieldType; ///< Type of vector field
+  bool _dimensionsOkay; ///< Flag indicating it is okay to dimensionalize
 
+
 // NOT IMPLEMENTED //////////////////////////////////////////////////////
 private :
 
@@ -147,6 +230,7 @@
 }; // Field
 
 #include "Field.icc"
+#include "Field.cc"
 
 #endif // pylith_topology_field_hh
 

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.icc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.icc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -15,20 +15,86 @@
 #else
 
 // Get Sieve section.
+template<typename mesh_type>
 inline
-const ALE::Obj<pylith::MeshRealSection>&
-pylith::topology::Field::section(void) const {
+const ALE::Obj<typename mesh_type::RealSection>&
+pylith::topology::Field<mesh_type>::section(void) const {
   return _section;
 }
 
 // Get mesh associated with field.
+template<typename mesh_type>
 inline
 const
-pylith::topology::Mesh&
-pylith::topology::Field::mesh(void) const {
+mesh_type&
+pylith::topology::Field<mesh_type>::mesh(void) const {
   return _mesh;
 }
 
+// Set name of field.
+template<typename mesh_type>
+inline
+void
+pylith::topology::Field<mesh_type>::name(const char* value) {
+  _name = value;
+}
+
+// Get name of field.
+template<typename mesh_type>
+inline
+const char*
+pylith::topology::Field<mesh_type>::name(void) const {
+  return _name.c_str();
+}
+
+// Set vector field type
+template<typename mesh_type>
+inline
+void
+pylith::topology::Field<mesh_type>::vectorFieldType(const VectorFieldEnum value) {
+  _vecFieldType = value;
+}
+
+// Get vector field type
+template<typename mesh_type>
+inline
+typename pylith::topology::Field<mesh_type>::VectorFieldEnum
+pylith::topology::Field<mesh_type>::vectorFieldType(void) const {
+  return _vecFieldType;
+}
+
+// Set scale for dimensionalizing field.
+template<typename mesh_type>
+inline
+void
+pylith::topology::Field<mesh_type>::scale(const double value) {
+  _scale = value;
+}
+
+// Get scale for dimensionalizing field.
+template<typename mesh_type>
+inline
+double
+pylith::topology::Field<mesh_type>::scale(void) const {
+  return _scale;
+}
+
+// Set flag indicating whether it is okay to dimensionalize field.
+template<typename mesh_type>
+inline
+void
+pylith::topology::Field<mesh_type>::addDimensionOkay(const bool value) {
+  _dimensionsOkay = value;
+}
+
+// Set flag indicating whether it is okay to dimensionalize field.
+template<typename mesh_type>
+inline
+bool
+pylith::topology::Field<mesh_type>::addDimensionOkay(void) const {
+  return _dimensionsOkay;
+}
+
 #endif
 
 

Deleted: short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.cc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.cc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -1,34 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#include <portinfo>
-
-#include "FieldBase.hh" // implementation of class methods
-
-// ----------------------------------------------------------------------
-// Default constructor.
-pylith::topology::FieldBase::FieldBase(void) :
-  _scale(1.0),
-  _name("unknown"),
-  _vecFieldType(OTHER),
-  _dimensionsOkay(false)
-{ // constructor
-} // constructor
-
-// ----------------------------------------------------------------------
-// Destructor.
-pylith::topology::FieldBase::~FieldBase(void)
-{ // destructor
-} // destructor
-
-
-// End of file 

Deleted: short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.hh	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.hh	2009-02-06 00:09:22 UTC (rev 14023)
@@ -1,143 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-/**
- * @file libsrc/topology/FieldBase.hh
- *
- * @brief Vector field over the vertices or cells of a finite-element
- * mesh or subset of a finite-element mesh.
- *
- * Extends Sieve real general section by adding metadata.
- *
- * We could replace FieldBase, Field, and FieldSubMesh (which
- * implement a field over a finite-element and subset of the
- * finite-element mesh) by templating Field over the mesh, but this
- * would not permit as much insulation against the underlying Sieve
- * implementation. Separation into Field and FieldSubMesh results in
- * complete insulation of objects using Field and FieldSubMesh from
- * the Sieve implementation.
- */
-
-#if !defined(pylith_topology_fieldbase_hh)
-#define pylith_topology_fieldbase_hh
-
-// Include directives ---------------------------------------------------
-#include "topologyfwd.hh" // forward declarations
-
-#define NEWPYLITHMESH 1
-#include "pylith/utils/sievetypes.hh" // HASA PETSc real_section_type
-
-#include <string> // HASA std::string
-
-// FieldBase ----------------------------------------------------------------
-class pylith::topology::FieldBase
-{ // FieldBase
-  friend class TestFieldBase; // unit testing
-
-// PUBLIC ENUMS /////////////////////////////////////////////////////////
-public :
-
-  enum VectorFieldEnum {
-    SCALAR=0, ///< Scalar.
-    VECTOR=1, ///< Vector.
-    TENSOR=2, ///< Tensor.
-    OTHER=3, ///< Not a scalar, vector, or tensor.
-    MULTI_SCALAR=4, ///< Scalar at multiple points.
-    MULTI_VECTOR=5, ///< Vector at multiple points.
-    MULTI_TENSOR=6, ///< Tensor at multiple points.
-    MULTI_OTHER=7, ///< Not a scalar, vector, or tensor at multiple points.
-  }; // VectorFieldEnum
-
-  enum DomainEnum {
-    VERTICES_FIELD=0, ///< FieldBase over vertices.
-    CELLS_FIELD=1, ///< FieldBase over cells.
-  }; // omainEnum
-
-// PUBLIC MEMBERS ///////////////////////////////////////////////////////
-public :
-
-  /// Default constructor.
-  FieldBase(void);
-
-  /// Destructor.
-  ~FieldBase(void);
-
-  /** Set name of field.
-   *
-   * @param value Name of field.
-   */
-  void name(const char* value);
-
-  /** Get name of field.
-   *
-   * @returns Name of field.
-   */
-  const char* name(void) const;
-
-  /** Set vector field type
-   *
-   * @param value Type of vector field.
-   */
-  void vectorFieldType(const VectorFieldEnum value);
-
-  /** Get vector field type
-   *
-   * @returns Type of vector field.
-   */
-  VectorFieldEnum vectorFieldType(void) const;
-
-  /** Set scale for dimensionalizing field.
-   *
-   * @param value Scale associated with field.
-   */
-  void scale(const double value);
-
-  /** Get scale for dimensionalizing field.
-   *
-   * @returns Scale associated with field.
-   */
-  double scale(void) const;
-
-  /** Set flag indicating whether it is okay to dimensionalize field.
-   *
-   * @param value True if it is okay to dimensionalize field.
-   */
-  void addDimensionOkay(const bool value);
-
-  /** Set flag indicating whether it is okay to dimensionalize field.
-   *
-   * @param value True if it is okay to dimensionalize field.
-   */
-  bool addDimensionOkay(void) const;
-
-// PROTECTED MEMBERS ////////////////////////////////////////////////////
-protected :
-
-  double _scale; ///< Dimensional scale associated with field
-  std::string _name; ///< Name of field
-  VectorFieldEnum _vecFieldType; ///< Type of vector field
-  bool _dimensionsOkay; ///< Flag indicating it is okay to dimensionalize
-
-// NOT IMPLEMENTED //////////////////////////////////////////////////////
-private :
-
-  FieldBase(const FieldBase&); ///< Not implemented
-  const FieldBase& operator=(const FieldBase&); ///< Not implemented
-
-}; // FieldBase
-
-#include "FieldBase.icc"
-
-#endif // pylith_topology_fieldbase_hh
-
-
-// End of file 

Deleted: short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.icc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.icc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -1,76 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#if !defined(pylith_topology_fieldbase_hh)
-#error "FieldBase.icc must be included only from FieldBase.hh"
-#else
-
-// Set name of field.
-inline
-void
-pylith::topology::FieldBase::name(const char* value) {
-  _name = value;
-}
-
-// Get name of field.
-inline
-const char*
-pylith::topology::FieldBase::name(void) const {
-  return _name.c_str();
-}
-
-// Set vector field type
-inline
-void
-pylith::topology::FieldBase::vectorFieldType(const VectorFieldEnum value) {
-  _vecFieldType = value;
-}
-
-// Get vector field type
-inline
-pylith::topology::FieldBase::VectorFieldEnum
-pylith::topology::FieldBase::vectorFieldType(void) const {
-  return _vecFieldType;
-}
-
-// Set scale for dimensionalizing field.
-inline
-void
-pylith::topology::FieldBase::scale(const double value) {
-  _scale = value;
-}
-
-// Get scale for dimensionalizing field.
-inline
-double
-pylith::topology::FieldBase::scale(void) const {
-  return _scale;
-}
-
-// Set flag indicating whether it is okay to dimensionalize field.
-inline
-void
-pylith::topology::FieldBase::addDimensionOkay(const bool value) {
-  _dimensionsOkay = value;
-}
-
-// Set flag indicating whether it is okay to dimensionalize field.
-inline
-bool
-pylith::topology::FieldBase::addDimensionOkay(void) const {
-  return _dimensionsOkay;
-}
-
-#endif
-
-
-// End of file

Deleted: short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.cc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.cc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -1,368 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#include <portinfo>
-
-#include "FieldSubMesh.hh" // implementation of class methods
-
-#include "SubMesh.hh" // HASA SubMesh
-#include "pylith/utils/array.hh" // USES double_array
-
-#include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
-#include "spatialdata/units/Nondimensional.hh" // USES Nondimensional
-
-#include <stdexcept> // USES std::runtime_error
-#include <sstream> // USES std::ostringstream
-#include <cassert> // USES assert()
-
-// ----------------------------------------------------------------------
-// Default constructor.
-pylith::topology::FieldSubMesh::FieldSubMesh(const SubMesh& mesh) :
-  _mesh(mesh)
-{ // constructor
-} // constructor
-
-// ----------------------------------------------------------------------
-// Destructor.
-pylith::topology::FieldSubMesh::~FieldSubMesh(void)
-{ // destructor
-} // destructor
-
-// ----------------------------------------------------------------------
-// Get spatial dimension of domain.
-int
-pylith::topology::FieldSubMesh::spaceDim(void) const
-{ // spaceDim
-  const spatialdata::geocoords::CoordSys* cs = _mesh.coordsys();
-  return (0 != cs) ? cs->spaceDim() : 0;
-} // spaceDim
-
-// ----------------------------------------------------------------------
-// Create seive section.
-void
-pylith::topology::FieldSubMesh::newSection(void)
-{ // newSection
-  _section = new SubMeshRealSection(_mesh.comm(), _mesh.debug());  
-} // newSection
-
-// ----------------------------------------------------------------------
-// Create sieve section and set chart and fiber dimesion.
-void
-pylith::topology::FieldSubMesh::newSection(
-			  const ALE::Obj<SieveSubMesh::label_sequence>& points,
-			  const int fiberDim)
-{ // newSection
-  if (fiberDim < 0) {
-    std::ostringstream msg;
-    msg
-      << "Fiber dimension (" << fiberDim << ") for field '" << _name
-      << "' must be nonnegative.";
-    throw std::runtime_error(msg.str());
-  } // if
-
-  _section = new SubMeshRealSection(_mesh.comm(), _mesh.debug());
-
-  const SieveSubMesh::point_type pointMin = 
-    *std::min_element(points->begin(), points->end());
-  const SieveSubMesh::point_type pointMax = 
-    *std::max_element(points->begin(), points->end());
-  _section->setChart(SubMeshRealSection::chart_type(pointMin, pointMax+1));
-  _section->setFiberDimension(points, fiberDim);  
-} // newSection
-
-// ----------------------------------------------------------------------
-// Create sieve section and set chart and fiber dimesion.
-void
-pylith::topology::FieldSubMesh::newSection(const DomainEnum domain,
-					   const int fiberDim)
-{ // newSection
-  const ALE::Obj<SieveSubMesh>& sieveMesh = _mesh.sieveMesh();
-  assert(!sieveMesh.isNull());
-
-  ALE::Obj<SieveSubMesh::label_sequence> points;
-  if (VERTICES_FIELD == domain)
-    points = sieveMesh->depthStratum(0);
-  else if (CELLS_FIELD == domain)
-    points = sieveMesh->heightStratum(1);
-  else {
-    std::cerr << "Unknown value for DomainEnum: " << domain << std::endl;
-    assert(0);
-  } // else
-
-  newSection(points, fiberDim);
-} // newSection
-
-// ----------------------------------------------------------------------
-// Create section given chart.
-void
-pylith::topology::FieldSubMesh::newSection(
-			const SubMeshRealSection::chart_type& chart,
-			const int fiberDim)
-{ // newSection
-  if (_section.isNull())
-    FieldSubMesh::newSection();
-
-  _section->setChart(chart);
-
-  const SubMeshRealSection::chart_type::const_iterator chartEnd = chart.end();
-  for (SubMeshRealSection::chart_type::const_iterator c_iter = chart.begin();
-       c_iter != chartEnd;
-       ++c_iter)
-    _section->setFiberDimension(*c_iter, fiberDim);
-  allocate();
-} // newSection
-
-// ----------------------------------------------------------------------
-// Create section with same layout as another section.
-void
-pylith::topology::FieldSubMesh::newSection(const FieldSubMesh& src)
-{ // newSection
-  _vecFieldType = src._vecFieldType;
-
-  const ALE::Obj<SubMeshRealSection>& srcSection = src.section();
-  if (!srcSection.isNull() && _section.isNull())
-    newSection();
-
-  if (!_section.isNull()) {
-    _section->setAtlas(srcSection->getAtlas());
-    _section->allocateStorage();
-    _section->setBC(srcSection->getBC());
-  } // if
-} // newSection
-
-// ----------------------------------------------------------------------
-// Clear variables associated with section.
-void
-pylith::topology::FieldSubMesh::clear(void)
-{ // clear
-  if (!_section.isNull())
-    _section->clear();
-
-  _scale = 1.0;
-  _vecFieldType = OTHER;
-  _dimensionsOkay = false;
-} // clear
-
-// ----------------------------------------------------------------------
-// Allocate Sieve section.
-void
-pylith::topology::FieldSubMesh::allocate(void)
-{ // allocate
-  assert(!_section.isNull());
-
-  const ALE::Obj<SieveSubMesh>& sieveMesh = _mesh.sieveMesh();
-  assert(!sieveMesh.isNull());
-  sieveMesh->allocate(_section);
-} // allocate
-
-// ----------------------------------------------------------------------
-// Zero section values.
-void
-pylith::topology::FieldSubMesh::zero(void)
-{ // zero
-  if (!_section.isNull())
-    _section->zero();
-} // zero
-
-// ----------------------------------------------------------------------
-// Complete section by assembling across processors.
-void
-pylith::topology::FieldSubMesh::complete(void)
-{ // complete
-  const ALE::Obj<SieveSubMesh>& sieveMesh = _mesh.sieveMesh();
-  assert(!sieveMesh.isNull());
-
-  if (!_section.isNull())
-    ALE::Completion::completeSectionAdd(sieveMesh->getSendOverlap(),
-					sieveMesh->getRecvOverlap(), 
-					_section, _section);
-} // complete
-
-// ----------------------------------------------------------------------
-// Copy field values and metadata.
-void
-pylith::topology::FieldSubMesh::copy(const FieldSubMesh& field)
-{ // copy
-  // Check compatibility of sections
-  const int srcSize = (!field._section.isNull()) ? field._section->size() : 0;
-  const int dstSize = (!_section.isNull()) ? _section->size() : 0;
-  if (field.spaceDim() != spaceDim() ||
-      field._vecFieldType != _vecFieldType ||
-      field._scale != _scale ||
-      srcSize != dstSize) {
-    std::ostringstream msg;
-
-    msg << "Cannot copy values from section '" << field._name 
-	<< "' to section '" << _name << "'. Sections are incompatible.\n"
-	<< "  Source section:\n"
-	<< "    space dim: " << field.spaceDim() << "\n"
-	<< "    vector field type: " << field._vecFieldType << "\n"
-	<< "    scale: " << field._scale << "\n"
-	<< "    size: " << srcSize
-	<< "  Destination section:\n"
-	<< "    space dim: " << spaceDim() << "\n"
-	<< "    vector field type: " << _vecFieldType << "\n"
-	<< "    scale: " << _scale << "\n"
-	<< "    size: " << dstSize;
-    throw std::runtime_error(msg.str());
-  } // if
-  assert( (_section.isNull() && field._section.isNull()) ||
-	  (!_section.isNull() && !field._section.isNull()) );
-
-  if (!_section.isNull()) {
-    // Copy values from field
-    const SubMeshRealSection::chart_type& chart = _section->getChart();
-    const SubMeshRealSection::chart_type::const_iterator chartEnd = chart.end();
-
-    for (SubMeshRealSection::chart_type::const_iterator c_iter = chart.begin();
-	 c_iter != chartEnd;
-	 ++c_iter) {
-      assert(field._section->getFiberDimension(*c_iter) ==
-	     _section->getFiberDimension(*c_iter));
-      _section->updatePoint(*c_iter, field._section->restrictPoint(*c_iter));
-    } // for
-  } // if
-} // copy
-
-// ----------------------------------------------------------------------
-// Add two fields, storing the result in one of the fields.
-void
-pylith::topology::FieldSubMesh::operator+=(const FieldSubMesh& field)
-{ // operator+=
-  // Check compatibility of sections
-  const int srcSize = (!field._section.isNull()) ? field._section->size() : 0;
-  const int dstSize = (!_section.isNull()) ? _section->size() : 0;
-  if (field.spaceDim() != spaceDim() ||
-      field._vecFieldType != _vecFieldType ||
-      field._scale != _scale ||
-      srcSize != dstSize) {
-    std::ostringstream msg;
-
-    msg << "Cannot add values from section '" << field._name 
-	<< "' to section '" << _name << "'. Sections are incompatible.\n"
-	<< "  Source section:\n"
-	<< "    space dim: " << field.spaceDim() << "\n"
-	<< "    vector field type: " << field._vecFieldType << "\n"
-	<< "    scale: " << field._scale << "\n"
-	<< "    size: " << srcSize
-	<< "  Destination section:\n"
-	<< "    space dim: " << spaceDim() << "\n"
-	<< "    vector field type: " << _vecFieldType << "\n"
-	<< "    scale: " << _scale << "\n"
-	<< "    size: " << dstSize;
-    throw std::runtime_error(msg.str());
-  } // if
-  assert( (_section.isNull() && field._section.isNull()) ||
-	  (!_section.isNull() && !field._section.isNull()) );
-
-  if (!_section.isNull()) {
-    // Add values from field
-    const SubMeshRealSection::chart_type& chart = _section->getChart();
-    const SubMeshRealSection::chart_type::const_iterator chartEnd = chart.end();
-
-    // Assume fiber dimension is uniform
-    const int fiberDim = _section->getFiberDimension(*chart.begin());
-    double_array values(fiberDim);
-
-    for (SubMeshRealSection::chart_type::const_iterator c_iter = chart.begin();
-	 c_iter != chartEnd;
-	 ++c_iter) {
-      assert(fiberDim == field._section->getFiberDimension(*c_iter));
-      assert(fiberDim == _section->getFiberDimension(*c_iter));
-      field._section->restrictPoint(*c_iter, &values[0], values.size());
-      _section->updateAddPoint(*c_iter, &values[0]);
-    } // for
-  } // if
-} // operator+=
-
-// ----------------------------------------------------------------------
-// Dimensionalize field.
-void
-pylith::topology::FieldSubMesh::dimensionalize(void)
-{ // dimensionalize
-  if (!_dimensionsOkay) {
-    std::ostringstream msg;
-    msg << "Cannot dimensionalize field '" << _name << "' because the flag "
-	<< "has been set to keep field nondimensional.";
-    throw std::runtime_error(msg.str());
-  } // if
-
-  if (!_section.isNull()) {
-    const SubMeshRealSection::chart_type& chart = _section->getChart();
-    const SubMeshRealSection::chart_type::const_iterator chartEnd = chart.end();
-
-    // Assume fiber dimension is uniform
-    const int fiberDim = _section->getFiberDimension(*chart.begin());
-    double_array values(fiberDim);
-
-    spatialdata::units::Nondimensional normalizer;
-
-    for (SubMeshRealSection::chart_type::const_iterator c_iter = chart.begin();
-	 c_iter != chartEnd;
-	 ++c_iter) {
-      assert(fiberDim == _section->getFiberDimension(*c_iter));
-      
-      _section->restrictPoint(*c_iter, &values[0], values.size());
-      normalizer.dimensionalize(&values[0], values.size(), _scale);
-      _section->updatePoint(*c_iter, &values[0]);
-    } // for
-  } // if
-} // dimensionalize
-
-// ----------------------------------------------------------------------
-// Print field to standard out.
-void
-pylith::topology::FieldSubMesh::view(const char* label)
-{ // view
-  std::string vecFieldSubMeshString;
-  switch(_vecFieldType)
-    { // switch
-    case SCALAR:
-      vecFieldSubMeshString = "scalar";
-      break;
-    case VECTOR:
-      vecFieldSubMeshString = "vector";
-      break;
-    case TENSOR:
-      vecFieldSubMeshString = "tensor";
-      break;
-    case OTHER:
-      vecFieldSubMeshString = "other";
-      break;
-    case MULTI_SCALAR:
-      vecFieldSubMeshString = "multiple scalars";
-      break;
-    case MULTI_VECTOR:
-      vecFieldSubMeshString = "multiple vectors";
-      break;
-    case MULTI_TENSOR:
-      vecFieldSubMeshString = "multiple tensors";
-      break;
-    case MULTI_OTHER:
-      vecFieldSubMeshString = "multiple other values";
-      break;
-    default :
-      std::cerr << "Unknown vector field value '" << _vecFieldType
-		<< "'." << std::endl;
-      assert(0);
-    } // switch
-
-  std::cout << "Viewing field '" << _name << "' "<< label << ".\n"
-	    << "  vector field type: " << vecFieldSubMeshString << "\n"
-	    << "  scale: " << _scale << "\n"
-	    << "  dimensionalize flag: " << _dimensionsOkay << std::endl;
-  if (!_section.isNull())
-    _section->view(label);
-} // view
-
-
-// End of file 

Deleted: short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.hh	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.hh	2009-02-06 00:09:22 UTC (rev 14023)
@@ -1,154 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-/**
- * @file libsrc/topology/FieldSubMesh.hh
- *
- * @brief Vector field over the vertices or cells of a lower dimension
- * portion of a finite-element mesh.
- *
- * Extends Sieve real general section by adding metadata.
- */
-
-#if !defined(pylith_topology_fieldsubmesh_hh)
-#define pylith_topology_fieldsubmesh_hh
-
-// Include directives ---------------------------------------------------
-#include "FieldBase.hh" // ISA FieldBase
-
-// FieldSubMesh ---------------------------------------------------------
-class pylith::topology::FieldSubMesh : public FieldBase
-{ // FieldSubMesh
-  friend class TestFieldSubMesh; // unit testing
-
-// PUBLIC MEMBERS ///////////////////////////////////////////////////////
-public :
-
-  /** Default constructor.
-   *
-   * @param mesh Lower dimension finite-element mesh.
-   */
-  FieldSubMesh(const SubMesh& mesh);
-
-  /// Destructor.
-  ~FieldSubMesh(void);
-
-  /** Get Sieve section.
-   *
-   * @returns Sieve section.
-   */
-  const ALE::Obj<SubMeshRealSection>& section(void) const;
-
-  /** Get mesh associated with field.
-   *
-   * @returns Lower-dimension finite-element mesh.
-   */
-  const SubMesh& mesh(void) const;
-
-  /** Get spatial dimension of domain.
-   *
-   * @returns Spatial dimension of domain.
-   */
-  int spaceDim(void) const;
-
-  /// Create sieve section.
-  void newSection(void);
-
-  /** Create sieve section and set chart and fiber dimesion.
-   *
-   * @param points Points over which to define section.
-   * @param dim Fiber dimension for section.
-   */
-  void newSection(const ALE::Obj<SieveSubMesh::label_sequence>& points,
-		  const int fiberDim);
-
-  /** Create sieve section and set chart and fiber dimesion.
-   *
-   * @param domain Type of points over which to define section.
-   * @param dim Fiber dimension for section.
-   */
-  void newSection(const DomainEnum domain,
-		  const int fiberDim);
-
-  /** Create section given chart. This allows a chart to be reused
-   * across multiple fields, reducing memory usage.
-   *
-   * @param chart Chart defining points over which section is defined.
-   * @param fiberDim Fiber dimension.
-   */
-  void newSection(const SubMeshRealSection::chart_type& chart,
-		  const int fiberDim);
-
-  /** Create section with same layout (fiber dimension and
-   * constraints) as another section. This allows the layout data
-   * structures to be reused across multiple fields, reducing memory
-   * usage.
-   *
-   * @param sec Section defining layout.
-   */
-  void newSection(const FieldSubMesh& src);
-
-  /// Clear variables associated with section.
-  void clear(void);
-
-  /// Allocate field.
-  void allocate(void);
-
-  /// Zero section values.
-  void zero(void);
-
-  /// Complete section by assembling across processors.
-  void complete(void);
-
-  /** Copy field values and metadata.
-   *
-   * @param field FieldSubMesh to copy.
-   */
-  void copy(const FieldSubMesh& field);
-
-  /** Add two fields, storing the result in one of the fields.
-   *
-   * @param field FieldSubMesh to add.
-   */
-  void operator+=(const FieldSubMesh& field);
-
-  /** Dimensionalize field. Throws runtime_error if field is not
-   * allowed to be dimensionalized.
-   */
-  void dimensionalize(void);
-
-  /** Print field to standard out.
-   *
-   * @param label Label for output.
-   */
-  void view(const char* label);
-
-// PROTECTED MEMBERS ////////////////////////////////////////////////////
-protected :
-
-  const SubMesh& _mesh; ///< Mesh associated with section
-  ALE::Obj<SubMeshRealSection> _section; ///< Real section with data
-
-// NOT IMPLEMENTED //////////////////////////////////////////////////////
-private :
-
-  FieldSubMesh(const FieldSubMesh&); ///< Not implemented
-  const FieldSubMesh& operator=(const FieldSubMesh&); ///< Not implemented
-
-}; // FieldSubMesh
-
-#include "FieldSubMesh.icc"
-
-#endif // pylith_topology_fieldsubmesh_hh
-
-
-// End of file 

Deleted: short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.icc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.icc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -1,35 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#if !defined(pylith_topology_fieldsubmesh_hh)
-#error "FieldSubMesh.icc must be included only from FieldSubMesh.hh"
-#else
-
-// Get Sieve section.
-inline
-const ALE::Obj<pylith::SubMeshRealSection>&
-pylith::topology::FieldSubMesh::section(void) const {
-  return _section;
-}
-
-// Get mesh associated with field.
-inline
-const
-pylith::topology::SubMesh&
-pylith::topology::FieldSubMesh::mesh(void) const {
-  return _mesh;
-}
-
-#endif
-
-
-// End of file

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Makefile.am	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Makefile.am	2009-02-06 00:09:22 UTC (rev 14023)
@@ -15,12 +15,9 @@
 
 subpkginclude_HEADERS = \
 	Distributor.hh \
-	FieldBase.hh \
-	FieldBase.icc \
 	Field.hh \
 	Field.icc \
-	FieldSubMesh.hh \
-	FieldSubMesh.icc \
+	Field.cc \
 	Fields.hh \
 	Fields.icc \
 	Mesh.hh \
@@ -30,6 +27,7 @@
 	RefineUniform.hh \
 	SubMesh.hh \
 	SubMesh.icc \
+	SubMesh.cc \
 	topologyfwd.hh
 
 noinst_HEADERS =

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Mesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Mesh.hh	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Mesh.hh	2009-02-06 00:09:22 UTC (rev 14023)
@@ -26,14 +26,30 @@
 #include "topologyfwd.hh" // forward declarations
 #include "spatialdata/geocoords/geocoordsfwd.hh" // forward declarations
 
-#define NEWPYLITHMESH 1 
-#include "pylith/utils/sievetypes.hh"
+#include <petscmesh.hh> // HASA ALE::IMesh
 
 // Mesh -----------------------------------------------------------------
 class pylith::topology::Mesh
 { // Mesh
   friend class TestMesh; // unit testing
 
+// PUBLIC TYPEDEFS //////////////////////////////////////////////////////
+public :
+
+  // Typedefs for basic types associated with Sieve mesh.
+  // All other PyLith mesh and submesh objects should define:
+  //   (1) SieveMesh - Sieve mesh
+  //   (2) RealSection - Section of doubles
+  //   (3) IntSection - Section of ints
+  // because these are used in templated code.
+  // 
+  // All other mesh objects for the domain should also define
+  //   (1) SieveSubMesh - SubMesh object
+  typedef ALE::IMesh<> SieveMesh;
+  typedef SieveMesh::real_section_type RealSection;
+  typedef SieveMesh::int_section_type IntSection;
+  typedef ALE::IMesh<ALE::LabelSifter<int, SieveMesh::point_type> > SieveSubMesh;
+
 // PUBLIC METHODS ///////////////////////////////////////////////////////
 public :
 

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Mesh.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Mesh.icc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Mesh.icc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -16,14 +16,14 @@
 
 // Get Sieve mesh.
 inline
-const ALE::Obj<pylith::SieveMesh>&
+const ALE::Obj<pylith::topology::Mesh::SieveMesh>&
 pylith::topology::Mesh::sieveMesh(void) const {
   return _mesh;
 }
 
 // Get Sieve mesh.
 inline
-ALE::Obj<pylith::SieveMesh>&
+ALE::Obj<pylith::topology::Mesh::SieveMesh>&
 pylith::topology::Mesh::sieveMesh(void) {
   return _mesh;
 }

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.cc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.cc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -12,16 +12,14 @@
 
 #include <portinfo>
 
-#include "SubMesh.hh" // implementation of class methods
-
-#include "Mesh.hh" // USES Mesh
 #include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
 
 #include <Selection.hh> // USES ALE::Selection
 
 // ----------------------------------------------------------------------
 // Default constructor
-pylith::topology::SubMesh::SubMesh(void) :
+template<typename mesh_type>
+pylith::topology::SubMesh<mesh_type>::SubMesh(void) :
   _coordsys(0),
   _debug(false)
 { // constructor
@@ -29,8 +27,9 @@
 
 // ----------------------------------------------------------------------
 // Constructor with mesh and label for vertices marking boundary.
-pylith::topology::SubMesh::SubMesh(const Mesh& mesh,
-				   const char* label) :
+template<typename mesh_type>
+pylith::topology::SubMesh<mesh_type>::SubMesh(const mesh_type& mesh,
+					      const char* label) :
   _coordsys(0),
   _debug(false)
 { // constructor
@@ -39,32 +38,42 @@
 
 // ----------------------------------------------------------------------
 // Default destructor
-pylith::topology::SubMesh::~SubMesh(void)
+template<typename mesh_type>
+pylith::topology::SubMesh<mesh_type>::~SubMesh(void)
 { // destructor
   delete _coordsys; _coordsys = 0;
 } // destructor
 
 // ----------------------------------------------------------------------
 // Create Sieve mesh.
+template<typename mesh_type>
 void
-pylith::topology::SubMesh::createSubMesh(const Mesh& mesh,
-					 const char* label)
+pylith::topology::SubMesh<mesh_type>::createSubMesh(const mesh_type& mesh,
+						    const char* label)
 { // createSieveMesh
   _mesh.destroy();
 
-  const ALE::Obj<SieveMesh>& meshSieveMesh = mesh.sieveMesh();
+  const ALE::Obj<DomainSieveMesh>& meshSieveMesh = mesh.sieveMesh();
   assert(!meshSieveMesh.isNull());
 
-  const ALE::Obj<SieveMesh::int_section_type>& groupField = 
-    meshSieveMesh->getIntSection(label);
+  const ALE::Obj<IntSection>& groupField = meshSieveMesh->getIntSection(label);
   if (groupField.isNull()) {
     std::ostringstream msg;
     msg << "Could not find group of points '" << label << "' in mesh.";
     throw std::runtime_error(msg.str());
   } // if
+#if 0
+  // QUESTION FOR MATT
+  // Why doesn't this work?
+  // SieveMesh and SieveSubMesh are typedefs in SubMesh.hh
   _mesh = 
-    ALE::Selection<SieveMesh>::submeshV<SieveSubMesh>(meshSieveMesh,
-						      groupField);
+    ALE::Selection<DomainSieveMesh>::submeshV<SieveMesh>(meshSieveMesh,
+							 groupField);
+#else
+  _mesh = 
+    ALE::Selection<ALE::IMesh<> >::submeshV<SieveMesh>(meshSieveMesh,
+						       groupField);
+#endif
   if (_mesh.isNull()) {
     std::ostringstream msg;
     msg << "Could not construct boundary mesh for boundary '"
@@ -75,13 +84,15 @@
 			meshSieveMesh->getRealSection("coordinates"));
 
   // Create the parallel overlap
-  ALE::Obj<SieveSubMesh::send_overlap_type> sendParallelMeshOverlap =
+  ALE::Obj<typename SieveMesh::send_overlap_type> sendParallelMeshOverlap =
     _mesh->getSendOverlap();
-  ALE::Obj<SieveSubMesh::recv_overlap_type> recvParallelMeshOverlap =
+  ALE::Obj<typename SieveMesh::recv_overlap_type> recvParallelMeshOverlap =
     _mesh->getRecvOverlap();
-  SieveMesh::renumbering_type& renumbering = meshSieveMesh->getRenumbering();
+  typename DomainSieveMesh::renumbering_type& renumbering = 
+    meshSieveMesh->getRenumbering();
   //   Can I figure this out in a nicer way?
-  ALE::SetFromMap<std::map<SieveMesh::point_type,SieveMesh::point_type> > globalPoints(renumbering);
+  ALE::SetFromMap<std::map<typename DomainSieveMesh::point_type,
+    typename DomainSieveMesh::point_type> > globalPoints(renumbering);
 
   ALE::OverlapBuilder<>::constructOverlap(globalPoints, renumbering,
 					  sendParallelMeshOverlap,
@@ -98,8 +109,9 @@
 
 // ----------------------------------------------------------------------
 // Initialize the finite-element mesh.
+template<typename mesh_type>
 void 
-pylith::topology::SubMesh::initialize(void)
+pylith::topology::SubMesh<mesh_type>::initialize(void)
 { // initialize
   if (0 != _coordsys)
     _coordsys->initialize();

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.hh	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.hh	2009-02-06 00:09:22 UTC (rev 14023)
@@ -26,14 +26,24 @@
 #include "topologyfwd.hh" // forward declarations
 #include "spatialdata/geocoords/geocoordsfwd.hh" // forward declarations
 
-#define NEWPYLITHMESH 1 
-#include "pylith/utils/sievetypes.hh"
-
 // SubMesh -----------------------------------------------------------------
+template<typename mesh_type>
 class pylith::topology::SubMesh
 { // SubMesh
   friend class TestSubMesh; // unit testing
 
+// PUBLIC TYPEDEFS //////////////////////////////////////////////////////
+public:
+
+  // Typedefs for basic types associated with Sieve mesh.
+  // SieveMesh, RealSection, and IntSection are used in templated code.
+  typedef typename mesh_type::SieveSubMesh SieveMesh;
+  typedef typename mesh_type::RealSection  RealSection;
+  typedef typename mesh_type::IntSection IntSection;
+
+  // Sieve mesh for higher level domain (mesh, not submesh)
+  typedef typename mesh_type::SieveMesh DomainSieveMesh;
+
 // PUBLIC METHODS ///////////////////////////////////////////////////////
 public :
 
@@ -45,7 +55,7 @@
    * @param mesh Finite-element mesh over domain.
    * @param label Label for vertices marking boundary.
    */
-  SubMesh(const Mesh& mesh,
+  SubMesh(const mesh_type& mesh,
 	  const char* label);
 
   /// Default destructor
@@ -56,20 +66,20 @@
    * @param mesh Finite-element mesh over domain.
    * @param label Label for vertices marking boundary.
    */
-  void createSubMesh(const Mesh& mesh,
+  void createSubMesh(const mesh_type& mesh,
 		     const char* label); 
 
   /** Get Sieve mesh.
    *
    * @returns Sieve mesh.
    */
-  const ALE::Obj<SieveSubMesh>& sieveMesh(void) const;
+  const ALE::Obj<SieveMesh>& sieveMesh(void) const;
 
   /** Get Sieve mesh.
    *
    * @returns Sieve mesh.
    */
-  ALE::Obj<SieveSubMesh>& sieveMesh(void);
+  ALE::Obj<SieveMesh>& sieveMesh(void);
 
   /** Get coordinate system.
    *
@@ -113,7 +123,7 @@
 // PRIVATE MEMBERS //////////////////////////////////////////////////////
 private :
 
-  ALE::Obj<SieveSubMesh> _mesh; ///< Sieve mesh.
+  ALE::Obj<SieveMesh> _mesh; ///< Sieve mesh.
   spatialdata::geocoords::CoordSys* _coordsys; ///< Coordinate system.
   bool _debug; ///< Debugging flag for mesh.
   
@@ -126,6 +136,7 @@
 }; // SubMesh
 
 #include "SubMesh.icc"
+#include "SubMesh.cc"
 
 #endif // pylith_topology_submesh_hh
 

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.icc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.icc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -15,60 +15,68 @@
 #else
 
 // Get Sieve mesh.
+template<typename mesh_type>
 inline
-const ALE::Obj<pylith::SieveSubMesh>&
-pylith::topology::SubMesh::sieveMesh(void) const {
+const ALE::Obj<typename mesh_type::SieveSubMesh>&
+pylith::topology::SubMesh<mesh_type>::sieveMesh(void) const {
   return _mesh;
 }
 
 // Get Sieve mesh.
+template<typename mesh_type>
 inline
-ALE::Obj<pylith::SieveSubMesh>&
-pylith::topology::SubMesh::sieveMesh(void) {
+ALE::Obj<typename mesh_type::SieveSubMesh>&
+pylith::topology::SubMesh<mesh_type>::sieveMesh(void) {
   return _mesh;
 }
 
 // Get coordinate system.
+template<typename mesh_type>
 inline
 const spatialdata::geocoords::CoordSys*
-pylith::topology::SubMesh::coordsys(void) const {
+pylith::topology::SubMesh<mesh_type>::coordsys(void) const {
   return _coordsys;
 }
 
 // Set debug flag.
+template<typename mesh_type>
 inline
 void
-pylith::topology::SubMesh::debug(const bool value) {
+pylith::topology::SubMesh<mesh_type>::debug(const bool value) {
   _debug = value;
   if (!_mesh.isNull())
     _mesh->setDebug(value);
 }
 
 // Get debug flag.
+template<typename mesh_type>
 inline
 bool
-pylith::topology::SubMesh::debug(void) const {
+pylith::topology::SubMesh<mesh_type>::debug(void) const {
   return _debug;
 }
 
 // Get dimension of mesh.
+template<typename mesh_type>
 inline
 int
-pylith::topology::SubMesh::dimension(void) const {
+pylith::topology::SubMesh<mesh_type>::dimension(void) const {
   return (!_mesh.isNull()) ? _mesh->getDimension() : 0;
 }
 
 // Get MPI communicator associated with mesh.
+template<typename mesh_type>
 inline
 const MPI_Comm
-pylith::topology::SubMesh::comm(void) const {
+pylith::topology::SubMesh<mesh_type>::comm(void) const {
   return (!_mesh.isNull()) ? _mesh->comm() : 0;
 }
     
 // Print mesh to stdout.
+template<typename mesh_type>
 inline
 void
-pylith::topology::SubMesh::view(const char* label) {
+pylith::topology::SubMesh<mesh_type>::view(const char* label) {
   _mesh->view(label);
 }
 

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/topologyfwd.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/topologyfwd.hh	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/topologyfwd.hh	2009-02-06 00:09:22 UTC (rev 14023)
@@ -25,21 +25,22 @@
   namespace topology {
 
     class Mesh;
-    class SubMesh;
+    template<typename mesh_type> class SubMesh;
+    template<typename mesh_type> class Field;
+
+#if 0
     class MeshOps;
 
-    class FieldBase;
-    class Field;
-    class FieldSubMesh;
-    template<typename field_type, typename mesh_type> class Fields;
-    typedef Fields<Field, Mesh> FieldsMesh;
-    typedef Fields<FieldSubMesh, SubMesh> FieldsSubMesh;
+    template<typename field_type> class Fields;
+    typedef Fields<Field<Mesh> > FieldsMesh;
+    typedef Fields<Field<SubMesh> > FieldsSubMesh;
     class SolutionFields;
 
     class Distributor;
 
     class MeshRefiner;
     class RefineUniform;
+#endif
 
   } // topology
 } // pylith

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/utils/sievetypes.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/utils/sievetypes.hh	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/utils/sievetypes.hh	2009-02-06 00:09:22 UTC (rev 14023)
@@ -23,22 +23,11 @@
 
 namespace pylith {
 
-#if NEWPYLITHMESH // For use with pylith::topology::Mesh
-  typedef ALE::IMesh<> SieveMesh;
-  typedef SieveMesh::real_section_type MeshRealSection;
-  typedef SieveMesh::int_section_type MeshIntSection;
-
-  typedef ALE::IMesh<ALE::LabelSifter<int, SieveMesh::point_type> > SieveSubMesh;
-  typedef SieveSubMesh::real_section_type SubMeshRealSection;
-  typedef SieveSubMesh::int_section_type SubMeshIntSection;
-
-#else
   typedef ALE::IMesh<> Mesh;
   typedef ALE::IMesh<ALE::LabelSifter<int, Mesh::point_type> > SubMesh;
   typedef Mesh::sieve_type sieve_type;
   typedef Mesh::real_section_type real_section_type; 
   typedef Mesh::int_section_type int_section_type;
-#endif
 
 } // pylith
 

Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Field.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Field.i	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Field.i	2009-02-06 00:09:22 UTC (rev 14023)
@@ -19,9 +19,38 @@
 namespace pylith {
   namespace topology {
 
-    class Field : public FieldBase
+    template<typename mesh_type>
+    class Field
     { // Field
 
+      // PUBLIC ENUMS ///////////////////////////////////////////////////
+    public :
+
+      enum VectorFieldEnum {
+	SCALAR=0, ///< Scalar.
+	VECTOR=1, ///< Vector.
+	TENSOR=2, ///< Tensor.
+	OTHER=3, ///< Not a scalar, vector, or tensor.
+	MULTI_SCALAR=4, ///< Scalar at multiple points.
+	MULTI_VECTOR=5, ///< Vector at multiple points.
+	MULTI_TENSOR=6, ///< Tensor at multiple points.
+	MULTI_OTHER=7, ///< Not a scalar, vector, or tensor at multiple points.
+      }; // VectorFieldEnum
+
+      enum DomainEnum {
+	VERTICES_FIELD=0, ///< FieldBase over vertices.
+	CELLS_FIELD=1, ///< FieldBase over cells.
+      }; // omainEnum
+
+      // PRIVATE TYPEDEFS ///////////////////////////////////////////////
+    private:
+
+      // Convenience typedefs
+      typedef typename mesh_type::RealSection RealSection;
+      typedef typename mesh_type::SieveMesh SieveMesh;
+      typedef typename SieveMesh::label_sequence label_sequence;
+      typedef typename RealSection::chart_type chart_type;
+      
       // PUBLIC MEMBERS /////////////////////////////////////////////////
     public :
 
@@ -29,7 +58,7 @@
        *
        * @param mesh Finite-element mesh.
        */
-      Field(const Mesh& mesh);
+      Field(const mesh_type& mesh);
 
       /// Destructor.
       ~Field(void);
@@ -38,14 +67,62 @@
        *
        * @returns Finite-element mesh.
        */
-      const Mesh& mesh(void) const;
+      const mesh_type& mesh(void) const;
 
+      /** Set name of field.
+       *
+       * @param value Name of field.
+       */
+      void name(const char* value);
+
+      /** Get name of field.
+       *
+       * @returns Name of field.
+       */
+      const char* name(void) const;
+      
+      /** Set vector field type
+       *
+       * @param value Type of vector field.
+       */
+      void vectorFieldType(const VectorFieldEnum value);
+
+      /** Get vector field type
+       *
+       * @returns Type of vector field.
+       */
+      VectorFieldEnum vectorFieldType(void) const;
+
+      /** Set scale for dimensionalizing field.
+       *
+       * @param value Scale associated with field.
+       */
+      void scale(const double value);
+
+      /** Get scale for dimensionalizing field.
+       *
+       * @returns Scale associated with field.
+       */
+      double scale(void) const;
+      
+      /** Set flag indicating whether it is okay to dimensionalize field.
+       *
+       * @param value True if it is okay to dimensionalize field.
+       */
+      void addDimensionOkay(const bool value);
+      
+      /** Set flag indicating whether it is okay to dimensionalize field.
+       *
+       * @param value True if it is okay to dimensionalize field.
+       */
+      bool addDimensionOkay(void) const;
+      
       /** Get spatial dimension of domain.
        *
        * @returns Spatial dimension of domain.
        */
       int spaceDim(void) const;
-
+      
       /// Create sieve section.
       void newSection(void);
 
@@ -56,7 +133,7 @@
        */
       void newSection(const DomainEnum domain,
 		      const int fiberDim);
-      
+
       /** Create section with same layout (fiber dimension and
        * constraints) as another section. This allows the layout data
        * structures to be reused across multiple fields, reducing memory
@@ -65,10 +142,10 @@
        * @param sec Section defining layout.
        */
       void newSection(const Field& src);
-      
+
       /// Clear variables associated with section.
       void clear(void);
-      
+
       /// Allocate field.
       void allocate(void);
       
@@ -77,7 +154,7 @@
       
       /// Complete section by assembling across processors.
       void complete(void);
-      
+
       /** Copy field values and metadata.
        *
        * @param field Field to copy.
@@ -100,9 +177,9 @@
        * @param label Label for output.
        */
       void view(const char* label);
-      
+
     }; // Field
-    
+
   } // topology
 } // pylith
 

Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/topology/SubMesh.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/topology/SubMesh.i	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/topology/SubMesh.i	2009-02-06 00:09:22 UTC (rev 14023)
@@ -19,6 +19,7 @@
 namespace pylith {
   namespace topology {
 
+    template<typename mesh_type>
     class SubMesh
     { // SubMesh
 
@@ -33,7 +34,7 @@
        * @param mesh Finite-element mesh over domain.
        * @param label Label for vertices marking boundary.
        */
-      SubMesh(const Mesh& mesh,
+      SubMesh(const mesh_type& mesh,
 	      const char* label);
 
       /// Default destructor
@@ -44,7 +45,7 @@
        * @param mesh Finite-element mesh over domain.
        * @param label Label for vertices marking boundary.
        */
-      void createSubMesh(const Mesh& mesh,
+      void createSubMesh(const mesh_type& mesh,
 			 const char* label); 
 
       /** Get coordinate system.

Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/topology/topology.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/topology/topology.i	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/topology/topology.i	2009-02-06 00:09:22 UTC (rev 14023)
@@ -17,10 +17,10 @@
 %{
 #include "pylith/topology/Mesh.hh"
 #include "pylith/topology/SubMesh.hh"
-#include "pylith/topology/MeshOps.hh"
-#include "pylith/topology/FieldBase.hh"
+// #include "pylith/topology/MeshOps.hh"
+// #include "pylith/topology/FieldBase.hh"
 #include "pylith/topology/Field.hh"
-#include "pylith/topology/FieldSubMesh.hh"
+// #include "pylith/topology/FieldSubMesh.hh"
 %}
 
 %include "exception.i"
@@ -46,11 +46,16 @@
 // Interfaces
 %include "Mesh.i"
 %include "SubMesh.i"
-%include "MeshOps.i"
-%include "FieldBase.i"
+// %include "MeshOps.i"
+// %include "FieldBase.i"
 %include "Field.i"
-%include "FieldSubMesh.i"
+// %include "FieldSubMesh.i"
 
 
+// Template instatiation
+%template(MeshSubMesh) pylith::topology::SubMesh<pylith::topology::Mesh>;
+%template(MeshField) pylith::topology::Field<pylith::topology::Mesh>;
+%template(SubMeshField) pylith::topology::Field<pylith::topology::SubMesh<pylith::topology::Mesh> >;
+
 // End of file
 

Modified: short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am	2009-02-06 00:09:22 UTC (rev 14023)
@@ -114,8 +114,8 @@
 	topology/FieldsManager.py \
 	topology/Mesh.py \
 	topology/SubMesh.py \
-	topology/Field.py \
-	topology/FieldSubMesh.py \
+	topology/MeshField.py \
+	topology/SubMeshField.py \
 	topology/MeshGenerator.py \
 	topology/MeshImporter.py \
 	topology/MeshRefiner.py \

Deleted: short/3D/PyLith/branches/pylith-swig/pylith/topology/Field.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/topology/Field.py	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/pylith/topology/Field.py	2009-02-06 00:09:22 UTC (rev 14023)
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pylith/topology/Field.py
-##
-## @brief Python object for managing a vector field over vertices or
-## cells of a finite-element mesh.
-
-from topology import Field as ModuleField
-
-# Field class
-class Field(ModuleField):
-  """
-  Python object for managing a vector field over vertices or cells of
-  a finite-element mesh.
-  """
-
-  # PUBLIC METHODS /////////////////////////////////////////////////////
-
-  def __init__(self, mesh):
-    """
-    Constructor.
-    """
-    ModuleField.__init__(self, mesh)
-    return
-    
-
-# End of file

Deleted: short/3D/PyLith/branches/pylith-swig/pylith/topology/FieldSubMesh.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/topology/FieldSubMesh.py	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/pylith/topology/FieldSubMesh.py	2009-02-06 00:09:22 UTC (rev 14023)
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pylith/topology/FieldSubMesh.py
-##
-## @brief Python object for managing a vector field over vertices or
-## cells of a lower-dimension portion of a finite-element mesh.
-
-from topology import FieldSubMesh as ModuleFieldSubMesh
-
-# FieldSubMesh class
-class Field(ModuleFieldSubMesh):
-  """
-  Python object for managing a vector field over vertices or cells of
-  a lower-dimension portion of a finite-element mesh.
-  """
-
-  # PUBLIC METHODS /////////////////////////////////////////////////////
-
-  def __init__(self, submesh):
-    """
-    Constructor.
-    """
-    ModuleFieldSubMesh.__init__(self, submesh)
-    return
-    
-
-# End of file

Added: short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshField.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshField.py	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshField.py	2009-02-06 00:09:22 UTC (rev 14023)
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/topology/MeshField.py
+##
+## @brief Python object for managing a vector field over vertices or
+## cells of a finite-element mesh.
+
+from topology import MeshField as ModuleField
+
+# MeshField class
+class MeshField(ModuleField):
+  """
+  Python object for managing a vector field over vertices or cells of
+  a finite-element mesh.
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, mesh):
+    """
+    Constructor.
+    """
+    ModuleField.__init__(self, mesh)
+    return
+    
+
+# End of file

Modified: short/3D/PyLith/branches/pylith-swig/pylith/topology/SubMesh.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/topology/SubMesh.py	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/pylith/topology/SubMesh.py	2009-02-06 00:09:22 UTC (rev 14023)
@@ -15,7 +15,7 @@
 ## @brief Python Mesh for lower-dimension finite-element topology
 ## information.
 
-from topology import SubMesh as ModuleSubMesh
+from topology import MeshSubMesh as ModuleSubMesh
 
 # SubMesh class
 class SubMesh(ModuleSubMesh):

Added: short/3D/PyLith/branches/pylith-swig/pylith/topology/SubMeshField.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/topology/SubMeshField.py	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/pylith/topology/SubMeshField.py	2009-02-06 00:09:22 UTC (rev 14023)
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/topology/SubMeshField.py
+##
+## @brief Python object for managing a vector field over vertices or
+## cells of a finite-element mesh.
+
+from topology import SubMeshField as ModuleField
+
+# SubMeshField class
+class SubMeshField(ModuleField):
+  """
+  Python object for managing a vector field over vertices or cells of
+  a lower-dimension finite-element mesh.
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, mesh):
+    """
+    Constructor.
+    """
+    ModuleField.__init__(self, mesh)
+    return
+    
+
+# End of file

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/Makefile.am	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/Makefile.am	2009-02-06 00:09:22 UTC (rev 14023)
@@ -26,6 +26,7 @@
 	TestMeshIOLagrit.cc \
 	test_meshio.cc
 
+
 #	TestCellFilterAvg.cc \
 # 	TestDataWriterVTK.cc \
 # 	TestDataWriterVTKMesh.cc \

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIO.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIO.cc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIO.cc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -25,6 +25,9 @@
 #include <stdexcept> // USES std::logic_error
 
 // ----------------------------------------------------------------------
+typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+
+// ----------------------------------------------------------------------
 // Get simple mesh for testing I/O.
 pylith::topology::Mesh*
 pylith::meshio::TestMeshIO::_createMesh(const MeshData& data)

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIO.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIO.hh	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIO.hh	2009-02-06 00:09:22 UTC (rev 14023)
@@ -24,19 +24,17 @@
 // Include directives ---------------------------------------------------
 #include <cppunit/extensions/HelperMacros.h>
 
+#include "pylith/topology/topologyfwd.hh" // USES Mesh
+#include "pylith/meshio/meshiofwd.hh" // USES MeshIO
+
 // Forward declarations -------------------------------------------------
 /// Namespace for pylith package
 namespace pylith {
   namespace meshio {
     class TestMeshIO;
-    class MeshIO; // USES MeshIO
 
     class MeshData; // test data
   } // meshio
-
-  namespace topology {
-    class Mesh; // USES Mesh
-  } // topology
 } // pylith
 
 // MeshIO ---------------------------------------------------------------

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIOCubit.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIOCubit.cc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIOCubit.cc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -30,6 +30,9 @@
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestMeshIOCubit );
 
 // ----------------------------------------------------------------------
+typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+
+// ----------------------------------------------------------------------
 // Test constructor
 void
 pylith::meshio::TestMeshIOCubit::testConstructor(void)

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIOLagrit.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIOLagrit.cc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/meshio/TestMeshIOLagrit.cc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -33,6 +33,9 @@
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestMeshIOLagrit );
 
 // ----------------------------------------------------------------------
+typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+
+// ----------------------------------------------------------------------
 // Test constructor
 void
 pylith::meshio::TestMeshIOLagrit::testConstructor(void)

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/Makefile.am	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/Makefile.am	2009-02-06 00:09:22 UTC (rev 14023)
@@ -23,20 +23,22 @@
 testtopology_SOURCES = \
 	TestMesh.cc \
 	TestSubMesh.cc \
-	TestMeshOps.cc \
-	TestFieldBase.cc \
-	TestField.cc \
-	TestFieldSubMesh.cc \
-	TestFieldsMesh.cc \
-	TestFieldsSubMesh.cc \
+	TestFieldMesh.cc \
 	test_topology.cc
 
+#	TestMeshOps.cc \
+#	TestFieldBase.cc \
+#	TestField.cc \
+#	TestFieldSubMesh.cc \
+#	TestFieldsMesh.cc \
+#	TestFieldsSubMesh.cc
+
 noinst_HEADERS = \
 	TestMesh.hh \
 	TestSubMesh.hh \
 	TestMeshOps.hh \
 	TestFieldBase.hh \
-	TestField.hh \
+	TestFieldMesh.hh \
 	TestFieldSubMesh.hh \
 	TestFieldsMesh.hh \
 	TestFieldsSubMesh.hh

Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -1,673 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestField.hh" // Implementation of class methods
-#include "pylith/topology/Field.hh" // USES Field
-
-#include "pylith/topology/Mesh.hh" // USES Mesh
-#include "pylith/utils/array.hh" // USES double_array
-
-#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( pylith::topology::TestField );
-
-// ----------------------------------------------------------------------
-namespace pylith {
-  namespace topology {
-    namespace _TestField {
-      const int cellDim = 2;
-      const int nvertices = 4;
-      const int ncells = 1;
-      const int ncorners = 4;
-      const int cells[] = { 0, 1, 2, 3 };
-      const double coordinates[] = {
-	0.0, 0.0,
-	1.0, 0.0,
-	0.0, 1.0,
-	1.0, 1.0,
-      };
-    } // _TestField
-  } // topology
-} // pylith
-
-// ----------------------------------------------------------------------
-// Test constructor.
-void
-pylith::topology::TestField::testConstructor(void)
-{ // testConstructor
-  Mesh mesh;
-  Field field(mesh);
-} // testConstructor
-
-// ----------------------------------------------------------------------
-// Test section().
-void
-pylith::topology::TestField::testSection(void)
-{ // testSection
-  Mesh mesh;
-  Field field(mesh);
-
-  mesh.createSieveMesh();
-  const ALE::Obj<SieveMesh::real_section_type>& section = field.section();
-  CPPUNIT_ASSERT(section.isNull());
-} // testSection
-
-// ----------------------------------------------------------------------
-// Test mesh().
-void
-pylith::topology::TestField::testMesh(void)
-{ // testMesh
-  Mesh mesh;
-  _buildMesh(&mesh);
-  Field field(mesh);
-
-  const Mesh& mesh2 = field.mesh();
-  CPPUNIT_ASSERT_EQUAL(_TestField::cellDim, mesh2.dimension());  
-} // testMesh
-
-// ----------------------------------------------------------------------
-// Test spaceDim().
-void
-pylith::topology::TestField::testSpaceDim(void)
-{ // testSpaceDim
-  Mesh mesh;
-  _buildMesh(&mesh);
-  Field field(mesh);
-
-  CPPUNIT_ASSERT_EQUAL(_TestField::cellDim, field.spaceDim());
-} // testSpaceDim
-
-// ----------------------------------------------------------------------
-// Test newSection().
-void
-pylith::topology::TestField::testNewSection(void)
-{ // testNewSection
-  Mesh mesh;
-  _buildMesh(&mesh);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-
-  Field field(mesh);
-  field.newSection();
-  const ALE::Obj<SieveMesh::real_section_type>& section = field.section();
-  CPPUNIT_ASSERT(!section.isNull());
-} // testNewSection
-
-// ----------------------------------------------------------------------
-// Test newSection(points).
-void
-pylith::topology::TestField::testNewSectionPoints(void)
-{ // testNewSectionPoints
-  const int fiberDim = 2;
-
-  Mesh mesh;
-  _buildMesh(&mesh);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-
-  Field field(mesh);
-  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
-    sieveMesh->depthStratum(0);
-  field.newSection(vertices, fiberDim);
-  const ALE::Obj<SieveMesh::real_section_type>& section = field.section();
-  CPPUNIT_ASSERT(!section.isNull());
-
-  CPPUNIT_ASSERT(!vertices.isNull());
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter)
-    CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
-} // testNewSectionPoints
-
-// ----------------------------------------------------------------------
-// Test newSection(domain).
-void
-pylith::topology::TestField::testNewSectionDomain(void)
-{ // testNewSectionDomain
-  const int fiberDim = 2;
-
-  Mesh mesh;
-  _buildMesh(&mesh);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-
-  Field field(mesh);
-  field.newSection(Field::VERTICES_FIELD, fiberDim);
-
-  const ALE::Obj<SieveMesh::real_section_type>& section = field.section();
-  CPPUNIT_ASSERT(!section.isNull());
-  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
-    sieveMesh->depthStratum(0);
-  CPPUNIT_ASSERT(!vertices.isNull());
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter)
-    CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
-} // testNewSectionDomain
-
-// ----------------------------------------------------------------------
-// Test newSection(chart).
-void
-pylith::topology::TestField::testNewSectionChart(void)
-{ // testNewSectionChart
-  const int fiberDim = 3;
-  const int nconstraints[] = { 0, 2, 1, 3 };
-  const int constraints[] = {
-              // 0
-    0, 3,     // 1
-    2,        // 2
-    0, 1, 2,  // 3
-  };
-    
-  Mesh mesh;
-  _buildMesh(&mesh);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-
-  // Create field with atlas to use to create new field
-  Field fieldSrc(mesh);
-  fieldSrc.newSection(Field::VERTICES_FIELD, fiberDim);
-  const ALE::Obj<MeshRealSection>& sectionSrc = fieldSrc.section();
-  CPPUNIT_ASSERT(!sectionSrc.isNull());
-  const MeshRealSection::chart_type& chart = sectionSrc->getChart();
-
-  Field field(mesh);
-  field.newSection(chart, fiberDim);
-  const ALE::Obj<MeshRealSection>& section = field.section();
-  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
-    sieveMesh->depthStratum(0);
-  CPPUNIT_ASSERT(!vertices.isNull());
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter)
-    CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
-} // testNewSectionChart
-
-// ----------------------------------------------------------------------
-// Test newSection(field).
-void
-pylith::topology::TestField::testNewSectionField(void)
-{ // testNewSectionField
-  const int fiberDim = 3;
-  const int nconstraints[] = { 0, 2, 1, 3 };
-  const int constraints[] = {
-              // 0
-    0, 3,     // 1
-    2,        // 2
-    0, 1, 2,  // 3
-  };
-    
-  Mesh mesh;
-  _buildMesh(&mesh);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-
-  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
-    sieveMesh->depthStratum(0);
-  CPPUNIT_ASSERT(!vertices.isNull());
-
-  // Create field with atlas to use to create new field
-  Field fieldSrc(mesh);
-  { // Setup source field
-    fieldSrc.newSection(Field::VERTICES_FIELD, fiberDim);
-    const ALE::Obj<MeshRealSection>& section = fieldSrc.section();
-    int iV=0;
-
-    CPPUNIT_ASSERT(!vertices.isNull());
-    for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-	 v_iter != vertices->end();
-	 ++v_iter)
-      section->addConstraintDimension(*v_iter, nconstraints[iV++]);
-    fieldSrc.allocate();
-  } // Setup source field
-
-
-  Field field(mesh);
-  field.newSection(fieldSrc);
-  const ALE::Obj<MeshRealSection>& section = field.section();
-  int iV = 0;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter) {
-    CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
-    CPPUNIT_ASSERT_EQUAL(nconstraints[iV++], 
-			 section->getConstraintDimension(*v_iter));
-  } // for
-} // testNewSectionField
-
-// ----------------------------------------------------------------------
-// Test clear().
-void
-pylith::topology::TestField::testClear(void)
-{ // testClear
-  Mesh mesh(_TestField::cellDim);
-  Field field(mesh);
-
-  field.scale(2.0);
-  field.vectorFieldType(Field::TENSOR);
-  field.addDimensionOkay(true);
-  
-  field.clear();
-
-  CPPUNIT_ASSERT_EQUAL(1.0, field._scale);
-  CPPUNIT_ASSERT_EQUAL(Field::OTHER, field._vecFieldType);
-  CPPUNIT_ASSERT_EQUAL(false, field._dimensionsOkay);
-} // testClear
-
-// ----------------------------------------------------------------------
-// Test allocate().
-void
-pylith::topology::TestField::testAllocate(void)
-{ // testAllocate
-  const int fiberDim = 3;
-  const double scale = 2.0;
-  const double valuesNondim[] = {
-    1.1, 2.2, 3.3,
-    1.2, 2.3, 3.4,
-    1.3, 2.4, 3.5,
-    1.4, 2.5, 3.6,
-  };
-
-  Mesh mesh;
-  _buildMesh(&mesh);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
-    sieveMesh->depthStratum(0);
-
-  Field field(mesh);
-  field.newSection(Field::VERTICES_FIELD, fiberDim);
-  field.allocate();
-  const ALE::Obj<MeshRealSection>& section = field.section();
-
-  double_array values(fiberDim);
-  int i = 0;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter) {
-    for (int iDim=0; iDim < fiberDim; ++iDim)
-      values[iDim] = valuesNondim[i++];
-    section->updatePoint(*v_iter, &values[0]);
-  } // for
-
-  const double tolerance = 1.0e-6;
-  i = 0;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter) {
-    section->restrictPoint(*v_iter, &values[0], values.size());
-    for (int iDim=0; iDim < fiberDim; ++iDim) {
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesNondim[i++], values[iDim], tolerance);
-    } // for
-  } // for
-} // testAllocate
-
-// ----------------------------------------------------------------------
-// Test zero().
-void
-pylith::topology::TestField::testZero(void)
-{ // testZero
-  const int fiberDim = 3;
-  const double scale = 2.0;
-  const double valuesNondim[] = {
-    1.1, 2.2, 3.3,
-    1.2, 2.3, 3.4,
-    1.3, 2.4, 3.5,
-    1.4, 2.5, 3.6,
-  };
-
-  Mesh mesh;
-  _buildMesh(&mesh);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
-    sieveMesh->depthStratum(0);
-
-  Field field(mesh);
-  field.newSection(Field::VERTICES_FIELD, fiberDim);
-  field.allocate();
-  const ALE::Obj<MeshRealSection>& section = field.section();
-
-  double_array values(fiberDim);
-  int i = 0;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter) {
-    for (int iDim=0; iDim < fiberDim; ++iDim)
-      values[iDim] = valuesNondim[i++];
-    section->updatePoint(*v_iter, &values[0]);
-  } // for
-
-  field.zero();
-
-  const double tolerance = 1.0e-6;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter) {
-    section->restrictPoint(*v_iter, &values[0], values.size());
-    for (int iDim=0; iDim < fiberDim; ++iDim) {
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, values[iDim], tolerance);
-    } // for
-  } // for
-} // testZero
-
-// ----------------------------------------------------------------------
-// Test complete().
-void
-pylith::topology::TestField::testComplete(void)
-{ // testComplete
-  const int fiberDim = 3;
-  const double scale = 2.0;
-  const double valuesNondim[] = {
-    1.1, 2.2, 3.3,
-    1.2, 2.3, 3.4,
-    1.3, 2.4, 3.5,
-    1.4, 2.5, 3.6,
-  };
-
-  Mesh mesh;
-  _buildMesh(&mesh);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
-    sieveMesh->depthStratum(0);
-
-  Field field(mesh);
-  field.newSection(Field::VERTICES_FIELD, fiberDim);
-  field.allocate();
-  const ALE::Obj<MeshRealSection>& section = field.section();
-
-  double_array values(fiberDim);
-  int i = 0;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter) {
-    for (int iDim=0; iDim < fiberDim; ++iDim)
-      values[iDim] = valuesNondim[i++];
-    section->updatePoint(*v_iter, &values[0]);
-  } // for
-
-  field.complete();
-
-  // Expect no change for this serial test
-  i = 0;
-  const double tolerance = 1.0e-6;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter) {
-    section->restrictPoint(*v_iter, &values[0], values.size());
-    for (int iDim=0; iDim < fiberDim; ++iDim) {
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesNondim[i++], values[iDim], tolerance);
-    } // for
-  } // for
-} // testComplete
-
-// ----------------------------------------------------------------------
-// Test copy().
-void
-pylith::topology::TestField::testCopy(void)
-{ // testCopy
-  const int fiberDim = 3;
-  const double scale = 2.0;
-  const double valuesNondim[] = {
-    1.1, 2.2, 3.3,
-    1.2, 2.3, 3.4,
-    1.3, 2.4, 3.5,
-    1.4, 2.5, 3.6,
-  };
-
-  Mesh mesh;
-  _buildMesh(&mesh);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
-    sieveMesh->depthStratum(0);
-
-  Field fieldSrc(mesh);
-  { // Setup source field
-    fieldSrc.newSection(Field::VERTICES_FIELD, fiberDim);
-    fieldSrc.allocate();
-    const ALE::Obj<MeshRealSection>& section = fieldSrc.section();
-    
-    double_array values(fiberDim);
-    int i = 0;
-    for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-	 v_iter != vertices->end();
-	 ++v_iter) {
-      for (int iDim=0; iDim < fiberDim; ++iDim)
-	values[iDim] = valuesNondim[i++];
-      section->updatePoint(*v_iter, &values[0]);
-    } // for
-  } // Setup source field
-
-  Field field(mesh);
-  field.newSection(Field::VERTICES_FIELD, fiberDim);
-  field.allocate();
-  const ALE::Obj<MeshRealSection>& section = field.section();
-
-  field.copy(fieldSrc);
-
-  int i = 0;
-  double_array values(fiberDim);
-  const double tolerance = 1.0e-6;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter) {
-    section->restrictPoint(*v_iter, &values[0], values.size());
-    for (int iDim=0; iDim < fiberDim; ++iDim) {
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesNondim[i++], values[iDim], tolerance);
-    } // for
-  } // for
-} // testCopy
-
-// ----------------------------------------------------------------------
-// Test operator+=().
-void
-pylith::topology::TestField::testOperatorAdd(void)
-{ // testOperateAdd
-  const int fiberDim = 3;
-  const double scale = 2.0;
-  const double valuesA[] = {
-    1.1, 2.2, 3.3,
-    1.2, 2.3, 3.4,
-    1.3, 2.4, 3.5,
-    1.4, 2.5, 3.6,
-  };
-  const double valuesB[] = {
-    10.1, 20.2, 30.3,
-    10.2, 20.3, 30.4,
-    10.3, 20.4, 30.5,
-    10.4, 20.5, 30.6,
-  };
-
-  Mesh mesh;
-  _buildMesh(&mesh);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
-    sieveMesh->depthStratum(0);
-
-  Field fieldSrc(mesh);
-  { // Setup source field
-    fieldSrc.newSection(Field::VERTICES_FIELD, fiberDim);
-    fieldSrc.allocate();
-    const ALE::Obj<MeshRealSection>& section = fieldSrc.section();
-    
-    double_array values(fiberDim);
-    int i = 0;
-    for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-	 v_iter != vertices->end();
-	 ++v_iter) {
-      for (int iDim=0; iDim < fiberDim; ++iDim)
-	values[iDim] = valuesA[i++];
-      section->updatePoint(*v_iter, &values[0]);
-    } // for
-  } // Setup source field
-
-  Field field(mesh);
-  field.newSection(Field::VERTICES_FIELD, fiberDim);
-  field.allocate();
-  const ALE::Obj<MeshRealSection>& section = field.section();
-  { // Setup destination field
-
-    double_array values(fiberDim);
-    int i = 0;
-    for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-	 v_iter != vertices->end();
-	 ++v_iter) {
-      for (int iDim=0; iDim < fiberDim; ++iDim)
-	values[iDim] = valuesB[i++];
-      section->updatePoint(*v_iter, &values[0]);
-    } // for
-  } // Setup destination field
-
-  field += fieldSrc;
-
-  int i = 0;
-  double_array values(fiberDim);
-  const double tolerance = 1.0e-6;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter) {
-    section->restrictPoint(*v_iter, &values[0], values.size());
-    for (int iDim=0; iDim < fiberDim; ++iDim) {
-      const double valueE = valuesA[i] + valuesB[i];
-      ++i;
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(valueE, values[iDim], tolerance);
-    } // for
-  } // for
-} // testOperateAdd
-
-// ----------------------------------------------------------------------
-// Test dimensionalize().
-void
-pylith::topology::TestField::testDimensionalize(void)
-{ // testDimensionalize
-  const int fiberDim = 3;
-  const double scale = 2.0;
-  const double valuesNondim[] = {
-    1.1, 2.2, 3.3,
-    1.2, 2.3, 3.4,
-    1.3, 2.4, 3.5,
-    1.4, 2.5, 3.6,
-  };
-
-  Mesh mesh;
-  _buildMesh(&mesh);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-  Field field(mesh);
-  field.newSection(Field::VERTICES_FIELD, fiberDim);
-  field.allocate();
-  const ALE::Obj<MeshRealSection>& section = field.section();
-  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
-    sieveMesh->depthStratum(0);
-
-  double_array values(fiberDim);
-  int i = 0;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter) {
-    for (int iDim=0; iDim < fiberDim; ++iDim)
-      values[iDim] = valuesNondim[i++];
-    section->updatePoint(*v_iter, &values[0]);
-  } // for
-
-  field.scale(scale);
-  field.addDimensionOkay(true);
-  field.dimensionalize();
-
-  i = 0;
-  const double tolerance = 1.0e-6;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter) {
-    section->restrictPoint(*v_iter, &values[0], values.size());
-    for (int iDim=0; iDim < fiberDim; ++iDim) {
-      const double valueE = valuesNondim[i++]*scale;
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(valueE, values[iDim], tolerance);
-    } // for
-  } // for
-
-} // testDimensionalize
-
-// ----------------------------------------------------------------------
-// Test view().
-void
-pylith::topology::TestField::testView(void)
-{ // testView
-  const int fiberDim = 3;
-  const double scale = 2.0;
-  const double valuesNondim[] = {
-    1.1, 2.2, 3.3,
-    1.2, 2.3, 3.4,
-    1.3, 2.4, 3.5,
-    1.4, 2.5, 3.6,
-  };
-
-  Mesh mesh;
-  _buildMesh(&mesh);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-  Field field(mesh);
-  field.newSection(Field::VERTICES_FIELD, fiberDim);
-  field.allocate();
-  const ALE::Obj<MeshRealSection>& section = field.section();
-  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
-    sieveMesh->depthStratum(0);
-
-  double_array values(fiberDim);
-  int i = 0;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
-       v_iter != vertices->end();
-       ++v_iter) {
-    for (int iDim=0; iDim < fiberDim; ++iDim)
-      values[iDim] = valuesNondim[i++];
-    section->updatePoint(*v_iter, &values[0]);
-  } // for
-
-  field.view("Testing view");
-} // testView
-
-// ----------------------------------------------------------------------
-void
-pylith::topology::TestField::_buildMesh(Mesh* mesh)
-{ // _buildMesh
-  assert(0 != mesh);
-
-  mesh->createSieveMesh(_TestField::cellDim);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh->sieveMesh();
-
-  ALE::Obj<SieveMesh::sieve_type> sieve = 
-    new SieveMesh::sieve_type(sieveMesh->comm());
-  CPPUNIT_ASSERT(!sieve.isNull());
-
-  ALE::Obj<ALE::Mesh::sieve_type> s = 
-    new ALE::Mesh::sieve_type(sieve->comm(), sieve->debug());
-  
-  const int cellDim = _TestField::cellDim;
-  const int ncells = _TestField::ncells;
-  const int* cells = _TestField::cells;
-  const int nvertices = _TestField::nvertices;
-  const int ncorners = _TestField::ncorners;
-  const int spaceDim = _TestField::cellDim;
-  const double* coordinates = _TestField::coordinates;
-  const bool interpolate = false;
-  ALE::SieveBuilder<ALE::Mesh>::buildTopology(s, cellDim, ncells, (int*) cells,
-					      nvertices, interpolate, 
-					      ncorners);
-  std::map<SieveMesh::point_type,SieveMesh::point_type> renumbering;
-  ALE::ISieveConverter::convertSieve(*s, *sieve, renumbering);
-  sieveMesh->setSieve(sieve);
-  sieveMesh->stratify();
-  ALE::SieveBuilder<SieveMesh>::buildCoordinates(sieveMesh, spaceDim, 
-						 coordinates);
-
-  spatialdata::geocoords::CSCart cs;
-  cs.setSpaceDim(spaceDim);
-  cs.initialize();
-  mesh->coordsys(&cs);
-} // _buildMesh
-
-
-// End of file 

Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh	2009-02-06 00:09:22 UTC (rev 14023)
@@ -1,133 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/topology/TestField.hh
- *
- * @brief C++ unit testing for Field.
- */
-
-#if !defined(pylith_topology_testfield_hh)
-#define pylith_topology_testfield_hh
-
-// Include directives ---------------------------------------------------
-#include <cppunit/extensions/HelperMacros.h>
-
-// Forward declarations -------------------------------------------------
-/// Namespace for pylith package
-namespace pylith {
-  namespace topology {
-    class TestField;
-
-    class Field;
-    class Mesh;
-  } // topology
-} // pylith
-
-// TestField -------------------------------------------------------------
-/// C++ unit testing for Field.
-class pylith::topology::TestField : public CppUnit::TestFixture
-{ // class TestField
-
-  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
-  CPPUNIT_TEST_SUITE( TestField );
-
-  CPPUNIT_TEST( testConstructor );
-  CPPUNIT_TEST( testSection );
-  CPPUNIT_TEST( testMesh );
-  CPPUNIT_TEST( testSpaceDim );
-  CPPUNIT_TEST( testNewSection );
-  CPPUNIT_TEST( testNewSectionPoints );
-  CPPUNIT_TEST( testNewSectionDomain );
-  CPPUNIT_TEST( testNewSectionChart );
-  CPPUNIT_TEST( testNewSectionField );
-  CPPUNIT_TEST( testClear );
-  CPPUNIT_TEST( testAllocate );
-  CPPUNIT_TEST( testZero );
-  CPPUNIT_TEST( testComplete );
-  CPPUNIT_TEST( testCopy );
-  CPPUNIT_TEST( testOperatorAdd );
-  CPPUNIT_TEST( testDimensionalize );
-  CPPUNIT_TEST( testView );
-
-  CPPUNIT_TEST_SUITE_END();
-
-  // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
-  /// Test constructor.
-  void testConstructor(void);
-
-  /// Test section().
-  void testSection(void);
-
-  /// Test mesh().
-  void testMesh(void);
-
-  /// Test spaceDim().
-  void testSpaceDim(void);
-
-  /// Test newSection().
-  void testNewSection(void);
-
-  /// Test newSection(points).
-  void testNewSectionPoints(void);
-
-  /// Test newSection(domain).
-  void testNewSectionDomain(void);
-
-  /// Test newSection(chart).
-  void testNewSectionChart(void);
-
-  /// Test newSection(field).
-  void testNewSectionField(void);
-
-  /// Test clear().
-  void testClear(void);
-
-  /// Test allocate().
-  void testAllocate(void);
-
-  /// Test zero().
-  void testZero(void);
-
-  /// Test complete().
-  void testComplete(void);
-
-  /// Test copy().
-  void testCopy(void);
-
-  /// Test operator+=().
-  void testOperatorAdd(void);
-
-  /// Test dimensionalize().
-  void testDimensionalize(void);
-
-  /// Test view().
-  void testView(void);
-
-// PRIVATE METHODS /////////////////////////////////////////////////////
-private :
-
-  /** Build mesh.
-   *
-   * @param mesh Finite-element mesh.
-   */
-  static
-  void _buildMesh(Mesh* mesh);
-
-}; // class TestField
-
-#endif // pylith_topology_testfield_hh
-
-
-// End of file 

Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.cc (from rev 14022, short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.cc	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.cc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -0,0 +1,673 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestFieldMesh.hh" // Implementation of class methods
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/topology/Field.hh" // USES Field
+
+#include "pylith/utils/array.hh" // USES double_array
+
+#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::topology::TestFieldMesh );
+
+// ----------------------------------------------------------------------
+namespace pylith {
+  namespace topology {
+    namespace _TestFieldMesh {
+      const int cellDim = 2;
+      const int nvertices = 4;
+      const int ncells = 1;
+      const int ncorners = 4;
+      const int cells[] = { 0, 1, 2, 3 };
+      const double coordinates[] = {
+	0.0, 0.0,
+	1.0, 0.0,
+	0.0, 1.0,
+	1.0, 1.0,
+      };
+    } // _TestFieldMesh
+  } // topology
+} // pylith
+
+// ----------------------------------------------------------------------
+// Test constructor.
+void
+pylith::topology::TestFieldMesh::testConstructor(void)
+{ // testConstructor
+  Mesh mesh;
+  Field<Mesh> field(mesh);
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test section().
+void
+pylith::topology::TestFieldMesh::testSection(void)
+{ // testSection
+  Mesh mesh;
+  Field<Mesh> field(mesh);
+
+  mesh.createSieveMesh();
+  const ALE::Obj<Mesh::RealSection>& section = field.section();
+  CPPUNIT_ASSERT(section.isNull());
+} // testSection
+
+// ----------------------------------------------------------------------
+// Test mesh().
+void
+pylith::topology::TestFieldMesh::testMesh(void)
+{ // testMesh
+  Mesh mesh;
+  _buildMesh(&mesh);
+  Field<Mesh> field(mesh);
+
+  const Mesh& mesh2 = field.mesh();
+  CPPUNIT_ASSERT_EQUAL(_TestFieldMesh::cellDim, mesh2.dimension());  
+} // testMesh
+
+// ----------------------------------------------------------------------
+// Test spaceDim().
+void
+pylith::topology::TestFieldMesh::testSpaceDim(void)
+{ // testSpaceDim
+  Mesh mesh;
+  _buildMesh(&mesh);
+  Field<Mesh> field(mesh);
+
+  CPPUNIT_ASSERT_EQUAL(_TestFieldMesh::cellDim, field.spaceDim());
+} // testSpaceDim
+
+// ----------------------------------------------------------------------
+// Test newSection().
+void
+pylith::topology::TestFieldMesh::testNewSection(void)
+{ // testNewSection
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+
+  Field<Mesh> field(mesh);
+  field.newSection();
+  const ALE::Obj<Mesh::RealSection>& section = field.section();
+  CPPUNIT_ASSERT(!section.isNull());
+} // testNewSection
+
+// ----------------------------------------------------------------------
+// Test newSection(points).
+void
+pylith::topology::TestFieldMesh::testNewSectionPoints(void)
+{ // testNewSectionPoints
+  const int fiberDim = 2;
+
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+
+  Field<Mesh> field(mesh);
+  const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+  field.newSection(vertices, fiberDim);
+  const ALE::Obj<Mesh::RealSection>& section = field.section();
+  CPPUNIT_ASSERT(!section.isNull());
+
+  CPPUNIT_ASSERT(!vertices.isNull());
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter)
+    CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
+} // testNewSectionPoints
+
+// ----------------------------------------------------------------------
+// Test newSection(domain).
+void
+pylith::topology::TestFieldMesh::testNewSectionDomain(void)
+{ // testNewSectionDomain
+  const int fiberDim = 2;
+
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+
+  Field<Mesh> field(mesh);
+  field.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
+
+  const ALE::Obj<Mesh::RealSection>& section = field.section();
+  CPPUNIT_ASSERT(!section.isNull());
+  const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+  CPPUNIT_ASSERT(!vertices.isNull());
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter)
+    CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
+} // testNewSectionDomain
+
+// ----------------------------------------------------------------------
+// Test newSection(chart).
+void
+pylith::topology::TestFieldMesh::testNewSectionChart(void)
+{ // testNewSectionChart
+  const int fiberDim = 3;
+  const int nconstraints[] = { 0, 2, 1, 3 };
+  const int constraints[] = {
+              // 0
+    0, 3,     // 1
+    2,        // 2
+    0, 1, 2,  // 3
+  };
+    
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+
+  // Create field with atlas to use to create new field
+  Field<Mesh> fieldSrc(mesh);
+  fieldSrc.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
+  const ALE::Obj<Mesh::RealSection>& sectionSrc = fieldSrc.section();
+  CPPUNIT_ASSERT(!sectionSrc.isNull());
+  const Mesh::RealSection::chart_type& chart = sectionSrc->getChart();
+
+  Field<Mesh> field(mesh);
+  field.newSection(chart, fiberDim);
+  const ALE::Obj<Mesh::RealSection>& section = field.section();
+  const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+  CPPUNIT_ASSERT(!vertices.isNull());
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter)
+    CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
+} // testNewSectionChart
+
+// ----------------------------------------------------------------------
+// Test newSection(field).
+void
+pylith::topology::TestFieldMesh::testNewSectionField(void)
+{ // testNewSectionField
+  const int fiberDim = 3;
+  const int nconstraints[] = { 0, 2, 1, 3 };
+  const int constraints[] = {
+              // 0
+    0, 3,     // 1
+    2,        // 2
+    0, 1, 2,  // 3
+  };
+    
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+
+  const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+  CPPUNIT_ASSERT(!vertices.isNull());
+
+  // Create field with atlas to use to create new field
+  Field<Mesh> fieldSrc(mesh);
+  { // Setup source field
+    fieldSrc.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
+    const ALE::Obj<Mesh::RealSection>& section = fieldSrc.section();
+    int iV=0;
+
+    CPPUNIT_ASSERT(!vertices.isNull());
+    for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+	 v_iter != vertices->end();
+	 ++v_iter)
+      section->addConstraintDimension(*v_iter, nconstraints[iV++]);
+    fieldSrc.allocate();
+  } // Setup source field
+
+
+  Field<Mesh> field(mesh);
+  field.newSection(fieldSrc);
+  const ALE::Obj<Mesh::RealSection>& section = field.section();
+  int iV = 0;
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter) {
+    CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
+    CPPUNIT_ASSERT_EQUAL(nconstraints[iV++], 
+			 section->getConstraintDimension(*v_iter));
+  } // for
+} // testNewSectionField
+
+// ----------------------------------------------------------------------
+// Test clear().
+void
+pylith::topology::TestFieldMesh::testClear(void)
+{ // testClear
+  Mesh mesh(_TestFieldMesh::cellDim);
+  Field<Mesh> field(mesh);
+
+  field.scale(2.0);
+  field.vectorFieldType(Field<Mesh>::TENSOR);
+  field.addDimensionOkay(true);
+  
+  field.clear();
+
+  CPPUNIT_ASSERT_EQUAL(1.0, field._scale);
+  CPPUNIT_ASSERT_EQUAL(Field<Mesh>::OTHER, field._vecFieldType);
+  CPPUNIT_ASSERT_EQUAL(false, field._dimensionsOkay);
+} // testClear
+
+// ----------------------------------------------------------------------
+// Test allocate().
+void
+pylith::topology::TestFieldMesh::testAllocate(void)
+{ // testAllocate
+  const int fiberDim = 3;
+  const double scale = 2.0;
+  const double valuesNondim[] = {
+    1.1, 2.2, 3.3,
+    1.2, 2.3, 3.4,
+    1.3, 2.4, 3.5,
+    1.4, 2.5, 3.6,
+  };
+
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+  const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+
+  Field<Mesh> field(mesh);
+  field.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
+  field.allocate();
+  const ALE::Obj<Mesh::RealSection>& section = field.section();
+
+  double_array values(fiberDim);
+  int i = 0;
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter) {
+    for (int iDim=0; iDim < fiberDim; ++iDim)
+      values[iDim] = valuesNondim[i++];
+    section->updatePoint(*v_iter, &values[0]);
+  } // for
+
+  const double tolerance = 1.0e-6;
+  i = 0;
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter) {
+    section->restrictPoint(*v_iter, &values[0], values.size());
+    for (int iDim=0; iDim < fiberDim; ++iDim) {
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesNondim[i++], values[iDim], tolerance);
+    } // for
+  } // for
+} // testAllocate
+
+// ----------------------------------------------------------------------
+// Test zero().
+void
+pylith::topology::TestFieldMesh::testZero(void)
+{ // testZero
+  const int fiberDim = 3;
+  const double scale = 2.0;
+  const double valuesNondim[] = {
+    1.1, 2.2, 3.3,
+    1.2, 2.3, 3.4,
+    1.3, 2.4, 3.5,
+    1.4, 2.5, 3.6,
+  };
+
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+  const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+
+  Field<Mesh> field(mesh);
+  field.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
+  field.allocate();
+  const ALE::Obj<Mesh::RealSection>& section = field.section();
+
+  double_array values(fiberDim);
+  int i = 0;
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter) {
+    for (int iDim=0; iDim < fiberDim; ++iDim)
+      values[iDim] = valuesNondim[i++];
+    section->updatePoint(*v_iter, &values[0]);
+  } // for
+
+  field.zero();
+
+  const double tolerance = 1.0e-6;
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter) {
+    section->restrictPoint(*v_iter, &values[0], values.size());
+    for (int iDim=0; iDim < fiberDim; ++iDim) {
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, values[iDim], tolerance);
+    } // for
+  } // for
+} // testZero
+
+// ----------------------------------------------------------------------
+// Test complete().
+void
+pylith::topology::TestFieldMesh::testComplete(void)
+{ // testComplete
+  const int fiberDim = 3;
+  const double scale = 2.0;
+  const double valuesNondim[] = {
+    1.1, 2.2, 3.3,
+    1.2, 2.3, 3.4,
+    1.3, 2.4, 3.5,
+    1.4, 2.5, 3.6,
+  };
+
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+  const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+
+  Field<Mesh> field(mesh);
+  field.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
+  field.allocate();
+  const ALE::Obj<Mesh::RealSection>& section = field.section();
+
+  double_array values(fiberDim);
+  int i = 0;
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter) {
+    for (int iDim=0; iDim < fiberDim; ++iDim)
+      values[iDim] = valuesNondim[i++];
+    section->updatePoint(*v_iter, &values[0]);
+  } // for
+
+  field.complete();
+
+  // Expect no change for this serial test
+  i = 0;
+  const double tolerance = 1.0e-6;
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter) {
+    section->restrictPoint(*v_iter, &values[0], values.size());
+    for (int iDim=0; iDim < fiberDim; ++iDim) {
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesNondim[i++], values[iDim], tolerance);
+    } // for
+  } // for
+} // testComplete
+
+// ----------------------------------------------------------------------
+// Test copy().
+void
+pylith::topology::TestFieldMesh::testCopy(void)
+{ // testCopy
+  const int fiberDim = 3;
+  const double scale = 2.0;
+  const double valuesNondim[] = {
+    1.1, 2.2, 3.3,
+    1.2, 2.3, 3.4,
+    1.3, 2.4, 3.5,
+    1.4, 2.5, 3.6,
+  };
+
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+  const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+
+  Field<Mesh> fieldSrc(mesh);
+  { // Setup source field
+    fieldSrc.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
+    fieldSrc.allocate();
+    const ALE::Obj<Mesh::RealSection>& section = fieldSrc.section();
+    
+    double_array values(fiberDim);
+    int i = 0;
+    for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+	 v_iter != vertices->end();
+	 ++v_iter) {
+      for (int iDim=0; iDim < fiberDim; ++iDim)
+	values[iDim] = valuesNondim[i++];
+      section->updatePoint(*v_iter, &values[0]);
+    } // for
+  } // Setup source field
+
+  Field<Mesh> field(mesh);
+  field.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
+  field.allocate();
+  const ALE::Obj<Mesh::RealSection>& section = field.section();
+
+  field.copy(fieldSrc);
+
+  int i = 0;
+  double_array values(fiberDim);
+  const double tolerance = 1.0e-6;
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter) {
+    section->restrictPoint(*v_iter, &values[0], values.size());
+    for (int iDim=0; iDim < fiberDim; ++iDim) {
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesNondim[i++], values[iDim], tolerance);
+    } // for
+  } // for
+} // testCopy
+
+// ----------------------------------------------------------------------
+// Test operator+=().
+void
+pylith::topology::TestFieldMesh::testOperatorAdd(void)
+{ // testOperateAdd
+  const int fiberDim = 3;
+  const double scale = 2.0;
+  const double valuesA[] = {
+    1.1, 2.2, 3.3,
+    1.2, 2.3, 3.4,
+    1.3, 2.4, 3.5,
+    1.4, 2.5, 3.6,
+  };
+  const double valuesB[] = {
+    10.1, 20.2, 30.3,
+    10.2, 20.3, 30.4,
+    10.3, 20.4, 30.5,
+    10.4, 20.5, 30.6,
+  };
+
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+  const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+
+  Field<Mesh> fieldSrc(mesh);
+  { // Setup source field
+    fieldSrc.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
+    fieldSrc.allocate();
+    const ALE::Obj<Mesh::RealSection>& section = fieldSrc.section();
+    
+    double_array values(fiberDim);
+    int i = 0;
+    for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+	 v_iter != vertices->end();
+	 ++v_iter) {
+      for (int iDim=0; iDim < fiberDim; ++iDim)
+	values[iDim] = valuesA[i++];
+      section->updatePoint(*v_iter, &values[0]);
+    } // for
+  } // Setup source field
+
+  Field<Mesh> field(mesh);
+  field.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
+  field.allocate();
+  const ALE::Obj<Mesh::RealSection>& section = field.section();
+  { // Setup destination field
+
+    double_array values(fiberDim);
+    int i = 0;
+    for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+	 v_iter != vertices->end();
+	 ++v_iter) {
+      for (int iDim=0; iDim < fiberDim; ++iDim)
+	values[iDim] = valuesB[i++];
+      section->updatePoint(*v_iter, &values[0]);
+    } // for
+  } // Setup destination field
+
+  field += fieldSrc;
+
+  int i = 0;
+  double_array values(fiberDim);
+  const double tolerance = 1.0e-6;
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter) {
+    section->restrictPoint(*v_iter, &values[0], values.size());
+    for (int iDim=0; iDim < fiberDim; ++iDim) {
+      const double valueE = valuesA[i] + valuesB[i];
+      ++i;
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(valueE, values[iDim], tolerance);
+    } // for
+  } // for
+} // testOperateAdd
+
+// ----------------------------------------------------------------------
+// Test dimensionalize().
+void
+pylith::topology::TestFieldMesh::testDimensionalize(void)
+{ // testDimensionalize
+  const int fiberDim = 3;
+  const double scale = 2.0;
+  const double valuesNondim[] = {
+    1.1, 2.2, 3.3,
+    1.2, 2.3, 3.4,
+    1.3, 2.4, 3.5,
+    1.4, 2.5, 3.6,
+  };
+
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+  Field<Mesh> field(mesh);
+  field.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
+  field.allocate();
+  const ALE::Obj<Mesh::RealSection>& section = field.section();
+  const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+
+  double_array values(fiberDim);
+  int i = 0;
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter) {
+    for (int iDim=0; iDim < fiberDim; ++iDim)
+      values[iDim] = valuesNondim[i++];
+    section->updatePoint(*v_iter, &values[0]);
+  } // for
+
+  field.scale(scale);
+  field.addDimensionOkay(true);
+  field.dimensionalize();
+
+  i = 0;
+  const double tolerance = 1.0e-6;
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter) {
+    section->restrictPoint(*v_iter, &values[0], values.size());
+    for (int iDim=0; iDim < fiberDim; ++iDim) {
+      const double valueE = valuesNondim[i++]*scale;
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(valueE, values[iDim], tolerance);
+    } // for
+  } // for
+
+} // testDimensionalize
+
+// ----------------------------------------------------------------------
+// Test view().
+void
+pylith::topology::TestFieldMesh::testView(void)
+{ // testView
+  const int fiberDim = 3;
+  const double scale = 2.0;
+  const double valuesNondim[] = {
+    1.1, 2.2, 3.3,
+    1.2, 2.3, 3.4,
+    1.3, 2.4, 3.5,
+    1.4, 2.5, 3.6,
+  };
+
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+  Field<Mesh> field(mesh);
+  field.newSection(Field<Mesh>::VERTICES_FIELD, fiberDim);
+  field.allocate();
+  const ALE::Obj<Mesh::RealSection>& section = field.section();
+  const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+
+  double_array values(fiberDim);
+  int i = 0;
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter) {
+    for (int iDim=0; iDim < fiberDim; ++iDim)
+      values[iDim] = valuesNondim[i++];
+    section->updatePoint(*v_iter, &values[0]);
+  } // for
+
+  field.view("Testing view");
+} // testView
+
+// ----------------------------------------------------------------------
+void
+pylith::topology::TestFieldMesh::_buildMesh(Mesh* mesh)
+{ // _buildMesh
+  assert(0 != mesh);
+
+  mesh->createSieveMesh(_TestFieldMesh::cellDim);
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh->sieveMesh();
+
+  ALE::Obj<Mesh::SieveMesh::sieve_type> sieve = 
+    new Mesh::SieveMesh::sieve_type(sieveMesh->comm());
+  CPPUNIT_ASSERT(!sieve.isNull());
+
+  ALE::Obj<ALE::Mesh::sieve_type> s = 
+    new ALE::Mesh::sieve_type(sieve->comm(), sieve->debug());
+  
+  const int cellDim = _TestFieldMesh::cellDim;
+  const int ncells = _TestFieldMesh::ncells;
+  const int* cells = _TestFieldMesh::cells;
+  const int nvertices = _TestFieldMesh::nvertices;
+  const int ncorners = _TestFieldMesh::ncorners;
+  const int spaceDim = _TestFieldMesh::cellDim;
+  const double* coordinates = _TestFieldMesh::coordinates;
+  const bool interpolate = false;
+  ALE::SieveBuilder<ALE::Mesh>::buildTopology(s, cellDim, ncells, (int*) cells,
+					      nvertices, interpolate, 
+					      ncorners);
+  std::map<Mesh::SieveMesh::point_type,Mesh::SieveMesh::point_type> renumbering;
+  ALE::ISieveConverter::convertSieve(*s, *sieve, renumbering);
+  sieveMesh->setSieve(sieve);
+  sieveMesh->stratify();
+  ALE::SieveBuilder<Mesh::SieveMesh>::buildCoordinates(sieveMesh, spaceDim, 
+						       coordinates);
+
+  spatialdata::geocoords::CSCart cs;
+  cs.setSpaceDim(spaceDim);
+  cs.initialize();
+  mesh->coordsys(&cs);
+} // _buildMesh
+
+
+// End of file 

Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.hh (from rev 14022, short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.hh	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.hh	2009-02-06 00:09:22 UTC (rev 14023)
@@ -0,0 +1,132 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/topology/TestFieldMesh.hh
+ *
+ * @brief C++ unit testing for Field.
+ */
+
+#if !defined(pylith_topology_testfieldmesh_hh)
+#define pylith_topology_testfieldmesh_hh
+
+// Include directives ---------------------------------------------------
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "pylith/topology/topologyfwd.hh" // forward declarations
+
+// Forward declarations -------------------------------------------------
+/// Namespace for pylith package
+namespace pylith {
+  namespace topology {
+    class TestFieldMesh;
+  } // topology
+} // pylith
+
+// TestFieldMesh -------------------------------------------------------------
+/// C++ unit testing for Field.
+class pylith::topology::TestFieldMesh : public CppUnit::TestFixture
+{ // class TestFieldMesh
+
+  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+  CPPUNIT_TEST_SUITE( TestFieldMesh );
+
+  CPPUNIT_TEST( testConstructor );
+  CPPUNIT_TEST( testSection );
+  CPPUNIT_TEST( testMesh );
+  CPPUNIT_TEST( testSpaceDim );
+  CPPUNIT_TEST( testNewSection );
+  CPPUNIT_TEST( testNewSectionPoints );
+  CPPUNIT_TEST( testNewSectionDomain );
+  CPPUNIT_TEST( testNewSectionChart );
+  CPPUNIT_TEST( testNewSectionField );
+  CPPUNIT_TEST( testClear );
+  CPPUNIT_TEST( testAllocate );
+  CPPUNIT_TEST( testZero );
+  CPPUNIT_TEST( testComplete );
+  CPPUNIT_TEST( testCopy );
+  CPPUNIT_TEST( testOperatorAdd );
+  CPPUNIT_TEST( testDimensionalize );
+  CPPUNIT_TEST( testView );
+
+  CPPUNIT_TEST_SUITE_END();
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Test constructor.
+  void testConstructor(void);
+
+  /// Test section().
+  void testSection(void);
+
+  /// Test mesh().
+  void testMesh(void);
+
+  /// Test spaceDim().
+  void testSpaceDim(void);
+
+  /// Test newSection().
+  void testNewSection(void);
+
+  /// Test newSection(points).
+  void testNewSectionPoints(void);
+
+  /// Test newSection(domain).
+  void testNewSectionDomain(void);
+
+  /// Test newSection(chart).
+  void testNewSectionChart(void);
+
+  /// Test newSection(field).
+  void testNewSectionField(void);
+
+  /// Test clear().
+  void testClear(void);
+
+  /// Test allocate().
+  void testAllocate(void);
+
+  /// Test zero().
+  void testZero(void);
+
+  /// Test complete().
+  void testComplete(void);
+
+  /// Test copy().
+  void testCopy(void);
+
+  /// Test operator+=().
+  void testOperatorAdd(void);
+
+  /// Test dimensionalize().
+  void testDimensionalize(void);
+
+  /// Test view().
+  void testView(void);
+
+// PRIVATE METHODS /////////////////////////////////////////////////////
+private :
+
+  /** Build mesh.
+   *
+   * @param mesh Finite-element mesh.
+   */
+  static
+  void _buildMesh(Mesh* mesh);
+
+}; // class TestFieldMesh
+
+#endif // pylith_topology_testfieldmesh_hh
+
+
+// End of file 

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestMesh.cc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestMesh.cc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -69,7 +69,7 @@
   const int dim = 2;
   Mesh mesh(dim);
   
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
   CPPUNIT_ASSERT(!sieveMesh.isNull());
   CPPUNIT_ASSERT_EQUAL(dim, sieveMesh->getDimension());
 } // testSieveMesh

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSubMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSubMesh.cc	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSubMesh.cc	2009-02-06 00:09:22 UTC (rev 14023)
@@ -13,8 +13,9 @@
 #include <portinfo>
 
 #include "TestSubMesh.hh" // Implementation of class methods
+
+#include "pylith/topology/Mesh.hh" // USES Mesh
 #include "pylith/topology/SubMesh.hh" // USES SubMesh
-#include "pylith/topology/Mesh.hh" // USES Mesh
 
 #include "spatialdata/geocoords/CSCart.hh" // USES CSCart
 
@@ -56,7 +57,7 @@
 void
 pylith::topology::TestSubMesh::testConstructor(void)
 { // testConstructor
-  SubMesh mesh;
+  SubMesh<Mesh> mesh;
   CPPUNIT_ASSERT(mesh._mesh.isNull());
   CPPUNIT_ASSERT_EQUAL(0, mesh.dimension());
   CPPUNIT_ASSERT_EQUAL(false, mesh.debug());
@@ -71,19 +72,19 @@
   Mesh mesh2D;
   _buildMesh(&mesh2D);
   
-  SubMesh mesh(mesh2D, _TestSubMesh::label);
+  SubMesh<Mesh> mesh(mesh2D, _TestSubMesh::label);
   CPPUNIT_ASSERT(!mesh._mesh.isNull());
   CPPUNIT_ASSERT_EQUAL(_TestSubMesh::cellDim-1, mesh.dimension());
   CPPUNIT_ASSERT_EQUAL(PETSC_COMM_WORLD, mesh.comm());
 
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+  const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices = 
     sieveMesh->depthStratum(0);
   CPPUNIT_ASSERT(!vertices.isNull());
   const int nvertices = _TestSubMesh::groupSize;
   CPPUNIT_ASSERT_EQUAL(size_t(nvertices), vertices->size());
   int iV = 0;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
        v_iter != vertices->end();
        ++v_iter)
     CPPUNIT_ASSERT_EQUAL(_TestSubMesh::submeshVertices[iV++], *v_iter);
@@ -97,9 +98,9 @@
   Mesh mesh2D;
   _buildMesh(&mesh2D);
 
-  SubMesh mesh(mesh2D, _TestSubMesh::label);
+  SubMesh<Mesh> mesh(mesh2D, _TestSubMesh::label);
   
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
   CPPUNIT_ASSERT(!sieveMesh.isNull());
   CPPUNIT_ASSERT_EQUAL(_TestSubMesh::cellDim-1, mesh.dimension());
 } // testSieveMesh
@@ -112,20 +113,20 @@
   Mesh mesh2D;
   _buildMesh(&mesh2D);
   
-  SubMesh mesh;
+  SubMesh<Mesh> mesh;
   mesh.createSubMesh(mesh2D, _TestSubMesh::label);
   CPPUNIT_ASSERT(!mesh._mesh.isNull());
   CPPUNIT_ASSERT_EQUAL(_TestSubMesh::cellDim-1, mesh.dimension());
   CPPUNIT_ASSERT_EQUAL(PETSC_COMM_WORLD, mesh.comm());
 
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
+  const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices = 
     sieveMesh->depthStratum(0);
   CPPUNIT_ASSERT(!vertices.isNull());
   const int nvertices = _TestSubMesh::groupSize;
   CPPUNIT_ASSERT_EQUAL(size_t(nvertices), vertices->size());
   int iV = 0;
-  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+  for (Mesh::SieveMesh::label_sequence::iterator v_iter=vertices->begin();
        v_iter != vertices->end();
        ++v_iter)
     CPPUNIT_ASSERT_EQUAL(_TestSubMesh::submeshVertices[iV++], *v_iter);
@@ -139,7 +140,7 @@
   Mesh mesh2D;
   _buildMesh(&mesh2D);
 
-  SubMesh mesh(mesh2D, _TestSubMesh::label);
+  SubMesh<Mesh> mesh(mesh2D, _TestSubMesh::label);
 
   CPPUNIT_ASSERT_EQUAL(_TestSubMesh::cellDim, mesh.coordsys()->spaceDim());
 } // testCoordsys
@@ -149,7 +150,7 @@
 void
 pylith::topology::TestSubMesh::testDebug(void)
 { // testDebug
-  SubMesh mesh;
+  SubMesh<Mesh> mesh;
   CPPUNIT_ASSERT_EQUAL(false, mesh.debug());
 
   mesh.debug(true);
@@ -161,12 +162,12 @@
 void
 pylith::topology::TestSubMesh::testDimension(void)
 { // testDimension
-  SubMesh mesh;
+  SubMesh<Mesh> mesh;
   CPPUNIT_ASSERT_EQUAL(0, mesh.dimension());
 
   Mesh mesh2D;
   _buildMesh(&mesh2D);
-  SubMesh mesh2(mesh2D, _TestSubMesh::label);
+  SubMesh<Mesh> mesh2(mesh2D, _TestSubMesh::label);
   CPPUNIT_ASSERT_EQUAL(_TestSubMesh::cellDim-1, mesh2.dimension());
 } // testDimension
 
@@ -175,7 +176,7 @@
 void
 pylith::topology::TestSubMesh::testComm(void)
 { // testComm
-  SubMesh mesh;
+  SubMesh<Mesh> mesh;
   CPPUNIT_ASSERT_EQUAL(0, mesh.comm());
 
   Mesh mesh2D;
@@ -192,7 +193,7 @@
 { // testInitialize
   Mesh mesh2D;
   _buildMesh(&mesh2D);
-  SubMesh mesh(mesh2D, _TestSubMesh::label);
+  SubMesh<Mesh> mesh(mesh2D, _TestSubMesh::label);
 
   mesh.initialize();
 } // testInitialize
@@ -204,10 +205,10 @@
   assert(0 != mesh);
 
   mesh->createSieveMesh(_TestSubMesh::cellDim);
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh->sieveMesh();
+  const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh->sieveMesh();
 
-  ALE::Obj<SieveMesh::sieve_type> sieve = 
-    new SieveMesh::sieve_type(sieveMesh->comm());
+  ALE::Obj<Mesh::SieveMesh::sieve_type> sieve = 
+    new Mesh::SieveMesh::sieve_type(sieveMesh->comm());
   CPPUNIT_ASSERT(!sieve.isNull());
 
   ALE::Obj<ALE::Mesh::sieve_type> s = 
@@ -224,20 +225,20 @@
   ALE::SieveBuilder<ALE::Mesh>::buildTopology(s, cellDim, ncells, (int*) cells,
 					      nvertices, interpolate, 
 					      ncorners);
-  std::map<SieveMesh::point_type,SieveMesh::point_type> renumbering;
+  std::map<Mesh::SieveMesh::point_type,Mesh::SieveMesh::point_type> renumbering;
   ALE::ISieveConverter::convertSieve(*s, *sieve, renumbering);
   sieveMesh->setSieve(sieve);
   sieveMesh->stratify();
-  ALE::SieveBuilder<SieveMesh>::buildCoordinates(sieveMesh, spaceDim, 
-						 coordinates);
+  ALE::SieveBuilder<Mesh::SieveMesh>::buildCoordinates(sieveMesh, spaceDim, 
+						       coordinates);
 
   spatialdata::geocoords::CSCart cs;
   cs.setSpaceDim(spaceDim);
   cs.initialize();
   mesh->coordsys(&cs);
 
-  typedef SieveMesh::int_section_type::chart_type chart_type;
-  const ALE::Obj<SieveMesh::int_section_type>& groupField = 
+  typedef Mesh::IntSection::chart_type chart_type;
+  const ALE::Obj<Mesh::IntSection>& groupField = 
     sieveMesh->getIntSection(_TestSubMesh::label);
   assert(!groupField.isNull());
 

Added: short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMeshField.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMeshField.py	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMeshField.py	2009-02-06 00:09:22 UTC (rev 14023)
@@ -0,0 +1,151 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/topology/TestMeshField.py
+
+## @brief Unit testing of MeshField object.
+
+import unittest
+
+from pylith.topology.MeshField import MeshField
+
+# ----------------------------------------------------------------------
+class TestMeshField(unittest.TestCase):
+  """
+  Unit testing of MeshField object.
+  """
+
+  def setUp(self):
+    """
+    Setup mesh and associated field.
+    """
+    from spatialdata.geocoords.CSCart import CSCart
+    cs = CSCart()
+    cs.inventory.spaceDim = 2
+    cs._configure()
+
+    from spatialdata.units.Nondimensional import Nondimensional
+    normalizer = Nondimensional()
+    normalizer._configure()    
+
+    from pylith.meshio.MeshIOAscii import MeshIOAscii
+    importer = MeshIOAscii()
+    importer.inventory.filename = "data/tri3.mesh"
+    importer.inventory.coordsys = cs
+    importer._configure()
+    self.mesh = importer.read(normalizer, debug=False, interpolate=False)
+    
+    self.field = MeshField(self.mesh)
+    return
+
+
+  def test_constructorA(self):
+    """
+    Test constructor.
+    """
+    return
+
+
+  def test_mesh(self):
+    """
+    Test mesh().
+    """
+    mesh = self.field.mesh()
+    
+    self.assertEqual(2, mesh.dimension())
+    return
+
+
+  def test_name(self):
+    """
+    Test name().
+    """
+    name = "field A"
+
+    self.field.name(name)
+    self.assertEqual(name, self.field.name())
+    return
+
+
+  def test_vectorFieldType(self):
+    """
+    Test vectorFieldType().
+    """
+    fieldType = MeshField.MULTI_SCALAR
+
+    self.field.vectorFieldType(fieldType)
+    self.assertEqual(fieldType, self.field.vectorFieldType())
+    return
+
+
+  def test_scale(self):
+    """
+    Test scale().
+    """
+    scale = 2.0
+
+    self.field.scale(scale)
+    self.assertEqual(scale, self.field.scale())
+    return
+
+
+  def test_addDimensionOkay(self):
+    """
+    Test addDimensionOkay().
+    """
+    self.assertEqual(False, self.field.addDimensionOkay())
+
+    self.field.addDimensionOkay(True)
+    self.assertEqual(True, self.field.addDimensionOkay())
+    return
+
+
+  def test_spaceDim(self):
+    """
+    Test spaceDim().
+    """
+    self.assertEqual(2, self.field.spaceDim())
+    return
+
+
+  def test_newSection(self):
+    """
+    Test newSection().
+    """
+    self.field.newSection()
+
+    # No test of result
+    return
+
+
+  def test_newSectionDomain(self):
+    """
+    Test newSection(domain).
+    """
+    self.field.newSection(MeshField.VERTICES_FIELD, 4)
+
+    # No test of result
+    return
+
+
+  def test_newSectionField(self):
+    """
+    Test newSection(field).
+    """
+    fieldB = MeshField(self.mesh)
+    fieldB.newSection(self.field)
+
+    # No test of result
+    return
+
+
+# End of file 

Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/testdriver.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/testdriver.py	2009-02-04 19:23:21 UTC (rev 14022)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/testdriver.py	2009-02-06 00:09:22 UTC (rev 14023)
@@ -60,6 +60,9 @@
     from TestSubMesh import TestSubMesh
     suite.addTest(unittest.makeSuite(TestSubMesh))
 
+    from TestMeshField import TestMeshField
+    suite.addTest(unittest.makeSuite(TestMeshField))
+
     from TestMeshGenerator import TestMeshGenerator
     suite.addTest(unittest.makeSuite(TestMeshGenerator))
 



More information about the CIG-COMMITS mailing list