[cig-commits] r21425 - short/3D/PyLith/trunk/libsrc/pylith/meshio
knepley at geodynamics.org
knepley at geodynamics.org
Fri Mar 1 05:23:55 PST 2013
Author: knepley
Date: 2013-03-01 05:23:54 -0800 (Fri, 01 Mar 2013)
New Revision: 21425
Modified:
short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc
Log:
Fixes for HDF5 output, now parallel test passes
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc 2013-03-01 00:41:06 UTC (rev 21424)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc 2013-03-01 13:23:54 UTC (rev 21425)
@@ -108,64 +108,28 @@
const spatialdata::geocoords::CoordSys* cs = mesh.coordsys();
assert(cs);
-#if 0
const char *context = DataWriter<mesh_type, field_type>::_context.c_str();
DM dmCoord;
+ Vec coordinates;
PetscReal lengthScale;
-
- err = DMPlexGetScale(dmMesh, PETSC_UNIT_LENGTH, &lengthScale);CHECK_PETSC_ERROR(err);
- err = DMGetCoordinateDM(dmMesh, &dmCoord);CHECK_PETSC_ERROR(err);
- topology::Field<mesh_type> coordinates(mesh, dmCoord, topology::FieldBase::Metadata());
- coordinates.label("vertices");
- coordinates.createScatterWithBC(mesh, PETSC_NULL, context);
- coordinates.scatterSectionToVector(context);
- PetscVec coordVec = coordinates.vector(context);
- assert(coordVec);
- err = VecScale(coordVec, lengthScale);CHECK_PETSC_ERROR(err);
- err = PetscViewerHDF5PushGroup(_viewer, "/geometry");CHECK_PETSC_ERROR(err);
- err = VecView(coordVec, _viewer);CHECK_PETSC_ERROR(err);
- err = PetscViewerHDF5PopGroup(_viewer); CHECK_PETSC_ERROR(err);
-#else
- DM dmCoord;
- Vec coordinates;
topology::FieldBase::Metadata metadata;
+
metadata.label = "vertices";
metadata.vectorFieldType = topology::FieldBase::VECTOR;
+ err = DMPlexGetScale(dmMesh, PETSC_UNIT_LENGTH, &lengthScale);CHECK_PETSC_ERROR(err);
err = DMGetCoordinateDM(dmMesh, &dmCoord);CHECK_PETSC_ERROR(err);
err = PetscObjectReference((PetscObject) dmCoord);CHECK_PETSC_ERROR(err);
err = DMGetCoordinatesLocal(dmMesh, &coordinates);CHECK_PETSC_ERROR(err);
topology::Field<mesh_type> field(mesh, dmCoord, coordinates, metadata);
field.createScatterWithBC(mesh, "", 0, metadata.label.c_str());
field.scatterSectionToVector(metadata.label.c_str());
- PetscVec vector = field.vector(metadata.label.c_str());
- assert(vector);
+ PetscVec coordVector = field.vector(metadata.label.c_str());
+ assert(coordVector);
+ err = VecScale(coordVector, lengthScale);CHECK_PETSC_ERROR(err);
err = PetscViewerHDF5PushGroup(_viewer, "/geometry");CHECK_PETSC_ERROR(err);
- err = VecView(vector, _viewer);CHECK_PETSC_ERROR(err);
+ err = VecView(coordVector, _viewer);CHECK_PETSC_ERROR(err);
err = PetscViewerHDF5PopGroup(_viewer); CHECK_PETSC_ERROR(err);
-#endif
-#if 0
- const ALE::Obj<typename mesh_type::RealSection>& coordinatesSection =
- sieveMesh->hasRealSection("coordinates_dimensioned") ?
- sieveMesh->getRealSection("coordinates_dimensioned") :
- sieveMesh->getRealSection("coordinates");
- assert(!coordinatesSection.isNull());
- topology::FieldBase::Metadata metadata;
- // :KLUDGE: We would like to use field_type for the coordinates
- // field. However, the mesh coordinates are Field<mesh_type> and
- // field_type can be Field<Mesh> (e.g., displacement field over a
- // SubMesh).
- const char* context = DataWriter<mesh_type, field_type>::_context.c_str();
- topology::Field<mesh_type> coordinates(mesh, coordinatesSection, metadata);
- coordinates.label("vertices");
- coordinates.createScatterWithBC(mesh, vNumbering, context);
- coordinates.scatterSectionToVector(context);
- PetscVec coordinatesVector = coordinates.vector(context);
- assert(coordinatesVector);
- err = PetscViewerHDF5PushGroup(_viewer, "/geometry");CHECK_PETSC_ERROR(err);
- err = VecView(coordinatesVector, _viewer);CHECK_PETSC_ERROR(err);
- err = PetscViewerHDF5PopGroup(_viewer); CHECK_PETSC_ERROR(err);
-#endif
PetscInt vStart, vEnd, cStart, cEnd, cMax, dof, conesSize, numCorners, numCornersLocal = 0;
err = DMPlexGetDepthStratum(dmMesh, 0, &vStart, &vEnd);CHECK_PETSC_ERROR(err);
More information about the CIG-COMMITS
mailing list