[cig-commits] r19479 - short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio
brad at geodynamics.org
brad at geodynamics.org
Wed Jan 25 15:13:16 PST 2012
Author: brad
Date: 2012-01-25 15:13:16 -0800 (Wed, 25 Jan 2012)
New Revision: 19479
Modified:
short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5.cc
short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterVTK.cc
Log:
Cleanup get getNumbering(..., depth). Insure depth is same on all processors so numberings are consistent.
Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5.cc 2012-01-25 23:07:39 UTC (rev 19478)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5.cc 2012-01-25 23:13:16 UTC (rev 19479)
@@ -146,7 +146,9 @@
CHECK_PETSC_ERROR(err);
// Account for censored cells
- const int cellDepth = (sieveMesh->depth() == -1) ? -1 : 1;
+ int cellDepth = sieveMesh->depth();
+ err = MPI_Allreduce(&cellDepth, &cellDepth, 1, MPI_INT, MPI_MAX,
+ sieveMesh->comm());CHECK_PETSC_ERROR(err);
const int depth = (0 == label) ? cellDepth : labelId;
const std::string labelName = (0 == label) ?
((sieveMesh->hasLabel("censored depth")) ?
@@ -221,12 +223,12 @@
} catch (const std::exception& err) {
std::ostringstream msg;
msg << "Error while opening HDF5 file "
- << _filename << ".\n" << err.what();
+ << _hdf5Filename() << ".\n" << err.what();
throw std::runtime_error(msg.str());
} catch (...) {
std::ostringstream msg;
msg << "Unknown error while opening HDF5 file "
- << _filename << ".\n";
+ << _hdf5Filename() << ".\n";
throw std::runtime_error(msg.str());
} // try/catch
} // open
@@ -346,12 +348,12 @@
} catch (const std::exception& err) {
std::ostringstream msg;
msg << "Error while writing field '" << field.label() << "' at time "
- << t << " to HDF5 file '" << _filename << "'.\n" << err.what();
+ << t << " to HDF5 file '" << _hdf5Filename() << "'.\n" << err.what();
throw std::runtime_error(msg.str());
} catch (...) {
std::ostringstream msg;
msg << "Error while writing field '" << field.label() << "' at time "
- << t << " to HDF5 file '" << _filename << "'.\n";
+ << t << " to HDF5 file '" << _hdf5Filename() << "'.\n";
throw std::runtime_error(msg.str());
} // try/catch
} // writeVertexField
@@ -372,11 +374,14 @@
try {
const char* context = DataWriter<mesh_type, field_type>::_context.c_str();
+ PetscErrorCode err = 0;
const ALE::Obj<typename mesh_type::SieveMesh>& sieveMesh =
field.mesh().sieveMesh();
assert(!sieveMesh.isNull());
- const int cellDepth = (sieveMesh->depth() == -1) ? -1 : 1;
+ int cellDepth = sieveMesh->depth();
+ err = MPI_Allreduce(&cellDepth, &cellDepth, 1, MPI_INT, MPI_MAX,
+ sieveMesh->comm());CHECK_PETSC_ERROR(err);
const int depth = (0 == label) ? cellDepth : labelId;
const std::string labelName = (0 == label) ?
((sieveMesh->hasLabel("censored depth")) ?
@@ -400,7 +405,6 @@
field.mesh().comm());
assert(fiberDim > 0);
- PetscErrorCode err = 0;
if (_timesteps.find(field.label()) == _timesteps.end())
_timesteps[field.label()] = 0;
@@ -434,12 +438,12 @@
} catch (const std::exception& err) {
std::ostringstream msg;
msg << "Error while writing field '" << field.label() << "' at time "
- << t << " to HDF5 file '" << _filename << "'.\n" << err.what();
+ << t << " to HDF5 file '" << _hdf5Filename() << "'.\n" << err.what();
throw std::runtime_error(msg.str());
} catch (...) {
std::ostringstream msg;
msg << "Error while writing field '" << field.label() << "' at time "
- << t << " to HDF5 file '" << _filename << "'.\n";
+ << t << " to HDF5 file '" << _hdf5Filename() << "'.\n";
throw std::runtime_error(msg.str());
} // try/catch
} // writeCellField
Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc 2012-01-25 23:07:39 UTC (rev 19478)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc 2012-01-25 23:13:16 UTC (rev 19479)
@@ -159,7 +159,9 @@
// Write cells
// Account for censored cells
- const int cellDepth = (sieveMesh->depth() == -1) ? -1 : 1;
+ int cellDepth = sieveMesh->depth();
+ err = MPI_Allreduce(&cellDepth, &cellDepth, 1, MPI_INT, MPI_MAX,
+ sieveMesh->comm());CHECK_PETSC_ERROR(err);
const int depth = (0 == label) ? cellDepth : labelId;
const std::string labelName = (0 == label) ?
((sieveMesh->hasLabel("censored depth")) ?
@@ -430,14 +432,17 @@
try {
const char* context = DataWriter<mesh_type, field_type>::_context.c_str();
+ PetscErrorCode err = 0;
int rank = 0;
- MPI_Comm_rank(field.mesh().comm(), &rank);
+ err = MPI_Comm_rank(field.mesh().comm(), &rank);CHECK_PETSC_ERROR(err);
const ALE::Obj<typename mesh_type::SieveMesh>& sieveMesh =
field.mesh().sieveMesh();
assert(!sieveMesh.isNull());
- const int cellDepth = (sieveMesh->depth() == -1) ? -1 : 1;
+ int cellDepth = sieveMesh->depth();
+ err = MPI_Allreduce(&cellDepth, &cellDepth, 1, MPI_INT, MPI_MAX,
+ sieveMesh->comm());CHECK_PETSC_ERROR(err);
const int depth = (0 == label) ? cellDepth : labelId;
const std::string labelName = (0 == label) ?
((sieveMesh->hasLabel("censored depth")) ?
@@ -452,7 +457,6 @@
assert(vector);
PetscViewer binaryViewer;
- PetscErrorCode err = 0;
// Create external dataset if necessary
bool createdExternalDataset = false;
Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterVTK.cc 2012-01-25 23:07:39 UTC (rev 19478)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterVTK.cc 2012-01-25 23:13:16 UTC (rev 19479)
@@ -150,12 +150,12 @@
} catch (const std::exception& err) {
std::ostringstream msg;
msg << "Error while preparing for writing data to VTK file "
- << _filename << " at time " << t << ".\n" << err.what();
+ << _vtkFilename(t) << " at time " << t << ".\n" << err.what();
throw std::runtime_error(msg.str());
} catch (...) {
std::ostringstream msg;
msg << "Unknown error while preparing for writing data to VTK file "
- << _filename << " at time " << t << ".\n";
+ << _vtkFilename(t) << " at time " << t << ".\n";
throw std::runtime_error(msg.str());
} // try/catch
} // openTimeStep
@@ -223,12 +223,12 @@
} catch (const std::exception& err) {
std::ostringstream msg;
msg << "Error while writing field '" << field.label() << "' at time "
- << t << " to VTK file '" << _filename << "'.\n" << err.what();
+ << t << " to VTK file '" << _vtkFilename(t) << "'.\n" << err.what();
throw std::runtime_error(msg.str());
} catch (...) {
std::ostringstream msg;
msg << "Error while writing field '" << field.label() << "' at time "
- << t << " to VTK file '" << _filename << "'.\n";
+ << t << " to VTK file '" << _vtkFilename(t) << "'.\n";
throw std::runtime_error(msg.str());
} // try/catch
} // writeVertexField
@@ -247,14 +247,17 @@
typedef typename field_type::Mesh::RealSection RealSection;
try {
+ PetscErrorCode err = 0;
int rank = 0;
- MPI_Comm_rank(field.mesh().comm(), &rank);
+ err = MPI_Comm_rank(field.mesh().comm(), &rank);CHECK_PETSC_ERROR(err);
// Correctly handle boundary and fault meshes
// Cannot just use mesh->depth() because boundaries report the wrong thing
const ALE::Obj<SieveMesh>& sieveMesh = field.mesh().sieveMesh();
assert(!sieveMesh.isNull());
- const int cellDepth = (sieveMesh->depth() == -1) ? -1 : 1;
+ int cellDepth = sieveMesh->depth();
+ err = MPI_Allreduce(&cellDepth, &cellDepth, 1, MPI_INT, MPI_MAX,
+ sieveMesh->comm());CHECK_PETSC_ERROR(err);
const int depth = (!label) ? cellDepth : labelId;
const std::string labelName = (!label) ?
((sieveMesh->hasLabel("censored depth")) ?
@@ -263,7 +266,6 @@
const ALE::Obj<typename SieveMesh::numbering_type>& numbering =
sieveMesh->getFactory()->getNumbering(sieveMesh, labelName, depth);
assert(!numbering.isNull());
- assert(!sieveMesh->getLabelStratum(labelName, depth).isNull());
const ALE::Obj<RealSection>& section = field.section();
assert(!section.isNull());
@@ -279,7 +281,6 @@
const int enforceDim =
(field.vectorFieldType() != topology::FieldBase::VECTOR) ? fiberDim : 3;
- PetscErrorCode err = 0;
if (!_wroteCellHeader) {
err = PetscViewerASCIIPrintf(_viewer, "CELL_DATA %d\n",
numbering->getGlobalSize());
@@ -292,12 +293,12 @@
} catch (const std::exception& err) {
std::ostringstream msg;
msg << "Error while writing field '" << field.label() << "' at time "
- << t << " to VTK file '" << _filename << "'.\n" << err.what();
+ << t << " to VTK file '" << _vtkFilename(t) << "'.\n" << err.what();
throw std::runtime_error(msg.str());
} catch (...) {
std::ostringstream msg;
msg << "Error while writing field '" << field.label() << "' at time "
- << t << " to VTK file '" << _filename << "'.\n";
+ << t << " to VTK file '" << _vtkFilename(t) << "'.\n";
throw std::runtime_error(msg.str());
} // try/catch
} // writeCellField
More information about the CIG-COMMITS
mailing list