[cig-commits] r14063 - in short/3D/PyLith/branches/pylith-swig: . libsrc libsrc/bc libsrc/materials libsrc/topology

brad at geodynamics.org brad at geodynamics.org
Tue Feb 17 15:43:20 PST 2009


Author: brad
Date: 2009-02-17 15:43:19 -0800 (Tue, 17 Feb 2009)
New Revision: 14063

Added:
   short/3D/PyLith/branches/pylith-swig/libsrc/materials/Metadata.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/materials/Metadata.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/materials/Metadata.icc
   short/3D/PyLith/branches/pylith-swig/libsrc/materials/materialsfwd.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.hh
Modified:
   short/3D/PyLith/branches/pylith-swig/TODO
   short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
   short/3D/PyLith/branches/pylith-swig/libsrc/bc/AbsorbingDampers.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/bc/Neumann.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/materials/Makefile.am
   short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.icc
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh
   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/SubMesh.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/topologyfwd.hh
Log:
Started cleaning up Material interface.

Modified: short/3D/PyLith/branches/pylith-swig/TODO
===================================================================
--- short/3D/PyLith/branches/pylith-swig/TODO	2009-02-17 23:28:34 UTC (rev 14062)
+++ short/3D/PyLith/branches/pylith-swig/TODO	2009-02-17 23:43:19 UTC (rev 14063)
@@ -9,11 +9,12 @@
   libtests/bc/TestDirichletBoundary::testVertexField()
   libtests/bc/TestDirichletBoundary::testBoundaryMesh()
 
-  FieldsManager (change to SolutionFields)
-
   DirichletPoints (Python) - rate == None -> dbRate == 0
   DirichletBoundary (Python) - rate == None -> dbRate == 0
 
+  materials::Metadata
+    Need array of names of properties and state variables?
+
 1. Reduce memory use (new labels) [Matt]
 
 2. Nondimensionalize [Brad]
@@ -33,23 +34,19 @@
       Integrator::normalizer()
       DataWriter::normalizer()
 
-3. Mesh and Field objects [Brad]
-    Change name of FieldsManager to SolutionFields
-      (more accurate description).
+3. Clean-up interface for materials [Brad]
 
-4. Clean-up interface for materials [Brad]
+4. Power-law nonlinear rheology [Charles]
 
-5. Power-law nonlinear rheology [Charles]
+5. Savage-Presscott benchmark [Charles]
 
-6. Savage-Presscott benchmark [Charles]
+6. Interface with PETSc nonlinear solvers [Brad and Matt]
 
-7. Interface with PETSc nonlinear solvers [Brad and Matt]
+7. Modularize output? [Matt]
 
-8. Modularize output? [Matt]
-
 -- Release (v1.4) --
 
-9. Fault friction
+8. Fault friction
 
 Other
 

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am	2009-02-17 23:28:34 UTC (rev 14062)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am	2009-02-17 23:43:19 UTC (rev 14063)
@@ -50,6 +50,8 @@
 	feassemble/Quadrature2D.cc \
 	feassemble/Quadrature2Din3D.cc \
 	feassemble/Quadrature3D.cc \
+	materials/Metadata.cc \
+	materials/Material.cc \
 	meshio/BinaryIO.cc \
 	meshio/GMVFile.cc \
 	meshio/GMVFileAscii.cc \
@@ -61,6 +63,7 @@
 	meshio/PsetFile.cc \
 	meshio/PsetFileAscii.cc \
 	meshio/PsetFileBinary.cc \
+	topology/FieldBase.cc \
 	topology/Mesh.cc \
 	topology/MeshOps.cc \
 	topology/SubMesh.cc \
@@ -89,7 +92,6 @@
 # 	feassemble/Quadrature2D.cc \
 # 	feassemble/Quadrature2Din3D.cc \
 # 	feassemble/Quadrature3D.cc \
-# 	materials/Material.cc \
 # 	materials/ElasticStress1D.cc \
 # 	materials/ElasticStrain1D.cc \
 # 	materials/ElasticIsotropic3D.cc \

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/AbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/AbsorbingDampers.cc	2009-02-17 23:28:34 UTC (rev 14062)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/AbsorbingDampers.cc	2009-02-17 23:43:19 UTC (rev 14063)
@@ -215,7 +215,8 @@
       // Compute normal/tangential orientation
       submesh->restrictClosure(coordinates, *c_iter, 
 			       &cellVertices[0], cellVertices.size());
-      memcpy(&quadPtRef[0], &quadPtsRef[iQuad*cellDim], cellDim*sizeof(double));
+      memcpy(&quadPtRef[0], &quadPtsRef[iQuad*cellDim], 
+	     cellDim*sizeof(double));
       memcpy(&cellVertices[0], coordsVisitor.getValues(), 
 	     cellVertices.size()*sizeof(double));
       cellGeometry.jacobian(&jacobian, &jacobianDet, cellVertices, quadPtRef);
@@ -240,9 +241,10 @@
 // ----------------------------------------------------------------------
 // Integrate contributions to residual term (r) for operator.
 void
-pylith::bc::AbsorbingDampers::integrateResidual(const topology::Field<topology::Mesh>& residual,
-						const double t,
-						topology::SolutionFields* const fields)
+pylith::bc::AbsorbingDampers::integrateResidual(
+			     const topology::Field<topology::Mesh>& residual,
+			     const double t,
+			     topology::SolutionFields* const fields)
 { // integrateResidual
   assert(0 != _quadrature);
   assert(0 != _boundaryMesh);
@@ -258,6 +260,10 @@
   const int numBasis = _quadrature->numBasis();
   const int spaceDim = _quadrature->spaceDim();
 
+  // Allocate vectors for cell values.
+  _initCellVector();
+  double_array dampersCell(numQuadPts*spaceDim);
+
   // Get cell information
   const ALE::Obj<SieveSubMesh>& submesh = _boundaryMesh->sieveMesh();
   assert(!submesh.isNull());
@@ -272,6 +278,8 @@
 
   const ALE::Obj<RealSection>& residualSection = residual.section();
   assert(!residualSection.isNull());
+  topology::SubMesh::UpdateAddVisitor residualVisitor(*residualSection,
+						      &_cellVector[0]);
 
   const topology::Field<topology::Mesh>& dispTpdt = 
     fields->get("disp t+dt");
@@ -290,9 +298,6 @@
   const double dt = _dt;
   assert(dt > 0);
 
-  // Allocate vectors for cell values.
-  _initCellVector();
-
   for (SieveSubMesh::label_sequence::iterator c_iter=cells->begin();
        c_iter != cellsEnd;
        ++c_iter) {
@@ -311,8 +316,8 @@
     submesh->restrictClosure(*c_iter, dispTmdtVisitor);
     const double* dispTmdtCell = dispTmdtVisitor.getValues();
 
-    assert(numQuadPts*spaceDim == dampersSection->getFiberDimension(*c_iter));
-    const double* dampingConstsCell = dampersSection->restrictPoint(*c_iter);
+    dampersSection->restrictPoint(*c_iter, 
+				  &dampersCell[0], dampersCell.size());
 
     // Get cell geometry information that depends on cell
     const double_array& basis = _quadrature->basis();
@@ -329,7 +334,7 @@
           const double valIJ = valI * basis[iQuad*numBasis+jBasis];
           for (int iDim=0; iDim < spaceDim; ++iDim)
             _cellVector[iBasis*spaceDim+iDim] += 
-	      dampingConstsCell[iQuad*spaceDim+iDim] *
+	      dampersCell[iQuad*spaceDim+iDim] *
 	      valIJ * (dispTmdtCell[jBasis*spaceDim+iDim]);
         } // for
       } // for
