diff --git a/libsrc/pylith/meshio/DataWriterHDF5.cc b/libsrc/pylith/meshio/DataWriterHDF5.cc index e39db52ace..de6eaf62d1 100644 --- a/libsrc/pylith/meshio/DataWriterHDF5.cc +++ b/libsrc/pylith/meshio/DataWriterHDF5.cc @@ -239,43 +239,6 @@ pylith::meshio::DataWriterHDF5::open(const topology::Mesh& mesh, const int cellDim = mesh.dimension(); HDF5::writeAttribute(h5, "/topology/cells", "cell_dim", (void*)&cellDim, H5T_NATIVE_INT); - // If 2-D, write zero vector for z components - if (2 == cs->spaceDim()) { - err = PetscViewerHDF5PushGroup(_viewer, "/zero"); PYLITH_CHECK_ERROR(err); - - const char* vlabel = "vertex_zero"; - topology::Field vzeroField(mesh); - vzeroField.newSection(coordinatesField, 1); - vzeroField.allocate(); - vzeroField.zeroAll(); - vzeroField.label(vlabel); - vzeroField.vectorFieldType(topology::FieldBase::SCALAR); - vzeroField.createScatterWithBC(mesh, "", 0, vlabel); - vzeroField.scatterLocalToGlobal(vlabel); - - PetscVec vzeroVector = vzeroField.vector(vlabel); assert(vzeroVector); - err = PetscObjectTypeCompare((PetscObject) vzeroVector, VECSEQ, &isseq); PYLITH_CHECK_ERROR(err); - if (isseq) {err = VecView_Seq(vzeroVector, _viewer); PYLITH_CHECK_ERROR(err); } - else {err = VecView_MPI(vzeroVector, _viewer); PYLITH_CHECK_ERROR(err); } - - const char* clabel = "cell_zero"; - topology::Field czeroField(mesh); - czeroField.newSection(cStart, cEnd, 1); - czeroField.allocate(); - czeroField.zeroAll(); - czeroField.label(clabel); - czeroField.vectorFieldType(topology::FieldBase::SCALAR); - czeroField.createScatterWithBC(mesh, "", 0, clabel); - czeroField.scatterLocalToGlobal(clabel); - - PetscVec czeroVector = czeroField.vector(clabel); assert(czeroVector); - err = PetscObjectTypeCompare((PetscObject) czeroVector, VECSEQ, &isseq); PYLITH_CHECK_ERROR(err); - if (isseq) {err = VecView_Seq(czeroVector, _viewer); PYLITH_CHECK_ERROR(err); } - else {err = VecView_MPI(czeroVector, _viewer); PYLITH_CHECK_ERROR(err); } - - err = PetscViewerHDF5PopGroup(_viewer); PYLITH_CHECK_ERROR(err); - } // if - } catch (const std::exception& err) { std::ostringstream msg; msg << "Error while opening HDF5 file " << _hdf5Filename() << ".\n" << err.what(); diff --git a/libsrc/pylith/meshio/DataWriterHDF5Ext.cc b/libsrc/pylith/meshio/DataWriterHDF5Ext.cc index d7f634d34b..e8bc42b5f7 100644 --- a/libsrc/pylith/meshio/DataWriterHDF5Ext.cc +++ b/libsrc/pylith/meshio/DataWriterHDF5Ext.cc @@ -288,68 +288,6 @@ pylith::meshio::DataWriterHDF5Ext::open(const topology::Mesh& mesh, _h5->writeAttribute("/topology/cells", "cell_dim", (void*)&cellDim, H5T_NATIVE_INT); } // if - // If 2-D, write zero vector for z coordinate and z component in vectors - if (2 == cs->spaceDim()) { - if (!commRank) _h5->createGroup("/zero"); - const char* vlabel = "vertex_zero"; - const std::string& vfilenameZero = _datasetFilename(vlabel); - err = PetscViewerBinaryOpen(comm, vfilenameZero.c_str(), FILE_MODE_WRITE, &binaryViewer); PYLITH_CHECK_ERROR(err); - err = PetscViewerBinarySetSkipHeader(binaryViewer, PETSC_TRUE); PYLITH_CHECK_ERROR(err); - topology::Field vzeroField(mesh); - vzeroField.newSection(coordinatesField, 1); - vzeroField.allocate(); - vzeroField.zeroAll(); - vzeroField.label(vlabel); - vzeroField.vectorFieldType(topology::FieldBase::SCALAR); - vzeroField.createScatterWithBC(mesh, "", 0, vlabel); - vzeroField.scatterLocalToGlobal(vlabel); - - PetscVec vzeroVector = vzeroField.vector(vlabel); assert(vzeroVector); - err = PetscObjectTypeCompare((PetscObject) vzeroVector, VECSEQ, &isseq); PYLITH_CHECK_ERROR(err); - if (isseq) {err = VecView_Seq(vzeroVector, binaryViewer); PYLITH_CHECK_ERROR(err); } - else {err = VecView_MPI(vzeroVector, binaryViewer); PYLITH_CHECK_ERROR(err); } - - err = PetscViewerDestroy(&binaryViewer); PYLITH_CHECK_ERROR(err); - - // Create external dataset for vertex_zero field - if (!commRank) { - const hsize_t ndims = 2; - hsize_t dims[ndims]; - dims[0] = numVertices; - dims[1] = 1; - _h5->createDatasetRawExternal("/zero", vlabel, vfilenameZero.c_str(), dims, ndims, scalartype); - } // if - - const char* clabel = "cell_zero"; - const std::string& cfilenameZero = _datasetFilename(clabel); - err = PetscViewerBinaryOpen(comm, cfilenameZero.c_str(), FILE_MODE_WRITE, &binaryViewer); PYLITH_CHECK_ERROR(err); - err = PetscViewerBinarySetSkipHeader(binaryViewer, PETSC_TRUE); PYLITH_CHECK_ERROR(err); - topology::Field czeroField(mesh); - czeroField.newSection(cStart, cEnd, 1); - czeroField.allocate(); - czeroField.zeroAll(); - czeroField.label(clabel); - czeroField.vectorFieldType(topology::FieldBase::SCALAR); - czeroField.createScatterWithBC(mesh, "", 0, clabel); - czeroField.scatterLocalToGlobal(clabel); - - PetscVec czeroVector = czeroField.vector(clabel); assert(czeroVector); - err = PetscObjectTypeCompare((PetscObject) czeroVector, VECSEQ, &isseq); PYLITH_CHECK_ERROR(err); - if (isseq) {err = VecView_Seq(czeroVector, binaryViewer); PYLITH_CHECK_ERROR(err); } - else {err = VecView_MPI(czeroVector, binaryViewer); PYLITH_CHECK_ERROR(err); } - - err = PetscViewerDestroy(&binaryViewer); PYLITH_CHECK_ERROR(err); - - // Create external dataset for vertex_zero field - if (!commRank) { - const hsize_t ndims = 2; - hsize_t dims[ndims]; - dims[0] = numCells; - dims[1] = 1; - _h5->createDatasetRawExternal("/zero", clabel, cfilenameZero.c_str(), dims, ndims, scalartype); - } // if - } // if - } catch (const std::exception& err) { std::ostringstream msg; msg << "Error while opening HDF5 file " << _filename << ".\n" << err.what(); diff --git a/libsrc/pylith/meshio/Xdmf.cc b/libsrc/pylith/meshio/Xdmf.cc index cac18d902b..cb2e3dab8a 100644 --- a/libsrc/pylith/meshio/Xdmf.cc +++ b/libsrc/pylith/meshio/Xdmf.cc @@ -424,8 +424,10 @@ pylith::meshio::Xdmf::_writeDomainVertices(const int numVertices, << " &HeavyData;:/geometry/vertices\n" << " \n" << " \n" - << " \n" - << " &HeavyData;:/zero/vertex_zero\n" + << " \n" + << " \n" + << " /Xdmf/Domain/DataItem[@Name=\"vertices\"]/DataItem[@Name=\"verticesX\"]\n" + << " \n" << " \n" << " \n"; } else { @@ -563,9 +565,12 @@ pylith::meshio::Xdmf::_writeGridAttribute(const FieldMetadata& metadata, << " \n" << " \n" // z component - << " \n" - << " &HeavyData;:" << h5ZeroName << "\n" + << " \n" + << " \n" + << " /Xdmf/Domain/Grid/Attribute[@Name=\"" << metadata.name << "\"]/DataItem[1]/DataItem[1]\n" + << " \n" << " \n" + // close << " \n" << " \n"; } else { diff --git a/m4 b/m4 index 8f32836359..41259ed151 160000 --- a/m4 +++ b/m4 @@ -1 +1 @@ -Subproject commit 8f32836359cb238a6301041c36d2cb267873d7e1 +Subproject commit 41259ed151da691773913b766d511f6467617855 diff --git a/templates/friction/m4 b/templates/friction/m4 index 8f32836359..9912ff1c7f 160000 --- a/templates/friction/m4 +++ b/templates/friction/m4 @@ -1 +1 @@ -Subproject commit 8f32836359cb238a6301041c36d2cb267873d7e1 +Subproject commit 9912ff1c7f7e66577d849160c4169c0c3be4806f diff --git a/templates/materials/m4 b/templates/materials/m4 index 8f32836359..9912ff1c7f 160000 --- a/templates/materials/m4 +++ b/templates/materials/m4 @@ -1 +1 @@ -Subproject commit 8f32836359cb238a6301041c36d2cb267873d7e1 +Subproject commit 9912ff1c7f7e66577d849160c4169c0c3be4806f diff --git a/unittests/libtests/meshio/data/quad4_cell.xmf b/unittests/libtests/meshio/data/quad4_cell.xmf index 73a48dc61b..74d579e7cf 100644 --- a/unittests/libtests/meshio/data/quad4_cell.xmf +++ b/unittests/libtests/meshio/data/quad4_cell.xmf @@ -25,8 +25,10 @@ &HeavyData;:/geometry/vertices - - &HeavyData;:/zero/vertex_zero + + + /Xdmf/Domain/DataItem[@Name="vertices"]/DataItem[@Name="verticesX"] + @@ -119,8 +121,10 @@ &HeavyData;:/cell_fields/traction - - &HeavyData;:/zero/cell_zero + + + /Xdmf/Domain/Grid/Attribute[@Name="traction"]/DataItem[1]/DataItem[1] + diff --git a/unittests/libtests/meshio/data/quad4_points.h5 b/unittests/libtests/meshio/data/quad4_points.h5 index 5418661125..770d62d244 100644 Binary files a/unittests/libtests/meshio/data/quad4_points.h5 and b/unittests/libtests/meshio/data/quad4_points.h5 differ diff --git a/unittests/libtests/meshio/data/quad4_points_vertex.h5 b/unittests/libtests/meshio/data/quad4_points_vertex.h5 index 63819a1bf3..3073d3dbd7 100644 Binary files a/unittests/libtests/meshio/data/quad4_points_vertex.h5 and b/unittests/libtests/meshio/data/quad4_points_vertex.h5 differ diff --git a/unittests/libtests/meshio/data/quad4_vertex.xmf b/unittests/libtests/meshio/data/quad4_vertex.xmf index 139873f54a..645c2c0e4b 100644 --- a/unittests/libtests/meshio/data/quad4_vertex.xmf +++ b/unittests/libtests/meshio/data/quad4_vertex.xmf @@ -25,8 +25,10 @@ &HeavyData;:/geometry/vertices - - &HeavyData;:/zero/vertex_zero + + + /Xdmf/Domain/DataItem[@Name="vertices"]/DataItem[@Name="verticesX"] + @@ -59,8 +61,10 @@ &HeavyData;:/vertex_fields/displacement - - &HeavyData;:/zero/vertex_zero + + + /Xdmf/Domain/Grid/Attribute[@Name="displacement"]/DataItem[1]/DataItem[1] + diff --git a/unittests/libtests/meshio/data/tri3_cell.xmf b/unittests/libtests/meshio/data/tri3_cell.xmf index 1c73c5b83a..30b9c79f1a 100644 --- a/unittests/libtests/meshio/data/tri3_cell.xmf +++ b/unittests/libtests/meshio/data/tri3_cell.xmf @@ -25,8 +25,10 @@ &HeavyData;:/geometry/vertices - - &HeavyData;:/zero/vertex_zero + + + /Xdmf/Domain/DataItem[@Name="vertices"]/DataItem[@Name="verticesX"] + @@ -119,8 +121,10 @@ &HeavyData;:/cell_fields/traction - - &HeavyData;:/zero/cell_zero + + + /Xdmf/Domain/Grid/Attribute[@Name="traction"]/DataItem[1]/DataItem[1] + diff --git a/unittests/libtests/meshio/data/tri3_points.h5 b/unittests/libtests/meshio/data/tri3_points.h5 index 332687410e..8828f7142a 100644 Binary files a/unittests/libtests/meshio/data/tri3_points.h5 and b/unittests/libtests/meshio/data/tri3_points.h5 differ diff --git a/unittests/libtests/meshio/data/tri3_points_vertex.h5 b/unittests/libtests/meshio/data/tri3_points_vertex.h5 index 0265732e90..1f489fad4f 100644 Binary files a/unittests/libtests/meshio/data/tri3_points_vertex.h5 and b/unittests/libtests/meshio/data/tri3_points_vertex.h5 differ diff --git a/unittests/libtests/meshio/data/tri3_vertex.xmf b/unittests/libtests/meshio/data/tri3_vertex.xmf index 4a2011f4de..274dcce90b 100644 --- a/unittests/libtests/meshio/data/tri3_vertex.xmf +++ b/unittests/libtests/meshio/data/tri3_vertex.xmf @@ -25,8 +25,10 @@ &HeavyData;:/geometry/vertices - - &HeavyData;:/zero/vertex_zero + + + /Xdmf/Domain/DataItem[@Name="vertices"]/DataItem[@Name="verticesX"] + @@ -59,8 +61,10 @@ &HeavyData;:/vertex_fields/displacement - - &HeavyData;:/zero/vertex_zero + + + /Xdmf/Domain/Grid/Attribute[@Name="displacement"]/DataItem[1]/DataItem[1] +