[cig-commits] r9203 - in short/3D/PyLith/trunk: libsrc/meshio modulesrc/meshio pylith/faults pylith/meshio pylith/problems unittests/pytests/topology
brad at geodynamics.org
brad at geodynamics.org
Thu Jan 31 21:33:54 PST 2008
Author: brad
Date: 2008-01-31 21:33:54 -0800 (Thu, 31 Jan 2008)
New Revision: 9203
Modified:
short/3D/PyLith/trunk/libsrc/meshio/DataWriter.cc
short/3D/PyLith/trunk/libsrc/meshio/DataWriter.hh
short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc
short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh
short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc
short/3D/PyLith/trunk/libsrc/meshio/OutputManager.hh
short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src
short/3D/PyLith/trunk/pylith/faults/Fault.py
short/3D/PyLith/trunk/pylith/meshio/OutputManager.py
short/3D/PyLith/trunk/pylith/problems/Formulation.py
short/3D/PyLith/trunk/unittests/pytests/topology/TestMeshGenSimple.py
Log:
Added label and labelId to args for output to allow outputting subset of mesh.
Modified: short/3D/PyLith/trunk/libsrc/meshio/DataWriter.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/DataWriter.cc 2008-02-01 00:28:03 UTC (rev 9202)
+++ short/3D/PyLith/trunk/libsrc/meshio/DataWriter.cc 2008-02-01 05:33:54 UTC (rev 9203)
@@ -33,7 +33,9 @@
pylith::meshio::DataWriter::open(
const ALE::Obj<ALE::Mesh>& mesh,
const spatialdata::geocoords::CoordSys* csMesh,
- const int numTimeSteps)
+ const int numTimeSteps,
+ const char* label,
+ const int labelId)
{ // open
_numTimeSteps = numTimeSteps;
} // open
@@ -51,7 +53,9 @@
pylith::meshio::DataWriter::openTimeStep(
const double t,
const ALE::Obj<ALE::Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh)
+ const spatialdata::geocoords::CoordSys* csMesh,
+ const char* label,
+ const int labelId)
{ // openTimeStep
} // openTimeStep
Modified: short/3D/PyLith/trunk/libsrc/meshio/DataWriter.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/DataWriter.hh 2008-02-01 00:28:03 UTC (rev 9202)
+++ short/3D/PyLith/trunk/libsrc/meshio/DataWriter.hh 2008-02-01 05:33:54 UTC (rev 9203)
@@ -69,11 +69,16 @@
* @param mesh PETSc mesh object
* @param csMesh Coordinate system of mesh geometry
* @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<ALE::Mesh>& mesh,
const spatialdata::geocoords::CoordSys* csMesh,
- const int numTimeSteps);
+ const int numTimeSteps,
+ const char* label =0,
+ const int labelId =0);
/// Close output files.
virtual
@@ -84,11 +89,16 @@
* @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<ALE::Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh);
+ const spatialdata::geocoords::CoordSys* csMesh,
+ const char* label =0,
+ const int labelId =0);
/// Cleanup after writing data for a time step.
virtual
Modified: short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc 2008-02-01 00:28:03 UTC (rev 9202)
+++ short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc 2008-02-01 05:33:54 UTC (rev 9203)
@@ -54,7 +54,9 @@
pylith::meshio::DataWriterVTK::openTimeStep(
const double t,
const ALE::Obj<ALE::Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh)
+ const spatialdata::geocoords::CoordSys* csMesh,
+ const char* label,
+ const int labelId)
{ // openTimeStep
assert(!mesh.isNull());
assert(0 != csMesh);
@@ -87,7 +89,10 @@
err = VTKViewer::writeHeader(_viewer);
err = VTKViewer::writeVertices(mesh, _viewer);
- err = VTKViewer::writeElements(mesh, _viewer);
+ if (0 == label)
+ err = VTKViewer::writeElements(mesh, _viewer);
+ else
+ err = VTKViewer::writeElements(mesh, label, labelId, _viewer);
if (err)
throw std::runtime_error("Could not write topology.");
} catch (const std::exception& err) {
Modified: short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh 2008-02-01 00:28:03 UTC (rev 9202)
+++ short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh 2008-02-01 05:33:54 UTC (rev 9203)
@@ -62,10 +62,15 @@
* @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.
*/
void openTimeStep(const double t,
const ALE::Obj<ALE::Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh);
+ const spatialdata::geocoords::CoordSys* csMesh,
+ const char* label =0,
+ const int labelId =0);
/// Cleanup after writing data for a time step.
void closeTimeStep(void);
Modified: short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc 2008-02-01 00:28:03 UTC (rev 9202)
+++ short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc 2008-02-01 05:33:54 UTC (rev 9203)
@@ -78,11 +78,13 @@
pylith::meshio::OutputManager::open(
const ALE::Obj<ALE::Mesh>& mesh,
const spatialdata::geocoords::CoordSys* csMesh,
- const int numTimeSteps)
+ const int numTimeSteps,
+ const char* label,
+ const int labelId)
{ // open
assert(0 != _writer);
- _writer->open(mesh, csMesh, numTimeSteps);
+ _writer->open(mesh, csMesh, numTimeSteps, label, labelId);
} // open
// ----------------------------------------------------------------------
@@ -97,12 +99,15 @@
// ----------------------------------------------------------------------
// Setup file for writing fields at time step.
void
-pylith::meshio::OutputManager::openTimeStep(const double t,
- const ALE::Obj<ALE::Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh)
+pylith::meshio::OutputManager::openTimeStep(
+ const double t,
+ const ALE::Obj<ALE::Mesh>& mesh,
+ const spatialdata::geocoords::CoordSys* csMesh,
+ const char* label,
+ const int labelId)
{ // openTimeStep
assert(0 != _writer);
- _writer->openTimeStep(t, mesh, csMesh);
+ _writer->openTimeStep(t, mesh, csMesh, label, labelId);
} // openTimeStep
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/meshio/OutputManager.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/OutputManager.hh 2008-02-01 00:28:03 UTC (rev 9202)
+++ short/3D/PyLith/trunk/libsrc/meshio/OutputManager.hh 2008-02-01 05:33:54 UTC (rev 9203)
@@ -80,10 +80,15 @@
* @param mesh PETSc mesh object.
* @param csMesh Coordinate system of mesh geometry.
* @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<ALE::Mesh>& mesh,
const spatialdata::geocoords::CoordSys* csMesh,
- const int numTimeSteps);
+ const int numTimeSteps,
+ const char* label =0,
+ const int labelId =0);
/// Close output files.
void close(void);
@@ -93,10 +98,15 @@
* @param t Time of time step.
* @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.
*/
void openTimeStep(const double t,
const ALE::Obj<ALE::Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh);
+ const spatialdata::geocoords::CoordSys* csMesh,
+ const char* label =0,
+ const int labelId =0);
/// End writing fields at time step.
void closeTimeStep(void);
Modified: short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src 2008-02-01 00:28:03 UTC (rev 9202)
+++ short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src 2008-02-01 05:33:54 UTC (rev 9203)
@@ -598,19 +598,19 @@
return
- def open(self, mesh, cs, numTimeSteps):
+ def open(self, mesh, cs, numTimeSteps, label, labelId):
"""
Open output file.
"""
# create shim for method 'open'
- #embed{ void OutputManager_open(void* objVptr, void* meshVptr, void* csVptr, int numTimeSteps)
+ #embed{ void OutputManager_open(void* objVptr, void* meshVptr, void* csVptr, int numTimeSteps, char* label, int labelId)
try {
assert(0 != objVptr);
assert(0 != csVptr);
ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
spatialdata::geocoords::CoordSys* cs =
(spatialdata::geocoords::CoordSys*) csVptr;
- ((pylith::meshio::OutputManager*) objVptr)->open(*mesh, cs, numTimeSteps);
+ ((pylith::meshio::OutputManager*) objVptr)->open(*mesh, cs, numTimeSteps, label, labelId);
} catch (const std::exception& err) {
PyErr_SetString(PyExc_RuntimeError,
const_cast<char*>(err.what()));
@@ -628,8 +628,12 @@
if not cs.name == "spatialdata_geocoords_CoordSys":
raise TypeError, \
"Argument 'cs' must be extension module type 'CoordSys'."
- OutputManager_open(self.thisptr, ptrFromHandle(mesh),
- ptrFromHandle(cs), numTimeSteps)
+ if None == label or None == labelId:
+ OutputManager_open(self.thisptr, ptrFromHandle(mesh),
+ ptrFromHandle(cs), numTimeSteps, NULL, 0)
+ else:
+ OutputManager_open(self.thisptr, ptrFromHandle(mesh),
+ ptrFromHandle(cs), numTimeSteps, label, labelId)
return
@@ -657,12 +661,12 @@
return
- def openTimeStep(self, t, mesh, cs):
+ def openTimeStep(self, t, mesh, cs, label, labelId):
"""
Prepare for writing solution to file.
"""
# create shim for method 'openTimeStep'
- #embed{ void OutputManager_openTimeStep(void* objVptr, double t, void* meshVptr, void* csVptr)
+ #embed{ void OutputManager_openTimeStep(void* objVptr, double t, void* meshVptr, void* csVptr, char* label, int labelId)
try {
assert(0 != objVptr);
assert(0 != meshVptr);
@@ -670,7 +674,8 @@
ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
spatialdata::geocoords::CoordSys* cs =
(spatialdata::geocoords::CoordSys*) csVptr;
- ((pylith::meshio::OutputManager*) objVptr)->openTimeStep(t, *mesh, cs);
+ ((pylith::meshio::OutputManager*) objVptr)->openTimeStep(t, *mesh, cs,
+ label, labelId);
} catch (const std::exception& err) {
PyErr_SetString(PyExc_RuntimeError,
const_cast<char*>(err.what()));
@@ -688,8 +693,14 @@
if not cs.name == "spatialdata_geocoords_CoordSys":
raise TypeError, \
"Argument must be extension module type 'CoordSys'."
- OutputManager_openTimeStep(self.thisptr, t,
- ptrFromHandle(mesh), ptrFromHandle(cs))
+ if None == label or None == labelId:
+ OutputManager_openTimeStep(self.thisptr, t,
+ ptrFromHandle(mesh), ptrFromHandle(cs),
+ NULL, 0)
+ else:
+ OutputManager_openTimeStep(self.thisptr, t,
+ ptrFromHandle(mesh), ptrFromHandle(cs),
+ label, labelId)
return
Modified: short/3D/PyLith/trunk/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/Fault.py 2008-02-01 00:28:03 UTC (rev 9202)
+++ short/3D/PyLith/trunk/pylith/faults/Fault.py 2008-02-01 05:33:54 UTC (rev 9203)
@@ -185,7 +185,7 @@
"""
Get mesh associated with data fields.
"""
- return self.faultMesh
+ return (self.faultMesh, None, None)
# PRIVATE METHODS ////////////////////////////////////////////////////
Modified: short/3D/PyLith/trunk/pylith/meshio/OutputManager.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputManager.py 2008-02-01 00:28:03 UTC (rev 9202)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputManager.py 2008-02-01 05:33:54 UTC (rev 9203)
@@ -160,13 +160,13 @@
elif self.outputFreq == "time_step":
nsteps = 1 + int(totalTime / self.dt)
- mesh = self.dataProvider.getDataMesh()
+ (mesh, label, labelId) = self.dataProvider.getDataMesh()
assert(None != self.cppHandle)
assert(None != mesh.cppHandle)
assert(None != mesh.coordsys.cppHandle)
self.cppHandle.open(mesh.cppHandle, mesh.coordsys.cppHandle,
- nsteps)
+ nsteps, label, labelId)
self._logger.eventEnd(logEvent)
return
@@ -197,9 +197,10 @@
from pyre.units.time import s
t = 0.0*s
self.open(totalTime=0.0*s, numTimeSteps=0)
- mesh = self.dataProvider.getDataMesh()
+ (mesh, label, labelId) = self.dataProvider.getDataMesh()
self.cppHandle.openTimeStep(t.value,
- mesh.cppHandle, mesh.coordsys.cppHandle)
+ mesh.cppHandle, mesh.coordsys.cppHandle,
+ label, labelId)
for name in self.vertexInfoFields:
(field, fieldType) = self.dataProvider.getVertexField(name)
@@ -227,9 +228,10 @@
if self._checkWrite(t):
- mesh = self.dataProvider.getDataMesh()
+ (mesh, label, labelId) = self.dataProvider.getDataMesh()
self.cppHandle.openTimeStep(t.value,
- mesh.cppHandle, mesh.coordsys.cppHandle)
+ mesh.cppHandle, mesh.coordsys.cppHandle,
+ label, labelId)
for name in self.vertexDataFields:
(field, fieldType) = self.dataProvider.getVertexField(name)
Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py 2008-02-01 00:28:03 UTC (rev 9202)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py 2008-02-01 05:33:54 UTC (rev 9203)
@@ -303,7 +303,7 @@
"""
Get mesh associated with data fields.
"""
- return self.mesh
+ return (self.mesh, None, None)
def getVertexField(self, name):
Modified: short/3D/PyLith/trunk/unittests/pytests/topology/TestMeshGenSimple.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/topology/TestMeshGenSimple.py 2008-02-01 00:28:03 UTC (rev 9202)
+++ short/3D/PyLith/trunk/unittests/pytests/topology/TestMeshGenSimple.py 2008-02-01 05:33:54 UTC (rev 9203)
@@ -71,7 +71,7 @@
"""
Get mesh.
"""
- return self.mesh
+ return (self.mesh, None, None)
# End of file
More information about the cig-commits
mailing list