35#include <boost/algorithm/string.hpp>
36#include <boost/core/ignore_unused.hpp>
37#include <boost/filesystem.hpp>
46#define TIME_RESULT(verb, msg, timer) \
49 std::cout << " - " << msg << ": " << timer.TimePerTest(1) << "\n" \
58namespace SpatialDomains
67 "IO with HDF5 geometry");
98std::pair<size_t, size_t>
SplitWork(
size_t vecsize,
int rank,
int nprocs)
100 size_t div = vecsize / nprocs;
101 size_t rem = vecsize % nprocs;
104 return std::make_pair(rank * (div + 1), div + 1);
108 return std::make_pair((rank - rem) * div + rem * (div + 1), div);
112template <class T, typename std::enable_if<T::kDim == 0, int>::type = 0>
115 boost::ignore_unused(geomMap);
119template <class T, typename std::enable_if<T::kDim == 1, int>::type = 0>
120inline int GetGeomDataDim(std::map<
int, std::shared_ptr<T>> &geomMap)
122 boost::ignore_unused(geomMap);
126template <class T, typename std::enable_if<T::kDim == 2, int>::type = 0>
127inline int GetGeomDataDim(std::map<
int, std::shared_ptr<T>> &geomMap)
129 boost::ignore_unused(geomMap);
133template <class T, typename std::enable_if<T::kDim == 3, int>::type = 0>
134inline int GetGeomDataDim(std::map<
int, std::shared_ptr<T>> &geomMap)
136 boost::ignore_unused(geomMap);
140template <
class... T>
inline void UniqueValues(std::unordered_set<int> &unique)
142 boost::ignore_unused(unique);
147 const std::vector<int> &input, T &...args)
159 "use-hdf5-node-comm",
"",
160 "Use a per-node communicator for HDF5 partitioning.");
175 const bool isRoot = comm->TreatAsRankZero();
187 TiXmlAttribute *attr =
m_xmlGeom->FirstAttribute();
193 std::string attrName(attr->Name());
194 if (attrName ==
"DIM")
197 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read mesh dimension.");
199 else if (attrName ==
"SPACE")
202 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read space dimension.");
204 else if (attrName ==
"PARTITION")
207 "PARTITION parameter should only be used in XML meshes");
209 else if (attrName ==
"HDF5FILE")
213 else if (attrName ==
"PARTITIONED")
216 "PARTITIONED parameter should only be used in XML meshes");
220 std::string errstr(
"Unknown attribute: ");
230 "Mesh dimension greater than space dimension.");
236 if (commMesh->GetSize() > 1)
239 parallelProps = H5::PList::FileAccess();
240 parallelProps->SetMpio(commMesh);
242 m_readPL = H5::PList::DatasetXfer();
248 auto root =
m_file->OpenGroup(
"NEKTAR");
249 ASSERTL0(root,
"Cannot find NEKTAR group in HDF5 file.");
251 auto root2 = root->OpenGroup(
"GEOMETRY");
252 ASSERTL0(root2,
"Cannot find NEKTAR/GEOMETRY group in HDF5 file.");
257 for (; attrIt != attrEnd; ++attrIt)
259 if (*attrIt ==
"FORMAT_VERSION")
265 "Unable to determine Nektar++ geometry HDF5 file version.");
270 " is higher than supported in "
271 "this version of Nektar++");
273 m_mesh = root2->OpenGroup(
"MESH");
274 ASSERTL0(
m_mesh,
"Cannot find NEKTAR/GEOMETRY/MESH group in HDF5 file.");
275 m_maps = root2->OpenGroup(
"MAPS");
276 ASSERTL0(
m_mesh,
"Cannot find NEKTAR/GEOMETRY/MAPS group in HDF5 file.");
289 std::vector<std::tuple<std::string, int, LibUtilities::ShapeType>>>
300 const bool verbRoot =
301 isRoot &&
m_session->DefinesCmdLineArgument(
"verbose");
305 std::cout <<
"Reading HDF5 geometry..." << std::endl;
313 int innerRank = 0, innerSize = 1,
314 interRank = interComm->GetRowComm()->GetRank(),
315 interSize = interComm->GetRowComm()->GetSize();
317 if (session->DefinesCmdLineArgument(
"use-hdf5-node-comm"))
319 ASSERTL0(comm->GetSize() == commMesh->GetSize(),
320 "--use-hdf5-node-comm not available with Parallel-in-Time")
322 auto splitComm = comm->SplitCommNode();
323 innerComm = splitComm.first;
324 interComm = splitComm.second;
325 innerRank = innerComm->GetRank();
326 innerSize = innerComm->GetSize();
330 interRank = interComm->GetRank();
331 interSize = interComm->GetSize();
337 std::unordered_set<int> toRead;
346 std::cout <<
" - beginning partitioning" << std::endl;
356 const bool verbRoot2 =
357 isRoot && session->DefinesCmdLineArgument(
"verbose");
360 std::vector<int> ids;
364 std::vector<MeshEntity> elmts;
365 std::unordered_map<int, int> row2id, id2row;
375 auto parallelProps = H5::PList::FileAccess();
376 parallelProps->SetMpio(interComm);
379 readPL = H5::PList::DatasetXfer();
380 readPL->SetDxMpioCollective();
381 file = H5::File::Open(
m_hdf5Name, H5F_ACC_RDONLY, parallelProps);
383 auto root = file->OpenGroup(
"NEKTAR");
384 auto root2 = root->OpenGroup(
"GEOMETRY");
385 mesh = root2->OpenGroup(
"MESH");
386 maps = root2->OpenGroup(
"MAPS");
392 std::string ds = std::get<0>(it);
394 if (!mesh->ContainsDataSet(ds))
402 vector<hsize_t> dims = space->GetDims();
406 vector<hsize_t> mdims = mspace->GetDims();
411 vector<int> tmpElmts, tmpIds;
412 mdata->Read(tmpIds, mspace, readPL);
413 data->Read(tmpElmts, space, readPL);
415 const int nGeomData = std::get<1>(it);
417 for (
int i = 0, cnt = 0; i < tmpIds.size(); ++i, ++rowCount)
420 row2id[rowCount] = tmpIds[i];
421 id2row[tmpIds[i]] = row2id[rowCount];
425 e.
list = std::vector<unsigned int>(&tmpElmts[cnt],
426 &tmpElmts[cnt + nGeomData]);
432 interComm->GetRowComm()->Block();
439 size_t numElmt = elmts.size();
440 ASSERTL0(commMesh->GetSize() <= numElmt,
441 "This mesh has more processors than elements!");
443 auto elRange =
SplitWork(numElmt, interRank, interSize);
446 std::map<int, MeshEntity> partElmts;
447 std::unordered_set<int> facetIDs;
451 for (
int el = elRange.first; el < elRange.first + elRange.second;
456 partElmts[el] = elmt;
458 for (
auto &facet : elmt.
list)
460 facetIDs.insert(facet);
467 for (
int i = 0; i < numElmt; ++i)
470 if (i >= elRange.first && i < elRange.first + elRange.second)
479 for (
auto &eId : elmt.
list)
481 if (facetIDs.find(eId) != facetIDs.end())
491 partElmts[elmt.
id] = elmt;
498 string partitionerName =
499 commMesh->GetSize() > 1 ?
"PtScotch" :
"Scotch";
502 partitionerName =
"ParMetis";
504 if (session->DefinesCmdLineArgument(
"use-parmetis"))
506 partitionerName =
"ParMetis";
508 if (session->DefinesCmdLineArgument(
"use-ptscotch"))
510 partitionerName =
"PtScotch";
519 TIME_RESULT(verbRoot2,
" - partitioner setup", t2);
522 partitioner->PartitionMesh(interSize,
true,
false, nLocal);
529 std::vector<unsigned int> nodeElmts;
530 partitioner->GetElementIDs(interRank, nodeElmts);
535 std::map<int, MeshEntity> partElmts;
536 std::unordered_map<int, int> row2elmtid, elmtid2row;
543 for (
auto &elmtRow : nodeElmts)
545 row2elmtid[vcnt] = elmts[elmtRow].origId;
546 elmtid2row[elmts[elmtRow].origId] = vcnt;
549 partElmts[vcnt++] = elmt;
562 TIME_RESULT(verbRoot2,
" - inner partition setup", t2);
565 partitioner->PartitionMesh(innerSize,
true,
false, 0);
568 TIME_RESULT(verbRoot2,
" - inner partitioning", t2);
572 for (
int i = 1; i < innerSize; ++i)
574 std::vector<unsigned int> tmp;
575 partitioner->GetElementIDs(i, tmp);
576 size_t tmpsize = tmp.size();
577 for (
int j = 0; j < tmpsize; ++j)
579 tmp[j] = row2elmtid[tmp[j]];
581 innerComm->Send(i, tmpsize);
582 innerComm->Send(i, tmp);
586 TIME_RESULT(verbRoot2,
" - inner partition scatter", t2);
588 std::vector<unsigned int> tmp;
589 partitioner->GetElementIDs(0, tmp);
591 for (
auto &tmpId : tmp)
593 toRead.insert(row2elmtid[tmpId]);
598 for (
auto &tmpId : nodeElmts)
600 toRead.insert(row2id[tmpId]);
609 innerComm->Recv(0, tmpSize);
610 std::vector<unsigned int> tmp(tmpSize);
611 innerComm->Recv(0, tmp);
613 for (
auto &tmpId : tmp)
615 toRead.insert(tmpId);
625 std::vector<int> vertIDs, segIDs, triIDs, quadIDs;
626 std::vector<int> tetIDs, prismIDs, pyrIDs, hexIDs;
627 std::vector<int> segData, triData, quadData, tetData;
628 std::vector<int> prismData, pyrData, hexData;
629 std::vector<NekDouble> vertData;
641 UniqueValues(toRead, hexData, pyrData, prismData, tetData);
686 for (
auto &edge : segIDs)
702 for (
auto &face : triIDs)
706 for (
auto &face : quadIDs)
731 if (
m_session->DefinesElement(
"NEKTAR/CONDITIONS"))
733 std::set<int> vBndRegionIdList;
734 TiXmlElement *vConditions =
735 new TiXmlElement(*
m_session->GetElement(
"Nektar/Conditions"));
736 TiXmlElement *vBndRegions =
737 vConditions->FirstChildElement(
"BOUNDARYREGIONS");
744 vItem = vBndRegions->FirstChildElement();
747 std::string vSeqStr = vItem->FirstChild()->ToText()->Value();
748 std::string::size_type indxBeg = vSeqStr.find_first_of(
'[') + 1;
749 std::string::size_type indxEnd = vSeqStr.find_last_of(
']') - 1;
750 vSeqStr = vSeqStr.substr(indxBeg, indxEnd - indxBeg + 1);
752 std::vector<unsigned int> vSeq;
755 int p = atoi(vItem->Attribute(
"ID"));
757 vItem = vItem->NextSiblingElement();
766template <
class T,
typename DataType>
768 std::map<
int, std::shared_ptr<T>> &geomMap,
int id, DataType *data,
771 boost::ignore_unused(geomMap,
id, data, curve);
776 std::map<
int, std::shared_ptr<PointGeom>> &geomMap,
int id,
NekDouble *data,
779 boost::ignore_unused(curve);
786 std::map<
int, std::shared_ptr<SegGeom>> &geomMap,
int id,
int *data,
796 std::map<
int, std::shared_ptr<TriGeom>> &geomMap,
int id,
int *data,
806 std::map<
int, std::shared_ptr<QuadGeom>> &geomMap,
int id,
int *data,
816 std::map<
int, std::shared_ptr<TetGeom>> &geomMap,
int id,
int *data,
819 boost::ignore_unused(curve);
828 geomMap[id] = tetGeom;
833 std::map<
int, std::shared_ptr<PyrGeom>> &geomMap,
int id,
int *data,
836 boost::ignore_unused(curve);
843 geomMap[id] = pyrGeom;
848 std::map<
int, std::shared_ptr<PrismGeom>> &geomMap,
int id,
int *data,
851 boost::ignore_unused(curve);
858 geomMap[id] = prismGeom;
863 std::map<
int, std::shared_ptr<HexGeom>> &geomMap,
int id,
int *data,
866 boost::ignore_unused(curve);
877 geomMap[id] = hexGeom;
880template <
class T,
typename DataType>
882 const CurveMap &curveMap, std::vector<int> &ids,
883 std::vector<DataType> &geomData)
886 const int nRows = geomData.size() / nGeomData;
890 if (curveMap.size() > 0)
892 for (
int i = 0, cnt = 0; i < nRows; i++, cnt += nGeomData)
894 auto cIt = curveMap.find(ids[i]);
896 cIt == curveMap.end() ? empty : cIt->second);
901 for (
int i = 0, cnt = 0; i < nRows; i++, cnt += nGeomData)
908template <
class T,
typename DataType>
911 const std::unordered_set<int> &readIds,
912 std::vector<int> &ids,
913 std::vector<DataType> &geomData)
915 if (!
m_mesh->ContainsDataSet(dataSet))
923 vector<hsize_t> dims = space->GetDims();
928 vector<hsize_t> mdims = mspace->GetDims();
930 ASSERTL0(mdims[0] == dims[0],
"map and data set lengths do not match");
936 mdata->Read(allIds, mspace);
943 std::vector<hsize_t> coords;
944 for (
auto &
id : allIds)
946 if (readIds.find(
id) != readIds.end())
948 for (
int j = 0; j < nGeomData; ++j)
958 space->SetSelection(coords.size() / 2, coords);
961 data->Read(geomData, space,
m_readPL);
965 const std::unordered_set<int> &readIds)
968 if (!
m_mesh->ContainsDataSet(dsName))
982 vector<int> ids, newIds;
983 idData->Read(ids, idSpace);
984 curveSpace->ClearRange();
987 vector<hsize_t> curveSel;
992 if (readIds.find(
id) != readIds.end())
994 curveSel.push_back(cnt);
995 curveSel.push_back(0);
996 curveSel.push_back(cnt);
997 curveSel.push_back(1);
998 curveSel.push_back(cnt);
999 curveSel.push_back(2);
1000 newIds.push_back(
id);
1007 auto toRead = newIds.size();
1008 m_session->GetComm()->GetRowComm()->AllReduce(toRead,
1017 vector<int> curveInfo;
1018 curveSpace->SetSelection(curveSel.size() / 2, curveSel);
1019 curveData->Read(curveInfo, curveSpace,
m_readPL);
1023 std::unordered_map<int, int> curvePtOffset;
1026 for (
int i = 0, cnt = 0, cnt2 = 0; i < curveInfo.size() / 3; ++i, cnt += 3)
1031 curve->m_points.resize(curveInfo[cnt]);
1033 const int ptOffset = curveInfo[cnt + 2];
1035 for (
int j = 0; j < curveInfo[cnt]; ++j)
1039 curveSel.push_back(ptOffset + j);
1040 curveSel.push_back(0);
1041 curveSel.push_back(ptOffset + j);
1042 curveSel.push_back(1);
1043 curveSel.push_back(ptOffset + j);
1044 curveSel.push_back(2);
1049 curvePtOffset[newIds[i]] = 3 * cnt2;
1050 cnt2 += curveInfo[cnt];
1052 curveMap[newIds[i]] = curve;
1061 nodeSpace->ClearRange();
1062 nodeSpace->SetSelection(curveSel.size() / 2, curveSel);
1064 vector<NekDouble> nodeRawData;
1065 nodeData->Read(nodeRawData, nodeSpace,
m_readPL);
1068 for (
auto &cIt : curvePtOffset)
1073 int cnt = cIt.second;
1074 for (
int i = 0; i < curve->m_points.size(); ++i, cnt += 3)
1078 nodeRawData[cnt + 2]);
1087 map<int, CompositeSharedPtr> fullDomain;
1091 vector<string> data;
1092 dst->ReadVectorString(data, space,
m_readPL);
1099 std::vector<CompositeMap> fullDomain;
1103 vector<string> data;
1104 dst->ReadVectorString(data, space,
m_readPL);
1105 for (
auto &dIt : data)
1115 mdata->Read(ids, mspace);
1117 for (
int i = 0; i < ids.size(); ++i)
1125 string nm =
"COMPOSITE";
1129 vector<hsize_t> dims = space->GetDims();
1131 vector<string> comps;
1132 data->ReadVectorString(comps, space);
1136 vector<hsize_t> mdims = mspace->GetDims();
1139 mdata->Read(ids, mspace);
1141 for (
int i = 0; i < dims[0]; i++)
1143 string compStr = comps[i];
1146 istringstream strm(compStr);
1152 string::size_type indxBeg = compStr.find_first_of(
'[') + 1;
1153 string::size_type indxEnd = compStr.find_last_of(
']') - 1;
1155 string indxStr = compStr.substr(indxBeg, indxEnd - indxBeg + 1);
1156 vector<unsigned int> seqVector;
1164 for (
auto &i : seqVector)
1169 comp->m_geomVec.push_back(it->second);
1175 for (
auto &i : seqVector)
1180 comp->m_geomVec.push_back(it->second);
1185 for (
auto &i : seqVector)
1192 comp->m_geomVec.push_back(it->second);
1198 for (
auto &i : seqVector)
1205 comp->m_geomVec.push_back(it->second);
1211 for (
auto &i : seqVector)
1218 comp->m_geomVec.push_back(it1->second);
1226 comp->m_geomVec.push_back(it2->second);
1232 for (
auto &i : seqVector)
1239 comp->m_geomVec.push_back(it->second);
1245 for (
auto &i : seqVector)
1252 comp->m_geomVec.push_back(it->second);
1258 for (
auto &i : seqVector)
1265 comp->m_geomVec.push_back(it->second);
1271 for (
auto &i : seqVector)
1278 comp->m_geomVec.push_back(it->second);
1285 if (comp->m_geomVec.size() > 0)
1293 std::unordered_map<int, int> &id2row)
1297 string nm =
"COMPOSITE";
1301 vector<hsize_t> dims = space->GetDims();
1303 vector<string> comps;
1304 data->ReadVectorString(comps, space);
1308 vector<hsize_t> mdims = mspace->GetDims();
1311 mdata->Read(ids, mspace);
1313 for (
int i = 0; i < dims[0]; i++)
1315 string compStr = comps[i];
1318 istringstream strm(compStr);
1322 string::size_type indxBeg = compStr.find_first_of(
'[') + 1;
1323 string::size_type indxEnd = compStr.find_last_of(
']') - 1;
1325 string indxStr = compStr.substr(indxBeg, indxEnd - indxBeg + 1);
1326 vector<unsigned int> seqVector;
1364 std::vector<int> filteredVector;
1365 for (
auto &compElmt : seqVector)
1367 if (id2row.find(compElmt) == id2row.end())
1372 filteredVector.push_back(compElmt);
1375 if (filteredVector.size() == 0)
1380 ret[ids[i]] = std::make_pair(shapeType, filteredVector);
1386template <class T, typename std::enable_if<T::kDim == 0, int>::type = 0>
1392template <class T, typename std::enable_if<T::kDim == 1, int>::type = 0>
1395 return geom->GetVid(i);
1398template <class T, typename std::enable_if<T::kDim == 2, int>::type = 0>
1399inline int GetGeomData(std::shared_ptr<T> &geom,
int i)
1401 return geom->GetEid(i);
1404template <class T, typename std::enable_if<T::kDim == 3, int>::type = 0>
1405inline int GetGeomData(std::shared_ptr<T> &geom,
int i)
1407 return geom->GetFid(i);
1412 std::string datasetName)
1414 typedef typename std::conditional<std::is_same<T, PointGeom>::value,
1418 const size_t nGeom = geomMap.size();
1426 vector<int> idMap(nGeom);
1427 vector<DataType> data(nGeom * nGeomData);
1429 int cnt1 = 0, cnt2 = 0;
1430 for (
auto &it : geomMap)
1432 idMap[cnt1++] = it.first;
1434 for (
int j = 0; j < nGeomData; ++j)
1442 vector<hsize_t> dims = {
static_cast<hsize_t
>(nGeom),
1443 static_cast<hsize_t
>(nGeomData)};
1448 dst->Write(data, ds);
1450 tp = H5::DataType::OfObject(idMap[0]);
1452 ds = std::shared_ptr<H5::DataSpace>(
new H5::DataSpace(dims));
1453 dst =
m_maps->CreateDataSet(datasetName, tp, ds);
1454 dst->Write(idMap, ds);
1461 vector<int> data, map;
1464 for (
auto &c : curves)
1466 map.push_back(c.first);
1467 data.push_back(c.second->m_points.size());
1468 data.push_back(c.second->m_ptype);
1469 data.push_back(ptOffset);
1471 ptOffset += c.second->m_points.size();
1473 for (
auto &pt : c.second->m_points)
1477 pt->GetCoords(v.
x, v.
y, v.
z);
1478 curvedPts.
pts.push_back(v);
1479 curvedPts.
index.push_back(newIdx++);
1484 vector<hsize_t> dims = {data.size() / 3, 3};
1489 dst->Write(data, ds);
1491 tp = H5::DataType::OfObject(map[0]);
1492 dims = {map.size()};
1493 ds = std::shared_ptr<H5::DataSpace>(
new H5::DataSpace(dims));
1494 dst =
m_maps->CreateDataSet(dsName, tp, ds);
1495 dst->Write(map, ds);
1500 vector<double> vertData(curvedPts.
pts.size() * 3);
1503 for (
auto &pt : curvedPts.
pts)
1505 vertData[cnt++] = pt.x;
1506 vertData[cnt++] = pt.y;
1507 vertData[cnt++] = pt.z;
1510 vector<hsize_t> dims = {curvedPts.
pts.size(), 3};
1515 dst->Write(vertData, ds);
1520 vector<string> comps;
1527 for (
auto &cIt : composites)
1529 if (cIt.second->m_geomVec.size() == 0)
1535 c_map.push_back(cIt.first);
1541 dst->WriteVectorString(comps, ds, tp);
1543 tp = H5::DataType::OfObject(c_map[0]);
1544 ds = H5::DataSpace::OneD(c_map.size());
1545 dst =
m_maps->CreateDataSet(
"COMPOSITE", tp, ds);
1546 dst->Write(c_map, ds);
1555 std::vector<vector<unsigned int>> idxList;
1558 for (
auto &dIt : domain)
1560 idxList.push_back(std::vector<unsigned int>());
1561 for (
auto cIt = dIt.second.begin(); cIt != dIt.second.end(); ++cIt)
1563 idxList[cnt].push_back(cIt->first);
1567 d_map.push_back(dIt.first);
1570 stringstream domString;
1571 vector<string> doms;
1572 for (
auto &cIt : idxList)
1580 dst->WriteVectorString(doms, ds, tp);
1582 tp = H5::DataType::OfObject(d_map[0]);
1583 ds = H5::DataSpace::OneD(d_map.size());
1584 dst =
m_maps->CreateDataSet(
"DOMAIN", tp, ds);
1585 dst->Write(d_map, ds);
1589 std::string &outfilename,
bool defaultExp,
1592 boost::ignore_unused(metadata);
1595 boost::split(tmp, outfilename, boost::is_any_of(
"."));
1596 string filenameXml = tmp[0] +
".xml";
1597 string filenameHdf5 = tmp[0] +
".nekg";
1606 TiXmlDocument *doc =
new TiXmlDocument;
1608 TiXmlElement *geomTag;
1610 if (boost::filesystem::exists(filenameXml.c_str()))
1612 ifstream file(filenameXml.c_str());
1614 TiXmlHandle docHandle(doc);
1615 root = docHandle.FirstChildElement(
"NEKTAR").Element();
1616 ASSERTL0(root,
"Unable to find NEKTAR tag in file.");
1617 geomTag = root->FirstChildElement(
"GEOMETRY");
1622 TiXmlDeclaration *decl =
new TiXmlDeclaration(
"1.0",
"utf-8",
"");
1623 doc->LinkEndChild(decl);
1624 root =
new TiXmlElement(
"NEKTAR");
1625 doc->LinkEndChild(root);
1627 geomTag =
new TiXmlElement(
"GEOMETRY");
1628 root->LinkEndChild(geomTag);
1634 geomTag->SetAttribute(
"HDF5FILE", filenameHdf5);
1640 TiXmlElement *expTag =
new TiXmlElement(
"EXPANSIONS");
1647 TiXmlElement *exp =
new TiXmlElement(
"E");
1650 "C[" + boost::lexical_cast<string>(it->first) +
"]");
1651 exp->SetAttribute(
"NUMMODES", 4);
1652 exp->SetAttribute(
"TYPE",
"MODIFIED");
1653 exp->SetAttribute(
"FIELDS",
"u");
1655 expTag->LinkEndChild(exp);
1658 root->LinkEndChild(expTag);
1661 doc->SaveFile(filenameXml);
1668 m_file = H5::File::Create(filenameHdf5, H5F_ACC_TRUNC);
1669 auto hdfRoot =
m_file->CreateGroup(
"NEKTAR");
1670 auto hdfRoot2 = hdfRoot->CreateGroup(
"GEOMETRY");
1676 m_mesh = hdfRoot2->CreateGroup(
"MESH");
1677 m_maps = hdfRoot2->CreateGroup(
"MAPS");
1695 int ptOffset = 0, newIdx = 0;
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define TIME_RESULT(verb, msg, timer)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
static void GetXMLElementTimeLevel(TiXmlElement *&element, const size_t timeLevel, const bool disableCheck=true)
Get XML elment time level (Parallel-in-Time)
static std::string RegisterCmdLineFlag(const std::string &pName, const std::string &pShortName, const std::string &pDescription)
Registers a command-line flag with the session reader.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static std::string GenerateSeqString(const std::vector< T > &v)
Generate a compressed comma-separated string representation of a vector of unsigned integers.
static bool GenerateSeqVector(const std::string &str, std::vector< unsigned int > &out)
Takes a comma-separated compressed string and converts it to entries in a vector.
void FillGeomMap(std::map< int, std::shared_ptr< T > > &geomMap, const CurveMap &curveMap, std::vector< int > &ids, std::vector< DataType > &geomData)
void ConstructGeomObject(std::map< int, std::shared_ptr< T > > &geomMap, int id, DataType *data, CurveSharedPtr curve)
virtual void v_PartitionMesh(LibUtilities::SessionReaderSharedPtr session) override
Partition the mesh.
void ReadCurveMap(CurveMap &curveMap, std::string dsName, const std::unordered_set< int > &readIds)
static const unsigned int FORMAT_VERSION
Version of the Nektar++ HDF5 geometry format, which is embedded into the main NEKTAR/GEOMETRY group a...
static std::string className
virtual void v_ReadGeometry(LibUtilities::DomainRangeShPtr rng, bool fillGraph) override
void WriteComposites(CompositeMap &comps)
virtual void v_WriteGeometry(std::string &outfilename, bool defaultExp=false, const LibUtilities::FieldMetaDataMap &metadata=LibUtilities::NullFieldMetaDataMap) override
static std::string cmdSwitch
void WriteCurvePoints(MeshCurvedPts &curvedPts)
LibUtilities::H5::GroupSharedPtr m_maps
static MeshGraphSharedPtr create()
LibUtilities::H5::PListSharedPtr m_readPL
unsigned int m_inFormatVersion
LibUtilities::H5::FileSharedPtr m_file
void WriteGeometryMap(std::map< int, std::shared_ptr< T > > &geomMap, std::string datasetName)
void ReadGeometryData(std::map< int, std::shared_ptr< T > > &geomMap, std::string dataSet, const std::unordered_set< int > &readIds, std::vector< int > &ids, std::vector< DataType > &geomData)
void WriteDomain(std::map< int, CompositeMap > &domain)
LibUtilities::H5::GroupSharedPtr m_mesh
void WriteCurveMap(CurveMap &curves, std::string dsName, MeshCurvedPts &curvedPts, int &ptOffset, int &newIdx)
bool CheckRange(Geometry2D &geom)
Check if goemetry is in range definition if activated.
PrismGeomMap m_prismGeoms
void PopulateFaceToElMap(Geometry3DSharedPtr element, int kNfaces)
Given a 3D geometry object #element, populate the face to element map m_faceToElMap which maps faces ...
Geometry2DSharedPtr GetGeometry2D(int gID)
LibUtilities::SessionReaderSharedPtr m_session
std::map< int, CompositeMap > m_domain
CompositeOrdering m_compOrder
void GetCompositeList(const std::string &compositeStr, CompositeMap &compositeVector) const
CompositeMap m_meshComposites
std::string GetCompositeString(CompositeSharedPtr comp)
Returns a string representation of a composite.
SegGeomSharedPtr GetSegGeom(int id)
CompositeDescriptor CreateCompositeDescriptor()
PointGeomSharedPtr GetVertex(int id)
LibUtilities::DomainRangeShPtr m_domainRange
BndRegionOrdering m_bndRegOrder
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
std::map< std::string, std::string > FieldMetaDataMap
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< DomainRange > DomainRangeShPtr
CommFactory & GetCommFactory()
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
NekDouble GetGeomData(std::shared_ptr< T > &geom, int i)
std::shared_ptr< QuadGeom > QuadGeomSharedPtr
int GetGeomDataDim(std::map< int, std::shared_ptr< T > > &geomMap)
std::map< int, std::pair< LibUtilities::ShapeType, std::vector< int > > > CompositeDescriptor
MeshPartitionFactory & GetMeshPartitionFactory()
std::pair< size_t, size_t > SplitWork(size_t vecsize, int rank, int nprocs)
Utility function to split a vector equally amongst a number of processors.
std::shared_ptr< Composite > CompositeSharedPtr
std::shared_ptr< Curve > CurveSharedPtr
std::unordered_map< int, CurveSharedPtr > CurveMap
std::shared_ptr< SegGeom > SegGeomSharedPtr
std::shared_ptr< PointGeom > PointGeomSharedPtr
std::shared_ptr< Geometry2D > Geometry2DSharedPtr
std::shared_ptr< MeshPartition > MeshPartitionSharedPtr
std::shared_ptr< TriGeom > TriGeomSharedPtr
MeshGraphFactory & GetMeshGraphFactory()
void UniqueValues(std::unordered_set< int > &unique)
std::map< int, CompositeSharedPtr > CompositeMap
The above copyright notice and this permission notice shall be included.
std::vector< MeshVertex > pts
mapping to access pts value.
std::vector< NekInt64 > index
id of this Point set
std::vector< unsigned int > list