@@ -338,7 +343,8 @@
     PetscLogFlops(numQuadPts*(3+numBasis*(1+numBasis*(5*spaceDim))));
 
     // Assemble cell contribution into field
-    submesh->updateAdd(residualSection, *c_iter, &_cellVector[0]);
+    residualVisitor.clear();
+    submesh->updateAdd(*c_iter, residualVisitor);
   } // for
 } // integrateResidual
 
@@ -346,9 +352,9 @@
 // Integrate contributions to Jacobian matrix (A) associated with
 void
 pylith::bc::AbsorbingDampers::integrateJacobian(
-					 PetscMat* jacobian,
-					 const double t,
-					 topology::SolutionFields* const fields)
+				      PetscMat* jacobian,
+				      const double t,
+				      topology::SolutionFields* const fields)
 { // integrateJacobian
   assert(0 != _quadrature);
   assert(0 != _boundaryMesh);

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/Neumann.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/Neumann.cc	2009-02-17 23:28:34 UTC (rev 14062)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/Neumann.cc	2009-02-17 23:43:19 UTC (rev 14063)
@@ -244,9 +244,10 @@
 // ----------------------------------------------------------------------
 // Integrate contributions to residual term (r) for operator.
 void
-pylith::bc::Neumann::integrateResidual(const topology::Field<topology::Mesh>& residual,
-				       const double t,
-				       topology::SolutionFields* const fields)
+pylith::bc::Neumann::integrateResidual(
+			     const topology::Field<topology::Mesh>& residual,
+			     const double t,
+			     topology::SolutionFields* const fields)
 { // integrateResidual
   assert(0 != _quadrature);
   assert(0 != _boundaryMesh);
@@ -254,6 +255,17 @@
 
   PetscErrorCode err = 0;
 
+  // Get cell geometry information that doesn't depend on cell
+  const int numQuadPts = _quadrature->numQuadPts();
+  const double_array& quadWts = _quadrature->quadWts();
+  assert(quadWts.size() == numQuadPts);
+  const int numBasis = _quadrature->numBasis();
+  const int spaceDim = _quadrature->spaceDim();
+
+  // Allocate vectors for cell values.
+  _initCellVector();
+  double_array tractionsCell(numQuadPts*spaceDim);
+
   // Get cell information
   const ALE::Obj<SieveSubMesh>& submesh = _boundaryMesh->sieveMesh();
   assert(!submesh.isNull());
@@ -266,19 +278,9 @@
   const ALE::Obj<SubRealSection>& tractSection = _tractions->section();
   assert(!tractSection.isNull());
   const ALE::Obj<RealSection>& residualSection = residual.section();
+  topology::SubMesh::UpdateAddVisitor residualVisitor(*residualSection,
+						      &_cellVector[0]);
 
-  // Get cell geometry information that doesn't depend on cell
-  const int numQuadPts = _quadrature->numQuadPts();
-  const double_array& quadWts = _quadrature->quadWts();
-  assert(quadWts.size() == numQuadPts);
-  const int numBasis = _quadrature->numBasis();
-  const int spaceDim = _quadrature->spaceDim();
-
-  // Allocate vectors for cell values.
-  _initCellVector();
-  const int cellVecSize = numBasis*spaceDim;
-  double_array tractionsCell(numQuadPts*spaceDim);
-
   // Loop over faces and integrate contribution from each face
   for (SieveSubMesh::label_sequence::iterator c_iter=cells->begin();
        c_iter != cellsEnd;
@@ -311,8 +313,8 @@
       } // for
     } // for
     // Assemble cell contribution into field
-    // :TODO: Use an UpdateAddVisitor?
-    submesh->updateAdd(residualSection, *c_iter, &_cellVector[0]);
+    residualVisitor.clear();
+    submesh->updateAdd(*c_iter, residualVisitor);
 
     PetscLogFlops(numQuadPts*(1+numBasis*(1+numBasis*(1+2*spaceDim))));
   } // for

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/materials/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/Makefile.am	2009-02-17 23:28:34 UTC (rev 14062)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/Makefile.am	2009-02-17 23:43:19 UTC (rev 14063)
@@ -25,10 +25,14 @@
 	GenMaxwellIsotropic3D.icc \
 	MaxwellIsotropic3D.hh \
 	MaxwellIsotropic3D.icc \
+	Metadata.hh \
+	Metadata.icc \
 	Material.hh \
 	Material.icc \
-	ViscoelasticMaxwell.hh
+	ViscoelasticMaxwell.hh \
+	materialsfwd.hh
 
+
 noinst_HEADERS =
 
 # export

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.cc	2009-02-17 23:28:34 UTC (rev 14062)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.cc	2009-02-17 23:43:19 UTC (rev 14063)
@@ -14,6 +14,7 @@
 
 #include "Material.hh" // implementation of object methods
 
+#include "pylith/topology/Mesh.hh" // USES Mesh
 #include "pylith/feassemble/Quadrature.hh" // USES Quadrature
 #include "pylith/utils/array.hh" // USES double_array, std::vector
 
@@ -29,33 +30,42 @@
 #include <sstream> // USES std::ostringstream
 
 // ----------------------------------------------------------------------
+typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+typedef pylith::topology::Mesh::RealSection RealSection;
+
+// ----------------------------------------------------------------------
 // Default constructor.
