[cig-commits] r8991 - short/3D/PyLith/trunk/libsrc/meshio
brad at geodynamics.org
brad at geodynamics.org
Mon Jan 7 17:36:49 PST 2008
Author: brad
Date: 2008-01-07 17:36:49 -0800 (Mon, 07 Jan 2008)
New Revision: 8991
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:
More work on output.
Modified: short/3D/PyLith/trunk/libsrc/meshio/DataWriter.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/DataWriter.hh 2008-01-08 00:40:12 UTC (rev 8990)
+++ short/3D/PyLith/trunk/libsrc/meshio/DataWriter.hh 2008-01-08 01:36:49 UTC (rev 8991)
@@ -19,7 +19,8 @@
#if !defined(pylith_meshio_datawriter_hh)
#define pylith_meshio_datawriter_hh
-#include "pylith/utils/sievetypes.hh" // USES ALE::Obj, ALE::Mesh, real_section_type
+#include "pylith/utils/petscfwd.hh" // USES PetscVec
+#include "pylith/utils/sievetypes.hh" // USES ALE::Mesh, real_section_type
namespace pylith {
namespace meshio {
@@ -83,28 +84,24 @@
/** Write field over vertices to file.
*
* @param t Time associated with field.
- * @param field PETSc field over vertices.
- * @param mesh Finite-element mesh
+ * @param vec PETSc Vec field over vertices.
* @param name Name of field.
*/
virtual
void writeVertexField(const double t,
- const ALE::Obj<real_section_type>& field,
- const char* name,
- const ALE::Obj<ALE::Mesh>& mesh) = 0;
+ const PetscVec* vec,
+ const char* name) = 0;
/** Write field over cells to file.
*
* @param t Time associated with field.
- * @param field PETSc field over cells.
+ * @param vec PETSc Vec field over cells.
* @param name Name of field.
- * @param mesh PETSc mesh object.
*/
virtual
void writeCellField(const double t,
- const ALE::Obj<real_section_type>& field,
- const char* name,
- const ALE::Obj<ALE::Mesh>& mesh) = 0;
+ const PetscVec* vec,
+ const char* name) = 0;
// PROTECTED MEMBERS ////////////////////////////////////////////////////
public :
Modified: short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc 2008-01-08 00:40:12 UTC (rev 8990)
+++ short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc 2008-01-08 01:36:49 UTC (rev 8991)
@@ -14,7 +14,9 @@
#include "DataWriterVTK.hh" // implementation of class methods
-#include <petscmesh_viewers.hh> // USES VTKViewer
+#include "petscmesh_viewers.hh" // USES VTKViewer
+#include "petscvec.h" // USES Petsc Vec
+
#include <assert.h> // USES assert()
#include <sstream> // USES std::ostringstream
#include <stdexcept> // USES std::runtime_error
@@ -96,11 +98,9 @@
// ----------------------------------------------------------------------
// Write field over vertices to file.
void
-pylith::meshio::DataWriterVTK::writeVertexField(
- const double t,
- const ALE::Obj<real_section_type>& field,
- const char* name,
- const ALE::Obj<ALE::Mesh>& mesh)
+pylith::meshio::DataWriterVTK::writeVertexField(const double t,
+ const PetscVec* vec,
+ const char* name)
{ // writeVertexField
try {
std::ostringstream buffer;
@@ -109,12 +109,7 @@
sprintf(timestamp, _timeFormat.c_str(), t);
buffer << name << "_t" << timestamp;
- // Now we are enforcing a 3D solution
- // Perhaps we need to push this argument higher
- const int spaceDim = 3;
- PetscErrorCode err = SectionView_Sieve_Ascii(mesh, field,
- buffer.str().c_str(),
- _viewer, spaceDim);
+ PetscErrorCode err = VecView(*vec, _viewer);
if (err)
throw std::runtime_error("Could not write vertex data.");
} catch (const std::exception& err) {
@@ -135,9 +130,8 @@
void
pylith::meshio::DataWriterVTK::writeCellField(
const double t,
- const ALE::Obj<real_section_type>& field,
- const char* name,
- const ALE::Obj<ALE::Mesh>& mesh)
+ const PetscVec* vec,
+ const char* name)
{ // writeCellField
try {
PetscErrorCode err = 0;
@@ -150,11 +144,7 @@
err = PetscViewerPushFormat(_viewer, PETSC_VIEWER_ASCII_VTK_CELL);
- // Get fiber dimension of first cell
- const ALE::Obj<Mesh::label_sequence>& cells = mesh->heightStratum(0);
- const int fiberDim = field->getFiberDimension(*cells->begin());
- err = SectionView_Sieve_Ascii(mesh, field, buffer.str().c_str(),
- _viewer, fiberDim);
+ PetscErrorCode err = VecView(*vec, _viewer);
if (err)
throw std::runtime_error("Could not write cell data.");
} catch (const std::exception& err) {
Modified: short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh 2008-01-08 00:40:12 UTC (rev 8990)
+++ short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh 2008-01-08 01:36:49 UTC (rev 8991)
@@ -67,26 +67,22 @@
/** Write field over vertices to file.
*
* @param t Time associated with field.
- * @param field PETSc field over vertices.
- * @param mesh Finite-element mesh
+ * @param vec PETSc Vec field over vertices.
* @param name Name of field.
*/
void writeVertexField(const double t,
- const ALE::Obj<real_section_type>& field,
- const char* name,
- const ALE::Obj<ALE::Mesh>& mesh);
+ const PetscVec* vec,
+ const char* name);
/** Write field over cells to file.
*
* @param t Time associated with field.
- * @param field PETSc field over cells.
+ * @param vec PETSc Vec field over cells.
* @param name Name of field.
- * @param mesh PETSc mesh object.
*/
void writeCellField(const double t,
- const ALE::Obj<real_section_type>& field,
- const char* name,
- const ALE::Obj<ALE::Mesh>& mesh);
+ const PetscVec* vec,
+ const char* name);
// PRIVATE MEMBERS //////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc 2008-01-08 00:40:12 UTC (rev 8990)
+++ short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc 2008-01-08 01:36:49 UTC (rev 8991)
@@ -113,51 +113,44 @@
const spatialdata::geocoords::CoordSys* csMesh)
{ // writeFields
assert(0 != _writer);
+ assert(0 != fields);
+
_writer->openTimeStep(t, mesh, csMesh);
const int nvfields = _vertexFields.size();
for (int i=0; i < nvfields; ++i) {
- // Try to get field from mesh
- if (1) {
- // ADD STUFF HERE
- } else if (0 != fields) {
- // If field is not in mesh, try to get it from fields manager
- // ADD STUFF HERE
- } else {
- std::ostringstream msg;
- msg << "Could not find field '" << _vertexFields[i]
- << "' in fields available for output.";
- throw std::runtime_error(msg.str());
- } // if/else
+ const ALE::Obj<real_section_type>& field =
+ fields->getReal(_vertexFields[i]);
- // Extract values from section
+ // Create PETSc Vec for field values (if nec)
// ADD STUFF HERE
+
+ // Copy values from section to PETSc Vec
+ // ADD STUFF HERE
if (0 != _vertexFilter) {
// Apply vertex filter
// ADD STUFF HERE
} // if
- //_writer->writeVertexField(t, data, _vertexFields[i], mesh);
+ //_writer->writeVertexField(t, fieldVec, _vertexFields[i], mesh);
} // for
const int ncfields = _cellFields.size();
for (int i=0; i < ncfields; ++i) {
- // Try to get field from mesh
- if (1) {
- // ADD STUFF HERE
- } else if (0 != fields) {
- // If field is not in mesh, try to get it from fields manager
- // ADD STUFF HERE
- } // else
+ const ALE::Obj<real_section_type>& field =
+ fields->getReal(_cellFields[i]);
- // Extract values from section
+ // Create PETSc Vec for field values (if nec)
// ADD STUFF HERE
+
+ // Copy values from section to PETSc Vec
+ // ADD STUFF HERE
if (0 != _cellFilter) {
// Apply vertex filter
// ADD STUFF HERE
} // if
- //_writer->writeCellField(t, data, _cellFields[i], mesh);
+ //_writer->writeCellField(t, fieldVec, _cellFields[i], mesh);
} // for
_writer->closeTimeStep();
More information about the cig-commits
mailing list