37 #include <boost/unordered_set.hpp>
39 namespace berrc = boost::system::errc;
43 namespace LibUtilities
50 return PredefinedDataType::Native<int>();
146 bool sharedFilesystem)
147 :
FieldIO(pComm, sharedFilesystem)
174 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
175 std::vector<std::vector<NekDouble> > &fielddata,
179 std::stringstream prfx;
180 prfx <<
m_comm->GetRank() <<
": FieldIOHdf5::v_Write(): ";
181 double tm0 = 0.0, tm1 = 0.0;
183 if (
m_comm->GetRank() == 0)
197 ASSERTL1(fielddefs.size() == fielddata.size(),
198 prfx.str() +
"fielddefs and fielddata have incompatible lengths.");
200 size_t nFields = fielddefs.size();
201 size_t nMaxFields = nFields;
208 if (
m_comm->GetSize() > 1)
210 max_fields_comm =
m_comm->CommCreateIf((nFields == nMaxFields) ? 1 : 0);
219 int rank =
m_comm->GetRank();
222 amRoot = (rank == root_rank);
231 prfx.str() +
"invalid root rank.");
233 std::vector<uint64_t> decomps(nMaxFields *
MAX_DCMPS, 0);
234 std::vector<uint64_t> all_hashes(nMaxFields *
m_comm->GetSize(), 0);
235 std::vector<uint64_t> cnts(
MAX_CNTS, 0);
236 std::vector<std::string> fieldNames(nFields);
237 std::vector<std::string> shapeStrings(nFields);
238 std::vector<std::vector<NekDouble> > homoLengths(nFields);
239 std::vector<std::vector<unsigned int> > homoSIDs(nFields),
240 homoYIDs(nFields), homoZIDs(nFields);
241 std::vector<std::vector<unsigned int> > numModesPerDirVar(nFields);
242 std::vector<std::string> numModesPerDirUni(nFields);
247 for (
int f = 0; f < nFields; ++f)
249 if (!fielddefs[f]->m_uniOrder)
261 for (
int f = 0; f < nFields; ++f)
265 "fielddata vector must contain at least one value.");
267 fielddefs[f]->m_fields.size() *
269 prfx.str() +
"fielddata vector has invalid size.");
271 std::size_t nFieldElems = fielddefs[f]->m_elementIDs.size();
272 std::size_t nElemVals = fielddata[f].size();
281 std::stringstream hashStream;
282 std::size_t nSubFields = fielddefs[f]->m_fields.size();
283 for (
int sf = 0; sf < nSubFields; ++sf)
285 hashStream << fielddefs[f]->m_fields[sf];
288 nSubFields = fielddefs[f]->m_basis.size();
289 for (
int sf = 0; sf < nSubFields; ++sf)
291 hashStream << fielddefs[f]->m_basis[sf];
295 std::stringstream shapeStringStream;
296 shapeStringStream <<
ShapeTypeMap[fielddefs[f]->m_shapeType];
298 if (fielddefs[f]->m_numHomogeneousDir > 0)
302 homDim = fielddefs[f]->m_numHomogeneousDir;
305 ASSERTL1(homDim == fielddefs[f]->m_numHomogeneousDir,
306 "HDF5 does not support variable homogeneous directions in "
309 shapeStringStream <<
"-HomogenousExp"
310 << fielddefs[f]->m_numHomogeneousDir <<
"D";
313 if (fielddefs[f]->m_homoStrips)
315 shapeStringStream <<
"-Strips";
318 shapeStrings[f] = shapeStringStream.str();
319 hashStream << shapeStringStream.str();
322 if (fielddefs[f]->m_numHomogeneousDir)
324 nSubFields = fielddefs[f]->m_homogeneousLengths.size();
325 homoLengths[f].resize(nSubFields);
326 for (
int sf = 0; sf < nSubFields; ++sf)
328 uint64_t len = fielddefs[f]->m_homogeneousLengths[sf];
330 homoLengths[f][sf] = len;
333 nSubFields = fielddefs[f]->m_homogeneousYIDs.size();
336 homoYIDs[f].resize(nSubFields);
339 for (
int sf = 0; sf < nSubFields; ++sf)
341 homoYIDs[f][sf] = fielddefs[f]->m_homogeneousYIDs[sf];
345 nSubFields = fielddefs[f]->m_homogeneousZIDs.size();
348 homoZIDs[f].resize(nSubFields);
351 for (
int sf = 0; sf < nSubFields; ++sf)
353 homoZIDs[f][sf] = fielddefs[f]->m_homogeneousZIDs[sf];
357 nSubFields = fielddefs[f]->m_homogeneousSIDs.size();
360 homoSIDs[f].resize(nSubFields);
363 for (
int sf = 0; sf < nSubFields; ++sf)
365 homoSIDs[f][sf] = fielddefs[f]->m_homogeneousSIDs[sf];
370 if (fielddefs[f]->m_uniOrder)
372 std::vector<unsigned int> elemModes(fielddefs[f]->m_basis.size());
374 for (std::vector<int>::size_type i = 0;
375 i < fielddefs[f]->m_basis.size(); ++i)
377 elemModes[i] = fielddefs[f]->m_numModes[i];
382 for (std::vector<int>::size_type i = 0; i < nFieldElems; ++i)
384 std::copy(elemModes.begin(), elemModes.end(),
385 std::back_inserter(numModesPerDirVar[f]));
388 nFieldElems * elemModes.size();
393 stringstream numModesStringStream;
394 numModesStringStream <<
"UNIORDER:";
395 for (std::vector<int>::size_type i = 0;
396 i < elemModes.size(); i++)
400 numModesStringStream <<
",";
402 numModesStringStream << elemModes[i];
405 numModesPerDirUni[f] = numModesStringStream.str();
406 hashStream << numModesPerDirUni[f];
411 numModesPerDirVar[f] = fielddefs[f]->m_numModes;
413 fielddefs[f]->m_numModes.size();
417 boost::hash<std::string> string_hasher;
418 std::stringstream fieldNameStream;
419 uint64_t fieldDefHash = string_hasher(hashStream.str());
422 all_hashes[
m_comm->GetRank() * nMaxFields + f] = fieldDefHash;
424 fieldNameStream << fieldDefHash;
425 fieldNames[f] = fieldNameStream.str();
429 std::vector<uint64_t> all_cnts =
m_comm->Gather(root_rank, cnts);
431 std::vector<uint64_t> all_decomps =
m_comm->Gather(root_rank, decomps);
432 std::vector<uint64_t> all_dsetsize(
MAX_CNTS, 0);
438 ASSERTL1(outfile, prfx.str() +
"cannot create HDF5 file.");
440 ASSERTL1(root, prfx.str() +
"cannot create root group.");
449 std::size_t nTotElems = 0, nTotVals = 0, nTotOrder = 0;
450 std::size_t nTotHomY = 0, nTotHomZ = 0, nTotHomS = 0;
451 int nRanks =
m_comm->GetSize();
452 for (
int r = 0; r < nRanks; ++r)
482 root->CreateDataSet(
"DECOMPOSITION", decomps_type, decomps_space);
484 prfx.str() +
"cannot create DECOMPOSITION dataset.");
491 root->CreateDataSet(
"ELEMENTIDS", ids_type, ids_space);
492 ASSERTL1(ids_dset, prfx.str() +
"cannot create ELEMENTIDS dataset.");
499 root->CreateDataSet(
"DATA", data_type, data_space);
500 ASSERTL1(data_dset, prfx.str() +
"cannot create DATA dataset.");
509 root->CreateDataSet(
"HOMOGENEOUSYIDS", homy_type, homy_space);
511 prfx.str() +
"cannot create HOMOGENEOUSYIDS dataset.");
521 root->CreateDataSet(
"HOMOGENEOUSZIDS", homz_type, homz_space);
523 prfx.str() +
"cannot create HOMOGENEOUSZIDS dataset.");
533 root->CreateDataSet(
"HOMOGENEOUSSIDS", homs_type, homs_space);
535 prfx.str() +
"cannot create HOMOGENEOUSSIDS dataset.");
545 root->CreateDataSet(
"POLYORDERS", order_type, order_space);
547 prfx.str() +
"cannot create POLYORDERS dataset.");
551 m_comm->Bcast(all_dsetsize, root_rank);
562 std::set<uint64_t> hashToProc;
564 std::map<int, std::vector<uint64_t> > writingProcs;
569 for (
int n = 0; n <
m_comm->GetSize(); ++n)
571 for (
int i = 0; i < nMaxFields; ++i)
573 uint64_t hash = all_hashes[n*nMaxFields + i];
576 if (hashToProc.find(hash) != hashToProc.end() || hash == 0)
580 hashToProc.insert(hash);
581 writingProcs[n].push_back(hash);
586 map<int, std::vector<uint64_t> >
::iterator sIt;
587 for (sIt = writingProcs.begin(); sIt != writingProcs.end(); sIt++)
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)
610 if (sIt->second[i] !=
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();
736 ASSERTL1(order_fspace, prfx.str() +
"cannot open POLYORDERS filespace.");
741 homy_dset = root->OpenDataSet(
"HOMOGENEOUSYIDS");
742 ASSERTL1(homy_dset, prfx.str() +
"cannot open HOMOGENEOUSYIDS dataset.");
743 homy_fspace = homy_dset->GetSpace();
744 ASSERTL1(homy_fspace, prfx.str() +
"cannot open HOMOGENEOUSYIDS filespace.");
749 homz_dset = root->OpenDataSet(
"HOMOGENEOUSZIDS");
750 ASSERTL1(homz_dset, prfx.str() +
"cannot open HOMOGENEOUSZIDS dataset.");
751 homz_fspace = homz_dset->GetSpace();
752 ASSERTL1(homz_fspace, prfx.str() +
"cannot open HOMOGENEOUSZIDS filespace.");
757 homs_dset = root->OpenDataSet(
"HOMOGENEOUSSIDS");
758 ASSERTL1(homs_dset, prfx.str() +
"cannot open HOMOGENEOUSSIDS dataset.");
759 homs_fspace = homs_dset->GetSpace();
760 ASSERTL1(homs_fspace, prfx.str() +
"cannot open HOMOGENEOUSSIDS filespace.");
764 for (
int f = 0; f < nFields; ++f)
767 std::size_t nFieldElems = fielddefs[f]->m_elementIDs.size();
768 ids_fspace->SelectRange(ids_i, nFieldElems);
769 ids_dset->Write(fielddefs[f]->m_elementIDs, ids_fspace, writePL);
770 ids_i += nFieldElems;
773 std::size_t nFieldVals = fielddata[f].size();
774 data_fspace->SelectRange(data_i, nFieldVals);
775 data_dset->Write(fielddata[f], data_fspace, writePL);
776 data_i += nFieldVals;
781 for (
int f = 0; f < nFields; ++f)
783 std::size_t nOrders = numModesPerDirVar[f].size();
784 order_fspace->SelectRange(order_i, nOrders);
785 order_dset->Write(numModesPerDirVar[f], order_fspace, writePL);
792 for (
int f = 0; f < nFields; ++f)
794 std::size_t nYIDs = homoYIDs[f].size();
795 homy_fspace->SelectRange(homy_i, nYIDs);
796 homy_dset->Write(homoYIDs[f], homy_fspace, writePL);
803 for (
int f = 0; f < nFields; ++f)
805 std::size_t nZIDs = homoZIDs[f].size();
806 homz_fspace->SelectRange(homz_i, nZIDs);
807 homz_dset->Write(homoZIDs[f], homz_fspace, writePL);
814 for (
int f = 0; f < nFields; ++f)
816 std::size_t nSIDs = homoSIDs[f].size();
817 homs_fspace->SelectRange(homs_i, nSIDs);
818 homs_dset->Write(homoSIDs[f], homs_fspace, writePL);
823 for (
int f = nFields; f < nMaxFields; ++f)
829 fielddefs[nFields - 1]->m_elementIDs, ids_fspace, writePL);
830 data_dset->Write(fielddata[nFields - 1], data_fspace, writePL);
836 if (
m_comm->GetRank() == 0)
839 cout <<
" (" << tm1 - tm0 <<
"s, HDF5)" << endl;
856 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
857 std::vector<std::vector<NekDouble> > &fielddata,
861 std::stringstream prfx;
862 int nRanks =
m_comm->GetSize();
872 parallelProps->SetMpio(
m_comm);
875 readPL->SetDxMpioCollective();
879 infilename, parallelProps);
884 ASSERTL1(h5, prfx.str() +
"cannot open HDF5 file.");
886 ASSERTL1(root, prfx.str() +
"cannot open root group.");
889 unsigned int formatVersion;
892 for (; attrIt != attrEnd; ++attrIt)
894 if (*attrIt ==
"FORMAT_VERSION")
901 "Unable to determine Nektar++ HDF5 file version");
902 root->GetAttribute(
"FORMAT_VERSION", formatVersion);
905 "File format if " + infilename +
" is higher than supported in "
906 "this version of Nektar++");
910 ASSERTL1(decomps_dset, prfx.str() +
"cannot open DECOMPOSITION dataset.");
913 ASSERTL1(ids_dset, prfx.str() +
"cannot open ELEMENTIDS dataset.");
916 ASSERTL1(data_dset, prfx.str() +
"cannot open DATA dataset.");
921 prfx.str() +
"cannot open DECOMPOSITION filespace.");
924 ASSERTL1(ids_fspace, prfx.str() +
"cannot open ELEMENTIDS filespace.");
927 ASSERTL1(data_fspace, prfx.str() +
"cannot open DATA filespace.");
930 std::vector<uint64_t> ids;
932 ids_dset->Read(ids, ids_fspace, readPL);
934 boost::unordered_set<uint64_t> toread;
937 for (uint64_t i = 0; i < ElementIDs.num_elements(); ++i)
939 toread.insert(ElementIDs[i]);
943 std::vector<uint64_t> decomps;
944 decomps_dset->Read(decomps, decomps_fspace, readPL);
946 size_t nDecomps = decomps.size() /
MAX_DCMPS;
947 size_t cnt = 0, cnt2 = 0;
950 vector<OffsetHelper> decompsToOffsets (nDecomps);
954 map<uint64_t, vector<unsigned int> > groupsToElmts;
957 map<uint64_t, set<uint64_t> > groupsToDecomps;
960 bool selective = toread.size() > 0;
965 for (
size_t i = 0; i < nDecomps; ++i, cnt +=
MAX_DCMPS)
970 vector<uint64_t> tmp;
974 for (
size_t j = 0; j < nElmt; ++j)
976 uint64_t elmtId = ids[cnt2 + j];
977 if (toread.find(elmtId) != toread.end())
979 tmp.push_back(elmtId);
986 tmp.begin(), ids.begin() + cnt2, ids.begin() + cnt2 + nElmt);
989 vector<unsigned int> tmp2(nElmt);
990 for (
size_t j = 0; j < nElmt; ++j)
992 tmp2[j] = ids[cnt2+j];
999 groupsToDecomps[groupHash].insert(i);
1002 groupsToElmts[i] = tmp2;
1003 decompsToOffsets[i] = running;
1013 for (gIt = groupsToDecomps.begin(); gIt != groupsToDecomps.end(); ++gIt)
1017 for (sIt = gIt->second.begin(); sIt != gIt->second.end(); ++sIt)
1019 std::stringstream fieldNameStream;
1020 fieldNameStream << gIt->first;
1024 ImportFieldDef(readPL, root, decomps, *sIt, decompsToOffsets[*sIt],
1025 fieldNameStream.str(), fielddef);
1027 fielddef->m_elementIDs = groupsToElmts[*sIt];
1028 fielddefs.push_back(fielddef);
1032 std::vector<NekDouble> decompFieldData;
1034 readPL, data_dset, data_fspace,
1035 decompsToOffsets[*sIt].data, decomps, *sIt, fielddef,
1037 fielddata.push_back(decompFieldData);
1056 std::vector<uint64_t> &decomps,
1062 std::stringstream prfx;
1063 prfx <<
m_comm->GetRank() <<
": FieldIOHdf5::ImportFieldDefsHdf5(): ";
1066 ASSERTL1(field, prfx.str() +
"cannot open field group, " + group +
'.');
1068 def->m_uniOrder =
false;
1072 for (; attrIt != attrEnd; ++attrIt)
1074 const std::string &attrName = *attrIt;
1075 if (attrName ==
"FIELDS")
1077 field->GetAttribute(attrName, def->m_fields);
1079 else if (attrName ==
"SHAPE")
1081 std::string shapeString;
1082 field->GetAttribute(attrName, shapeString);
1088 if (shapeString.find(
"Strips") != string::npos)
1090 def->m_homoStrips =
true;
1093 if ((loc = shapeString.find_first_of(
"-")) != string::npos)
1095 if (shapeString.find(
"Exp1D") != string::npos)
1097 def->m_numHomogeneousDir = 1;
1101 def->m_numHomogeneousDir = 2;
1104 shapeString.erase(loc, shapeString.length());
1119 ASSERTL0(valid, prfx.str() + std::string(
1120 "unable to correctly parse the shape type: ")
1121 .append(shapeString).c_str());
1123 else if (attrName ==
"BASIS")
1125 field->GetAttribute(attrName, def->m_basis);
1127 std::vector<BasisType>::const_iterator bIt = def->m_basis.begin();
1128 std::vector<BasisType>::const_iterator bEnd = def->m_basis.end();
1129 for (; bIt != bEnd; ++bIt)
1134 "unable to correctly parse the basis types.");
1137 else if (attrName ==
"HOMOGENEOUSLENGTHS")
1139 field->GetAttribute(attrName, def->m_homogeneousLengths);
1141 else if (attrName ==
"NUMMODESPERDIR")
1143 std::string numModesPerDir;
1144 field->GetAttribute(attrName, numModesPerDir);
1146 if (strstr(numModesPerDir.c_str(),
"UNIORDER:"))
1148 def->m_uniOrder =
true;
1150 numModesPerDir.c_str() + 9, def->m_numModes);
1153 "unable to correctly parse the number of modes.");
1156 else if (attrName ==
"POINTSTYPE")
1158 std::string pointsString;
1159 field->GetAttribute(attrName, pointsString);
1160 def->m_pointsDef =
true;
1162 std::vector<std::string> pointsStrings;
1164 pointsString.c_str(), pointsStrings);
1167 "unable to correctly parse the points types.");
1168 for (std::vector<std::string>::size_type i = 0;
1169 i < pointsStrings.size();
1187 "unable to correctly parse the points type: ")
1188 .append(pointsStrings[i])
1192 else if (attrName ==
"NUMPOINTSPERDIR")
1194 std::string numPointsPerDir;
1195 field->GetAttribute(attrName, numPointsPerDir);
1196 def->m_numPointsDef =
true;
1199 numPointsPerDir.c_str(), def->m_numPoints);
1202 "unable to correctly parse the number of points.");
1206 std::string errstr(
"unknown attribute: ");
1208 ASSERTL1(
false, prfx.str() + errstr.c_str());
1212 if (def->m_numHomogeneousDir >= 1)
1217 homz_fspace->SelectRange(offset.
homz, dsize);
1218 homz_dset->Read(def->m_homogeneousZIDs, homz_fspace, readPL);
1221 if (def->m_numHomogeneousDir >= 2)
1226 homy_fspace->SelectRange(offset.
homy, dsize);
1227 homy_dset->Read(def->m_homogeneousYIDs, homy_fspace, readPL);
1230 if (def->m_homoStrips)
1235 homs_fspace->SelectRange(offset.
homs, dsize);
1236 homs_dset->Read(def->m_homogeneousSIDs, homs_fspace, readPL);
1239 if (!def->m_uniOrder)
1244 order_fspace->SelectRange(offset.
order, dsize);
1245 order_dset->Read(def->m_numModes, order_fspace, readPL);
1266 std::vector<uint64_t> &decomps,
1269 std::vector<NekDouble> &fielddata)
1271 std::stringstream prfx;
1272 prfx <<
m_comm->GetRank() <<
": FieldIOHdf5::ImportFieldData(): ";
1275 uint64_t nFieldVals = nElemVals;
1277 data_fspace->SelectRange(data_i, nFieldVals);
1278 data_dset->Read(fielddata, data_fspace, readPL);
1282 fielddata.size() == datasize * fielddef->m_fields.size(),
1284 "input data is not the same length as header information.");
1295 const std::string &filename,
1323 pEnd = metadata->attr_end();
1324 for (; param != pEnd; ++param)
1326 std::string paramString = *param;
1327 if (paramString !=
"Provenance")
1329 std::string paramBodyStr;
1330 metadata->GetAttribute(paramString, paramBodyStr);
1331 fieldmetadatamap[paramString] = paramBodyStr;
boost::shared_ptr< H5DataSource > H5DataSourceSharedPtr
#define ASSERTL0(condition, msg)
static bool GenerateOrderedStringVector(const char *const str, std::vector< std::string > &vec)
boost::shared_ptr< Group > GroupSharedPtr
FieldIOHdf5(LibUtilities::CommSharedPtr pComm, bool sharedFilesystem)
Construct the FieldIO object for HDF5 output.
static bool GenerateOrderedVector(const char *const str, std::vector< unsigned int > &vec)
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 boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
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 ...
boost::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
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...
boost::shared_ptr< DataSet > DataSetSharedPtr
static DataTypeSharedPtr GetType()
void ImportHDF5FieldMetaData(DataSourceSharedPtr dataSource, FieldMetaDataMap &fieldmetadatamap)
Import field metadata from dataSource.
boost::shared_ptr< File > FileSharedPtr
boost::shared_ptr< DataType > DataTypeSharedPtr
boost::shared_ptr< PList > PListSharedPtr
FieldIOFactory & GetFieldIOFactory()
Returns the FieldIO factory.
std::map< std::string, std::string > FieldMetaDataMap
int CheckFieldDefinition(const FieldDefinitionsSharedPtr &fielddefs)
Check field definitions for correctness and return storage size.
const char *const ShapeTypeMap[]
boost::shared_ptr< DataSource > DataSourceSharedPtr
static const unsigned int HASH_DCMP_IDX
The hash of the field definition information, which defines the name of the attribute containing the ...
static DataSourceSharedPtr create(const std::string &fn, H5::PListSharedPtr parallelProps)
Static constructor for this data source.
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
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...
boost::shared_ptr< DataSpace > DataSpaceSharedPtr
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...
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 PListSharedPtr DatasetXfer()
Properties for raw data transfer.
int GetSize(const ConstArray< OneD, NekDouble > &x)
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 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.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
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 ...
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.
static PListSharedPtr FileAccess()
Properties for file access.
H5::FileSharedPtr Get()
Get H5::FileSharedPtr reference to file.
boost::shared_ptr< TagWriter > TagWriterSharedPtr
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...
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.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.