-pylith::materials::Material::Material(const int tensorSize,
-				      const char** dbValues,
-				      const char** initialStateDBValues,
-				      const int numDBValues,
-				      const PropMetaData* properties,
-				      const int numProperties) :
+pylith::materials::Material::Material(const int dimension,
+				      const int tensorSize,
+				      const Metadata& metadata) :
   _dt(0.0),
+  _properties(0),
+  _stateVars(0),
   _normalizer(new spatialdata::units::Nondimensional),
-  _totalPropsQuadPt(0),
-  _dimension(0),
+  _numPropsQuadPt(0),
+  _numVarsQuadPt(0),
+  _dimension(dimension),
   _tensorSize(tensorSize),
-  _initialStateSize(tensorSize),
-  _initialStateDBValues(initialStateDBValues),
   _needNewJacobian(false),
-  _db(0),
-  _initialStateDB(0),
+  _dbProperties(0),
+  _dbInitialState(0),
   _id(0),
   _label(""),
-  _propMetaData(properties),
-  _numProperties(numProperties),
-  _dbValues(dbValues),
-  _numDBValues(numDBValues)
+  _metadata(metadata)
 { // constructor
+  const string_vector& properties = metadata.properties();
+  const int numProperties = properties.size();
   for (int i=0; i < numProperties; ++i)
-    _totalPropsQuadPt += properties[i].fiberDim;
-  assert(_totalPropsQuadPt >= 0);
+    _numPropsQuadPt += metadata.fiberDim(properties[i].c_str(),
+					 Metadata::PROPERTY);
+  assert(_numPropsQuadPt >= 0);
+
+  const string_vector& stateVars = metadata.stateVars();
+  const int numStateVars = stateVars.size();
+  for (int i=0; i < numStateVars; ++i)
+    _numVarsQuadPt += metadata.fiberDim(stateVars[i].c_str(),
+					Metadata::STATEVAR);
+  assert(_numVarsQuadPt >= 0);
 } // constructor
 
 // ----------------------------------------------------------------------
@@ -64,9 +74,10 @@
 { // destructor
   delete _normalizer; _normalizer = 0;
 
-  // Python db object owns database, so just set pointer to null
-  _db = 0;
-  _initialStateDB = 0;
+  // Python db object owns databases, so just set pointer to null
+  // :KLUDGE: Should use shared pointer
+  _dbProperties = 0;
+  _dbInitialState = 0;
 } // destructor
 
 // ----------------------------------------------------------------------
