39 #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), homoYIDs(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.");
268 ASSERTL1(fielddata[f].size() == fielddefs[f]->m_fields.size() *
270 prfx.str() +
"fielddata vector has invalid size.");
272 std::size_t nFieldElems = fielddefs[f]->m_elementIDs.size();
273 std::size_t nElemVals = fielddata[f].size();
282 std::stringstream hashStream;
283 std::size_t nSubFields = fielddefs[f]->m_fields.size();
284 for (
int sf = 0; sf < nSubFields; ++sf)
286 hashStream << fielddefs[f]->m_fields[sf];
289 nSubFields = fielddefs[f]->m_basis.size();
290 for (
int sf = 0; sf < nSubFields; ++sf)
292 hashStream << fielddefs[f]->m_basis[sf];
296 std::stringstream shapeStringStream;
297 shapeStringStream <<
ShapeTypeMap[fielddefs[f]->m_shapeType];
299 if (fielddefs[f]->m_numHomogeneousDir > 0)
303 homDim = fielddefs[f]->m_numHomogeneousDir;
306 ASSERTL1(homDim == fielddefs[f]->m_numHomogeneousDir,
307 "HDF5 does not support variable homogeneous directions in "
310 shapeStringStream <<
"-HomogenousExp"
311 << fielddefs[f]->m_numHomogeneousDir <<
"D";
314 if (fielddefs[f]->m_homoStrips)
316 shapeStringStream <<
"-Strips";
319 shapeStrings[f] = shapeStringStream.str();
320 hashStream << shapeStringStream.str();
323 if (fielddefs[f]->m_numHomogeneousDir)
325 nSubFields = fielddefs[f]->m_homogeneousLengths.size();
326 homoLengths[f].resize(nSubFields);
327 for (
int sf = 0; sf < nSubFields; ++sf)
329 NekDouble len = fielddefs[f]->m_homogeneousLengths[sf];
331 homoLengths[f][sf] = len;
334 nSubFields = fielddefs[f]->m_homogeneousYIDs.size();
337 homoYIDs[f].resize(nSubFields);
340 for (
int sf = 0; sf < nSubFields; ++sf)
342 homoYIDs[f][sf] = fielddefs[f]->m_homogeneousYIDs[sf];
346 nSubFields = fielddefs[f]->m_homogeneousZIDs.size();
349 homoZIDs[f].resize(nSubFields);
352 for (
int sf = 0; sf < nSubFields; ++sf)
354 homoZIDs[f][sf] = fielddefs[f]->m_homogeneousZIDs[sf];
358 nSubFields = fielddefs[f]->m_homogeneousSIDs.size();
361 homoSIDs[f].resize(nSubFields);
364 for (
int sf = 0; sf < nSubFields; ++sf)
366 homoSIDs[f][sf] = fielddefs[f]->m_homogeneousSIDs[sf];
371 if (fielddefs[f]->m_uniOrder)
373 std::vector<unsigned int> elemModes(fielddefs[f]->m_basis.size());
375 for (std::vector<int>::size_type i = 0;
376 i < fielddefs[f]->m_basis.size(); ++i)
378 elemModes[i] = fielddefs[f]->m_numModes[i];
383 for (std::vector<int>::size_type i = 0; i < nFieldElems; ++i)
385 std::copy(elemModes.begin(), elemModes.end(),
386 std::back_inserter(numModesPerDirVar[f]));
389 nFieldElems * elemModes.size();
394 std::stringstream numModesStringStream;
395 numModesStringStream <<
"UNIORDER:";
396 for (std::vector<int>::size_type i = 0; i < elemModes.size();
401 numModesStringStream <<
",";
403 numModesStringStream << elemModes[i];
406 numModesPerDirUni[f] = numModesStringStream.str();
407 hashStream << numModesPerDirUni[f];
412 numModesPerDirVar[f] = fielddefs[f]->m_numModes;
414 fielddefs[f]->m_numModes.size();
418 std::hash<std::string> string_hasher;
419 std::stringstream fieldNameStream;
420 uint64_t fieldDefHash = string_hasher(hashStream.str());
423 all_hashes[
m_comm->GetRank() * nMaxFields + f] = fieldDefHash;
425 fieldNameStream << fieldDefHash;
426 fieldNames[f] = fieldNameStream.str();
430 std::vector<uint64_t> all_cnts =
m_comm->Gather(root_rank, cnts);
432 std::vector<uint64_t> all_decomps =
m_comm->Gather(root_rank, decomps);
433 std::vector<uint64_t> all_dsetsize(
MAX_CNTS, 0);
439 ASSERTL1(outfile, prfx.str() +
"cannot create HDF5 file.");
441 ASSERTL1(root, prfx.str() +
"cannot create root group.");
450 std::size_t nTotElems = 0, nTotVals = 0, nTotOrder = 0;
451 std::size_t nTotHomY = 0, nTotHomZ = 0, nTotHomS = 0;
452 int nRanks =
m_comm->GetSize();
453 for (
int r = 0; r < nRanks; ++r)
483 root->CreateDataSet(
"DECOMPOSITION", decomps_type, decomps_space);
485 prfx.str() +
"cannot create DECOMPOSITION dataset.");
492 root->CreateDataSet(
"ELEMENTIDS", ids_type, ids_space);
493 ASSERTL1(ids_dset, prfx.str() +
"cannot create ELEMENTIDS dataset.");
500 root->CreateDataSet(
"DATA", data_type, data_space);
501 ASSERTL1(data_dset, prfx.str() +
"cannot create DATA dataset.");
510 root->CreateDataSet(
"HOMOGENEOUSYIDS", homy_type, homy_space);
512 prfx.str() +
"cannot create HOMOGENEOUSYIDS dataset.");
522 root->CreateDataSet(
"HOMOGENEOUSZIDS", homz_type, homz_space);
524 prfx.str() +
"cannot create HOMOGENEOUSZIDS dataset.");
534 root->CreateDataSet(
"HOMOGENEOUSSIDS", homs_type, homs_space);
536 prfx.str() +
"cannot create HOMOGENEOUSSIDS dataset.");
546 root->CreateDataSet(
"POLYORDERS", order_type, order_space);
548 prfx.str() +
"cannot create POLYORDERS dataset.");
552 m_comm->Bcast(all_dsetsize, root_rank);
563 std::set<uint64_t> hashToProc;
565 std::map<int, std::vector<uint64_t>> writingProcs;
570 for (
int n = 0; n <
m_comm->GetSize(); ++n)
572 for (
int i = 0; i < nMaxFields; ++i)
574 uint64_t hash = all_hashes[n * nMaxFields + i];
577 if (hashToProc.find(hash) != hashToProc.end() || hash == 0)
581 hashToProc.insert(hash);
582 writingProcs[n].push_back(hash);
587 for (
auto &sIt : writingProcs)
589 int rank = sIt.first;
592 if (
m_comm->GetRank() == rank)
600 ASSERTL1(outfile, prfx.str() +
"cannot open HDF5 file.");
602 ASSERTL1(root, prfx.str() +
"cannot open root group.");
606 for (
int i = 0; i < sIt.second.size(); ++i)
608 for (
int f = 0; f < nFields; ++f)
611 all_hashes[
m_comm->GetRank() * nMaxFields + f] ||
612 hashToProc.find(sIt.second[i]) != hashToProc.end())
617 hashToProc.insert(sIt.second[i]);
621 root->CreateGroup(fieldNames[f]);
623 prfx.str() +
"cannot create field group.");
624 field_group->SetAttribute(
"FIELDS", fielddefs[f]->m_fields);
625 field_group->SetAttribute(
"BASIS", fielddefs[f]->m_basis);
626 field_group->SetAttribute(
"SHAPE", shapeStrings[f]);
628 if (homoLengths[f].size() > 0)
630 field_group->SetAttribute(
"HOMOGENEOUSLENGTHS",
640 field_group->SetAttribute(
"NUMMODESPERDIR",
641 numModesPerDirUni[f]);
645 std::string numModesPerDir =
"MIXORDER";
646 field_group->SetAttribute(
"NUMMODESPERDIR",
666 ASSERTL1(outfile, prfx.str() +
"cannot open HDF5 file.");
668 ASSERTL1(root, prfx.str() +
"cannot open root group.");
673 prfx.str() +
"cannot open DECOMPOSITION dataset.");
677 prfx.str() +
"cannot open DECOMPOSITION filespace.");
679 decomps_fspace->SelectRange(0, all_decomps.size());
680 decomps_dset->Write(all_decomps, decomps_fspace, writeSR);
684 std::vector<uint64_t> idx =
m_comm->Scatter(root_rank, all_idxs);
695 if (
m_comm->GetSize() > 1)
699 parallelProps->SetMpio(
m_comm);
702 writePL->SetDxMpioCollective();
708 ASSERTL1(outfile, prfx.str() +
"cannot open HDF5 file.");
710 ASSERTL1(root, prfx.str() +
"cannot open root group.");
717 ASSERTL1(ids_dset, prfx.str() +
"cannot open ELEMENTIDS dataset.");
719 ASSERTL1(ids_fspace, prfx.str() +
"cannot open ELEMENTIDS filespace.");
723 ASSERTL1(data_dset, prfx.str() +
"cannot open DATA dataset.");
725 ASSERTL1(data_fspace, prfx.str() +
"cannot open DATA filespace.");
733 order_dset = root->OpenDataSet(
"POLYORDERS");
734 ASSERTL1(order_dset, prfx.str() +
"cannot open POLYORDERS dataset.");
735 order_fspace = order_dset->GetSpace();
737 prfx.str() +
"cannot open POLYORDERS filespace.");
742 homy_dset = root->OpenDataSet(
"HOMOGENEOUSYIDS");
744 prfx.str() +
"cannot open HOMOGENEOUSYIDS dataset.");
745 homy_fspace = homy_dset->GetSpace();
747 prfx.str() +
"cannot open HOMOGENEOUSYIDS filespace.");
752 homz_dset = root->OpenDataSet(
"HOMOGENEOUSZIDS");
754 prfx.str() +
"cannot open HOMOGENEOUSZIDS dataset.");
755 homz_fspace = homz_dset->GetSpace();
757 prfx.str() +
"cannot open HOMOGENEOUSZIDS filespace.");
762 homs_dset = root->OpenDataSet(
"HOMOGENEOUSSIDS");
764 prfx.str() +
"cannot open HOMOGENEOUSSIDS dataset.");
765 homs_fspace = homs_dset->GetSpace();
767 prfx.str() +
"cannot open HOMOGENEOUSSIDS filespace.");
771 for (
int f = 0; f < nFields; ++f)
774 std::size_t nFieldElems = fielddefs[f]->m_elementIDs.size();
775 ids_fspace->SelectRange(ids_i, nFieldElems);
776 ids_dset->Write(fielddefs[f]->m_elementIDs, ids_fspace, writePL);
777 ids_i += nFieldElems;
780 std::size_t nFieldVals = fielddata[f].size();
781 data_fspace->SelectRange(data_i, nFieldVals);
782 data_dset->Write(fielddata[f], data_fspace, writePL);
783 data_i += nFieldVals;
788 for (
int f = 0; f < nFields; ++f)
790 std::size_t nOrders = numModesPerDirVar[f].size();
791 order_fspace->SelectRange(order_i, nOrders);
792 order_dset->Write(numModesPerDirVar[f], order_fspace, writePL);
799 for (
int f = 0; f < nFields; ++f)
801 std::size_t nYIDs = homoYIDs[f].size();
802 homy_fspace->SelectRange(homy_i, nYIDs);
803 homy_dset->Write(homoYIDs[f], homy_fspace, writePL);
810 for (
int f = 0; f < nFields; ++f)
812 std::size_t nZIDs = homoZIDs[f].size();
813 homz_fspace->SelectRange(homz_i, nZIDs);
814 homz_dset->Write(homoZIDs[f], homz_fspace, writePL);
821 for (
int f = 0; f < nFields; ++f)
823 std::size_t nSIDs = homoSIDs[f].size();
824 homs_fspace->SelectRange(homs_i, nSIDs);
825 homs_dset->Write(homoSIDs[f], homs_fspace, writePL);
830 for (
int f = nFields; f < nMaxFields; ++f)
835 ids_dset->Write(fielddefs[nFields - 1]->m_elementIDs, ids_fspace,
837 data_dset->Write(fielddata[nFields - 1], data_fspace, writePL);
841 order_dset->Write(numModesPerDirVar[nFields - 1], order_fspace,
847 homy_dset->Write(homoYIDs[nFields - 1], homy_fspace, writePL);
852 homz_dset->Write(homoZIDs[nFields - 1], homz_fspace, writePL);
857 homs_dset->Write(homoSIDs[nFields - 1], homs_fspace, writePL);
864 if (
m_comm->GetRank() == 0)
867 std::cout <<
" (" << tm1 - tm0 <<
"s, HDF5)" << std::endl;
884 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
885 std::vector<std::vector<NekDouble>> &fielddata,
889 std::stringstream prfx;
890 int nRanks =
m_comm->GetSize();
901 parallelProps->SetMpio(
m_comm);
904 readPL->SetDxMpioCollective();
906 readPLInd->SetDxMpioIndependent();
914 std::static_pointer_cast<H5DataSource>(dataSource);
915 ASSERTL1(h5, prfx.str() +
"cannot open HDF5 file.");
917 ASSERTL1(root, prfx.str() +
"cannot open root group.");
920 unsigned int formatVersion;
923 for (; attrIt != attrEnd; ++attrIt)
925 if (*attrIt ==
"FORMAT_VERSION")
932 "Unable to determine Nektar++ HDF5 file version");
933 root->GetAttribute(
"FORMAT_VERSION", formatVersion);
936 "File format if " + infilename +
937 " is higher than supported in "
938 "this version of Nektar++");
942 ASSERTL1(decomps_dset, prfx.str() +
"cannot open DECOMPOSITION dataset.");
945 ASSERTL1(ids_dset, prfx.str() +
"cannot open ELEMENTIDS dataset.");
948 ASSERTL1(data_dset, prfx.str() +
"cannot open DATA dataset.");
953 prfx.str() +
"cannot open DECOMPOSITION filespace.");
956 ASSERTL1(ids_fspace, prfx.str() +
"cannot open ELEMENTIDS filespace.");
959 ASSERTL1(data_fspace, prfx.str() +
"cannot open DATA filespace.");
962 std::vector<uint64_t> ids;
964 ids_dset->Read(ids, ids_fspace, readPL);
966 std::unordered_set<uint64_t> toread;
969 for (uint64_t i = 0; i < ElementIDs.size(); ++i)
971 toread.insert(ElementIDs[i]);
975 std::vector<uint64_t> decomps;
976 decomps_dset->Read(decomps, decomps_fspace, readPL);
978 size_t nDecomps = decomps.size() /
MAX_DCMPS;
979 size_t cnt = 0, cnt2 = 0;
982 std::vector<OffsetHelper> decompsToOffsets(nDecomps);
986 std::map<uint64_t, std::vector<unsigned int>> groupsToElmts;
989 std::map<uint64_t, std::set<uint64_t>> groupsToDecomps;
992 bool selective = toread.size() > 0;
997 for (
size_t i = 0; i < nDecomps; ++i, cnt +=
MAX_DCMPS)
1002 std::vector<uint64_t> tmp;
1006 for (
size_t j = 0; j < nElmt; ++j)
1008 uint64_t elmtId = ids[cnt2 + j];
1009 if (toread.find(elmtId) != toread.end())
1011 tmp.push_back(elmtId);
1017 tmp.insert(tmp.begin(), ids.begin() + cnt2,
1018 ids.begin() + cnt2 + nElmt);
1021 std::vector<unsigned int> tmp2(nElmt);
1022 for (
size_t j = 0; j < nElmt; ++j)
1024 tmp2[j] = ids[cnt2 + j];
1031 groupsToDecomps[groupHash].insert(i);
1034 groupsToElmts[i] = tmp2;
1035 decompsToOffsets[i] = running;
1044 for (
auto &gIt : groupsToDecomps)
1047 for (
auto &sIt : gIt.second)
1049 std::stringstream fieldNameStream;
1050 fieldNameStream << gIt.first;
1054 ImportFieldDef(readPLInd, root, decomps, sIt, decompsToOffsets[sIt],
1055 fieldNameStream.str(), fielddef);
1057 fielddef->m_elementIDs = groupsToElmts[sIt];
1058 fielddefs.push_back(fielddef);
1062 std::vector<NekDouble> decompFieldData;
1064 decompsToOffsets[sIt].data, decomps, sIt,
1065 fielddef, decompFieldData);
1066 fielddata.push_back(decompFieldData);
1085 std::vector<uint64_t> &decomps,
1090 std::stringstream prfx;
1091 prfx <<
m_comm->GetRank() <<
": FieldIOHdf5::ImportFieldDefsHdf5(): ";
1094 ASSERTL1(field, prfx.str() +
"cannot open field group, " + group +
'.');
1096 def->m_uniOrder =
false;
1100 for (; attrIt != attrEnd; ++attrIt)
1102 const std::string &attrName = *attrIt;
1103 if (attrName ==
"FIELDS")
1105 field->GetAttribute(attrName, def->m_fields);
1107 else if (attrName ==
"SHAPE")
1109 std::string shapeString;
1110 field->GetAttribute(attrName, shapeString);
1116 if (shapeString.find(
"Strips") != std::string::npos)
1118 def->m_homoStrips =
true;
1121 if ((
loc = shapeString.find_first_of(
"-")) != std::string::npos)
1123 if (shapeString.find(
"Exp1D") != std::string::npos)
1125 def->m_numHomogeneousDir = 1;
1129 def->m_numHomogeneousDir = 2;
1132 shapeString.erase(
loc, shapeString.length());
1150 std::string(
"unable to correctly parse the shape type: ")
1151 .append(shapeString)
1154 else if (attrName ==
"BASIS")
1156 field->GetAttribute(attrName, def->m_basis);
1158 for (
auto &bIt : def->m_basis)
1163 "unable to correctly parse the basis types.");
1166 else if (attrName ==
"HOMOGENEOUSLENGTHS")
1168 field->GetAttribute(attrName, def->m_homogeneousLengths);
1170 else if (attrName ==
"NUMMODESPERDIR")
1172 std::string numModesPerDir;
1173 field->GetAttribute(attrName, numModesPerDir);
1175 if (strstr(numModesPerDir.c_str(),
"UNIORDER:"))
1177 def->m_uniOrder =
true;
1179 numModesPerDir.substr(9), def->m_numModes);
1182 "unable to correctly parse the number of modes.");
1185 else if (attrName ==
"POINTSTYPE")
1187 std::string pointsString;
1188 field->GetAttribute(attrName, pointsString);
1189 def->m_pointsDef =
true;
1191 std::vector<std::string> pointsStrings;
1195 "unable to correctly parse the points types.");
1196 for (std::vector<std::string>::size_type i = 0;
1197 i < pointsStrings.size(); i++)
1213 "unable to correctly parse the points type: ")
1214 .append(pointsStrings[i])
1218 else if (attrName ==
"NUMPOINTSPERDIR")
1220 std::string numPointsPerDir;
1221 field->GetAttribute(attrName, numPointsPerDir);
1222 def->m_numPointsDef =
true;
1228 "unable to correctly parse the number of points.");
1232 std::string errstr(
"unknown attribute: ");
1234 ASSERTL1(
false, prfx.str() + errstr.c_str());
1238 if (def->m_numHomogeneousDir >= 1)
1243 homz_fspace->SelectRange(offset.
homz, dsize);
1244 homz_dset->Read(def->m_homogeneousZIDs, homz_fspace, readPL);
1247 if (def->m_numHomogeneousDir >= 2)
1252 homy_fspace->SelectRange(offset.
homy, dsize);
1253 homy_dset->Read(def->m_homogeneousYIDs, homy_fspace, readPL);
1256 if (def->m_homoStrips)
1261 homs_fspace->SelectRange(offset.
homs, dsize);
1262 homs_dset->Read(def->m_homogeneousSIDs, homs_fspace, readPL);
1265 if (!def->m_uniOrder)
1270 order_fspace->SelectRange(offset.
order, dsize);
1271 order_dset->Read(def->m_numModes, order_fspace, readPL);
1290 std::vector<uint64_t> &decomps, uint64_t decomp,
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);
1302 ASSERTL0(fielddata.size() == datasize * fielddef->m_fields.size(),
1304 "input data is not the same length as header information.");
1333 std::static_pointer_cast<H5DataSource>(dataSource);
1342 pEnd = metadata->attr_end();
1343 for (; param != pEnd; ++param)
1345 std::string paramString = *param;
1346 if (paramString !=
"Provenance")
1348 std::string paramBodyStr;
1349 metadata->GetAttribute(paramString, paramBodyStr);
1350 fieldmetadatamap[paramString] = paramBodyStr;
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
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.
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 FieldIOSharedPtr create(LibUtilities::CommSharedPtr pComm, bool sharedFilesystem)
Creates an instance of this class.
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...
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 HOMY_CNT_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous y-planes in th...
static std::string className
Name of class.
static const unsigned int ORDER_DCMP_IDX
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of ...
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 FORMAT_VERSION
Version of the Nektar++ HDF5 format, which is embedded into the main NEKTAR group as an attribute.
static const unsigned int HASH_DCMP_IDX
The hash of the field definition information, which defines the name of the attribute containing the ...
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 VAL_CNT_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of data points in the cnt arr...
virtual DataSourceSharedPtr v_ImportFieldMetaData(const std::string &filename, FieldMetaDataMap &fieldmetadatamap)
Import field metadata from filename and return the data source which wraps filename.
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...
static const unsigned int IDS_IDX_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the element IDs within the indexing set.
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 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 ORDER_CNT_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of order points in the cnt ar...
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 ORDER_IDX_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the element order within the indexing se...
static const unsigned int HOMZ_DCMP_IDX
A helper for FieldIOHdf5::v_Write and FieldIOHdf5::v_Import. Describes the position of the number of ...
static const unsigned int MAX_DCMPS
A helper for FieldIOHdf5::v_Write. Describes the maximum number of items in the decomposition per fie...
FieldIOHdf5(LibUtilities::CommSharedPtr pComm, bool sharedFilesystem)
Construct the FieldIO object for HDF5 output.
static const unsigned int MAX_IDXS
A helper for FieldIOHdf5::v_Write. Describes the maximum number of items in the indexing set.
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 const unsigned int DATA_IDX_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the data size within the indexing set.
void ImportHDF5FieldMetaData(DataSourceSharedPtr dataSource, FieldMetaDataMap &fieldmetadatamap)
Import field metadata from dataSource.
static const unsigned int HOMS_IDX_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of homogeneous strips within ...
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 HOMZ_IDX_IDX
A helper for FieldIOHdf5::v_Write. Describes the position of the number of z-planes within the indexi...
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...
Class for operating on Nektar++ input/output files.
int CheckFieldDefinition(const FieldDefinitionsSharedPtr &fielddefs)
Check field definitions for correctness and return storage size.
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 void AddInfoTag(TagWriterSharedPtr root, const FieldMetaDataMap &fieldmetadatamap)
Add provenance information to the field metadata map.
static DataSpaceSharedPtr OneD(hsize_t size)
static DataTypeSharedPtr OfObject(const T &obj)
static FileSharedPtr Open(const std::string &filename, unsigned mode, PListSharedPtr accessPL=PList::Default())
static FileSharedPtr Create(const std::string &filename, unsigned mode, PListSharedPtr createPL=PList::Default(), PListSharedPtr accessPL=PList::Default())
static PListSharedPtr DatasetXfer()
Properties for raw data transfer.
static PListSharedPtr FileAccess()
Properties for file access.
static PListSharedPtr Default()
Default options.
static DataSourceSharedPtr create(const std::string &fn, H5::PListSharedPtr parallelProps)
Static constructor for this data source.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
std::shared_ptr< DataSpace > DataSpaceSharedPtr
std::shared_ptr< PList > PListSharedPtr
std::shared_ptr< File > FileSharedPtr
std::shared_ptr< DataType > DataTypeSharedPtr
std::shared_ptr< Group > GroupSharedPtr
std::shared_ptr< DataSet > DataSetSharedPtr
const char *const ShapeTypeMap[SIZE_ShapeType]
std::shared_ptr< TagWriter > TagWriterSharedPtr
std::shared_ptr< H5DataSource > H5DataSourceSharedPtr
std::shared_ptr< DataSource > DataSourceSharedPtr
std::map< std::string, std::string > FieldMetaDataMap
const std::string kPointsTypeStr[]
static std::vector< std::vector< NekDouble > > NullVectorNekDoubleVector
std::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
FieldIOFactory & GetFieldIOFactory()
Returns the FieldIO factory.
@ SIZE_PointsType
Length of enum list.
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
@ SIZE_BasisType
Length of enum list.
The above copyright notice and this permission notice shall be included.
static Array< OneD, int > NullInt1DArray
static DataTypeSharedPtr GetType()