Skip to content

Commit 7147d51

Browse files
committed
ensure we don't try to load /mesh/owner field if we are a v1 h5 mesh
1 parent 0420d1d commit 7147d51

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

src/mesh/triangulation.cpp

+18-7
Original file line numberDiff line numberDiff line change
@@ -821,14 +821,16 @@ void triangulation::load_mesh_from_h5(const std::string& mesh_filename)
821821
H5::DataSpace dataspace(1, &partition_dims);
822822
H5::Attribute attribute = file.openAttribute("/mesh/is_partition");
823823
attribute.read(PredType::NATIVE_HBOOL, &_mesh_is_from_partition);
824-
LOG_DEBUG << "Loaded mesh is partitioned";
824+
825825

826826
}
827827
catch (AttributeIException& e)
828828
{
829829
// non partition meshes won't have this
830830
_mesh_is_from_partition = false;
831831
}
832+
833+
LOG_DEBUG << "Loaded mesh is partitioned = " <<_mesh_is_from_partition;
832834
}
833835

834836
if(!_mesh_is_from_partition && !_version.mesh_ver_meets_min_h5())
@@ -883,12 +885,21 @@ void triangulation::load_mesh_from_h5(const std::string& mesh_filename)
883885

884886
std::vector<int> owner; //what MPIrank owns each triangle,
885887
{
886-
H5::DataSet dataset = file.openDataSet("/mesh/owner");
887-
H5::DataSpace dataspace = dataset.getSpace();
888-
hsize_t nelem;
889-
int ndims = dataspace.getSimpleExtentDims(&nelem, NULL);
890-
owner.resize(nelem);
891-
dataset.read(owner.data(), PredType::NATIVE_INT);
888+
// if we have a h5 that isn't partitioned (ie mesh v 1.0.0) then we are entirely owned by rank 0
889+
if(_version.to_string() == "1.0.0")
890+
{
891+
owner.resize(_global_IDs.size(), 0);
892+
}
893+
else
894+
{
895+
H5::DataSet dataset = file.openDataSet("/mesh/owner");
896+
H5::DataSpace dataspace = dataset.getSpace();
897+
hsize_t nelem;
898+
int ndims = dataspace.getSimpleExtentDims(&nelem, NULL);
899+
owner.resize(nelem);
900+
dataset.read(owner.data(), PredType::NATIVE_INT);
901+
}
902+
892903
}
893904

894905
{

0 commit comments

Comments
 (0)