[cig-commits] r11298 - short/3D/PyLith/trunk/libsrc/meshio
brad at geodynamics.org
brad at geodynamics.org
Sat Mar 1 21:11:28 PST 2008
Author: brad
Date: 2008-03-01 21:11:28 -0800 (Sat, 01 Mar 2008)
New Revision: 11298
Modified:
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
Log:
Added label/labelId as args to write cell field for writiers. Needed to get correct cells.
Modified: short/3D/PyLith/trunk/libsrc/meshio/DataWriter.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/DataWriter.hh 2008-03-02 00:07:51 UTC (rev 11297)
+++ short/3D/PyLith/trunk/libsrc/meshio/DataWriter.hh 2008-03-02 05:11:28 UTC (rev 11298)
@@ -116,13 +116,18 @@
* @param field PETSc field over cells.
* @param fieldType Type of field.
* @param mesh PETSc 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.
*/
virtual
void writeCellField(const double t,
const char* name,
const ALE::Obj<real_section_type>& field,
const VectorFieldEnum fieldType,
- const ALE::Obj<ALE::Mesh>& mesh) = 0;
+ const ALE::Obj<ALE::Mesh>& mesh,
+ const char* label =0,
+ const int labelId =0) = 0;
// PROTECTED METHODS ////////////////////////////////////////////////////
protected :
Modified: short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc 2008-03-02 00:07:51 UTC (rev 11297)
+++ short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc 2008-03-02 05:11:28 UTC (rev 11298)
@@ -167,8 +167,10 @@
_wroteVertexHeader = true;
} // if
- VTKViewer::writeField(field, name, fiberDim, numbering, _viewer,
- enforceDim);
+ err = VTKViewer::writeField(field, name, fiberDim, numbering, _viewer,
+ enforceDim);
+ if (err)
+ throw std::runtime_error("Coult not write vertex field.");
} catch (const std::exception& err) {
std::ostringstream msg;
@@ -191,7 +193,9 @@
const char* name,
const ALE::Obj<real_section_type>& field,
const VectorFieldEnum fieldType,
- const ALE::Obj<ALE::Mesh>& mesh)
+ const ALE::Obj<ALE::Mesh>& mesh,
+ const char* label,
+ const int labelId)
{ // writeCellField
assert(0 != name);
assert(!mesh.isNull());
@@ -218,8 +222,16 @@
_wroteCellHeader = true;
} // if
- VTKViewer::writeField(field, name, fiberDim, numbering, _viewer,
- enforceDim);
+ if (0 == label)
+ err = VTKViewer::writeField(field, name, fiberDim, numbering, _viewer,
+ enforceDim);
+ else {
+ const std::string labelName =
+ (mesh->hasLabel("censored depth")) ? "censored depth" : "depth";
+ err = VTKViewer::writeField(mesh, label, labelId, labelName, 0, _viewer);
+ } // if/else
+ if (err)
+ throw std::runtime_error("Coult not write cell field.");
} catch (const std::exception& err) {
std::ostringstream msg;
Modified: short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh 2008-03-02 00:07:51 UTC (rev 11297)
+++ short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh 2008-03-02 05:11:28 UTC (rev 11298)
@@ -99,12 +99,17 @@
* @param field PETSc field over cells.
* @param fieldType Type of field.
* @param mesh PETSc 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.
*/
void writeCellField(const double t,
const char* name,
const ALE::Obj<real_section_type>& field,
const VectorFieldEnum fieldType,
- const ALE::Obj<ALE::Mesh>& mesh);
+ const ALE::Obj<ALE::Mesh>& mesh,
+ const char* label =0,
+ const int labelId =0);
// PRIVATE METHODS //////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc 2008-03-02 00:07:51 UTC (rev 11297)
+++ short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc 2008-03-02 05:11:28 UTC (rev 11298)
@@ -153,7 +153,7 @@
const ALE::Obj<real_section_type>& fieldFiltered =
(0 == _cellFilter) ? field : _cellFilter->filter(field, mesh, label, labelId);
- _writer->writeCellField(t, name, fieldFiltered, fieldType, mesh);
+ _writer->writeCellField(t, name, fieldFiltered, fieldType, mesh, label, labelId);
} // appendCellField
More information about the cig-commits
mailing list