[cig-commits] r14475 - in short/3D/PyLith/branches/pylith-swig: . libsrc libsrc/bc libsrc/meshio libsrc/topology modulesrc/include modulesrc/topology pylith/apps pylith/problems unittests/libtests/feassemble unittests/libtests/topology unittests/pytests/bc unittests/pytests/feassemble unittests/pytests/topology
brad at geodynamics.org
brad at geodynamics.org
Thu Mar 26 17:28:20 PDT 2009
Author: brad
Date: 2009-03-26 17:28:18 -0700 (Thu, 26 Mar 2009)
New Revision: 14475
Added:
short/3D/PyLith/branches/pylith-swig/modulesrc/include/integratorarray.i
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/DirichletBoundary.cc
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriter.cc
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriter.hh
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriterVTK.cc
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriterVTK.hh
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriterVTK.icc
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/Makefile.am
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/OutputManager.cc
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/OutputManager.hh
short/3D/PyLith/branches/pylith-swig/libsrc/meshio/meshiofwd.hh
short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc
short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh
short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.icc
short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.hh
short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.icc
short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Field.i
short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Fields.i
short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py
short/3D/PyLith/branches/pylith-swig/pylith/problems/Formulation.py
short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityImplicit.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsMesh.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsSubMesh.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestJacobian.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSolutionFields.cc
short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestAbsorbingDampers.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestNeumann.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/feassemble/TestElasticityExplicit.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/feassemble/TestElasticityImplicit.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestJacobian.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMeshField.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMeshFields.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestSolutionFields.py
Log:
Change Field::name to Field::label for clarification. Added label argument to Fields::add(). Started work on updating output.
Modified: short/3D/PyLith/branches/pylith-swig/TODO
===================================================================
--- short/3D/PyLith/branches/pylith-swig/TODO 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/TODO 2009-03-27 00:28:18 UTC (rev 14475)
@@ -63,8 +63,18 @@
7. Update manual for version 1.4
* Reduce memory use with ordering elements by material
+
* Nondimensionalization
+ * Material
+ * initial stress/strain
+
+ * Incompatibilities
+ importer -> reader
+ material
+ db -> properties_db
+ no need to set Quadrature type
+
-- Release (v1.4) --
7. Fault friction
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am 2009-03-27 00:28:18 UTC (rev 14475)
@@ -102,7 +102,7 @@
# materials/GenMaxwellIsotropic3D.cc \
# meshio/CellFilter.cc \
# meshio/CellFilterAvg.cc \
-# meshio/DataWriter.cc \
+# meshio/DataWriter.cc \
# meshio/DataWriterVTK.cc \
# meshio/OutputManager.cc \
# meshio/OutputSolnSubset.cc \
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.cc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.cc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -100,7 +100,7 @@
assert(0);
if (0 == strcasecmp(name, "initial")) {
- _tmpField->name("displacement");
+ _tmpField->label("displacement");
_tmpField->vectorFieldType(topology::Field<topology::SubMesh>::VECTOR);
_tmpField->scale(_normalizer->lengthScale());
_tmpField->addDimensionOkay(true);
@@ -115,7 +115,7 @@
section->updatePointAll(_points[iPoint], &values[0]);
} // for
} else if (0 == strcasecmp(name, "rate-of-change")) {
- _tmpField->name("velocity");
+ _tmpField->label("velocity");
_tmpField->vectorFieldType(topology::Field<topology::SubMesh>::VECTOR);
_tmpField->scale(_normalizer->lengthScale());
_tmpField->addDimensionOkay(true);
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriter.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriter.cc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriter.cc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -12,63 +12,64 @@
#include <portinfo>
-#include "DataWriter.hh" // implementation of class methods
-
// ----------------------------------------------------------------------
// Constructor
-pylith::meshio::DataWriter::DataWriter(void) :
+template<typename mesh_type>
+pylith::meshio::DataWriter<mesh_type>::DataWriter(void) :
_numTimeSteps(0)
{ // constructor
} // constructor
// ----------------------------------------------------------------------
// Destructor
-pylith::meshio::DataWriter::~DataWriter(void)
+template<typename mesh_type>
+pylith::meshio::DataWriter<mesh_type>::~DataWriter(void)
{ // destructor
} // destructor
// ----------------------------------------------------------------------
// Prepare for writing files.
+template<typename mesh_type>
void
-pylith::meshio::DataWriter::open(
- const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh,
- const int numTimeSteps,
- const char* label,
- const int labelId)
+pylith::meshio::DataWriter<mesh_type>::open(const mesh_type& mesh,
+ const int numTimeSteps,
+ const char* label,
+ const int labelId)
{ // open
_numTimeSteps = numTimeSteps;
} // open
// ----------------------------------------------------------------------
// Close output files.
+template<typename mesh_type>
void
-pylith::meshio::DataWriter::close(void)
+pylith::meshio::DataWriter<mesh_type>::close(void)
{ // close
} // close
// ----------------------------------------------------------------------
// Prepare file for data at a new time step.
+template<typename mesh_type>
void
-pylith::meshio::DataWriter::openTimeStep(
- const double t,
- const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh,
- const char* label,
- const int labelId)
+pylith::meshio::DataWriter<mesh_type>::openTimeStep(const double t,
+ const mesh_type& mesh,
+ const char* label,
+ const int labelId)
{ // openTimeStep
} // openTimeStep
// ----------------------------------------------------------------------
// Cleanup after writing data for a time step.
+template<typename mesh_type>
void
-pylith::meshio::DataWriter::closeTimeStep(void)
+pylith::meshio::DataWriter<mesh_type>::closeTimeStep(void)
{ // closeTimeStep
} // closeTimeStep
// ----------------------------------------------------------------------
// Copy constructor.
-pylith::meshio::DataWriter::DataWriter(const DataWriter& w)
+template<typename mesh_type>
+pylith::meshio::DataWriter<mesh_type>::DataWriter(const DataWriter& w)
{ // copy constructor
} // copy constructor
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriter.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriter.hh 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriter.hh 2009-03-27 00:28:18 UTC (rev 14475)
@@ -19,21 +19,11 @@
#if !defined(pylith_meshio_datawriter_hh)
#define pylith_meshio_datawriter_hh
-#include "pylith/utils/sievetypes.hh" // USES ALE::Obj, PETSc Mesh, real_section_type
-#include "pylith/utils/vectorfields.hh" // USES VectorFieldEnum
+// Include directives ---------------------------------------------------
+#include "meshiofwd.hh" // forward declarations
-namespace pylith {
- namespace meshio {
- class DataWriter;
- } // meshio
-} // pylith
-
-namespace spatialdata {
- namespace geocoords {
- class CoordSys; // USES CoordSys
- } // geocoords
-} // spatialdata
-
+// DataWriter -----------------------------------------------------------
+template<typename mesh_type>
class pylith::meshio::DataWriter
{ // DataWriter
@@ -56,16 +46,14 @@
/** Prepare for writing files.
*
- * @param mesh PETSc mesh object
- * @param csMesh Coordinate system of mesh geometry
+ * @param mesh Finite-element mesh.
* @param numTimeSteps Expected number of time steps for fields.
* @param label Name of label defining cells to include in output
* (=0 means use all cells in mesh).
* @param labelId Value of label defining which cells to include.
*/
virtual
- void open(const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh,
+ void open(const mesh_type& mesh,
const int numTimeSteps,
const char* label =0,
const int labelId =0);
@@ -78,15 +66,13 @@
*
* @param t Time stamp for new data
* @param mesh PETSc mesh object
- * @param csMesh Coordinate system of mesh geometry
* @param label Name of label defining cells to include in output
* (=0 means use all cells in mesh).
* @param labelId Value of label defining which cells to include.
*/
virtual
void openTimeStep(const double t,
- const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh,
+ const mesh_type& mesh,
const char* label =0,
const int labelId =0);
@@ -97,35 +83,23 @@
/** Write field over vertices to file.
*
* @param t Time associated with field.
- * @param name Name of field.
- * @param field PETSc field over vertices.
- * @param fieldType Type of field.
- * @param mesh Finite-element mesh
+ * @param field Field over vertices.
*/
virtual
void writeVertexField(const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const VectorFieldEnum fieldType,
- const ALE::Obj<Mesh>& mesh) = 0;
+ const topology::Field<mesh_type>& field) = 0;
/** Write field over cells to file.
*
* @param t Time associated with field.
- * @param name Name of field.
- * @param field PETSc field over cells.
- * @param fieldType Type of field.
- * @param mesh PETSc mesh object.
+ * @param field Field over cells.
* @param label Name of label defining cells to include in output
* (=0 means use all cells in mesh).
* @param labelId Value of label defining which cells to include.
*/
virtual
void writeCellField(const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const VectorFieldEnum fieldType,
- const ALE::Obj<Mesh>& mesh,
+ const topology::Field<mesh_type>& field,
const char* label =0,
const int labelId =0) = 0;
@@ -150,6 +124,8 @@
}; // DataWriter
+#include "DataWriter.cc" // template methods
+
#endif // pylith_meshio_datawriter_hh
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriterVTK.cc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriterVTK.cc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -12,8 +12,6 @@
#include <portinfo>
-#include "DataWriterVTK.hh" // implementation of class methods
-
#include <petscmesh_viewers.hh> // USES VTKViewer
#include <cassert> // USES assert()
@@ -22,7 +20,8 @@
// ----------------------------------------------------------------------
// Constructor
-pylith::meshio::DataWriterVTK::DataWriterVTK(void) :
+template<typename mesh_type>
+pylith::meshio::DataWriterVTK<mesh_type>::DataWriterVTK(void) :
_timeConstant(1.0),
_filename("output.vtk"),
_timeFormat("%f"),
@@ -34,7 +33,8 @@
// ----------------------------------------------------------------------
// Destructor
-pylith::meshio::DataWriterVTK::~DataWriterVTK(void)
+template<typename mesh_type>
+pylith::meshio::DataWriterVTK<mesh_type>::~DataWriterVTK(void)
{ // destructor
if (0 != _viewer)
PetscViewerDestroy(_viewer);
@@ -43,7 +43,8 @@
// ----------------------------------------------------------------------
// Copy constructor.
-pylith::meshio::DataWriterVTK::DataWriterVTK(const DataWriterVTK& w) :
+template<typename mesh_type>
+pylith::meshio::DataWriterVTK<mesh_type>::DataWriterVTK(const DataWriterVTK& w) :
DataWriter(w),
_timeConstant(w._timeConstant),
_filename(w._filename),
@@ -56,8 +57,9 @@
// ----------------------------------------------------------------------
// Set value used to normalize time stamp in name of VTK file.
+template<typename mesh_type>
void
-pylith::meshio::DataWriterVTK::timeConstant(const double value)
+pylith::meshio::DataWriterVTK<mesh_type>::timeConstant(const double value)
{ // timeConstant
if (value <= 0.0) {
std::ostringstream msg;
@@ -70,42 +72,43 @@
// ----------------------------------------------------------------------
// Prepare file for data at a new time step.
+template<typename mesh_type>
void
-pylith::meshio::DataWriterVTK::openTimeStep(
- const double t,
- const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh,
- const char* label,
- const int labelId)
+pylith::meshio::DataWriterVTK<mesh_type>::openTimeStep(const double t,
+ const mesh_type& mesh,
+ const char* label,
+ const int labelId)
{ // openTimeStep
- assert(!mesh.isNull());
- assert(0 != csMesh);
try {
- PetscErrorCode err;
+ PetscErrorCode err = 0;
const std::string& filename = _vtkFilename(t);
err = PetscViewerCreate(mesh->comm(), &_viewer);
+ CHECK_PETSC_ERROR(err);
err = PetscViewerSetType(_viewer, PETSC_VIEWER_ASCII);
+ CHECK_PETSC_ERROR(err);
err = PetscViewerSetFormat(_viewer, PETSC_VIEWER_ASCII_VTK);
+ CHECK_PETSC_ERROR(err);
err = PetscViewerFileSetName(_viewer, filename.c_str());
- if (err)
- throw std::runtime_error("Could not open VTK file.");
+ CHECK_PETSC_ERROR_MSF(err);
err = VTKViewer::writeHeader(_viewer);
+ CHECK_PETSC_ERROR(err);
//std::cout << "Wrote header for " << filename << std::endl;
err = VTKViewer::writeVertices(mesh, _viewer);
+ CHECK_PETSC_ERROR(err);
//std::cout << "Wrote vertices for " << filename << std::endl;
- if (0 == label)
+ if (0 == label) {
err = VTKViewer::writeElements(mesh, _viewer);
- else {
+ CHECK_PETSC_ERROR(err);
+ } else {
const std::string labelName =
(mesh->hasLabel("censored depth")) ? "censored depth" : "depth";
err = VTKViewer::writeElements(mesh, label, labelId, labelName, 0, _viewer);
+ CHECK_PETSC_ERROR(err);
} // if
- if (err)
- throw std::runtime_error("Could not write topology.");
//std::cout << "Wrote elements for " << filename << std::endl;
_wroteVertexHeader = false;
@@ -130,8 +133,9 @@
// ----------------------------------------------------------------------
/// Cleanup after writing data for a time step.
+template<typename mesh_type>
void
-pylith::meshio::DataWriterVTK::closeTimeStep(void)
+pylith::meshio::DataWriterVTK<mesh_type>::closeTimeStep(void)
{ // closeTimeStep
PetscViewerDestroy(_viewer); _viewer = 0;
_wroteVertexHeader = false;
@@ -140,18 +144,13 @@
// ----------------------------------------------------------------------
// Write field over vertices to file.
+template<typename mesh_type>
void
-pylith::meshio::DataWriterVTK::writeVertexField(
+pylith::meshio::DataWriterVTK<mesh_type>::writeVertexField(
const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const VectorFieldEnum fieldType,
- const ALE::Obj<Mesh>& mesh)
+ const topology::Field<mesh_type>& field)
{ // writeVertexField
- assert(0 != name);
- assert(!mesh.isNull());
- assert(!field.isNull());
-
+#if 0
try {
const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
assert(!vertices.isNull());
@@ -198,24 +197,20 @@
<< t << " to VTK file '" << _filename << "'.\n";
throw std::runtime_error(msg.str());
} // try/catch
+#endif
} // writeVertexField
// ----------------------------------------------------------------------
// Write field over cells to file.
+template<typename mesh_type>
void
-pylith::meshio::DataWriterVTK::writeCellField(
+pylith::meshio::DataWriterVTK<mesh_type>::writeCellField(
const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const VectorFieldEnum fieldType,
- const ALE::Obj<Mesh>& mesh,
+ const topology::Field<mesh_type>& field,
const char* label,
const int labelId)
{ // writeCellField
- assert(0 != name);
- assert(!mesh.isNull());
- assert(!field.isNull());
-
+#if 0
try {
const ALE::Obj<Mesh::label_sequence>& cells = (0 == label) ?
mesh->heightStratum(0) :
@@ -265,12 +260,14 @@
<< t << " to VTK file '" << _filename << "'.\n";
throw std::runtime_error(msg.str());
} // try/catch
+#endif
} // writeCellField
// ----------------------------------------------------------------------
// Generate filename for VTK file.
+template<typename mesh_type>
std::string
-pylith::meshio::DataWriterVTK::_vtkFilename(const double t) const
+pylith::meshio::DataWriterVTK<mesh_type>::_vtkFilename(const double t) const
{ // _vtkFilename
std::ostringstream filename;
const int indexExt = _filename.find(".vtk");
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriterVTK.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriterVTK.hh 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriterVTK.hh 2009-03-27 00:28:18 UTC (rev 14475)
@@ -19,18 +19,11 @@
#if !defined(pylith_meshio_datawritervtk_hh)
#define pylith_meshio_datawritervtk_hh
-#include "DataWriter.hh" // ISA DataWriter
+// Include directives ---------------------------------------------------
+#include "meshiofwd.hh" // forward declarations
-#include <string> // USES std::string
-
-namespace pylith {
- namespace meshio {
- class DataWriterVTK;
-
- class TestDataWriterVTK; // unit testing
- } // meshio
-} // pylith
-
+// DataWriterVTK --------------------------------------------------------
+template<typename mesh_type>
class pylith::meshio::DataWriterVTK : public DataWriter
{ // DataWriterVTK
friend class TestDataWriterVTK; // unit testing
@@ -74,15 +67,13 @@
/** Prepare file for data at a new time step.
*
* @param t Time stamp for new data
- * @param mesh PETSc mesh object
- * @param csMesh Coordinate system of mesh geometry
+ * @param mesh Finite-element mesh.
* @param label Name of label defining cells to include in output
* (=0 means use all cells in mesh).
* @param labelId Value of label defining which cells to include.
*/
void openTimeStep(const double t,
- const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh,
+ const mesh_type& mesh,
const char* label =0,
const int labelId =0);
@@ -92,33 +83,21 @@
/** Write field over vertices to file.
*
* @param t Time associated with field.
- * @param name Name of field.
- * @param field PETSc field over vertices.
- * @param fieldType Type of field.
- * @param mesh Finite-element mesh
+ * @param field Field over vertices.
*/
void writeVertexField(const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const VectorFieldEnum fieldType,
- const ALE::Obj<Mesh>& mesh);
+ const topology::Field<mesh_type>& field);
/** Write field over cells to file.
*
* @param t Time associated with field.
- * @param name Name of field.
- * @param field PETSc field over cells.
- * @param fieldType Type of field.
- * @param mesh PETSc mesh object.
+ * @param field Field over cells.
* @param label Name of label defining cells to include in output
* (=0 means use all cells in mesh).
* @param labelId Value of label defining which cells to include.
*/
void writeCellField(const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const VectorFieldEnum fieldType,
- const ALE::Obj<Mesh>& mesh,
+ const topology::Field<mesh_type>& field,
const char* label =0,
const int labelId =0);
@@ -159,6 +138,7 @@
}; // DataWriterVTK
#include "DataWriterVTK.icc" // inline methods
+#include "DataWriterVTK.cc"
#endif // pylith_meshio_datawritervtk_hh
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriterVTK.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriterVTK.icc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/DataWriterVTK.icc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -15,23 +15,24 @@
#else
// Make copy of this object.
+template<typename mesh_type>
inline
-pylith::meshio::DataWriter*
-pylith::meshio::DataWriterVTK::clone(void) const {
+pylith::meshio::DataWriter<mesh_type>*
+pylith::meshio::DataWriterVTK<mesh_type>::clone(void) const {
return new DataWriterVTK(*this);
}
// Set filename for VTK file.
inline
void
-pylith::meshio::DataWriterVTK::filename(const char* filename) {
+pylith::meshio::DataWriterVTK<mesh_type>::filename(const char* filename) {
_filename = filename;
}
// Set time format for time stamp in name of VTK file.
inline
void
-pylith::meshio::DataWriterVTK::timeFormat(const char* format) {
+pylith::meshio::DataWriterVTK<mesh_type>::timeFormat(const char* format) {
_timeFormat = format;
}
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/Makefile.am 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/Makefile.am 2009-03-27 00:28:18 UTC (rev 14475)
@@ -17,8 +17,10 @@
CellFilter.hh \
CellFilterAvg.hh \
DataWriter.hh \
+ DataWriter.cc \
DataWriterVTK.hh \
DataWriterVTK.icc \
+ DataWriterVTK.cc \
MeshBuilder.hh \
MeshIO.hh \
MeshIO.icc \
@@ -27,6 +29,7 @@
MeshIOLagrit.hh \
MeshIOLagrit.icc \
OutputManager.hh \
+ OutputManager.cc \
OutputSolnSubset.hh \
UCDFaultFile.hh \
VertexFilter.hh \
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/OutputManager.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/OutputManager.cc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/OutputManager.cc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -12,9 +12,6 @@
#include <portinfo>
-#include "OutputManager.hh" // implementation of class methods
-
-#include "DataWriter.hh" // USES DataWriter
#include "VertexFilter.hh" // USES VertexFilter
#include "CellFilter.hh" // USES CellFilter
@@ -22,7 +19,8 @@
// ----------------------------------------------------------------------
// Constructor
-pylith::meshio::OutputManager::OutputManager(void) :
+template<typename mesh_type>
+pylith::meshio::OutputManager<mesh_type>::OutputManager(void) :
_coordsys(0),
_writer(0),
_vertexFilter(0),
@@ -32,7 +30,8 @@
// ----------------------------------------------------------------------
// Destructor
-pylith::meshio::OutputManager::~OutputManager(void)
+template<typename mesh_type>
+pylith::meshio::OutputManager<mesh_type>::~OutputManager(void)
{ // destructor
delete _writer; _writer = 0;
delete _vertexFilter; _vertexFilter = 0;
@@ -42,55 +41,59 @@
// ----------------------------------------------------------------------
// Set coordinate system in output. The vertex fields in the output
+template<typename mesh_type>
void
-pylith::meshio::OutputManager::coordsys(const spatialdata::geocoords::CoordSys* cs)
+pylith::meshio::OutputManager<mesh_type>::coordsys(const spatialdata::geocoords::CoordSys* cs)
{ // coordsys
delete _coordsys; _coordsys = (0 != cs) ? cs->clone() : 0;
} // coordsys
// ----------------------------------------------------------------------
// Set writer to write data to file.
+template<typename mesh_type>
void
-pylith::meshio::OutputManager::writer(const DataWriter* datawriter)
+pylith::meshio::OutputManager<mesh_type>::writer(const DataWriter* datawriter)
{ // writer
delete _writer; _writer = (0 != datawriter) ? datawriter->clone() : 0;
} // writer
// ----------------------------------------------------------------------
// Set filter for vertex data.
+template<typename mesh_type>
void
-pylith::meshio::OutputManager::vertexFilter(const VertexFilter* filter)
+pylith::meshio::OutputManager<mesh_type>::vertexFilter(const VertexFilter* filter)
{ // vertexFilter
delete _vertexFilter; _vertexFilter = (0 != filter) ? filter->clone() : 0;
} // vertexFilter
// ----------------------------------------------------------------------
// Set filter for cell data.
+template<typename mesh_type>
void
-pylith::meshio::OutputManager::cellFilter(const CellFilter* filter)
+pylith::meshio::OutputManager<mesh_type>::cellFilter(const CellFilter* filter)
{ // cellFilter
delete _cellFilter; _cellFilter = (0 != filter) ? filter->clone() : 0;
} // cellFilter
// ----------------------------------------------------------------------
// Prepare for output.
+template<typename mesh_type>
void
-pylith::meshio::OutputManager::open(
- const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh,
- const int numTimeSteps,
- const char* label,
- const int labelId)
+pylith::meshio::OutputManager<mesh_type>::open(const mesh_type& mesh,
+ const int numTimeSteps,
+ const char* label,
+ const int labelId)
{ // open
assert(0 != _writer);
- _writer->open(mesh, csMesh, numTimeSteps, label, labelId);
+ _writer->open(mesh, numTimeSteps, label, labelId);
} // open
// ----------------------------------------------------------------------
/// Close output files.
+template<typename mesh_type>
void
-pylith::meshio::OutputManager::close(void)
+pylith::meshio::OutputManager<mesh_type>::close(void)
{ // close
assert(0 != _writer);
_writer->close();
@@ -98,22 +101,22 @@
// ----------------------------------------------------------------------
// Setup file for writing fields at time step.
+template<typename mesh_type>
void
-pylith::meshio::OutputManager::openTimeStep(
- const double t,
- const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh,
- const char* label,
- const int labelId)
+pylith::meshio::OutputManager<mesh_type>::openTimeStep(const double t,
+ const mesh_type& mesh,
+ const char* label,
+ const int labelId)
{ // openTimeStep
assert(0 != _writer);
- _writer->openTimeStep(t, mesh, csMesh, label, labelId);
+ _writer->openTimeStep(t, mesh, label, labelId);
} // openTimeStep
// ----------------------------------------------------------------------
// End writing fields at time step.
+template<typename mesh_type>
void
-pylith::meshio::OutputManager::closeTimeStep(void)
+pylith::meshio::OutputManager<mesh_type>::closeTimeStep(void)
{ // closeTimeStep
assert(0 != _writer);
_writer->closeTimeStep();
@@ -121,46 +124,32 @@
// ----------------------------------------------------------------------
// Append finite-element vertex field to file.
+template<typename mesh_type>
void
-pylith::meshio::OutputManager::appendVertexField(
+pylith::meshio::OutputManager<mesh_type>::appendVertexField(
const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const VectorFieldEnum fieldType,
- const ALE::Obj<Mesh>& mesh)
+ const topology::Field<mesh_type>& field)
{ // appendVertexField
- assert(0 != name);
+ const topology::Field<mesh_type>& fieldFiltered =
+ (0 == _vertexFilter) ? field : _vertexFilter->filter(field);
- VectorFieldEnum fieldTypeFiltered = fieldType;
- const ALE::Obj<real_section_type>& fieldFiltered =
- (0 == _vertexFilter) ?
- field : _vertexFilter->filter(&fieldTypeFiltered, field, mesh);
-
- _writer->writeVertexField(t, name, fieldFiltered, fieldTypeFiltered, mesh);
+ _writer->writeVertexField(t, fieldFiltered);
} // appendVertexField
// ----------------------------------------------------------------------
// Append finite-element cell field to file.
+template<typename mesh_type>
void
-pylith::meshio::OutputManager::appendCellField(
+pylith::meshio::OutputManager<mesh_type>::appendCellField(
const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const VectorFieldEnum fieldType,
- const ALE::Obj<Mesh>& mesh,
+ const topology::Field<mesh_type>& field,
const char* label,
const int labelId)
{ // appendCellField
- assert(0 != name);
+ const topology::Field<mesh_type>& fieldFiltered =
+ (0 == _cellFilter) ? field : _cellFilter->filter(field, label, labelId);
- VectorFieldEnum fieldTypeFiltered = fieldType;
- const ALE::Obj<real_section_type>& fieldFiltered =
- (0 == _cellFilter) ?
- field : _cellFilter->filter(&fieldTypeFiltered, field,
- mesh, label, labelId);
-
- _writer->writeCellField(t, name, fieldFiltered, fieldTypeFiltered,
- mesh, label, labelId);
+ _writer->writeCellField(t, fieldFiltered, label, labelId);
} // appendCellField
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/OutputManager.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/OutputManager.hh 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/OutputManager.hh 2009-03-27 00:28:18 UTC (rev 14475)
@@ -19,26 +19,17 @@
#if !defined(pylith_meshio_outputmanager_hh)
#define pylith_meshio_outputmanager_hh
+
+
#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh, real_section_type
#include "pylith/utils/vectorfields.hh" // USES VectorFieldEnum
-namespace pylith {
- namespace meshio {
- class OutputManager;
- class TestOutputManager; // unit testing
+// Include directives ---------------------------------------------------
+#include "meshiofwd.hh" // forward declarations
- class DataWriter; // HOLDS DataWriter
- class CellFilter; // HOLDSA CellFilter
- class VertexFilter; // HOLDSA VertexFilter
- } // meshio
-} // pylith
+#include "DataWriter.hh" // USES DataWriter in templated methods
-namespace spatialdata {
- namespace geocoords {
- class CoordSys; // USES CoordSys
- } // geocoords
-} // spatialdata
-
+// OutputManager --------------------------------------------------------
class pylith::meshio::OutputManager
{ // OutputManager
friend class TestOutputManager; // unit testing
@@ -64,7 +55,7 @@
*
* @param datawriter Writer for data.
*/
- void writer(const DataWriter* datawriter);
+ void writer(const DataWriter<mesh_type>* datawriter);
/** Set filter for vertex data.
*
@@ -80,15 +71,14 @@
/** Prepare for output.
*
- * @param mesh PETSc mesh object.
- * @param csMesh Coordinate system of mesh geometry.
+ * @param mesh Finite-element mesh object.
* @param numTimeSteps Expected number of time steps.
* @param label Name of label defining cells to include in output
* (=0 means use all cells in mesh).
* @param labelId Value of label defining which cells to include.
*/
- void open(const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh,
+ template<typename mesh_type>
+ void open(const mesh_type& mesh,
const int numTimeSteps,
const char* label =0,
const int labelId =0);
@@ -99,15 +89,14 @@
/** Setup file for writing fields at time step.
*
* @param t Time of time step.
- * @param mesh PETSc mesh object.
- * @param csMesh Coordinate system of mesh geometry
+ * @param mesh Finite-element mesh object.
* @param label Name of label defining cells to include in output
* (=0 means use all cells in mesh).
* @param labelId Value of label defining which cells to include.
*/
+ template<typename mesh_type>
void openTimeStep(const double t,
- const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh,
+ const mesh_type& mesh,
const char* label =0,
const int labelId =0);
@@ -117,16 +106,11 @@
/** Append finite-element vertex field to file.
*
* @param t Time associated with field.
- * @param name Name of field.
* @param field Vertex field.
- * @param fieldType Type of field.
- * @param mesh PETSc mesh object.
*/
+ template<typename mesh_type>
void appendVertexField(const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const VectorFieldEnum fieldType,
- const ALE::Obj<Mesh>& mesh);
+ const topology::Field<mesh_type>& field);
/** Append finite-element cell field to file.
*
@@ -139,11 +123,10 @@
* (=0 means use all cells in mesh).
* @param labelId Value of label defining which cells to include.
*/
+ template<typename mesh_type>
void appendCellField(const double t,
const char* name,
- const ALE::Obj<real_section_type>& field,
- const VectorFieldEnum fieldType,
- const ALE::Obj<Mesh>& mesh,
+ const topology::Field<mesh_type>& field,
const char* label =0,
const int labelId =0);
@@ -157,12 +140,15 @@
private :
spatialdata::geocoords::CoordSys* _coordsys; ///< Coordinate system for output.
- DataWriter* _writer; ///< Writer for data.
+ DataWriter<mesh_type>* _writer; ///< Writer for data.
VertexFilter* _vertexFilter; ///< Filter applied to vertex data.
CellFilter* _cellFilter; ///< Filter applied to cell data.
}; // OutputManager
+#include "OutputManager.icc" // template methods
+
#endif // pylith_meshio_outputmanager_hh
+
// End of file
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/meshiofwd.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/meshiofwd.hh 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/meshiofwd.hh 2009-03-27 00:28:18 UTC (rev 14475)
@@ -38,8 +38,9 @@
class PsetFileAscii;
class PsetFileBinary;
- class DataWriter;
- class DataWriterVTK;
+ template<typename mesh_type> class OutputManager;
+ template<typename mesh_type> class DataWriter;
+ template<typename mesh_type> class DataWriterVTK;
class CellFilter;
class CellFilterAvg;
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -29,7 +29,7 @@
template<typename mesh_type>
pylith::topology::Field<mesh_type>::Field(const mesh_type& mesh) :
_scale(1.0),
- _name("unknown"),
+ _label("unknown"),
_mesh(mesh),
_vector(0),
_scatter(0),
@@ -87,7 +87,7 @@
if (fiberDim < 0) {
std::ostringstream msg;
msg
- << "Fiber dimension (" << fiberDim << ") for field '" << _name
+ << "Fiber dimension (" << fiberDim << ") for field '" << _label
<< "' must be nonnegative.";
throw std::runtime_error(msg.str());
} // if
@@ -244,8 +244,8 @@
srcSize != dstSize) {
std::ostringstream msg;
- msg << "Cannot copy values from section '" << field._name
- << "' to section '" << _name << "'. Sections are incompatible.\n"
+ msg << "Cannot copy values from section '" << field._label
+ << "' to section '" << _label << "'. Sections are incompatible.\n"
<< " Source section:\n"
<< " space dim: " << field.spaceDim() << "\n"
<< " vector field type: " << field._vecFieldType << "\n"
@@ -291,8 +291,8 @@
srcSize != dstSize) {
std::ostringstream msg;
- msg << "Cannot add values from section '" << field._name
- << "' to section '" << _name << "'. Sections are incompatible.\n"
+ msg << "Cannot add values from section '" << field._label
+ << "' to section '" << _label << "'. Sections are incompatible.\n"
<< " Source section:\n"
<< " space dim: " << field.spaceDim() << "\n"
<< " vector field type: " << field._vecFieldType << "\n"
@@ -336,7 +336,7 @@
{ // dimensionalize
if (!_dimensionsOkay) {
std::ostringstream msg;
- msg << "Cannot dimensionalize field '" << _name << "' because the flag "
+ msg << "Cannot dimensionalize field '" << _label << "' because the flag "
<< "has been set to keep field nondimensional.";
throw std::runtime_error(msg.str());
} // if
@@ -402,7 +402,7 @@
assert(0);
} // switch
- std::cout << "Viewing field '" << _name << "' "<< label << ".\n"
+ std::cout << "Viewing field '" << _label << "' "<< label << ".\n"
<< " vector field type: " << vecFieldString << "\n"
<< " scale: " << _scale << "\n"
<< " dimensionalize flag: " << _dimensionsOkay << std::endl;
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh 2009-03-27 00:28:18 UTC (rev 14475)
@@ -75,17 +75,17 @@
*/
const mesh_type& mesh(void) const;
- /** Set name of field.
+ /** Set label for field.
*
- * @param value Name of field.
+ * @param value Label for field.
*/
- void name(const char* value);
+ void label(const char* value);
- /** Get name of field.
+ /** Get label for field.
*
- * @returns Name of field.
+ * @returns Label for field.
*/
- const char* name(void) const;
+ const char* label(void) const;
/** Set vector field type
*
@@ -232,14 +232,14 @@
// PRIVATE MEMBERS //////////////////////////////////////////////////////
private :
- double _scale; ///< Dimensional scale associated with field
- std::string _name; ///< Name of field
- const mesh_type& _mesh; ///< Mesh associated with section
- ALE::Obj<RealSection> _section; ///< Real section with data
+ double _scale; ///< Dimensional scale associated with field.
+ std::string _label; ///< Label for field.
+ const mesh_type& _mesh; ///< Mesh associated with section.
+ ALE::Obj<RealSection> _section; ///< Real section with data.
PetscVec _vector; ///< PETSc vector associated with field.
PetscVecScatter _scatter; ///< PETSc scatter associated with field.
- VectorFieldEnum _vecFieldType; ///< Type of vector field
- bool _dimensionsOkay; ///< Flag indicating it is okay to dimensionalize
+ VectorFieldEnum _vecFieldType; ///< Type of vector field.
+ bool _dimensionsOkay; ///< Flag indicating it is okay to dimensionalize.
// NOT IMPLEMENTED //////////////////////////////////////////////////////
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.icc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.icc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -31,20 +31,20 @@
return _mesh;
}
-// Set name of field.
+// Set label for field.
template<typename mesh_type>
inline
void
-pylith::topology::Field<mesh_type>::name(const char* value) {
- _name = value;
+pylith::topology::Field<mesh_type>::label(const char* value) {
+ _label = value;
}
-// Get name of field.
+// Get label for field.
template<typename mesh_type>
inline
const char*
-pylith::topology::Field<mesh_type>::name(void) const {
- return _name.c_str();
+pylith::topology::Field<mesh_type>::label(void) const {
+ return _label.c_str();
}
// Set vector field type
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.hh 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.hh 2009-03-27 00:28:18 UTC (rev 14475)
@@ -46,16 +46,20 @@
/** Add field.
*
* @param name Name of field.
+ * @param label Label for field.
*/
- void add(const char* name);
+ void add(const char* name,
+ const char* label);
/** Add field.
*
* @param name Name of field.
+ * @param label Label for field.
* @param domain Type of points over which to define field.
* @param fiberDim Fiber dimension for field.
*/
void add(const char* name,
+ const char* label,
const pylith::topology::FieldBase::DomainEnum domain,
const int fiberDim);
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.icc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.icc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -41,7 +41,8 @@
// Add field.
template<typename field_type>
void
-pylith::topology::Fields<field_type>::add(const char* name)
+pylith::topology::Fields<field_type>::add(const char* name,
+ const char* label)
{ // add
typename map_type::iterator iter = _fields.find(name);
if (iter != _fields.end()) {
@@ -52,6 +53,7 @@
} // if
_fields[name] = new field_type(_mesh);
+ _fields[name]->label(label);
} // add
// ----------------------------------------------------------------------
@@ -60,6 +62,7 @@
void
pylith::topology::Fields<field_type>::add(
const char* name,
+ const char* label,
const pylith::topology::FieldBase::DomainEnum domain,
const int fiberDim)
{ // add
@@ -72,6 +75,7 @@
} // if
_fields[name] = new field_type(_mesh);
+ _fields[name]->label(label);
_fields[name]->newSection(domain, fiberDim);
} // add
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/include/integratorarray.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/include/integratorarray.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/include/integratorarray.i 2009-03-27 00:28:18 UTC (rev 14475)
@@ -0,0 +1,86 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// ----------------------------------------------------------------------
+// List of mesh integrators.
+%typemap(in) (pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::Mesh> >** integrators,
+ const int numIntegrators)
+{
+ // Check to make sure input is a list.
+ if (PyList_Check($input)) {
+ const int size = PyList_Size($input);
+ $2 = size;
+ $1 = (size > 0) ? new pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::Mesh> >*[size] : 0;
+ for (int i = 0; i < size; i++) {
+ PyObject* s = PyList_GetItem($input,i);
+ pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::Mesh> >* integrator = 0;
+ int err = SWIG_ConvertPtr(s, (void**) &integrator,
+ $descriptor(pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::Mesh> >*),
+ 0);
+ if (SWIG_IsOK(err))
+ $1[i] = (pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::Mesh> >*) integrator;
+ else {
+ PyErr_SetString(PyExc_TypeError, "List must contain mesh integrators.");
+ delete[] $1;
+ return NULL;
+ } // if
+ } // for
+ } else {
+ PyErr_SetString(PyExc_TypeError, "Expected list of mesh integrators.");
+ return NULL;
+ } // if/else
+} // typemap(in) [List of mesh integrators.]
+
+// This cleans up the array we malloc'd before the function call
+%typemap(freearg) (pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::Mesh> >** integrators,
+ const int numIntegrators) {
+ delete[] $1;
+}
+
+// ----------------------------------------------------------------------
+// List of submesh integrators.
+%typemap(in) (pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >** integrators,
+ const int numIntegrators)
+{
+ // Check to make sure input is a list.
+ if (PyList_Check($input)) {
+ const int size = PyList_Size($input);
+ $2 = size;
+ $1 = (size > 0) ? new pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >*[size] : 0;
+ for (int i = 0; i < size; i++) {
+ PyObject* s = PyList_GetItem($input,i);
+ pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >* integrator = 0;
+ int err = SWIG_ConvertPtr(s, (void**) &integrator,
+ $descriptor(pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >*),
+ 0);
+ if (SWIG_IsOK(err))
+ $1[i] = (pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >*) integrator;
+ else {
+ PyErr_SetString(PyExc_TypeError, "List must contain submesh integrators.");
+ delete[] $1;
+ return NULL;
+ } // if
+ } // for
+ } else {
+ PyErr_SetString(PyExc_TypeError, "Expected list of submesh integrators.");
+ return NULL;
+ } // if/else
+} // typemap(in) [List of submesh integrators.]
+
+// This cleans up the array we malloc'd before the function call
+%typemap(freearg) (pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >** integrators,
+ const int numIntegrators) {
+ delete[] $1;
+}
+
+
+// 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-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Field.i 2009-03-27 00:28:18 UTC (rev 14475)
@@ -50,17 +50,17 @@
*/
const mesh_type& mesh(void) const;
- /** Set name of field.
+ /** Set label for field.
*
- * @param value Name of field.
+ * @param value Label for field.
*/
- void name(const char* value);
+ void label(const char* value);
- /** Get name of field.
+ /** Get label for field.
*
- * @returns Name of field.
+ * @returns Label for field.
*/
- const char* name(void) const;
+ const char* label(void) const;
/** Set vector field type
*
Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Fields.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Fields.i 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/topology/Fields.i 2009-03-27 00:28:18 UTC (rev 14475)
@@ -38,16 +38,20 @@
/** Add field.
*
* @param name Name of field.
+ * @param label Label for field.
*/
- void add(const char* name);
+ void add(const char* name,
+ const char* label);
/** Add field.
*
* @param name Name of field.
+ * @param label Label for field.
* @param domain Type of points over which to define field.
* @param fiberDim Fiber dimension for field.
*/
void add(const char* name,
+ const char* label,
const pylith::topology::FieldBase::DomainEnum domain,
const int fiberDim);
Modified: short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py 2009-03-27 00:28:18 UTC (rev 14475)
@@ -89,6 +89,7 @@
if "interfaces" in dir(self.problem):
interfaces = self.problem.interfaces.components()
mesh = self.mesher.create(self.problem.normalizer, interfaces)
+ del interfaces
del self.mesher
self._debug.log(resourceUsageString())
self._logger.stagePop()
Modified: short/3D/PyLith/branches/pylith-swig/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/problems/Formulation.py 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/pylith/problems/Formulation.py 2009-03-27 00:28:18 UTC (rev 14475)
@@ -198,7 +198,7 @@
self._info.log("Creating solution field.")
solnName = self.solnField['name']
- self.fields.add(solnName)
+ self.fields.add(solnName, self.solnField['label'])
self.fields.solutionName(solnName)
solution = self.fields.solution()
solution.newSection(solution.VERTICES_FIELD, dimension)
Modified: short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py 2009-03-27 00:28:18 UTC (rev 14475)
@@ -71,7 +71,7 @@
Formulation.__init__(self, name)
self._loggingPrefix = "TSIm "
self.solnField = {'name': "disp(t), bc(t+dt)",
- 'label': "displacements"}
+ 'label': "displacement"}
self._stepCount = None
return
@@ -94,8 +94,8 @@
Formulation.initialize(self, dimension, normalizer)
self._info.log("Creating other fields.")
- self.fields.add("dispIncr(t)")
- self.fields.add("residual")
+ self.fields.add("dispIncr(t)", "displacement increment")
+ self.fields.add("residual", "residual")
self.fields.copyLayout("disp(t), bc(t+dt)")
self._debug.log(resourceUsageString())
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit.cc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityExplicit.cc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -362,10 +362,10 @@
// Setup fields
CPPUNIT_ASSERT(0 != fields);
- fields->add("residual");
- fields->add("disp(t+dt)");
- fields->add("disp(t)");
- fields->add("disp(t-dt)");
+ fields->add("residual", "residual");
+ fields->add("disp(t+dt)", "displacement");
+ fields->add("disp(t)", "displacement");
+ fields->add("disp(t-dt)", "displacement");
fields->solutionName("disp(t+dt)");
const char* history[] = { "disp(t+dt)", "disp(t)", "disp(t-dt)" };
const int historySize = 3;
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityImplicit.cc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestElasticityImplicit.cc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -359,9 +359,9 @@
// Setup fields
CPPUNIT_ASSERT(0 != fields);
- fields->add("residual");
- fields->add("disp(t), bc(t+dt)");
- fields->add("dispIncr(t->t+dt)");
+ fields->add("residual", "residual");
+ fields->add("disp(t), bc(t+dt)", "displacement");
+ fields->add("dispIncr(t->t+dt)", "displacement increment");
fields->solutionName("dispIncr(t->t+dt)");
topology::Field<topology::Mesh>& residual = fields->get("residual");
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.cc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.cc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -79,6 +79,42 @@
} // testMesh
// ----------------------------------------------------------------------
+// Test label().
+void
+pylith::topology::TestFieldMesh::testLabel(void)
+{ // testLabel
+ const std::string label = "velocity";
+
+ Mesh mesh;
+ _buildMesh(&mesh);
+ Field<Mesh> field(mesh);
+
+ field.label(label.c_str());
+ CPPUNIT_ASSERT_EQUAL(label, std::string(field.label()));
+} // testLabel
+
+// ----------------------------------------------------------------------
+// Test vectorFieldType().
+void
+pylith::topology::TestFieldMesh::testVectorFieldType(void)
+{ // testVectorFieldType
+} // testVectorFieldType
+
+// ----------------------------------------------------------------------
+// Test scale().
+void
+pylith::topology::TestFieldMesh::testScale(void)
+{ // testScale
+} // testScale
+
+// ----------------------------------------------------------------------
+// Test addDimensionsOkay().
+void
+pylith::topology::TestFieldMesh::testAddDimensionsOkay(void)
+{ // testAddDimensionsOkay
+} // testAddDimensionsOkay
+
+// ----------------------------------------------------------------------
// Test spaceDim().
void
pylith::topology::TestFieldMesh::testSpaceDim(void)
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.hh 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldMesh.hh 2009-03-27 00:28:18 UTC (rev 14475)
@@ -41,8 +41,11 @@
CPPUNIT_TEST_SUITE( TestFieldMesh );
CPPUNIT_TEST( testConstructor );
- CPPUNIT_TEST( testSection );
CPPUNIT_TEST( testMesh );
+ CPPUNIT_TEST( testLabel );
+ CPPUNIT_TEST( testVectorFieldType );
+ CPPUNIT_TEST( testScale );
+ CPPUNIT_TEST( testAddDimensionsOkay );
CPPUNIT_TEST( testSpaceDim );
CPPUNIT_TEST( testNewSection );
CPPUNIT_TEST( testNewSectionPoints );
@@ -77,6 +80,18 @@
/// Test mesh().
void testMesh(void);
+ /// Test label().
+ void testLabel(void);
+
+ /// Test vectorFieldType().
+ void testVectorFieldType(void);
+
+ /// Test scale().
+ void testScale(void);
+
+ /// Test addDimensionsOkay().
+ void testAddDimensionsOkay(void);
+
/// Test spaceDim().
void testSpaceDim(void);
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsMesh.cc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsMesh.cc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -63,7 +63,7 @@
FieldsMesh fields(*_mesh);
const char* label = "field";
- fields.add(label);
+ fields.add(label, "displacement");
const size_t size = 1;
CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
} // testAdd
@@ -79,7 +79,7 @@
FieldsMesh fields(*_mesh);
const char* label = "field";
- fields.add(label, Field<Mesh>::VERTICES_FIELD, fiberDim);
+ fields.add(label, "velocity", Field<Mesh>::VERTICES_FIELD, fiberDim);
const size_t size = 1;
CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
@@ -107,10 +107,10 @@
FieldsMesh fields(*_mesh);
const char* labelA = "field A";
- fields.add(labelA);
+ fields.add(labelA, "displacement");
const char* labelB = "field B";
- fields.add(labelB);
+ fields.add(labelB, "velocity");
size_t size = 2;
CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
@@ -118,6 +118,7 @@
size = 1;
CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
const Field<Mesh>& field = fields.get(labelB);
+ CPPUNIT_ASSERT_EQUAL(std::string("velocity"), std::string(field.label()));
} // testDelete
// ----------------------------------------------------------------------
@@ -129,7 +130,7 @@
FieldsMesh fields(*_mesh);
const char* label = "field";
- fields.add(label);
+ fields.add(label, "velocity");
const Field<Mesh>& field = fields.get(label);
} // testGet
@@ -142,7 +143,7 @@
FieldsMesh fields(*_mesh);
const char* label = "field";
- fields.add(label);
+ fields.add(label, "velocity");
const FieldsMesh* fieldsPtr = &fields;
CPPUNIT_ASSERT(0 != fieldsPtr);
@@ -160,10 +161,10 @@
FieldsMesh fields(*_mesh);
const char* labelA = "field A";
- fields.add(labelA, Field<Mesh>::VERTICES_FIELD, fiberDim);
+ fields.add(labelA, "displacement", Field<Mesh>::VERTICES_FIELD, fiberDim);
const char* labelB = "field B";
- fields.add(labelB);
+ fields.add(labelB, "velocity");
Field<Mesh>& fieldA = fields.get(labelA);
fieldA.allocate();
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsSubMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsSubMesh.cc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsSubMesh.cc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -66,7 +66,7 @@
FieldsSubMesh fields(*_submesh);
const char* label = "field";
- fields.add(label);
+ fields.add(label, "displacement");
const size_t size = 1;
CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
} // testAdd
@@ -82,7 +82,7 @@
FieldsSubMesh fields(*_submesh);
const char* label = "field";
- fields.add(label, Field<SubMesh>::VERTICES_FIELD, fiberDim);
+ fields.add(label, "velocity", Field<SubMesh>::VERTICES_FIELD, fiberDim);
const size_t size = 1;
CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
@@ -110,10 +110,10 @@
FieldsSubMesh fields(*_submesh);
const char* labelA = "field A";
- fields.add(labelA);
+ fields.add(labelA, "displacement");
const char* labelB = "field B";
- fields.add(labelB);
+ fields.add(labelB, "velocity");
size_t size = 2;
CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
@@ -132,7 +132,7 @@
FieldsSubMesh fields(*_submesh);
const char* label = "field";
- fields.add(label);
+ fields.add(label, "displacement");
const Field<SubMesh>& field = fields.get(label);
} // testGet
@@ -145,7 +145,7 @@
FieldsSubMesh fields(*_submesh);
const char* label = "field";
- fields.add(label);
+ fields.add(label, "displacement");
const FieldsSubMesh* fieldsPtr = &fields;
CPPUNIT_ASSERT(0 != fieldsPtr);
@@ -163,10 +163,10 @@
FieldsSubMesh fields(*_submesh);
const char* labelA = "field A";
- fields.add(labelA, Field<SubMesh>::VERTICES_FIELD, fiberDim);
+ fields.add(labelA, "velocity", Field<SubMesh>::VERTICES_FIELD, fiberDim);
const char* labelB = "field B";
- fields.add(labelB);
+ fields.add(labelB, "displacement");
Field<SubMesh>& fieldA = fields.get(labelA);
fieldA.allocate();
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestJacobian.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestJacobian.cc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestJacobian.cc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -118,7 +118,7 @@
iohandler.filename("data/tri3.mesh");
iohandler.read(mesh);
- fields->add("disp t+dt");
+ fields->add("disp t+dt", "displacement");
fields->solutionName("disp t+dt");
Field<Mesh>& solution = fields->solution();
solution.newSection(FieldBase::VERTICES_FIELD, mesh->dimension());
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSolutionFields.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSolutionFields.cc 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSolutionFields.cc 2009-03-27 00:28:18 UTC (rev 14475)
@@ -41,7 +41,7 @@
SolutionFields manager(mesh);
const std::string& name = "my solution";
- manager.add(name.c_str());
+ manager.add(name.c_str(), "displacement");
manager.solutionName(name.c_str());
CPPUNIT_ASSERT_EQUAL(name, manager._solutionName);
} // testSolutionName
@@ -62,7 +62,7 @@
const int fiberDimC = 4;
for (int i=0; i < size; ++i)
- manager.add(labels[i]);
+ manager.add(labels[i], "displacement");
const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
const ALE::Obj<Mesh::SieveMesh::label_sequence>& vertices =
@@ -99,7 +99,7 @@
// Add fields
for (int i=0; i < totalSize; ++i)
- manager.add(labels[i]);
+ manager.add(labels[i], "displacement");
manager.createHistory(labels, historySize);
for (int i=0; i < historySize; ++i)
@@ -121,7 +121,7 @@
const int fiberDimB = 3;
for (int i=0; i < numFields; ++i)
- manager.add(fieldNames[i]);
+ manager.add(fieldNames[i], "displacement");
manager.createHistory(fieldNames, numFields);
const ALE::Obj<Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestAbsorbingDampers.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestAbsorbingDampers.py 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestAbsorbingDampers.py 2009-03-27 00:28:18 UTC (rev 14475)
@@ -222,10 +222,10 @@
# Setup fields
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(mesh)
- fields.add("residual")
- fields.add("disp(t+dt)")
- fields.add("disp(t)")
- fields.add("disp(t-dt)")
+ fields.add("residual", "residual")
+ fields.add("disp(t+dt)", "displacement")
+ fields.add("disp(t)", "displacement")
+ fields.add("disp(t-dt)", "displacement")
fields.solutionName("disp(t+dt)")
fields.createHistory(["disp(t+dt)", "disp(t)", "disp(t-dt)"])
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestNeumann.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestNeumann.py 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestNeumann.py 2009-03-27 00:28:18 UTC (rev 14475)
@@ -223,9 +223,9 @@
# Setup fields
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(mesh)
- fields.add("residual")
- fields.add("disp(t), bc(t+dt)")
- fields.add("dispIncr(t->t+dt)")
+ fields.add("residual", "residual")
+ fields.add("disp(t), bc(t+dt)", "displacement")
+ fields.add("dispIncr(t->t+dt)", "displacement")
fields.solutionName("dispIncr(t->t+dt)")
residual = fields.get("residual")
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/feassemble/TestElasticityExplicit.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/feassemble/TestElasticityExplicit.py 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/feassemble/TestElasticityExplicit.py 2009-03-27 00:28:18 UTC (rev 14475)
@@ -273,10 +273,10 @@
# Setup fields
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(mesh)
- fields.add("residual")
- fields.add("disp(t+dt)")
- fields.add("disp(t)")
- fields.add("disp(t-dt)")
+ fields.add("residual", "residual")
+ fields.add("disp(t+dt)", "displacement")
+ fields.add("disp(t)", "displacement")
+ fields.add("disp(t-dt)", "displacement")
fields.solutionName("disp(t+dt)")
residual = fields.get("residual")
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/feassemble/TestElasticityImplicit.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/feassemble/TestElasticityImplicit.py 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/feassemble/TestElasticityImplicit.py 2009-03-27 00:28:18 UTC (rev 14475)
@@ -269,9 +269,9 @@
# Setup fields
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(mesh)
- fields.add("residual")
- fields.add("disp(t), bc(t+dt)")
- fields.add("dispIncr(t->t+dt)")
+ fields.add("residual", "residual")
+ fields.add("disp(t), bc(t+dt)", "displacement")
+ fields.add("dispIncr(t->t+dt)", "displacement increment")
fields.solutionName("dispIncr(t->t+dt)")
residual = fields.get("residual")
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestJacobian.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestJacobian.py 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestJacobian.py 2009-03-27 00:28:18 UTC (rev 14475)
@@ -47,7 +47,7 @@
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(self.mesh)
- fields.add("disp t+dt")
+ fields.add("disp t+dt", "displacement")
fields.solutionName("disp t+dt")
solution = fields.solution()
solution.newSection(solution.VERTICES_FIELD, self.mesh.dimension())
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMeshField.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMeshField.py 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMeshField.py 2009-03-27 00:28:18 UTC (rev 14475)
@@ -65,14 +65,14 @@
return
- def test_name(self):
+ def test_label(self):
"""
- Test name().
+ Test label().
"""
- name = "field A"
+ label = "field A"
- self.field.name(name)
- self.assertEqual(name, self.field.name())
+ self.field.label(label)
+ self.assertEqual(label, self.field.label())
return
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMeshFields.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMeshFields.py 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMeshFields.py 2009-03-27 00:28:18 UTC (rev 14475)
@@ -66,7 +66,7 @@
def test_add(self):
- self.fields.add("field")
+ self.fields.add("field", "displacement")
field = self.fields.get("field")
field.newSection()
@@ -76,7 +76,7 @@
def test_addFiberDim(self):
from pylith.topology.topology import FieldBase
- self.fields.add("field", )
+ self.fields.add("field", "displacement")
field = self.fields.get("field")
field.newSection(FieldBase.VERTICES_FIELD, 4)
@@ -85,8 +85,8 @@
def test_del(self):
- self.fields.add("field A")
- self.fields.add("field B")
+ self.fields.add("field A", "A")
+ self.fields.add("field B", "B")
self.fields.delField("field A")
field = self.fields.get("field B")
return
@@ -94,11 +94,11 @@
def test_copyLayout(self):
from pylith.topology.topology import FieldBase
- self.fields.add("field A")
+ self.fields.add("field A", "A")
field = self.fields.get("field A")
field.newSection(FieldBase.VERTICES_FIELD, 4)
- self.fields.add("field B")
+ self.fields.add("field B", "B")
self.fields.copyLayout("field A")
# No test of result
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestSolutionFields.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestSolutionFields.py 2009-03-26 22:16:27 UTC (rev 14474)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestSolutionFields.py 2009-03-27 00:28:18 UTC (rev 14475)
@@ -60,9 +60,9 @@
Test mesh().
"""
fields = self.fields
- fields.add("field A");
- fields.add("field B");
- fields.add("field C");
+ fields.add("field A", "A");
+ fields.add("field B", "B");
+ fields.add("field C", "C");
fields.solutionName("field B")
return
@@ -73,9 +73,9 @@
Test solution().
"""
fields = self.fields
- fields.add("field A");
- fields.add("field B");
- fields.add("field C");
+ fields.add("field A", "A");
+ fields.add("field B", "B");
+ fields.add("field C", "C");
fields.solutionName("field B")
solution = self.fields.solution()
@@ -87,9 +87,9 @@
Test createHistory().
"""
fields = self.fields
- fields.add("field A");
- fields.add("field B");
- fields.add("field C");
+ fields.add("field A", "A");
+ fields.add("field B", "B");
+ fields.add("field C", "C");
fields.createHistory(["field B", "field A", "field C"])
return
@@ -100,9 +100,9 @@
Test shiftHistory().
"""
fields = self.fields
- fields.add("field A");
- fields.add("field B");
- fields.add("field C");
+ fields.add("field A", "A");
+ fields.add("field B", "B");
+ fields.add("field C", "C");
fields.createHistory(["field B", "field A", "field C"])
fields.shiftHistory()
More information about the CIG-COMMITS
mailing list