@@ -84,78 +95,83 @@
 // Get physical property parameters and initial state (if used) from database.
 void
 pylith::materials::Material::initialize(
-			   const ALE::Obj<Mesh>& mesh,
-			   const spatialdata::geocoords::CoordSys* cs,
-			   pylith::feassemble::Quadrature* quadrature)
+		     const topology::Mesh& mesh,
+		     feassemble::Quadrature<topology::Mesh>* quadrature)
 { // initialize
-  assert(0 != _db);
-  assert(0 != cs);
+  assert(0 != _dbProperties);
   assert(0 != quadrature);
-  assert(!mesh.isNull());
 
+  // Get quadrature information
+  const int numQuadPts = quadrature->numQuadPts();
+  const int spaceDim = quadrature->spaceDim();
+
   // Get cells associated with material
-  const ALE::Obj<real_section_type>& coordinates = 
-    mesh->getRealSection("coordinates");
-  const ALE::Obj<Mesh::label_sequence>& cells = 
-    mesh->getLabelStratum("material-id", _id);
+  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+  assert(!sieveMesh.isNull());
+  const ALE::Obj<SieveMesh::label_sequence>& cells = 
+    sieveMesh->getLabelStratum("material-id", _id);
   assert(!cells.isNull());
-  const Mesh::label_sequence::iterator cellsEnd = cells->end();
+  const SieveMesh::label_sequence::iterator cellsEnd = cells->end();
+  const spatialdata::geocoords::CoordSys* cs = mesh.coordsys();
 
-  // Create sections to hold physical properties and state variables.
-  _properties = new real_section_type(mesh->comm(), mesh->debug());
-  assert(!_properties.isNull());
-  _properties->setChart(real_section_type::chart_type(*std::min_element(cells->begin(), cells->end()),
-                                                      *std::max_element(cells->begin(), cells->end())+1));
+  // Create sections to hold physical properties
+  delete _properties; _properties = new topology::Field<topology::Mesh>(mesh);
+  assert(0 != _properties);
+  int fiberDim = numQuadPts * _numPropsQuadPt;
+  _properties->newSection(cells, fiberDim);
+  _properties->allocate();
+  const ALE::Obj<RealSection>& propertiesSection = _properties->section();
+  assert(!propertiesSection.isNull());
 
-  const int numQuadPts = quadrature->numQuadPts();
-  const int spaceDim = quadrature->spaceDim();
+  // Create arrays for querying
+  const int numDBProperties = _metadata.numDBProperties();
   double_array quadPtsGlobal(numQuadPts*spaceDim);
-  
-  // Fiber dimension is number of quadrature points times number of
-  // values per parameter
-  const int totalPropsQuadPt = _totalPropsQuadPt;
-  const int fiberDim = totalPropsQuadPt * numQuadPts;
-  _properties->setFiberDimension(cells, fiberDim);
-  mesh->allocate(_properties);
+  double_array propertiesQuery(numDBProperties);
+  double_array propertiesCell(numQuadPts*numDBProperties);
 
-  const int initialStateSize = _initialStateSize;
-  const int initialStateFiberDim = initialStateSize * numQuadPts;
-  double_array initialStateQueryData(initialStateSize);
-  double_array initialStateCellData(initialStateFiberDim);
+  // Setup database for quering for physical properties
+  _dbProperties->open();
+  _dbProperties->queryVals(_metadata.dbProperties(),
+			   _metadata.numDBProperties());
 
-  // If initial state is being used, create a section to hold it.
-  if (0 == _initialStateDB)
-    assert(_initialState.isNull());
-  else {
-    _initialState = new real_section_type(mesh->comm(), mesh->debug());
-    assert(!_initialState.isNull());
-    _initialState->setChart(real_section_type::chart_type(
-		 *std::min_element(cells->begin(), cells->end()),
-		 *std::max_element(cells->begin(), cells->end())+1));
-    _initialState->setFiberDimension(cells, initialStateFiberDim);
-    mesh->allocate(_initialState);
+  // Create sections to hold state variables
+  delete _stateVars; _stateVars = new topology::Field<topology::Mesh>(mesh);
+  assert(0 != _stateVars);
+  fiberDim = numQuadPts * _numVarsQuadPt;
+  if (fiberDim > 0) {
+    const ALE::Obj<RealSection::chart_type>& chart = 
+      propertiesSection->getChart();
+    assert(!chart.isNull());
+    _stateVars->newSection(*chart, fiberDim);
+    _stateVars->allocate();
+  } // if
+  const ALE::Obj<RealSection>& stateVarsSection = _stateVars->section();
+  assert(!stateVarsSection.isNull());
 
-    // Setup database for querying
-    _initialStateDB->open();
-    _initialStateDB->queryVals(_initialStateDBValues, initialStateSize);
+  // Create arrays for querying
+  const int numDBStateVars = _metadata.numDBStateVars();
+  double_array stateVarsQuery;
+  double_array stateVarsCell;
+  if (0 != _dbInitialState) {
+    assert(numDBStateVars > 0);
+    assert(_numVarsQuadPt > 0);
+    stateVarsQuery.resize(numDBStateVars);
+    stateVarsCell.resize(numQuadPts*numDBStateVars);
+    
+    // Setup database for querying for initial state variables
+    _dbInitialState->open();
+    _dbInitialState->queryVals(_metadata.dbStateVars(),
+			       _metadata.numDBStateVars());
   } // if
 
-  // Setup database for querying
-  const int numValues = _numDBValues;
-  _db->open();
-  _db->queryVals(_dbValues, numValues);
-
   assert(0 != _normalizer);
   const double lengthScale = _normalizer->lengthScale();
-  
-  double_array queryData(numValues); // data returned in query  
-  double_array cellData(fiberDim); // Parameters at cell's quad pts
-
+    
   for (Mesh::label_sequence::iterator c_iter=cells->begin();
        c_iter != cellsEnd;
        ++c_iter) {
     // Compute geometry information for current cell
-    quadrature->computeGeometry(mesh, coordinates, *c_iter);
+    quadrature->retrieveGeometry(*c_iter);
 
     const double_array& quadPtsNonDim = quadrature->quadPts();
     quadPtsGlobal = quadPtsNonDim;
@@ -166,8 +182,8 @@
     for (int iQuadPt=0, index=0; 
 	 iQuadPt < numQuadPts; 
 	 ++iQuadPt, index+=spaceDim) {
-      int err = _db->query(&queryData[0], numValues, &quadPtsGlobal[index],
-			   spaceDim, cs);
+      int err = _dbProperties->query(&propertiesQuery[0], numDBProperties,
+				     &quadPtsGlobal[index], spaceDim, cs);
       if (err) {
 	std::ostringstream msg;
 	msg << "Could not find parameters for physical properties at \n"
@@ -175,15 +191,16 @@
 	for (int i=0; i < spaceDim; ++i)
 	  msg << "  " << quadPtsGlobal[index+i];
 	msg << ") in material " << _label << "\n"
-	    << "using spatial database '" << _db->label() << "'.";
+	    << "using spatial database '" << _dbProperties->label() << "'.";
 	throw std::runtime_error(msg.str());
       } // if
-      _dbToProperties(&cellData[totalPropsQuadPt*iQuadPt], queryData);
-      _nondimProperties(&cellData[totalPropsQuadPt*iQuadPt], totalPropsQuadPt);
+      _dbToProperties(&propertiesCell[iQuadPt*_numPropsQuadPt], 
+		      propertiesQuery);
+      _nondimProperties(&propertiesCell[iQuadPt*_numPropsQuadPt],
+			_numPropsQuadPt);
 
-      if (0 != _initialStateDB) {
-	err = _initialStateDB->query(&initialStateQueryData[0], 
-				     initialStateSize, 
+      if (0 != _dbInitialState) {
+	err = _dbInitialState->query(&stateVarsQuery[0], numDBStateVars,
 				     &quadPtsGlobal[index], spaceDim, cs);
 	if (err) {
 	  std::ostringstream msg;
@@ -191,56 +208,31 @@
 	  for (int i=0; i < spaceDim; ++i)
 	    msg << "  " << quadPtsGlobal[index+i];
 	  msg << ") in material " << _label << "\n"
-	      << "using spatial database '" << _initialStateDB->label() << "'.";
+	      << "using spatial database '" << _dbInitialState->label()
+	      << "'.";
 	  throw std::runtime_error(msg.str());
 	} // if
-	// nondimensionalize initial state
-	_nondimInitState(&initialStateQueryData[0], initialStateSize);
-	memcpy(&initialStateCellData[iQuadPt*initialStateSize],
-	       &initialStateQueryData[0],
-	       initialStateSize*sizeof(double));
+	_dbToStateVars(&stateVarsCell[iQuadPt*_numVarsQuadPt], 
+		       stateVarsQuery);
+	_nondimStateVars(&stateVarsCell[iQuadPt*_numVarsQuadPt],
+			 _numVarsQuadPt);
       } // if
 
     } // for
     // Insert cell contribution into fields
-    _properties->updatePoint(*c_iter, &cellData[0]);
-    if (0 != _initialStateDB)
-      _initialState->updatePoint(*c_iter, &initialStateCellData[0]);
+    propertiesSection->updatePoint(*c_iter, &propertiesCell[0]);
+    if (0 != _dbInitialState)
+      stateVarsSection->updatePoint(*c_iter, &stateVarsCell[0]);
   } // for
 
   // Close databases
-  _db->close();
-  if (0 != _initialStateDB)
-    _initialStateDB->close();
+  _dbProperties->close();
+  if (0 != _dbInitialState)
+    _dbInitialState->close();
 } // initialize
 
+#if 0
 // ----------------------------------------------------------------------
-// Get type of field associated with physical property.
-pylith::VectorFieldEnum
-pylith::materials::Material::propertyFieldType(const char* name) const
-{ // propertyFieldType
-  VectorFieldEnum fieldType = OTHER_FIELD;
-
-  // Find property in list of physical properties.
-  int i=0;
-  while (i < _numProperties)
-    if (0 == strcasecmp(name, _propMetaData[i].name))
-      break;
-    else
-      ++i;
-  if (i < _numProperties)
-    fieldType = _propMetaData[i].fieldType;
-  else {
-    std::ostringstream msg;
-    msg << "Unknown physical property '" << name << "' for material '"
-	<< _label << "'.";
-    throw std::runtime_error(msg.str());
-  } // else
- 
-  return fieldType;
-} // propertyFieldType
-
-// ----------------------------------------------------------------------
 // Get physical property field.
 void
 pylith::materials::Material::propertyField(ALE::Obj<real_section_type>* field,
@@ -310,6 +302,7 @@
     (*field)->updatePoint(*c_iter, &fieldCell[0]);
   } // for
 } // propertyField
+#endif
   
 
 // End of file 

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.hh	2009-02-17 23:28:34 UTC (rev 14062)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.hh	2009-02-17 23:43:19 UTC (rev 14063)
@@ -15,75 +15,42 @@
  * @brief C++ abstract base class for Material object.
  *
  * Interface definition for a material. The physical properties for
- * the material include BOTH parameters for the physical properties
- * AND state variables associated with the material constitutive
+ * the material are associated with the constants in the constitutive
  * model.
  */
 
 #if !defined(pylith_materials_material_hh)
 #define pylith_materials_material_hh
 
-#include "pylith/utils/array.hh" // USES double_array
-#include <string> // HASA std::string
-#include "pylith/utils/sievetypes.hh" // USES real_section_type
+// Include directives ---------------------------------------------------
+#include "materialsfwd.hh" // forward declarations
 
-/// Namespace for pylith package
-namespace pylith {
-  namespace materials {
-    class Material;
-    class TestMaterial; // unit testing
-  } // materials
+#include "pylith/topology/topologyfwd.hh" // forward declarations
+#include "pylith/feassemble/feassemblefwd.hh" // forward declarations
+#include "spatialdata/spatialdb/spatialdbfwd.hh" // forward declarations
+#include "spatialdata/units/unitsfwd.hh" // forward declarations
 
-  namespace feassemble {
-    class Quadrature; // USES Quadrature
-  } // feassemble
-} // pylith
+#include "Metadata.hh" // HASA Metadata
 
-/// Namespace for spatialdata package
-namespace spatialdata {
-  namespace spatialdb {
-    class SpatialDB; // forward declaration
-  } // spatialdb
-  namespace geocoords {
-    class CoordSys; // forward declaration
-  } // geocoords
-  namespace units {
-    class Nondimensional; // forward declaration
-  } // units
-} // spatialdata
+#include <string> // HASA std::string
 
-/// C++ abstract base class for Material object.
+// Material -------------------------------------------------------------
 class pylith::materials::Material
 { // class Material
   friend class TestMaterial; // unit testing
 
-  // PUBLIC STRUCTURES //////////////////////////////////////////////////
-public :
-
-  struct PropMetaData {
-    const char* name;
-    int fiberDim;
-    VectorFieldEnum fieldType;
-  }; // PropMetaData
-
   // PUBLIC METHODS /////////////////////////////////////////////////////
 public :
 
   /** Default constructor.
    *
+   * @param dimension Spatial dimension associated with material.
    * @param tensorSize Array of names of database values for material.
-   * @param initialStateDBValues Names of initial state database values for material.
-   * @param dbValues Array of names of database values for material.
-   * @param numDBValues Number of database values.
-   * @param properties Array of physical property meta data.
-   * @param numProperties Number of physical properties for material.
+   * @param metadata Metadata for physical properties and state variables.
    */
-  Material(const int tensorSize,
-	   const char** dbValues,
-	   const char** initialStateDBValues,
-	   const int numDBValues,
-	   const PropMetaData* properties,
-	   const int numProperties);
+  Material(const int dimension,
+	   const int tensorSize,
+	   const Metadata& metadata);
 
   /// Destructor.
   virtual
@@ -99,13 +66,13 @@
    *
    * @param value Pointer to database.
    */
-  void db(spatialdata::spatialdb::SpatialDB* value);
+  void dbProperties(spatialdata::spatialdb::SpatialDB* value);
 
   /** Set database for initial state variables.
    *
    * @param value Pointer to database.
    */
-  void initialStateDB(spatialdata::spatialdb::SpatialDB* value);
+  void dbInitialState(spatialdata::spatialdb::SpatialDB* value);
 
   /** Set identifier of material.
    *
@@ -157,7 +124,7 @@
    * @param quadrature Quadrature for finite-element integration
    */
   void initialize(const topology::Mesh& mesh,
-		  pylith::feassemble::Quadrature* quadrature);
+		  feassemble::Quadrature<topology::Mesh>* quadrature);
   
   /** Get flag indicating whether Jacobian matrix must be reformed for
    * current state.
@@ -170,14 +137,7 @@
   /// current state.
   void resetNeedNewJacobian(void);
 
-  /** Get type of field associated with physical property.
-   *
-   * @param name Name of physical property.
-   *
-   * @returns Type of vector field associated with property.
-   */
-  VectorFieldEnum propertyFieldType(const char* name) const;
-
+#if 0
   /** Get physical property field. Data is returned via the
    * argument.
    *
@@ -190,13 +150,14 @@
 		     const char* name,
 		     const topology::Mesh& mesh,
 		     const int numQuadPts) const;
+#endif
 
   // PROTECTED METHODS //////////////////////////////////////////////////
 protected :
 
   /** Compute properties from values in spatial database.
    *
-   * @param propVals Array of property values.
+   * @param propValues Array of property values.
    * @param dbValues Array of database values.
    */
   virtual
@@ -221,71 +182,71 @@
   void _dimProperties(double* const values,
 		      const int nvalues) const = 0;
 
-  /** Nondimensionalize initial state.
+  /** Compute initial state variables from values in spatial database.
    *
+   * @param stateValues Array of state variable values.
+   * @param dbValues Array of database values.
+   */
+  virtual
+  void _dbToStateVars(double* const stateValues,
+		      const double_array& dbValues) const = 0;
+
+  /** Nondimensionalize state variables.
+   *
    * @param values Array of initial state values.
    * @param nvalues Number of values.
    */
   virtual
-  void _nondimInitState(double* const values,
-			const int nvalues) const = 0;
-
-  /** Dimensionalize initial state.
+  void _nondimStateVars(double* const values,
+			   const int nvalues) const = 0;
+  
+  /** Dimensionalize state variables.
    *
    * @param values Array of initial state values.
    * @param nvalues Number of values.
    */
   virtual
-  void _dimInitState(double* const values,
-		     const int nvalues) const = 0;
+  void _dimStateVars(double* const values,
+			const int nvalues) const = 0;
 
-  // NOT IMPLEMENTED ////////////////////////////////////////////////////
-private :
-
-  /// Not implemented
-  Material(const Material& m);
-
-  /// Not implemented
-  const Material& operator=(const Material& m);
-
   // PROTECTED MEMBERS //////////////////////////////////////////////////
 protected :
 
   double _dt; ///< Current time step
 
-  /// Section containing physical properties of material.
-  ALE::Obj<real_section_type> _properties;
+  /// Field containing physical properties of material.
+  topology::Field<topology::Mesh>* _properties;
 
-  /// Section containing the initial state variables for the material.
-  ALE::Obj<real_section_type> _initialState;
+  /// Field containing the state variables for the material.
+  topology::Field<topology::Mesh>* _stateVars;
 
   spatialdata::units::Nondimensional* _normalizer; ///< Nondimensionalizer
   
-  int _totalPropsQuadPt; ///< Total # of property values per quad point.
-  int _dimension; ///< Spatial dimension associated with material.
-  int _tensorSize; ///< Tensor size for material.
-  int _initialStateSize; ///< Initial state size for material.
+  int _numPropsQuadPt; ///< Number of properties per quad point.
+  int _numVarsQuadPt; ///< Number of state variables per quad point.
+  const int _dimension; ///< Spatial dimension associated with material.
+  const int _tensorSize; ///< Tensor size for material.
   bool _needNewJacobian; ///< True if need to reform Jacobian, false otherwise.
 
   // PRIVATE MEMBERS ////////////////////////////////////////////////////
 private :
 
-  /// Database of parameters for physical properties of material
-  spatialdata::spatialdb::SpatialDB* _db;
+  /// Database of parameters for physical properties of material.
+  spatialdata::spatialdb::SpatialDB* _dbProperties;
 
-  /// Database of initial state values for the material
-  spatialdata::spatialdb::SpatialDB* _initialStateDB;
+  /// Database of initial state variables for the material.
+  spatialdata::spatialdb::SpatialDB* _dbInitialState;
 
-  int _id; ///< Material identifier
-  std::string _label; ///< Label of material
+  int _id; ///< Material identifier.
+  std::string _label; ///< Label of material.
 
-  const PropMetaData* _propMetaData; ///< Property meta data.
-  const int _numProperties; ///< Number of properties
+  const Metadata& _metadata; ///< Property and state variable metadata.
 
-  const char** _dbValues; ///< Names of database values
-  const int _numDBValues; ///< Number of database values
+  // NOT IMPLEMENTED ////////////////////////////////////////////////////
+private :
 
-  const char** _initialStateDBValues; ///< Names of initial state database values
+  Material(const Material&); ///< Not implemented.
+  const Material& operator=(const Material&); ///< Not implemented
 
 }; // class Material
 

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.icc	2009-02-17 23:28:34 UTC (rev 14062)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.icc	2009-02-17 23:43:19 UTC (rev 14063)
@@ -24,15 +24,15 @@
 // Set database for material parameters.
 inline
 void
-pylith::materials::Material::db(spatialdata::spatialdb::SpatialDB* value) {
-  _db = value;
+pylith::materials::Material::dbProperties(spatialdata::spatialdb::SpatialDB* value) {
+  _dbProperties = value;
 }
 
 // Set database for initial state variables.
 inline
 void
-pylith::materials::Material::initialStateDB(spatialdata::spatialdb::SpatialDB* value) {
-  _initialStateDB = value;
+pylith::materials::Material::dbInitialState(spatialdata::spatialdb::SpatialDB* value) {
+  _dbInitialState = value;
 }
 
 // Set identifier of material.
@@ -77,9 +77,8 @@
   return _dt;
 } // timeStep
 
-/* Get flag indicating whether Jacobian matrix must be reformed for
- * current state.
- */
+// Get flag indicating whether Jacobian matrix must be reformed for
+// current state.
 inline
 bool
 pylith::materials::Material::needNewJacobian(void) const {

Added: short/3D/PyLith/branches/pylith-swig/libsrc/materials/Metadata.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/Metadata.cc	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/Metadata.cc	2009-02-17 23:43:19 UTC (rev 14063)
@@ -0,0 +1,146 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "Metadata.hh" // implementation of class methods
+
+#include <sstream> // USES std::ostringstream
+#include <stdexcept> // USES std::runtime_error
+#include <cassert> // USES assert()
+
+// ----------------------------------------------------------------------
+// Constructor.
+pylith::materials::Metadata::Metadata(const int numProps,
+				      const ParamDescription* props,
+				      const int numDBProps,
+				      const char* dbProps[],
+				      const int numVars,
+				      const ParamDescription* vars,
+				      const int numDBVars,
+				      const char* dbVars[]) :
+  _numDBProperties(numDBProps),
+  _dbProperties(dbProps),
+  _numDBStateVars(numDBVars),
+  _dbStateVars(dbVars)
+{ // constructor
+  ParameterInfo info;
+
+  // Set physical property information.
+  _properties.clear();
+  _propertyNames.resize(numProps);
+  for (int i=0; i < numProps; ++i) {
+    info.fiberDim = props[i].fiberDim;
+    info.fieldType = props[i].fieldType;
+    _properties[props[i].name] = info;
+    _propertyNames[i] = props[i].name;
+  } // for
+
+  // Set state variable information.
+  _stateVars.clear();
+  _stateVarNames.resize(numVars);
+  for (int i=0; i < numVars; ++i) {
+    info.fiberDim = vars[i].fiberDim;
+    info.fieldType = vars[i].fieldType;
+    _stateVars[vars[i].name] = info;
+    _stateVarNames[i] = vars[i].name;
+  } // for
+} // constructor
+
+// ----------------------------------------------------------------------
+// Default destructor
+pylith::materials::Metadata::~Metadata(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Get fiber dimension of value.
+int
+pylith::materials::Metadata::fiberDim(const char* name,
+				      const ValueEnum valueType) const
+{ // fiberDim
+  int fiberDim = 0;
+
+  switch(valueType)
+    { // switch
+
+    case PROPERTY : {
+      ParameterMap::const_iterator iter = _properties.find(name);
+      if (iter == _properties.end()) {
+	std::ostringstream msg;
+	msg << "Could not find property '" << name
+	    << "' in list of properties to get fiber dimension.";
+	throw std::runtime_error(msg.str());
+      } // if
+      fiberDim = iter->second.fiberDim;
+    } // PROPERTY
+
+    case STATEVAR : {
+      ParameterMap::const_iterator iter = _stateVars.find(name);
+      if (iter == _stateVars.end()) {
+	std::ostringstream msg;
+	msg << "Could not find state variable '" << name
+	    << "' in list of state variables to get fiber dimension.";
+	throw std::runtime_error(msg.str());
+      } // if
+      fiberDim = iter->second.fiberDim;
+    } // STATEVAR
+
+    default :
+      assert(0);
+    } // switch
+
+  return fiberDim;
+} // fiberDim
+
+// ----------------------------------------------------------------------
+// Get type of vector field associated with value.
+pylith::topology::FieldBase::VectorFieldEnum
+pylith::materials::Metadata::fieldType(const char* name,
+				       const ValueEnum valueType) const
+{ // fieldType
+  topology::FieldBase::VectorFieldEnum fieldType = topology::FieldBase::OTHER;
+
+  switch(valueType)
+    { // switch
+
+    case PROPERTY : {
+      ParameterMap::const_iterator iter = _properties.find(name);
+      if (iter == _properties.end()) {
+	std::ostringstream msg;
+	msg << "Could not find property '" << name
+	    << "' in list of properties to get vector field type.";
+	throw std::runtime_error(msg.str());
+      } // if
+      fieldType = iter->second.fieldType;
+    } // PROPERTY
+
+    case STATEVAR : {
+      ParameterMap::const_iterator iter = _stateVars.find(name);
+      if (iter == _stateVars.end()) {
+	std::ostringstream msg;
+	msg << "Could not find state variable '" << name
+	    << "' in list of state variables to get vector field type.";
+	throw std::runtime_error(msg.str());
+      } // if
+      fieldType = iter->second.fieldType;
+    } // STATEVAR
+      
+    default :
+      assert(0);
+    } // switch
+  
+  return fieldType;
+} // fieldType
+   
+
+// End of file

Added: short/3D/PyLith/branches/pylith-swig/libsrc/materials/Metadata.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/Metadata.hh	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/Metadata.hh	2009-02-17 23:43:19 UTC (rev 14063)
@@ -0,0 +1,175 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file libsrc/topology/Metadata.hh
+ *
+ * @brief C++ object for material metadata.
+ *
+ * Extends Sieve mesh to include coordinate system associated with
+ * domain.
+ */
+
+#if !defined(pylith_materials_metadata_hh)
+#define pylith_materials_metadata_hh
+
+// Include directives ---------------------------------------------------
+#include "materialsfwd.hh" // forward declarations
+
+#include "pylith/topology/FieldBase.hh" // USES FieldBase::VectorFieldEnum
+#include "pylith/utils/array.hh" // HASA string_vector
+
+#include <map> // HASA std::map
+
+// MaterialMetadata -----------------------------------------------------
+class pylith::materials::Metadata
+{ // Mesh
+  friend class TestMetadata; // unit testing
+
+// PUBLIC ENUMS /////////////////////////////////////////////////////////
+public :
+
+  enum ValueEnum {
+    PROPERTY=0, ///< Property value.
+    STATEVAR=1, ///< State variable value.
+  }; // ValueEnum
+
+// PUBLIC STRUCTS ///////////////////////////////////////////////////////
+public :
+
+  struct ParamDescription {
+    const char* name;
+    const int fiberDim;
+    topology::FieldBase::VectorFieldEnum fieldType;
+  }; // ParamDescription
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+  /** Constructor.
+   *
+   * @param numProperties Number of physical properties for material.
+   * @param properties Array of property descriptions.
+   * @param numDBProperties Number of database values for physical properties.
+   * @param dbProperties Array of names for database values for properties.
+   * @param numStateVars Number of state variables for material.
+   * @param stateVars Array of state variable descriptions.
+   * @param numDBStateVars Number of database values for state variables.
+   * @param dbStateVars Array of names for database values for state variables.
+   */
+  Metadata(const int numProperties,
+	   const ParamDescription* properties,
+	   const int numDBProperties,
+	   const char* dbProperties[],
+	   const int numStateVars,
+	   const ParamDescription* stateVars,
+	   const int numDBStateVars,
+	   const char* dbStateVars[]);
+
+  /// Default destructor
+  ~Metadata(void);
+
+  /** Get names of properties.
+   * 
+   * @returns Array of names of properties.
+   */
+  const string_vector& properties(void) const;
+
+  /** Get names of state variables.
+   *
+   * @returns Array of names of state variables.
+   */
+  const string_vector& stateVars(void) const;
+
+  /** Get fiber dimension of value.
+   *
+   * @param name Name of value.
+   * @param valueType Type of value.
+   */
+  int fiberDim(const char* name,
+	       const ValueEnum valueType) const;
+
+  /** Get type of vector field associated with value.
+   *
+   * @param name Name of value.
+   * @param valueType Type of value.
+   */
+  topology::FieldBase::VectorFieldEnum
+  fieldType(const char* name,
+	    const ValueEnum valueType) const;
+   
+  /** Get names of database values for physical properties.
+   *
+   * @returns Array of names.
+   */
+  const char* const* dbProperties(void) const;
+
+  /** Get number of database values for physical properties.
+   *
+   * @returns Number of database values.
+   */
+  int numDBProperties(void) const;
+
+  /** Get names of database values for state variables.
+   *
+   * @returns Array of names.
+   */
+  const char* const* dbStateVars(void) const;
+
+  /** Get number of database values for state variables.
+   *
+   * @returns Number of database values.
+   */
+  int numDBStateVars(void) const;
+
+
+// PRIVATE STRUCTS //////////////////////////////////////////////////////
+private :
+
+  struct ParameterInfo {
+    int fiberDim; ///< Fiber dimension for parameter.
+    topology::FieldBase::VectorFieldEnum fieldType; ///< Type of Vector field.
+  }; // ParameterInfo
+
+// PRIVATE TYPEDEFS /////////////////////////////////////////////////////
+private :
+
+  typedef std::map< std::string, ParameterInfo > ParameterMap;
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private :
+
+  ParameterMap _properties; ///< Physical properties information.
+  ParameterMap _stateVars; ///< State variable information.
+
+  string_vector _propertyNames; ///< Names of physical properties.
+  string_vector _stateVarNames; ///< Names of state variables.
+  
+  const char* const* _dbProperties; ///< Names of db values for properties. 
+  const char* const* _dbStateVars; ///< Names of db values for state varaibles.
+  const int _numDBProperties; ///< Number of db values for properties.
+  const int _numDBStateVars; ///< Number of db values for state variables.
+  
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+  Metadata(const Metadata&); ///< Not implemented
+  const Metadata& operator=(const Metadata&); ///< Not implemented
+
+}; // Metadata
+
+#include "Metadata.icc"
+
+#endif // pylith_materials_metadata_hh
+
+
+// End of file

Added: short/3D/PyLith/branches/pylith-swig/libsrc/materials/Metadata.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/Metadata.icc	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/Metadata.icc	2009-02-17 23:43:19 UTC (rev 14063)
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(pylith_materials_metadata_hh)
+#error "Metadata.icc can only be included from Metadata.hh"
+#endif
+
+// Get names of properties.
+const pylith::string_vector&
+pylith::materials::Metadata::properties(void) const {
+  return _propertyNames;
+}
+
+// Get names of state variables.
+const pylith::string_vector&
+pylith::materials::Metadata::stateVars(void) const {
+  return _stateVarNames;
+}
+
+// Get names of database values for physical properties.
+const char* const*
+pylith::materials::Metadata::dbProperties(void) const {
+  return _dbProperties;
+}
+
+// Get number of database values for physical properties.
+int
+pylith::materials::Metadata::numDBProperties(void) const {
+  return _numDBProperties;
+}
+
+// Get names of database values for state variables.
+const char* const*
+pylith::materials::Metadata::dbStateVars(void) const {
+  return _dbStateVars;
+}
+
+// Get number of database values for state variables.
+int
+pylith::materials::Metadata::numDBStateVars(void) const {
+  return _numDBStateVars;
+}
+
+
+// End of file 

Added: short/3D/PyLith/branches/pylith-swig/libsrc/materials/materialsfwd.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/materialsfwd.hh	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/materialsfwd.hh	2009-02-17 23:43:19 UTC (rev 14063)
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/** @file libsrc/materials/materialsfwd.hh
+ *
+ * @brief Forward declarations for PyLith materials objects.
+ *
+ * Including this header file eliminates the need to use separate
+ * forward declarations.
+ */
+
+#if !defined(pylith_materials_materialsfwd_hh)
+#define pylith_materials_materialsfwd_hh
+
+namespace pylith {
+  namespace materials {
+
+    class Metadata;
+    class ElasticMetadata;
+
+    class Material;
+
+    class ElasticMaterial;
+    class ElasticStrain1D;
+    class ElasticStress1D;
+    class ElasticPlaneStrain;
+    class ElasticPlaneStress;
+    class ElasticIsotropic3D;
+    class MaxwellIsotropic3D;
+    class GenMaxwellIsotropic3D;
+
+  } // materials
+} // pylith
+
+
+#endif // pylith_materials_materialsfwd_hh
+
+
+// End of file 

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh	2009-02-17 23:28:34 UTC (rev 14062)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh	2009-02-17 23:43:19 UTC (rev 14063)
@@ -23,36 +23,17 @@
 #define pylith_topology_field_hh
 
 // Include directives ---------------------------------------------------
-#include "topologyfwd.hh" // forward declarations
+#include "FieldBase.hh" // ISA FieldBase
 
 #include <petscmesh.hh>
 
 // Field ----------------------------------------------------------------
 template<typename mesh_type>
-class pylith::topology::Field
+class pylith::topology::Field : public FieldBase
 { // Field
   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.
-  }; // DomainEnum
-
 // PUBLIC TYPEDEFS //////////////////////////////////////////////////////
 public:
 

Added: short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.cc	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.cc	2009-02-17 23:43:19 UTC (rev 14063)
@@ -0,0 +1,30 @@
+// -*- 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)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor.
+pylith::topology::FieldBase::~FieldBase(void)
+{ // destructor
+} // destructor
+
+
+// End of file 

Added: short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.hh	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldBase.hh	2009-02-17 23:43:19 UTC (rev 14063)
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file libsrc/topology/FieldBase.hh
+ *
+ * @brief Basic information related to a vector field over the
+ * vertices or cells of a finite-element mesh.
+ */
+
+#if !defined(pylith_topology_fieldbase_hh)
+#define pylith_topology_fieldbase_hh
+
+// Include directives ---------------------------------------------------
+#include "topologyfwd.hh" // forward declarations
+
+// FieldBase ------------------------------------------------------------
+class pylith::topology::FieldBase
+{ // 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.
+  }; // DomainEnum
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+  FieldBase(void); ///< Default constructor.
+  ~FieldBase(void); ///< Default destructor.
+
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+  FieldBase(const FieldBase&); ///< Not implemented
+  const FieldBase& operator=(const FieldBase&); ///< Not implemented
+
+}; // FieldBase
+
+#endif // pylith_topology_fieldbase_hh
+
+
+// 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-17 23:28:34 UTC (rev 14062)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Makefile.am	2009-02-17 23:43:19 UTC (rev 14063)
@@ -15,6 +15,7 @@
 
 subpkginclude_HEADERS = \
 	Distributor.hh \
+	FieldBase.hh \
 	Field.hh \
 	Field.icc \
 	Field.cc \
@@ -29,8 +30,6 @@
 	SubMesh.hh \
 	SubMesh.icc \
 	SubMesh.cc \
-	RestrictVisitor.hh \
-	RestrictVisitor.icc \
 	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-17 23:28:34 UTC (rev 14062)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Mesh.hh	2009-02-17 23:43:19 UTC (rev 14063)
@@ -50,6 +50,7 @@
   typedef SieveMesh::int_section_type IntSection;
   typedef ALE::IMesh<ALE::LabelSifter<int, SieveMesh::point_type> > SieveSubMesh;
   typedef ALE::ISieveVisitor::RestrictVisitor<RealSection> RestrictVisitor;
+  typedef ALE::ISieveVisitor::UpdateAddVisitor<RealSection> UpdateAddVisitor;
 
 
 // PUBLIC METHODS ///////////////////////////////////////////////////////

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.hh	2009-02-17 23:28:34 UTC (rev 14062)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/SubMesh.hh	2009-02-17 23:43:19 UTC (rev 14063)
@@ -42,6 +42,7 @@
   typedef Mesh::RealSection  RealSection;
   typedef Mesh::IntSection IntSection;
   typedef Mesh::RestrictVisitor RestrictVisitor;
+  typedef Mesh::UpdateAddVisitor UpdateAddVisitor;
 
   // Sieve mesh for higher level domain (mesh, not submesh)
   typedef Mesh::SieveMesh DomainSieveMesh;

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/topologyfwd.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/topologyfwd.hh	2009-02-17 23:28:34 UTC (rev 14062)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/topologyfwd.hh	2009-02-17 23:43:19 UTC (rev 14063)
@@ -26,12 +26,13 @@
 
     class Mesh;
     class SubMesh;
+
+    class FieldBase;
     template<typename mesh_type> class Field;
     template<typename field_type> class Fields;
     typedef Fields<Field<Mesh> > FieldsMesh;
     typedef Fields<Field<SubMesh> > FieldsSubMesh;
     class SolutionFields;
-    template<typename field_type> class RestrictVisitor;
 
     class MeshOps;
 



More information about the CIG-COMMITS mailing list