38 #include <unordered_set> 41 namespace berrc = boost::system::errc;
45 namespace LibUtilities
52 return PredefinedDataType::Native<int>();
148 bool sharedFilesystem)
149 :
FieldIO(pComm, sharedFilesystem)
176 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
177 std::vector<std::vector<NekDouble> > &fielddata,
181 std::stringstream prfx;
182 prfx <<
m_comm->GetRank() <<
": FieldIOHdf5::v_Write(): ";
183 double tm0 = 0.0, tm1 = 0.0;
185 if (
m_comm->GetRank() == 0)
199 ASSERTL1(fielddefs.size() == fielddata.size(),
200 prfx.str() +
"fielddefs and fielddata have incompatible lengths.");
202 size_t nFields = fielddefs.size();
203 size_t nMaxFields = nFields;
210 if (
m_comm->GetSize() > 1)
212 max_fields_comm =
m_comm->CommCreateIf((nFields == nMaxFields) ? 1 : 0);
221 int rank =
m_comm->GetRank();
224 amRoot = (rank == root_rank);
232 ASSERTL1(root_rank >= 0 && root_rank < m_comm->GetSize(),
233 prfx.str() +
"invalid root rank.");
235 std::vector<uint64_t> decomps(nMaxFields *
MAX_DCMPS, 0);
236 std::vector<uint64_t> all_hashes(nMaxFields *
m_comm->GetSize(), 0);
237 std::vector<uint64_t> cnts(
MAX_CNTS, 0);
238 std::vector<std::string> fieldNames(nFields);
239 std::vector<std::string> shapeStrings(nFields);
240 std::vector<std::vector<NekDouble> > homoLengths(nFields);
241 std::vector<std::vector<unsigned int> > homoSIDs(nFields),
242 homoYIDs(nFields), homoZIDs(nFields);
243 std::vector<std::vector<unsigned int> > numModesPerDirVar(nFields);
244 std::vector<std::string> numModesPerDirUni(nFields);
249 for (
int f = 0; f < nFields; ++f)
251 if (!fielddefs[f]->m_uniOrder)
263 for (
int f = 0; f < nFields; ++f)
267 "fielddata vector must contain at least one value.");
269 fielddefs[f]->m_fields.size() *
271 prfx.str() +
"fielddata vector has invalid size.");
273 std::size_t nFieldElems = fielddefs[f]->m_elementIDs.size();
274 std::size_t nElemVals = fielddata[f].size();
283 std::stringstream hashStream;
284 std::size_t nSubFields = fielddefs[f]->m_fields.size();
285 for (
int sf = 0; sf < nSubFields; ++sf)
287 hashStream << fielddefs[f]->m_fields[sf];
290 nSubFields = fielddefs[f]->m_basis.size();
291 for (
int sf = 0; sf < nSubFields; ++sf)
293 hashStream << fielddefs[f]->m_basis[sf];
297 std::stringstream shapeStringStream;
298 shapeStringStream <<
ShapeTypeMap[fielddefs[f]->m_shapeType];
300 if (fielddefs[f]->m_numHomogeneousDir > 0)
304 homDim = fielddefs[f]->m_numHomogeneousDir;
307 ASSERTL1(homDim == fielddefs[f]->m_numHomogeneousDir,
308 "HDF5 does not support variable homogeneous directions in " 311 shapeStringStream <<
"-HomogenousExp" 312 << fielddefs[f]->m_numHomogeneousDir <<
"D";
315 if (fielddefs[f]->m_homoStrips)
317 shapeStringStream <<
"-Strips";
320 shapeStrings[f] = shapeStringStream.str();
321 hashStream << shapeStringStream.str();
324 if (fielddefs[f]->m_numHomogeneousDir)
326 nSubFields = fielddefs[f]->m_homogeneousLengths.size();
327 homoLengths[f].resize(nSubFields);
328 for (
int sf = 0; sf < nSubFields; ++sf)
330 NekDouble len = fielddefs[f]->m_homogeneousLengths[sf];
332 homoLengths[f][sf] = len;
335 nSubFields = fielddefs[f]->m_homogeneousYIDs.size();
338 homoYIDs[f].resize(nSubFields);
341 for (
int sf = 0; sf < nSubFields; ++sf)
343 homoYIDs[f][sf] = fielddefs[f]->m_homogeneousYIDs[sf];
347 nSubFields = fielddefs[f]->m_homogeneousZIDs.size();
350 homoZIDs[f].resize(nSubFields);
353 for (
int sf = 0; sf < nSubFields; ++sf)
355 homoZIDs[f][sf] = fielddefs[f]->m_homogeneousZIDs[sf];
359 nSubFields = fielddefs[f]->m_homogeneousSIDs.size();
362 homoSIDs[f].resize(nSubFields);
365 for (
int sf = 0; sf < nSubFields; ++sf)
367 homoSIDs[f][sf] = fielddefs[f]->m_homogeneousSIDs[sf];
372 if (fielddefs[f]->m_uniOrder)
374 std::vector<unsigned int> elemModes(fielddefs[f]->m_basis.size());
376 for (std::vector<int>::size_type i = 0;
377 i < fielddefs[f]->m_basis.size(); ++i)
379 elemModes[i] = fielddefs[f]->m_numModes[i];
384 for (std::vector<int>::size_type i = 0; i < nFieldElems; ++i)
386 std::copy(elemModes.begin(), elemModes.end(),
387 std::back_inserter(numModesPerDirVar[f]));
390 nFieldElems * elemModes.size();
395 std::stringstream numModesStringStream;
396 numModesStringStream <<
"UNIORDER:";
397 for (std::vector<int>::size_type i = 0;
398 i < elemModes.size(); i++)
402 numModesStringStream <<
",";
404 numModesStringStream << elemModes[i];
407 numModesPerDirUni[f] = numModesStringStream.str();
408 hashStream << numModesPerDirUni[f];
413 numModesPerDirVar[f] = fielddefs[f]->m_numModes;
415 fielddefs[f]->m_numModes.size();
419 std::hash<std::string> string_hasher;
420 std::stringstream fieldNameStream;
421 uint64_t fieldDefHash = string_hasher(hashStream.str());
424 all_hashes[
m_comm->GetRank() * nMaxFields + f] = fieldDefHash;
426 fieldNameStream << fieldDefHash;
427 fieldNames[f] = fieldNameStream.str();
431 std::vector<uint64_t> all_cnts =
m_comm->Gather(root_rank, cnts);
433 std::vector<uint64_t> all_decomps =
m_comm->Gather(root_rank, decomps);
434 std::vector<uint64_t> all_dsetsize(
MAX_CNTS, 0);
440 ASSERTL1(outfile, prfx.str() +
"cannot create HDF5 file.");
442 ASSERTL1(root, prfx.str() +
"cannot create root group.");
451 std::size_t nTotElems = 0, nTotVals = 0, nTotOrder = 0;
452 std::size_t nTotHomY = 0, nTotHomZ = 0, nTotHomS = 0;
453 int nRanks =
m_comm->GetSize();
454 for (
int r = 0; r < nRanks; ++r)
484 root->CreateDataSet(
"DECOMPOSITION", decomps_type, decomps_space);
486 prfx.str() +
"cannot create DECOMPOSITION dataset.");
493 root->CreateDataSet(
"ELEMENTIDS", ids_type, ids_space);
494 ASSERTL1(ids_dset, prfx.str() +
"cannot create ELEMENTIDS dataset.");
501 root->CreateDataSet(
"DATA", data_type, data_space);
502 ASSERTL1(data_dset, prfx.str() +
"cannot create DATA dataset.");
511 root->CreateDataSet(
"HOMOGENEOUSYIDS", homy_type, homy_space);
513 prfx.str() +
"cannot create HOMOGENEOUSYIDS dataset.");
523 root->CreateDataSet(
"HOMOGENEOUSZIDS", homz_type, homz_space);
525 prfx.str() +
"cannot create HOMOGENEOUSZIDS dataset.");
535 root->CreateDataSet(
"HOMOGENEOUSSIDS", homs_type, homs_space);
537 prfx.str() +
"cannot create HOMOGENEOUSSIDS dataset.");
547 root->CreateDataSet(
"POLYORDERS", order_type, order_space);
549 prfx.str() +
"cannot create POLYORDERS dataset.");
553 m_comm->Bcast(all_dsetsize, root_rank);
564 std::set<uint64_t> hashToProc;
566 std::map<int, std::vector<uint64_t> > writingProcs;
571 for (
int n = 0; n <
m_comm->GetSize(); ++n)
573 for (
int i = 0; i < nMaxFields; ++i)
575 uint64_t hash = all_hashes[n*nMaxFields + i];
578 if (hashToProc.find(hash) != hashToProc.end() || hash == 0)
582 hashToProc.insert(hash);
583 writingProcs[n].push_back(hash);
588 for (
auto &sIt : writingProcs)
590 int rank = sIt.first;
593 if (
m_comm->GetRank() == rank)
601 ASSERTL1(outfile, prfx.str() +
"cannot open HDF5 file.");
603 ASSERTL1(root, prfx.str() +
"cannot open root group.");
607 for (
int i = 0; i < sIt.second.size(); ++i)
609 for (
int f = 0; f < nFields; ++f)
612 all_hashes[
m_comm->GetRank() * nMaxFields + f] ||
613 hashToProc.find(sIt.second[i]) != hashToProc.end())
618 hashToProc.insert(sIt.second[i]);
622 root->CreateGroup(fieldNames[f]);
624 prfx.str() +
"cannot create field group.");
625 field_group->SetAttribute(
"FIELDS", fielddefs[f]->m_fields);
626 field_group->SetAttribute(
"BASIS", fielddefs[f]->m_basis);
627 field_group->SetAttribute(
"SHAPE", shapeStrings[f]);
629 if (homoLengths[f].size() > 0)
631 field_group->SetAttribute(
"HOMOGENEOUSLENGTHS",
641 field_group->SetAttribute(
"NUMMODESPERDIR",
642 numModesPerDirUni[f]);
646 std::string numModesPerDir =
"MIXORDER";
647 field_group->SetAttribute(
"NUMMODESPERDIR",
667 ASSERTL1(outfile, prfx.str() +
"cannot open HDF5 file.");
669 ASSERTL1(root, prfx.str() +
"cannot open root group.");
674 prfx.str() +
"cannot open DECOMPOSITION dataset.");
678 prfx.str() +
"cannot open DECOMPOSITION filespace.");
680 decomps_fspace->SelectRange(0, all_decomps.size());
681 decomps_dset->Write(all_decomps, decomps_fspace, writeSR);
685 std::vector<uint64_t> idx =
m_comm->Scatter(root_rank, all_idxs);
696 if (
m_comm->GetSize() > 1)
700 parallelProps->SetMpio(
m_comm);
703 writePL->SetDxMpioCollective();
709 ASSERTL1(outfile, prfx.str() +
"cannot open HDF5 file.");
711 ASSERTL1(root, prfx.str() +
"cannot open root group.");
718 ASSERTL1(ids_dset, prfx.str() +
"cannot open ELEMENTIDS dataset.");
720 ASSERTL1(ids_fspace, prfx.str() +
"cannot open ELEMENTIDS filespace.");
724 ASSERTL1(data_dset, prfx.str() +
"cannot open DATA dataset.");
726 ASSERTL1(data_fspace, prfx.str() +
"cannot open DATA filespace.");
734 order_dset = root->OpenDataSet(
"POLYORDERS");
735 ASSERTL1(order_dset, prfx.str() +
"cannot open POLYORDERS dataset.");
736 order_fspace = order_dset->GetSpace();
737 ASSERTL1(order_fspace, prfx.str() +
"cannot open POLYORDERS filespace.");
742 homy_dset = root->OpenDataSet(
"HOMOGENEOUSYIDS");
743 ASSERTL1(homy_dset, prfx.str() +
"cannot open HOMOGENEOUSYIDS dataset.");
744 homy_fspace = homy_dset->GetSpace();
745 ASSERTL1(homy_fspace, prfx.str() +
"cannot open HOMOGENEOUSYIDS filespace.");
750 homz_dset = root->OpenDataSet(
"HOMOGENEOUSZIDS");
751 ASSERTL1(homz_dset, prfx.str() +
"cannot open HOMOGENEOUSZIDS dataset.");
752 homz_fspace = homz_dset->GetSpace();
753 ASSERTL1(homz_fspace, prfx.str() +
"cannot open HOMOGENEOUSZIDS filespace.");
758 homs_dset = root->OpenDataSet(
"HOMOGENEOUSSIDS");
759 ASSERTL1(homs_dset, prfx.str() +
"cannot open HOMOGENEOUSSIDS dataset.");
760 homs_fspace = homs_dset->GetSpace();
761 ASSERTL1(homs_fspace, prfx.str() +
"cannot open HOMOGENEOUSSIDS filespace.");
765 for (
int f = 0; f < nFields; ++f)
768 std::size_t nFieldElems = fielddefs[f]->m_elementIDs.size();
769 ids_fspace->SelectRange(ids_i, nFieldElems);
770 ids_dset->Write(fielddefs[f]->m_elementIDs, ids_fspace, writePL);
771 ids_i += nFieldElems;
774 std::size_t nFieldVals = fielddata[f].size();
775 data_fspace->SelectRange(data_i, nFieldVals);
776 data_dset->Write(fielddata[f], data_fspace, writePL);
777 data_i += nFieldVals;
782 for (
int f = 0; f < nFields; ++f)
784 std::size_t nOrders = numModesPerDirVar[f].size();
785 order_fspace->SelectRange(order_i, nOrders);
786 order_dset->Write(numModesPerDirVar[f], order_fspace, writePL);
793 for (
int f = 0; f < nFields; ++f)
795 std::size_t nYIDs = homoYIDs[f].size();
796 homy_fspace->SelectRange(homy_i, nYIDs);
797 homy_dset->Write(homoYIDs[f], homy_fspace, writePL);
804 for (
int f = 0; f < nFields; ++f)
806 std::size_t nZIDs = homoZIDs[f].size();
807 homz_fspace->SelectRange(homz_i, nZIDs);
808 homz_dset->Write(homoZIDs[f], homz_fspace, writePL);
815 for (
int f = 0; f < nFields; ++f)
817 std::size_t nSIDs = homoSIDs[f].size();
818 homs_fspace->SelectRange(homs_i, nSIDs);
819 homs_dset->Write(homoSIDs[f], homs_fspace, writePL);
824 for (
int f = nFields; f < nMaxFields; ++f)
830 fielddefs[nFields - 1]->m_elementIDs, ids_fspace, writePL);
831 data_dset->Write(fielddata[nFields - 1], data_fspace, writePL);
835 order_dset->Write(numModesPerDirVar[nFields - 1],
836 order_fspace, writePL);
841 homy_dset->Write(homoYIDs[nFields - 1], homy_fspace, writePL);
846 homz_dset->Write(homoZIDs[nFields - 1], homz_fspace, writePL);
851 homs_dset->Write(homoSIDs[nFields - 1], homs_fspace, writePL);
858 if (
m_comm->GetRank() == 0)
861 std::cout <<
" (" << tm1 - tm0 <<
"s, HDF5)" << std::endl;
878 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
879 std::vector<std::vector<NekDouble> > &fielddata,
883 std::stringstream prfx;
884 int nRanks =
m_comm->GetSize();
895 parallelProps->SetMpio(
m_comm);
898 readPL->SetDxMpioCollective();
900 readPLInd->SetDxMpioIndependent();
904 infilename, parallelProps);
909 ASSERTL1(h5, prfx.str() +
"cannot open HDF5 file.");
911 ASSERTL1(root, prfx.str() +
"cannot open root group.");
914 unsigned int formatVersion;
917 for (; attrIt != attrEnd; ++attrIt)
919 if (*attrIt ==
"FORMAT_VERSION")
926 "Unable to determine Nektar++ HDF5 file version");
927 root->GetAttribute(
"FORMAT_VERSION", formatVersion);
930 "File format if " + infilename +
" is higher than supported in " 931 "this version of Nektar++");
935 ASSERTL1(decomps_dset, prfx.str() +
"cannot open DECOMPOSITION dataset.");
938 ASSERTL1(ids_dset, prfx.str() +
"cannot open ELEMENTIDS dataset.");
941 ASSERTL1(data_dset, prfx.str() +
"cannot open DATA dataset.");
946 prfx.str() +
"cannot open DECOMPOSITION filespace.");
949 ASSERTL1(ids_fspace, prfx.str() +
"cannot open ELEMENTIDS filespace.");
952 ASSERTL1(data_fspace, prfx.str() +
"cannot open DATA filespace.");
955 std::vector<uint64_t> ids;
957 ids_dset->Read(ids, ids_fspace, readPL);
959 std::unordered_set<uint64_t> toread;
962 for (uint64_t i = 0; i < ElementIDs.num_elements(); ++i)
964 toread.insert(ElementIDs[i]);
968 std::vector<uint64_t> decomps;
969 decomps_dset->Read(decomps, decomps_fspace, readPL);
971 size_t nDecomps = decomps.size() /
MAX_DCMPS;
972 size_t cnt = 0, cnt2 = 0;
975 std::vector<OffsetHelper> decompsToOffsets (nDecomps);
979 std::map<uint64_t, std::vector<unsigned int> > groupsToElmts;
982 std::map<uint64_t, std::set<uint64_t> > groupsToDecomps;
985 bool selective = toread.size() > 0;
990 for (
size_t i = 0; i < nDecomps; ++i, cnt +=
MAX_DCMPS)
995 std::vector<uint64_t> tmp;
999 for (
size_t j = 0; j < nElmt; ++j)
1001 uint64_t elmtId = ids[cnt2 + j];
1002 if (toread.find(elmtId) != toread.end())
1004 tmp.push_back(elmtId);
1011 tmp.begin(), ids.begin() + cnt2, ids.begin() + cnt2 + nElmt);
1014 std::vector<unsigned int> tmp2(nElmt);
1015 for (
size_t j = 0; j < nElmt; ++j)
1017 tmp2[j] = ids[cnt2+j];
1024 groupsToDecomps[groupHash].insert(i);
1027 groupsToElmts[i] = tmp2;
1028 decompsToOffsets[i] = running;
1037 for (
auto &gIt : groupsToDecomps)
1040 for (
auto &sIt : gIt.second)
1042 std::stringstream fieldNameStream;
1043 fieldNameStream << gIt.first;
1047 ImportFieldDef(readPLInd, root, decomps, sIt, decompsToOffsets[sIt],
1048 fieldNameStream.str(), fielddef);
1050 fielddef->m_elementIDs = groupsToElmts[sIt];
1051 fielddefs.push_back(fielddef);
1055 std::vector<NekDouble> decompFieldData;
1057 readPLInd, data_dset, data_fspace,
1058 decompsToOffsets[sIt].data, decomps, sIt, fielddef,
1060 fielddata.push_back(decompFieldData);
1080 std::vector<uint64_t> &decomps,
1086 std::stringstream prfx;
1087 prfx <<
m_comm->GetRank() <<
": FieldIOHdf5::ImportFieldDefsHdf5(): ";
1090 ASSERTL1(field, prfx.str() +
"cannot open field group, " + group +
'.');
1092 def->m_uniOrder =
false;
1096 for (; attrIt != attrEnd; ++attrIt)
1098 const std::string &attrName = *attrIt;
1099 if (attrName ==
"FIELDS")
1101 field->GetAttribute(attrName, def->m_fields);
1103 else if (attrName ==
"SHAPE")
1105 std::string shapeString;
1106 field->GetAttribute(attrName, shapeString);
1112 if (shapeString.find(
"Strips") != std::string::npos)
1114 def->m_homoStrips =
true;
1117 if ((loc = shapeString.find_first_of(
"-")) != std::string::npos)
1119 if (shapeString.find(
"Exp1D") != std::string::npos)
1121 def->m_numHomogeneousDir = 1;
1125 def->m_numHomogeneousDir = 2;
1128 shapeString.erase(loc, shapeString.length());
1143 ASSERTL0(valid, prfx.str() + std::string(
1144 "unable to correctly parse the shape type: ")
1145 .append(shapeString).c_str());
1147 else if (attrName ==
"BASIS")
1149 field->GetAttribute(attrName, def->m_basis);
1151 for (
auto &bIt : def->m_basis)
1156 "unable to correctly parse the basis types.");
1159 else if (attrName ==
"HOMOGENEOUSLENGTHS")
1161 field->GetAttribute(attrName, def->m_homogeneousLengths);
1163 else if (attrName ==
"NUMMODESPERDIR")
1165 std::string numModesPerDir;
1166 field->GetAttribute(attrName, numModesPerDir);
1168 if (strstr(numModesPerDir.c_str(),
"UNIORDER:"))
1170 def->m_uniOrder =
true;
1172 numModesPerDir.substr(9), def->m_numModes);
1175 "unable to correctly parse the number of modes.");
1178 else if (attrName ==
"POINTSTYPE")
1180 std::string pointsString;
1181 field->GetAttribute(attrName, pointsString);
1182 def->m_pointsDef =
true;
1184 std::vector<std::string> pointsStrings;
1186 pointsString, pointsStrings);
1189 "unable to correctly parse the points types.");
1190 for (std::vector<std::string>::size_type i = 0;
1191 i < pointsStrings.size();
1209 "unable to correctly parse the points type: ")
1210 .append(pointsStrings[i])
1214 else if (attrName ==
"NUMPOINTSPERDIR")
1216 std::string numPointsPerDir;
1217 field->GetAttribute(attrName, numPointsPerDir);
1218 def->m_numPointsDef =
true;
1221 numPointsPerDir, def->m_numPoints);
1224 "unable to correctly parse the number of points.");
1228 std::string errstr(
"unknown attribute: ");
1230 ASSERTL1(
false, prfx.str() + errstr.c_str());
1234 if (def->m_numHomogeneousDir >= 1)
1239 homz_fspace->SelectRange(offset.
homz, dsize);
1240 homz_dset->Read(def->m_homogeneousZIDs, homz_fspace, readPL);
1243 if (def->m_numHomogeneousDir >= 2)
1248 homy_fspace->SelectRange(offset.
homy, dsize);
1249 homy_dset->Read(def->m_homogeneousYIDs, homy_fspace, readPL);
1252 if (def->m_homoStrips)
1257 homs_fspace->SelectRange(offset.
homs, dsize);
1258 homs_dset->Read(def->m_homogeneousSIDs, homs_fspace, readPL);
1261 if (!def->m_uniOrder)
1266 order_fspace->SelectRange(offset.
order, dsize);
1267 order_dset->Read(def->m_numModes, order_fspace, readPL);
1288 std::vector<uint64_t> &decomps,
1291 std::vector<NekDouble> &fielddata)
1293 std::stringstream prfx;
1294 prfx <<
m_comm->GetRank() <<
": FieldIOHdf5::ImportFieldData(): ";
1297 uint64_t nFieldVals = nElemVals;
1299 data_fspace->SelectRange(data_i, nFieldVals);
1300 data_dset->Read(fielddata, data_fspace, readPL);
1303 fielddata.size() == datasize * fielddef->m_fields.size(),
1305 "input data is not the same length as header information.");
1316 const std::string &filename,
1344 pEnd = metadata->attr_end();
1345 for (; param != pEnd; ++param)
1347 std::string paramString = *param;
1348 if (paramString !=
"Provenance")
1350 std::string paramBodyStr;
1351 metadata->GetAttribute(paramString, paramBodyStr);
1352 fieldmetadatamap[paramString] = paramBodyStr;
#define ASSERTL0(condition, msg)
std::shared_ptr< H5DataSource > H5DataSourceSharedPtr
FieldIOHdf5(LibUtilities::CommSharedPtr pComm, bool sharedFilesystem)
Construct the FieldIO object for HDF5 output.
static const unsigned int HOMY_CNT_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous y-planes in th...
static FileSharedPtr Create(const std::string &filename, unsigned mode, PListSharedPtr createPL=PList::Default(), PListSharedPtr accessPL=PList::Default())
virtual void v_Write(const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap=NullFieldMetaDataMap, const bool backup=false)
Write a HDF5 file to outFile given the field definitions fielddefs, field data fielddata and metadata...
const std::string kPointsTypeStr[]
static const unsigned int MAX_DCMPS
A helper for FieldIOHdf5::v_Write. Describes the maximum number of items in the decomposition per fie...
static const unsigned int HOMS_IDX_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous strips within ...
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
static DataTypeSharedPtr OfObject(const T &obj)
static const unsigned int ORDER_IDX_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the element order within the indexing se...
static DataTypeSharedPtr GetType()
std::shared_ptr< DataSpace > DataSpaceSharedPtr
void ImportHDF5FieldMetaData(DataSourceSharedPtr dataSource, FieldMetaDataMap &fieldmetadatamap)
Import field metadata from dataSource.
FieldIOFactory & GetFieldIOFactory()
Returns the FieldIO factory.
std::map< std::string, std::string > FieldMetaDataMap
std::shared_ptr< DataSet > DataSetSharedPtr
int CheckFieldDefinition(const FieldDefinitionsSharedPtr &fielddefs)
Check field definitions for correctness and return storage size.
std::shared_ptr< DataType > DataTypeSharedPtr
const char *const ShapeTypeMap[]
std::shared_ptr< PList > PListSharedPtr
static const unsigned int HASH_DCMP_IDX
The hash of the field definition information, which defines the name of the attribute containing the ...
std::shared_ptr< TagWriter > TagWriterSharedPtr
static DataSourceSharedPtr create(const std::string &fn, H5::PListSharedPtr parallelProps)
Static constructor for this data source.
void ImportFieldDef(H5::PListSharedPtr readPL, H5::GroupSharedPtr root, std::vector< uint64_t > &decomps, uint64_t decomp, OffsetHelper offset, std::string group, FieldDefinitionsSharedPtr def)
Import field definitions from a HDF5 document.
static const unsigned int FORMAT_VERSION
Version of the Nektar++ HDF5 format, which is embedded into the main NEKTAR group as an attribute...
std::shared_ptr< DataSource > DataSourceSharedPtr
static DataSpaceSharedPtr OneD(hsize_t size)
static const unsigned int HOMY_IDX_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of y-planes within the indexi...
std::shared_ptr< File > FileSharedPtr
static const unsigned int MAX_IDXS
A helper for FieldIOHdf5::v_Write. Describes the maximum number of items in the indexing set...
static FileSharedPtr Open(const std::string &filename, unsigned mode, PListSharedPtr accessPL=PList::Default())
static std::vector< std::vector< NekDouble > > NullVectorNekDoubleVector
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static PListSharedPtr DatasetXfer()
Properties for raw data transfer.
static const unsigned int HOMZ_CNT_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous z-planes in th...
static const unsigned int VAL_DCMP_IDX
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of ...
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
static const unsigned int IDS_IDX_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the element IDs within the indexing set...
std::string SetUpOutput(const std::string outname, bool perRank, bool backup=false)
Set up the filesystem ready for output.
LibUtilities::CommSharedPtr m_comm
Communicator to use when writing parallel format.
static std::string className
Name of class.
virtual void v_Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata=NullVectorNekDoubleVector, FieldMetaDataMap &fieldinfomap=NullFieldMetaDataMap, const Array< OneD, int > &ElementIDs=NullInt1DArray)
Import a HDF5 format file.
static const unsigned int MAX_CNTS
A helper for FieldIOHdf5::v_Write. Describes the maximum number of items in the cnt array per field d...
static const unsigned int ELEM_CNT_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of elements in the cnt array...
static const unsigned int ORDER_CNT_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of order points in the cnt ar...
static const unsigned int HOMY_DCMP_IDX
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of ...
static const unsigned int DATA_IDX_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the data size within the indexing set...
static const unsigned int HOMS_CNT_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous strips in the ...
static const unsigned int HOMZ_DCMP_IDX
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of ...
std::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
static const unsigned int ELEM_DCMP_IDX
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of ...
static const unsigned int HOMZ_IDX_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of z-planes within the indexi...
void ImportFieldData(H5::PListSharedPtr readPL, H5::DataSetSharedPtr data_dset, H5::DataSpaceSharedPtr data_fspace, uint64_t data_i, std::vector< uint64_t > &decomps, uint64_t decomp, const FieldDefinitionsSharedPtr fielddef, std::vector< NekDouble > &fielddata)
Import the field data from the HDF5 document.
Class for operating on Nektar++ input/output files.
std::shared_ptr< Group > GroupSharedPtr
static PListSharedPtr FileAccess()
Properties for file access.
H5::FileSharedPtr Get()
Get H5::FileSharedPtr reference to file.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static FieldIOSharedPtr create(LibUtilities::CommSharedPtr pComm, bool sharedFilesystem)
Creates an instance of this class.
static const unsigned int HOMS_DCMP_IDX
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of ...
static Array< OneD, int > NullInt1DArray
static const unsigned int ORDER_DCMP_IDX
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of ...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
static void AddInfoTag(TagWriterSharedPtr root, const FieldMetaDataMap &fieldmetadatamap)
Add provenance information to the field metadata map.
static const unsigned int VAL_CNT_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of data points in the cnt arr...
static PListSharedPtr Default()
Default options.
virtual DataSourceSharedPtr v_ImportFieldMetaData(const std::string &filename, FieldMetaDataMap &fieldmetadatamap)
Import field metadata from filename and return the data source which wraps filename.