[cig-commits] r14007 - in short/3D/PyLith/branches/pylith-swig: libsrc libsrc/bc libsrc/feassemble libsrc/topology modulesrc/bc modulesrc/feassemble modulesrc/topology pylith pylith/bc pylith/feassemble pylith/topology unittests/libtests/bc unittests/libtests/topology unittests/pytests/bc
brad at geodynamics.org
brad at geodynamics.org
Mon Feb 2 13:50:08 PST 2009
Author: brad
Date: 2009-02-02 13:50:07 -0800 (Mon, 02 Feb 2009)
New Revision: 14007
Added:
short/3D/PyLith/branches/pylith-swig/modulesrc/feassemble/Constraint.i
short/3D/PyLith/branches/pylith-swig/pylith/topology/FieldSubMesh.py
Modified:
short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.cc
short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.hh
short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.cc
short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.hh
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Constraint.hh
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/FieldSubMesh.hh
short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.icc
short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBC.i
short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBoundary.i
short/3D/PyLith/branches/pylith-swig/modulesrc/bc/bc.i
short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Field.i
short/3D/PyLith/branches/pylith-swig/modulesrc/topology/FieldSubMesh.i
short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am
short/3D/PyLith/branches/pylith-swig/pylith/bc/BoundaryCondition.py
short/3D/PyLith/branches/pylith-swig/pylith/bc/DirichletBC.py
short/3D/PyLith/branches/pylith-swig/pylith/bc/DirichletBoundary.py
short/3D/PyLith/branches/pylith-swig/pylith/feassemble/Constraint.py
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBC.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMulti.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldSubMesh.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldSubMesh.hh
short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletBC.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletBoundary.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/testbc.py
Log:
Work on topology/bc objects and interfaces.
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am 2009-02-02 21:50:07 UTC (rev 14007)
@@ -101,10 +101,10 @@
topology/Mesh.cc \
topology/MeshOps.cc \
topology/MeshRefiner.cc \
- topology/RefineUniform.cc \
topology/SubMesh.cc \
utils/EventLogger.cc
+# topology/RefineUniform.cc \
# bc/Neumann.cc
# bc/AbsorbingDampers.cc
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.cc 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.cc 2009-02-02 21:50:07 UTC (rev 14007)
@@ -72,8 +72,7 @@
// ----------------------------------------------------------------------
// Set number of degrees of freedom that are constrained at points in field.
void
-pylith::bc::DirichletBC::setConstraintSizes(const topology::Field& field,
- const topology::Mesh& mesh)
+pylith::bc::DirichletBC::setConstraintSizes(const topology::Field& field)
{ // setConstraintSizes
const int numFixedDOF = _fixedDOF.size();
if (0 == numFixedDOF)
@@ -106,8 +105,7 @@
// ----------------------------------------------------------------------
// Set which degrees of freedom are constrained at points in field.
void
-pylith::bc::DirichletBC::setConstraints(const topology::Field& field,
- const topology::Mesh& mesh)
+pylith::bc::DirichletBC::setConstraints(const topology::Field& field)
{ // setConstraints
const int numFixedDOF = _fixedDOF.size();
if (0 == numFixedDOF)
@@ -169,8 +167,7 @@
// Set values in field.
void
pylith::bc::DirichletBC::setField(const double t,
- const topology::Field& field,
- const topology::Mesh& mesh)
+ const topology::Field& field)
{ // setField
const int numFixedDOF = _fixedDOF.size();
if (0 == numFixedDOF)
@@ -178,7 +175,7 @@
const ALE::Obj<MeshRealSection>& section = field.section();
assert(!section.isNull());
- const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ const ALE::Obj<SieveMesh>& sieveMesh = field.mesh().sieveMesh();
assert(!sieveMesh.isNull());
const int numPoints = _points.size();
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.hh 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.hh 2009-02-02 21:50:07 UTC (rev 14007)
@@ -87,28 +87,22 @@
/** Set number of degrees of freedom that are constrained at points in field.
*
* @param field Solution field
- * @param mesh PETSc mesh
*/
- void setConstraintSizes(const topology::Field& field,
- const topology::Mesh& mesh);
+ void setConstraintSizes(const topology::Field& field);
/** Set which degrees of freedom are constrained at points in field.
*
* @param field Solution field
- * @param mesh PETSc mesh
*/
- void setConstraints(const topology::Field& field,
- const topology::Mesh& mesh);
+ void setConstraints(const topology::Field& field);
/** Set values in field.
*
* @param t Current time
* @param field Solution field
- * @param mesh PETSc mesh
*/
void setField(const double t,
- const topology::Field& field,
- const topology::Mesh& mesh);
+ const topology::Field& field);
// PROTECTED METHODS //////////////////////////////////////////////////
protected :
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.cc 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.cc 2009-02-02 21:50:07 UTC (rev 14007)
@@ -62,7 +62,6 @@
// Get vertex field of BC initial or rate of change of values.
const pylith::topology::FieldSubMesh&
pylith::bc::DirichletBoundary::vertexField(const char* name,
- const topology::Mesh& mesh,
const topology::SolutionFields& fields)
{ // getVertexField
assert(0 != name);
@@ -77,7 +76,7 @@
assert(!vertices.isNull());
const SieveMesh::label_sequence::iterator verticesEnd = vertices->end();
- const spatialdata::geocoords::CoordSys* cs = mesh.coordsys();
+ const spatialdata::geocoords::CoordSys* cs = _boundaryMesh->coordsys();
assert(0 != cs);
const int fiberDim = cs->spaceDim();
double_array values(fiberDim);
@@ -93,6 +92,7 @@
} // if
// ERROR: NEED TO TRANSLATE LABELS FROM MESH INTO SUBMESH
+ std::cerr << "TODO: Translate labels from mesh into submesh." << std::endl;
assert(0);
if (0 == strcasecmp(name, "initial")) {
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.hh 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.hh 2009-02-02 21:50:07 UTC (rev 14007)
@@ -67,16 +67,13 @@
/** Get vertex field with BC information.
*
- * @param fieldType Type of field.
* @param name Name of field.
- * @param mesh Finite-element mesh.
* @param fields Solution fields.
*
* @returns Field over vertices.
*/
const topology::FieldSubMesh&
vertexField(const char* name,
- const topology::Mesh& mesh,
const topology::SolutionFields& fields);
// NOT IMPLEMENTED ////////////////////////////////////////////////////
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Constraint.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Constraint.hh 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Constraint.hh 2009-02-02 21:50:07 UTC (rev 14007)
@@ -29,7 +29,7 @@
} // feassemble
namespace topology {
- class Field; // USES Field'
+ class Field; // USES Field
class Mesh; // USES Mesh
} // feassemble
} // pylith
@@ -64,20 +64,16 @@
/** Set number of degrees of freedom that are constrained at points in field.
*
* @param field Solution field
- * @param mesh Finite-element mesh.
*/
virtual
- void setConstraintSizes(const topology::Field& field,
- const topology::Mesh& mesh) = 0;
+ void setConstraintSizes(const topology::Field& field) = 0;
/** Set which degrees of freedom are constrained at points in field.
*
* @param field Solution field
- * @param mesh Finite-element mesh.
*/
virtual
- void setConstraints(const topology::Field& field,
- const topology::Mesh& mesh) = 0;
+ void setConstraints(const topology::Field& field) = 0;
/** Set flag for setting constraints for total field solution or
* incremental field solution.
@@ -91,12 +87,10 @@
*
* @param t Current time
* @param field Solution field
- * @param mesh Finite-element mesh.
*/
virtual
void setField(const double t,
- const topology::Field& field,
- const topology::Mesh& mesh) = 0;
+ const topology::Field& field) = 0;
// PROTECTED MEMBERS //////////////////////////////////////////////////
protected :
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh 2009-02-02 21:50:07 UTC (rev 14007)
@@ -61,6 +61,12 @@
*/
const ALE::Obj<MeshRealSection>& section(void) const;
+ /** Get mesh associated with field.
+ *
+ * @returns Finite-element mesh.
+ */
+ const Mesh& mesh(void) const;
+
/** Get spatial dimension of domain.
*
* @returns Spatial dimension of domain.
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.icc 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.icc 2009-02-02 21:50:07 UTC (rev 14007)
@@ -21,6 +21,14 @@
return _section;
}
+// Get mesh associated with field.
+inline
+const
+pylith::topology::Mesh&
+pylith::topology::Field::mesh(void) const {
+ return _mesh;
+}
+
#endif
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.hh 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.hh 2009-02-02 21:50:07 UTC (rev 14007)
@@ -61,6 +61,12 @@
*/
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.
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.icc 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldSubMesh.icc 2009-02-02 21:50:07 UTC (rev 14007)
@@ -21,6 +21,14 @@
return _section;
}
+// Get mesh associated with field.
+inline
+const
+pylith::topology::SubMesh&
+pylith::topology::FieldSubMesh::mesh(void) const {
+ return _mesh;
+}
+
#endif
Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBC.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBC.i 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBC.i 2009-02-02 21:50:07 UTC (rev 14007)
@@ -16,6 +16,10 @@
*/
namespace pylith {
+ namespace feassemble {
+ class Constraint;
+ } // feassemble
+
namespace bc {
class DirichletBC : public BoundaryCondition,
@@ -73,28 +77,22 @@
* points in field.
*
* @param field Solution field
- * @param mesh PETSc mesh
*/
- void setConstraintSizes(const pylith::topology::Field& field,
- const pylith::topology::Mesh& mesh);
+ void setConstraintSizes(const pylith::topology::Field& field);
/** Set which degrees of freedom are constrained at points in field.
*
* @param field Solution field
- * @param mesh PETSc mesh
*/
- void setConstraints(const pylith::topology::Field& field,
- const pylith::topology::Mesh& mesh);
+ void setConstraints(const pylith::topology::Field& field);
/** Set values in field.
*
* @param t Current time
* @param field Solution field
- * @param mesh PETSc mesh
*/
void setField(const double t,
- const pylith::topology::Field& field,
- const pylith::topology::Mesh& mesh);
+ const pylith::topology::Field& field);
}; // class DirichletBC
Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBoundary.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBoundary.i 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBoundary.i 2009-02-02 21:50:07 UTC (rev 14007)
@@ -42,20 +42,18 @@
*
* @return Boundary mesh.
*/
- const ALE::Obj<pylith::SieveSubMesh>& boundaryMesh(void) const;
+ const pylith::topology::SubMesh& boundaryMesh(void) const;
/** Get vertex field with BC information.
*
* @param fieldType Type of field.
* @param name Name of field.
- * @param mesh Finite-element mesh.
* @param fields Solution fields.
*
* @returns Field over vertices.
*/
- const pylith::topology::Field&
+ const pylith::topology::FieldSubMesh&
vertexField(const char* name,
- const pylith::topology::Mesh& mesh,
const pylith::topology::SolutionFields& fields);
}; // class DirichletBoundary
Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/bc/bc.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/bc/bc.i 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/bc/bc.i 2009-02-02 21:50:07 UTC (rev 14007)
@@ -44,6 +44,8 @@
%}
// Interfaces
+%include "../feassemble/Constraint.i" // DirichletBC isa Constraint
+
%include "BoundaryCondition.i"
%include "DirichletBC.i"
%include "DirichletBoundary.i"
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/feassemble/Constraint.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/feassemble/Constraint.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/feassemble/Constraint.i 2009-02-02 21:50:07 UTC (rev 14007)
@@ -0,0 +1,84 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/feassemble/Constraint.i
+ *
+ * @brief Python interface to C++ abstract base Constraint.
+ */
+
+namespace pylith {
+ namespace feassemble {
+
+ class Constraint
+ { // class Constraint
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ Constraint(void);
+
+ /// Destructor.
+ virtual
+ ~Constraint(void);
+
+ /** Set manager of scales used to nondimensionalize problem.
+ *
+ * @param dim Nondimensionalizer.
+ */
+ void normalizer(const spatialdata::units::Nondimensional& dim);
+
+ /** Set number of degrees of freedom that are constrained at
+ * points in field.
+ *
+ * @param field Solution field
+ * @param mesh Finite-element mesh.
+ */
+ virtual
+ void setConstraintSizes(const pylith::topology::Field& field,
+ const pylith::topology::Mesh& mesh) = 0;
+
+ /** Set which degrees of freedom are constrained at points in field.
+ *
+ * @param field Solution field
+ * @param mesh Finite-element mesh.
+ */
+ virtual
+ void setConstraints(const pylith::topology::Field& field,
+ const pylith::topology::Mesh& mesh) = 0;
+
+ /** Set flag for setting constraints for total field solution or
+ * incremental field solution.
+ *
+ * @param flag True if using incremental solution, false otherwise.
+ */
+ virtual
+ void useSolnIncr(const bool flag);
+
+ /** Set values in field.
+ *
+ * @param t Current time
+ * @param field Solution field
+ * @param mesh Finite-element mesh.
+ */
+ virtual
+ void setField(const double t,
+ const pylith::topology::Field& field,
+ const pylith::topology::Mesh& mesh) = 0;
+
+ }; // class Constraint
+
+ } // feassemble
+} // pylith
+
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Field.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Field.i 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Field.i 2009-02-02 21:50:07 UTC (rev 14007)
@@ -34,6 +34,12 @@
/// Destructor.
~Field(void);
+ /** Get mesh associated with field.
+ *
+ * @returns Finite-element mesh.
+ */
+ const Mesh& mesh(void) const;
+
/** Get spatial dimension of domain.
*
* @returns Spatial dimension of domain.
Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/topology/FieldSubMesh.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/topology/FieldSubMesh.i 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/topology/FieldSubMesh.i 2009-02-02 21:50:07 UTC (rev 14007)
@@ -34,6 +34,12 @@
/// Destructor.
~FieldSubMesh(void);
+ /** 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.
Modified: short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am 2009-02-02 21:50:07 UTC (rev 14007)
@@ -114,6 +114,8 @@
topology/FieldsManager.py \
topology/Mesh.py \
topology/SubMesh.py \
+ topology/Field.py \
+ topology/FieldSubMesh.py \
topology/MeshGenerator.py \
topology/MeshImporter.py \
topology/MeshRefiner.py \
Modified: short/3D/PyLith/branches/pylith-swig/pylith/bc/BoundaryCondition.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/bc/BoundaryCondition.py 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/pylith/bc/BoundaryCondition.py 2009-02-02 21:50:07 UTC (rev 14007)
@@ -93,6 +93,7 @@
Constructor.
"""
Component.__init__(self, name, facility="boundary_condition")
+ self.this = None
return
Modified: short/3D/PyLith/branches/pylith-swig/pylith/bc/DirichletBC.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/bc/DirichletBC.py 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/pylith/bc/DirichletBC.py 2009-02-02 21:50:07 UTC (rev 14007)
@@ -104,7 +104,9 @@
BoundaryCondition.preinitialize(self, mesh)
Constraint.preinitialize(self, mesh)
self.dbRate(self.inventory.dbRate)
- self.fixedDOF(self.inventory.fixedDOF)
+ import numpy
+ fixedDOF = numpy.array(self.inventory.fixedDOF, dtype=numpy.int32)
+ self.fixedDOF(fixedDOF)
return
Modified: short/3D/PyLith/branches/pylith-swig/pylith/bc/DirichletBoundary.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/bc/DirichletBoundary.py 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/pylith/bc/DirichletBoundary.py 2009-02-02 21:50:07 UTC (rev 14007)
@@ -18,7 +18,7 @@
## Factory: boundary_condition
from DirichletBC import DirichletBC
-from DicihletBC import validateDOF
+from DirichletBC import validateDOF
from bc import DirichletBoundary as ModuleDirichletBoundary
# DirichletBoundary class
@@ -32,13 +32,13 @@
# INVENTORY //////////////////////////////////////////////////////////
- class Inventory(BoundaryCondition.Inventory):
+ class Inventory(DirichletBC.Inventory):
"""
- Python object for managing BoundaryCondition facilities and properties.
+ Python object for managing DirichletBoundary facilities and properties.
"""
## @class Inventory
- ## Python object for managing BoundaryCondition facilities and properties.
+ ## Python object for managing DirichletBoundary facilities and properties.
##
## \b Properties
## @li None
@@ -88,7 +88,7 @@
logEvent = "%sverify" % self._loggingPrefix
self._logger.eventBegin(logEvent)
- DichletBC.verifyConfiguration(self)
+ DirichletBC.verifyConfiguration(self)
self.output.verifyConfiguration(self.mesh)
self._logger.eventEnd(logEvent)
@@ -137,7 +137,7 @@
"""
Setup members using inventory.
"""
- BoundaryCondition._configure(self)
+ DirichletBC._configure(self)
self.output = self.inventory.output
return
Modified: short/3D/PyLith/branches/pylith-swig/pylith/feassemble/Constraint.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/feassemble/Constraint.py 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/pylith/feassemble/Constraint.py 2009-02-02 21:50:07 UTC (rev 14007)
@@ -14,8 +14,6 @@
##
## @brief Python abstract base class for constraints on operator
## actions with finite-elements.
-##
-## Factory: fe_constraint.
def implementsConstraint(obj):
"""
@@ -45,8 +43,6 @@
"""
Python abstract base class for constraints on operator
actions with finite-elements.
-
- Factory: constraint.
"""
# PUBLIC METHODS /////////////////////////////////////////////////////
@@ -55,8 +51,6 @@
"""
Constructor.
"""
- self.cppHandle = None
- self.mesh = None
return
@@ -64,123 +58,10 @@
"""
Setup constraint.
"""
- self.mesh = mesh
self._setupLogging()
return
- def verifyConfiguration(self):
- """
- Verify compatibility of configuration.
- """
- logEvent = "%sverify" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
-
- self._logger.eventEnd(logEvent)
- return
-
-
- def initialize(self, totalTime, numTimeSteps, normalizer):
- """
- Do initialization.
- """
- logEvent = "%sinit" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
-
- assert(None != self.cppHandle)
- self.cppHandle.normalizer = normalizer.cppHandle
-
- self._logger.eventEnd(logEvent)
- return
-
-
- def timeStep(self, dt):
- """
- Set time step for advancing from time t to time t+dt.
- """
- assert(None != self.cppHandle)
- self.cppHandle.timeStep = dt
- return
-
-
- def setConstraintSizes(self, field):
- """
- Set constraint sizes in field.
- """
- logEvent = "%ssetSizes" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
-
- assert(None != self.cppHandle)
- self.cppHandle.setConstraintSizes(field, self.mesh.cppHandle)
-
- self._logger.eventEnd(logEvent)
- return
-
-
- def setConstraints(self, field):
- """
- Set constraints for field.
- """
- logEvent = "%sconstraints" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
-
- assert(None != self.cppHandle)
- self.cppHandle.setConstraints(field, self.mesh.cppHandle)
-
- self._logger.eventEnd(logEvent)
- return
-
-
- def useSolnIncr(self, flag):
- """
- Set behavior for using total field solution or incremental field solution.
- """
- logEvent = "%ssolnIncr" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
-
- assert(None != self.cppHandle)
- self.cppHandle.useSolnIncr = flag
-
- self._logger.eventEnd(logEvent)
- return
-
-
- def setField(self, t, field):
- """
- Set constrained values in field at time t.
- """
- logEvent = "%ssetField" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
-
- assert(None != self.cppHandle)
- self.cppHandle.setField(t, field, self.mesh.cppHandle)
-
- self._logger.eventEnd(logEvent)
- return
-
-
- def poststep(self, t, dt, totalTime, fields):
- """
- Hook for doing stuff after advancing time step.
- """
- logEvent = "%spoststep" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
-
- self._logger.eventEnd(logEvent)
- return
-
-
- def finalize(self):
- """
- Cleanup after time stepping.
- """
- logEvent = "%sfinalize" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
-
- self._logger.eventEnd(logEvent)
- return
-
-
# PRIVATE METHODS ////////////////////////////////////////////////////
def _setupLogging(self):
@@ -192,7 +73,7 @@
from pylith.utils.EventLogger import EventLogger
logger = EventLogger()
- logger.setClassName("FE Constraint")
+ logger.className("FE Constraint")
logger.initialize()
events = ["verify",
Added: short/3D/PyLith/branches/pylith-swig/pylith/topology/FieldSubMesh.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/topology/FieldSubMesh.py (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/pylith/topology/FieldSubMesh.py 2009-02-02 21:50:07 UTC (rev 14007)
@@ -0,0 +1,37 @@
+#!/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
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBC.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBC.cc 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBC.cc 2009-02-02 21:50:07 UTC (rev 14007)
@@ -131,7 +131,7 @@
const ALE::Obj<MeshRealSection>& fieldSection = field.section();
CPPUNIT_ASSERT(!fieldSection.isNull());
- bc.setConstraintSizes(field, mesh);
+ bc.setConstraintSizes(field);
const int numCells = sieveMesh->heightStratum(0)->size();
const int offset = numCells;
@@ -176,9 +176,9 @@
const ALE::Obj<MeshRealSection>& fieldSection = field.section();
CPPUNIT_ASSERT(!fieldSection.isNull());
- bc.setConstraintSizes(field, mesh);
+ bc.setConstraintSizes(field);
field.allocate();
- bc.setConstraints(field, mesh);
+ bc.setConstraints(field);
const int numCells = sieveMesh->heightStratum(0)->size();
const int offset = numCells;
@@ -223,9 +223,9 @@
const ALE::Obj<MeshRealSection>& fieldSection = field.section();
CPPUNIT_ASSERT(!fieldSection.isNull());
- bc.setConstraintSizes(field, mesh);
+ bc.setConstraintSizes(field);
field.allocate();
- bc.setConstraints(field, mesh);
+ bc.setConstraints(field);
const double tolerance = 1.0e-06;
@@ -243,7 +243,7 @@
// Only unconstrained values should be zero.
const double t = 1.0;
- bc.setField(t, field, mesh);
+ bc.setField(t, field);
// Create list of unconstrained DOF at constrained DOF
const int numFreeDOF = _data->numDOF - _data->numFixedDOF;
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMulti.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMulti.cc 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMulti.cc 2009-02-02 21:50:07 UTC (rev 14007)
@@ -68,9 +68,9 @@
const ALE::Obj<MeshRealSection>& fieldSection = field.section();
CPPUNIT_ASSERT(!fieldSection.isNull());
- bcA.setConstraintSizes(field, mesh);
- bcB.setConstraintSizes(field, mesh);
- bcC.setConstraintSizes(field, mesh);
+ bcA.setConstraintSizes(field);
+ bcB.setConstraintSizes(field);
+ bcC.setConstraintSizes(field);
const int numCells = sieveMesh->heightStratum(0)->size();
const int offset = numCells;
@@ -109,13 +109,13 @@
const ALE::Obj<MeshRealSection>& fieldSection = field.section();
CPPUNIT_ASSERT(!fieldSection.isNull());
- bcA.setConstraintSizes(field, mesh);
- bcB.setConstraintSizes(field, mesh);
- bcC.setConstraintSizes(field, mesh);
- sieveMesh->allocate(fieldSection);
- bcA.setConstraints(field, mesh);
- bcB.setConstraints(field, mesh);
- bcC.setConstraints(field, mesh);
+ bcA.setConstraintSizes(field);
+ bcB.setConstraintSizes(field);
+ bcC.setConstraintSizes(field);
+ field.allocate();
+ bcA.setConstraints(field);
+ bcB.setConstraints(field);
+ bcC.setConstraints(field);
const int numCells = sieveMesh->heightStratum(0)->size();
const int offset = numCells;
@@ -156,13 +156,13 @@
const ALE::Obj<MeshRealSection>& fieldSection = field.section();
CPPUNIT_ASSERT(!fieldSection.isNull());
- bcA.setConstraintSizes(field, mesh);
- bcB.setConstraintSizes(field, mesh);
- bcC.setConstraintSizes(field, mesh);
+ bcA.setConstraintSizes(field);
+ bcB.setConstraintSizes(field);
+ bcC.setConstraintSizes(field);
field.allocate();
- bcA.setConstraints(field, mesh);
- bcB.setConstraints(field, mesh);
- bcC.setConstraints(field, mesh);
+ bcA.setConstraints(field);
+ bcB.setConstraints(field);
+ bcC.setConstraints(field);
const double tolerance = 1.0e-06;
@@ -181,9 +181,9 @@
// Only unconstrained values should be zero.
// Expected values set in _data->field
const double t = 10.0;
- bcA.setField(t, field, mesh);
- bcB.setField(t, field, mesh);
- bcC.setField(t, field, mesh);
+ bcA.setField(t, field);
+ bcB.setField(t, field);
+ bcC.setField(t, field);
int i = 0;
for (SieveMesh::label_sequence::iterator v_iter = vertices->begin();
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc 2009-02-02 21:50:07 UTC (rev 14007)
@@ -52,7 +52,7 @@
} // testConstructor
// ----------------------------------------------------------------------
-// Test newSection().
+// Test section().
void
pylith::topology::TestField::testSection(void)
{ // testSection
@@ -65,6 +65,19 @@
} // 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)
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh 2009-02-02 21:50:07 UTC (rev 14007)
@@ -43,6 +43,7 @@
CPPUNIT_TEST( testConstructor );
CPPUNIT_TEST( testSection );
+ CPPUNIT_TEST( testMesh );
CPPUNIT_TEST( testSpaceDim );
CPPUNIT_TEST( testNewSection );
CPPUNIT_TEST( testNewSectionPoints );
@@ -69,6 +70,9 @@
/// Test section().
void testSection(void);
+ /// Test mesh().
+ void testMesh(void);
+
/// Test spaceDim().
void testSpaceDim(void);
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldSubMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldSubMesh.cc 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldSubMesh.cc 2009-02-02 21:50:07 UTC (rev 14007)
@@ -81,6 +81,20 @@
} // testSection
// ----------------------------------------------------------------------
+// Test mesh().
+void
+pylith::topology::TestFieldSubMesh::testMesh(void)
+{ // testMesh
+ Mesh mesh;
+ SubMesh submesh;
+ _buildMesh(&mesh, &submesh);
+ FieldSubMesh field(submesh);
+
+ const SubMesh& mesh2 = field.mesh();
+ CPPUNIT_ASSERT_EQUAL(_TestFieldSubMesh::cellDim-1, mesh2.dimension());
+} // testMesh
+
+// ----------------------------------------------------------------------
// Test spaceDim().
void
pylith::topology::TestFieldSubMesh::testSpaceDim(void)
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldSubMesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldSubMesh.hh 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldSubMesh.hh 2009-02-02 21:50:07 UTC (rev 14007)
@@ -43,6 +43,7 @@
CPPUNIT_TEST( testConstructor );
CPPUNIT_TEST( testSection );
+ CPPUNIT_TEST( testMesh );
CPPUNIT_TEST( testSpaceDim );
CPPUNIT_TEST( testNewSection );
CPPUNIT_TEST( testNewSectionPoints );
@@ -69,6 +70,9 @@
/// Test section().
void testSection(void);
+ /// Test mesh().
+ void testMesh(void);
+
/// Test spaceDim().
void testSpaceDim(void);
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletBC.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletBC.py 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletBC.py 2009-02-02 21:50:07 UTC (rev 14007)
@@ -75,7 +75,7 @@
(mesh, bc, field) = self._initialize()
bc.setConstraintSizes(field)
- mesh.allocateRealSection(field)
+ field.allocate()
bc.setConstraints(field)
# We should really add something here to check to make sure things
@@ -102,7 +102,7 @@
(mesh, bc, field) = self._initialize()
bc.setConstraintSizes(field)
- mesh.allocateRealSection(field)
+ field.allocate()
bc.setConstraints(field)
t = 1.0
bc.setField(t, field)
@@ -163,7 +163,7 @@
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
- normalizer.initialize()
+ normalizer._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
@@ -177,9 +177,8 @@
# Setup field
from pylith.topology.Field import Field
- field = Field()
- field.fiberDimension(cs.spaceDim())
- field.newSection()
+ field = Field(mesh)
+ field.newSection(Field.VERTICES_FIELD, cs.spaceDim())
field.zero()
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletBoundary.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletBoundary.py 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletBoundary.py 2009-02-02 21:50:07 UTC (rev 14007)
@@ -29,8 +29,8 @@
Test to make sure DirichletBoundary satisfies constraint requirements.
"""
bc = DirichletBoundary()
- from pylith.feassemble.Constraint import implementsConstraint
- self.failUnless(implementsConstraint(bc))
+ from pylith.feassemble.Constraint import Constraint
+ self.failUnless(isinstance(bc, Constraint))
return
@@ -51,10 +51,8 @@
don't verify the results.
"""
- (mesh, bc, fields) = self._initialize()
+ (mesh, bc, field) = self._initialize()
- self.assertNotEqual(None, bc.cppHandle)
-
# We should really add something here to check to make sure things
# actually initialized correctly
return
@@ -68,8 +66,7 @@
don't verify the results.
"""
- (mesh, bc, fields) = self._initialize()
- field = fields.getReal("field")
+ (mesh, bc, field) = self._initialize()
bc.setConstraintSizes(field)
# We should really add something here to check to make sure things
@@ -85,10 +82,9 @@
don't verify the results.
"""
- (mesh, bc, fields) = self._initialize()
- field = fields.getReal("field")
+ (mesh, bc, field) = self._initialize()
bc.setConstraintSizes(field)
- mesh.allocateRealSection(field)
+ field.allocate()
bc.setConstraints(field)
# We should really add something here to check to make sure things
@@ -100,7 +96,7 @@
"""
Test useSolnIncr().
"""
- (mesh, bc, fields) = self._initialize()
+ (mesh, bc, field) = self._initialize()
bc.useSolnIncr(True)
return
@@ -113,10 +109,9 @@
don't verify the results.
"""
- (mesh, bc, fields) = self._initialize()
- field = fields.getReal("field")
+ (mesh, bc, field) = self._initialize()
bc.setConstraintSizes(field)
- mesh.allocateRealSection(field)
+ field.allocate()
bc.setConstraints(field)
t = 1.0
bc.setField(t, field)
@@ -133,7 +128,7 @@
WARNING: This is not a rigorous test of finalize() because we
neither set the input fields or verify the results.
"""
- (mesh, bc, fields) = self._initialize()
+ (mesh, bc, field) = self._initialize()
bc.finalize()
# We should really add something here to check to make sure things
@@ -147,46 +142,48 @@
"""
Initialize DirichletBoundary boundary condition.
"""
- from pylith.bc.DirichletBoundary import DirichletBoundary
- bc = DirichletBoundary()
- bc._configure()
- bc.output._configure()
- bc.output.writer._configure()
- bc.label = "bc"
- bc.fixedDOF = [1]
+ from spatialdata.geocoords.CSCart import CSCart
+ cs = CSCart()
+ cs.spaceDim = 2
- from pyre.units.time import second
- bc.tRef = -1.0*second
-
+ from pylith.meshio.MeshIOAscii import MeshIOAscii
+ importer = MeshIOAscii()
+ importer.inventory.filename = "data/tri3.mesh"
+ importer.inventory.coordsys = cs
+ importer._configure()
+ mesh = importer.read(normalizer, debug=False, interpolate=False)
+
from spatialdata.spatialdb.SimpleDB import SimpleDB
db = SimpleDB()
+ db.inventory.label = "TestDirichletBoundary tri3"
+ db.inventory.iohandler.inventory.filename = "data/tri3.spatialdb"
+ db.inventory.iohandler._configure()
db._configure()
- db.label = "TestDirichletBoundary tri3"
- db.iohandler.filename = "data/tri3.spatialdb"
- db.initialize()
- bc.db = db
from pylith.bc.FixedDOFDB import FixedDOFDB
dbRate = FixedDOFDB()
+ dbRate.inventory.label = "TestDirichletBoundary rate tri3"
dbRate._configure()
- dbRate.label = "TestDirichletBoundary rate tri3"
- dbRate.initialize()
- bc.dbRate = dbRate
- from spatialdata.geocoords.CSCart import CSCart
- cs = CSCart()
- cs.spaceDim = 2
+ bc.inventory.db = db
+ bc.inventory.dbRate = dbRate
+
+ from pylith.bc.DirichletBoundary import DirichletBoundary
+ bc = DirichletBoundary()
+ bc.inventory.output._configure()
+ bc.output.writer._configure()
+ bc.label = "bc"
+ bc.fixedDOF = [1]
+ bc._configure()
+
+ from pyre.units.time import second
+ bc.tRef = -1.0*second
+
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer.initialize()
- from pylith.meshio.MeshIOAscii import MeshIOAscii
- importer = MeshIOAscii()
- importer.filename = "data/tri3.mesh"
- importer.coordsys = cs
- mesh = importer.read(normalizer, debug=False, interpolate=False)
-
bc.preinitialize(mesh)
bc.initialize(totalTime=0.0, numTimeSteps=1, normalizer=normalizer)
@@ -200,7 +197,7 @@
import pylith.topology.topology as bindings
bindings.zeroRealSection(fields.getReal("field"))
- return (mesh, bc, fields)
+ return (mesh, bc, field)
# End of file
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/testbc.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/testbc.py 2009-02-02 02:36:40 UTC (rev 14006)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/testbc.py 2009-02-02 21:50:07 UTC (rev 14007)
@@ -59,8 +59,8 @@
from TestDirichletBC import TestDirichletBC
suite.addTest(unittest.makeSuite(TestDirichletBC))
- from TestDirichletBoundary import TestDirichletBoundary
- suite.addTest(unittest.makeSuite(TestDirichletBoundary))
+ #from TestDirichletBoundary import TestDirichletBoundary
+ #suite.addTest(unittest.makeSuite(TestDirichletBoundary))
#from TestAbsorbingDampers import TestAbsorbingDampers
#suite.addTest(unittest.makeSuite(TestAbsorbingDampers))
More information about the CIG-COMMITS
mailing list