35 struct PartitionOptions;
73 return std::make_tuple(
91 return std::make_tuple(
111 return std::make_tuple(
121 return std::make_tuple(
186 std::vector<Geom::NodeIndexPBI>
ret;
198 std::vector<Geom::NodeIndexPBI>
ret;
229 template <
class TPair>
232 if (pair.trans.pLGhostMapping)
235 "EnsureGhostMapping: pLGlobalMapping must be set first");
237 pair.trans.pLGlobalMapping,
238 pair.father->Size(),
mpi);
246 template <
class TPair>
254 auto result = pair.trans.pLGhostMapping->search_indexAppend(
iGlobal, rank, val);
266 template <
class TPair>
275 return pair.trans.pLGhostMapping->operator()(-1,
iLocal);
284 template <
class TPair>
292 if (
iLocal >= pair.father->Size())
294 return pair.father->pLGlobalMapping->operator()(
mpi.
rank,
iLocal);
303 template <
class TPair>
309 auto [
ret, rank, val] = pair.father->pLGlobalMapping->search(
iGlobal);
365 template <
class TAdj,
class TFn>
380 template <
class TAdj,
class TFn>
384# pragma omp parallel for
408 template <
class TPair,
class TFn>
412 auto tmp = std::make_shared<TArr>(*pair.father);
413 if constexpr (TPair::IsCSR())
414 pair.father->Decompress();
418 if constexpr (TPair::IsCSR())
419 pair.father->ResizeRow(
iNew,
tmp->RowSize(
i));
423 if constexpr (TPair::IsCSR())
424 pair.father->Compress();
428 const tPoint &translation1,
431 const tPoint &translation2,
434 const tPoint &translation3,
518 const std::unordered_set<AdjKind, AdjKindHash> &
skip)
const;
535 const std::unordered_set<EntityKind> &destroyKinds = {});
574 const ReorderInput &
input,
575 const ReorderRegistry &
reg);
686 return bnd2node.father->globalSize();
714 template <
class tC2n>
717 cs.resize(Eigen::NoChange,
c2n.size());
733 template <
class tC2n,
class tCoordExt>
736 cs.resize(Eigen::NoChange,
c2n.size());
752 template <
class tC2n,
class tC2nPbi>
755 cs.resize(Eigen::NoChange,
c2n.size());
771 template <
class tC2n,
class tC2nPbi,
class tCoordExt>
774 cs.resize(Eigen::NoChange,
c2n.size());
865 template <
class FA,
class FB,
class F0 = std::function<
void(
void)>>
914 const std::string &name,
922 void ReadDistributed_EvenSplitRead(
929 std::vector<MPI_int> ReadDistributed_PartitionParMetis(
934 struct EntityPartitions
938 std::vector<MPI_int> bndPartition;
940 EntityPartitions ReadDistributed_DeriveEntityPartitions(
944 void ReadDistributed_Redistribute(
948 void ReadDistributed_RedistributeLegacy(
952 template <
class TFTrans>
1026 template <
typename F>
1035 template <DeviceBackend B>
1038 template <DeviceBackend B>
1050 bytes +=
v.ref.father->FullSizeBytes();
1052 bytes +=
v.ref.son->FullSizeBytes();
1113 int ascii_precision{16};
1114 std::string vtuFloatEncodeMode =
"ascii";
1184 template <
class tC2n,
class tCoordExt>
1187 cs.resize(Eigen::NoChange, c2n.size());
1191 cs(EigenAll,
i) = coo->operator[](iNode);
1198 template <
class tC2n,
class tC2nPbi,
class tCoordExt>
1201 cs.resize(Eigen::NoChange, c2n.size());
1205 cs(EigenAll,
i) =
mesh->periodicInfo.GetCoordByBits(coo->operator[](iNode), c2nPbi[
i]);
1213 if (!
mesh->isPeriodic)
1220 :
mesh(std::move(n_mesh)),
mRank(n_mRank) {}
1237 AutoAppendName2ID appended_name2id;
1239 return appended_name2id;
1301 int arraySiz,
int arraySizPoint,
1306 double t,
int flag);
1313 std::string fname, std::string seriesName,
1314 int arraySiz,
int vecArraySiz,
int arraySizPoint,
int vecArraySizPoint,
1323 double t,
int flag = 0);
1328 vtuFloatEncodeMode =
v;
Adjacency array (CSR-like index storage) built on ParArray.
Eigen-vector array: each row is an Eigen::Map over contiguous real storage.
Father-son array pairs with device views and ghost communication.
Core 2D variable-length array container with five data layouts.
pybind11-style configuration registration with macro-based field declaration and namespace-scoped tag...
#define DNDS_FIELD(name_, desc_,...)
Register a field inside a DNDS_DECLARE_CONFIG body.
Device memory abstraction layer with backend-specific storage and factory creation.
CRTP mixin that provides uniform to_device/to_host/device/getDeviceArrayBytes for classes that enumer...
#define DNDS_assert_info(expr, info)
Debug-only assertion with an extra std::string info message.
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
#define DNDS_check_throw_info(expr, info)
Same as DNDS_check_throw but attaches a user-supplied info message to the thrown std::runtime_error.
Layered DAG of mesh adjacency relations with composable DSL operations.
Tiny reflection-style helpers (MemberRef, MemberPtr) and for_each_member_* visitors used by config / ...
#define DNDS_MAKE_1_MEMBER_REF(x)
Construct a MemberRef capturing x and its stringified name.
Distributed entity reordering framework: ReorderRegistry, ReorderPlan, ReorderInput.
CRTP mixin giving a class uniform to_device / to_host / device / getDeviceArrayBytes methods.
EnumValuesTag enum_values(std::vector< std::string > vals)
Create an enum allowed-values tag.
RangeTag range(double min)
Create a minimum-only range constraint.
decltype(tAdj1Pair::father) tAdj1
std::function< std::string(int)> tFGetName
tFGetData tFDataFieldQuery
@ SerialReadAndDistribute
std::function< std::string(int)> tFDataFieldName
decltype(tAdj2Pair::father) tAdj2
decltype(tAdjPair::father) tAdj
std::function< DNDS::real(int, DNDS::index)> tFGetData
std::function< DNDS::real(int, DNDS::index, DNDS::rowsize)> tFGetVecData
DNDS::ssp< DNDS::ParArray< ElemInfo > > tElemInfoArray
std::function< std::string(t_index)> t_FBCID_2_Name
Eigen::Matrix< real, 3, Eigen::Dynamic > tSmallCoords
DNDS_DEVICE_CALLABLE bool FaceIDIsPeriodic(t_index id)
DNDS_DEVICE_CALLABLE bool FaceIDIsPeriodicDonor(t_index id)
DNDS_DEVICE_CALLABLE bool FaceIDIsPeriodicMain(t_index id)
std::function< t_index(const std::string &)> t_FBCName_2_ID
decltype(tPbiPair::father) tPbi
decltype(tCoordPair::father) tCoord
std::vector< std::vector< index > > tLocalMatStruct
void AllreduceOneIndex(index &v, MPI_Op op, const MPIInfo &mpi)
Single-scalar Allreduce helper for indices (in-place, count = 1).
ssp< SerializerBase > SerializerBaseSSP
DNDS_CONSTANT const index UnInitIndex
Sentinel "not initialised" index value (= INT64_MIN).
int32_t rowsize
Row-width / per-row element-count type (signed 32-bit).
constexpr MPI_int UnInitMPIInt
Sentinel "not initialised" MPI_int value (= -1, invalid rank).
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
std::shared_ptr< T > ssp
Shortened alias for std::shared_ptr used pervasively in DNDSR.
void for_each_member_list(TList &&obj_member_list, F &&f)
Invoke f(member) for every element of a std::tuple of members.
double real
Canonical floating-point scalar used throughout DNDSR (double precision).
int MPI_int
MPI counterpart type for MPI_int (= C int). Used for counts and ranks in MPI calls.
ssp< TArray > father
Owned-side array (must be resized before ghost setup).
index Size() const
Combined row count (father->Size() + son->Size()).
ssp< TArray > son
Ghost-side array (sized automatically by createMPITypes / BorrowAndPull).
static t_pLGhostMapping makeFatherOnlyMapping(const ssp< GlobalOffsetsMapping > &globalMapping, index fatherSize, const MPIInfo &mpi)
Create a ghost mapping with no ghost entries (father-only).
DNDS_DECLARE_CONFIG(PartitionOptions)
DNDS_DEVICE_CALLABLE auto GetVectorByBits(const Eigen::Matrix< real, dim, nVec > &v, const NodePeriodicBits &bits)
DNDS_DEVICE_CALLABLE tPoint GetCoordByBits(const tPoint &c, const NodePeriodicBits &bits) const
void SetASCIIPrecision(int n)
void MeshPartitionCell2Cell(const PartitionOptions &options)
void GetCoordsOnCellSerial(index iCell, tSmallCoords &cs, tCoord &coo)
analog of mesh's method
DNDS::ArrayTransformerType< tCoord::element_type >::Type coordSerialOutTrans
void GetCurrentOutputArrays(int flag, tCoordPair &coordOut, tAdjPair &cell2nodeOut, tPbiPair &cell2nodePbiOut, tElemInfoArrayPair &cellElemInfoOut, index &nCell, index &nNode)
void ReadFromOpenFOAMAndConvertSerial(const std::string &fName, const std::map< std::string, std::string > &nameMapping, const t_FBCName_2_ID &FBCName_2_ID=FBC_Name_2_ID_Default)
DNDS::ArrayTransformerType< tElemInfoArray::element_type >::Type cellElemInfoSerialOutTrans
void ReadFromCGNSSerial(const std::string &fName, const t_FBCName_2_ID &FBCName_2_ID)
reads a cgns file as serial input
void BuildSerialOut()
should be called to build data for serial out
void _detail_GetCoordsOnElemSerial(const tC2n &c2n, const tC2nPbi &c2nPbi, tSmallCoords &cs, tCoordExt &coo)
specially for periodicity, analog of mesh's method
DNDS::ArrayTransformerType< tAdj::element_type >::Type cell2nodeSerialOutTrans
void SetVTKFloatEncodeMode(const std::string &v)
tAdj cell2cellSerialFacial
tElemInfoArray bndElemInfoSerial
DNDS::ssp< UnstructuredMesh > mesh
void PartitionReorderToMeshCell2Cell()
void PrintSerialPartVTKDataArray(std::string fname, std::string seriesName, int arraySiz, int vecArraySiz, int arraySizPoint, int vecArraySizPoint, const tFGetName &names, const tFGetData &data, const tFGetName &vectorNames, const tFGetVecData &vectorData, const tFGetName &namesPoint, const tFGetData &dataPoint, const tFGetName &vectorNamesPoint, const tFGetVecData &vectorDataPoint, double t, int flag=0)
names(idata) data(idata, ivolume)
DNDS::ArrayTransformerType< tPbi::element_type >::Type cell2nodePbiSerialOutTrans
DNDS::ArrayTransformerType< tAdj::element_type >::Type bnd2nodeSerialOutTrans
DNDS::ArrayTransformerType< tElemInfoArray::element_type >::Type bndElemInfoSerialOutTrans
auto ReadFromCGNSSerial(const std::string &fName)
void PrintSerialPartPltBinaryDataArray(std::string fname, int arraySiz, int arraySizPoint, const tFGetName &names, const tFGetData &data, const tFGetName &namesPoint, const tFGetData &dataPoint, double t, int flag)
names(idata) data(idata, ivolume) https://tecplot.azureedge.net/products/360/current/360_data_format_...
void Deduplicate1to1Periodic(real search_eps=1e-8)
void BuildCell2Cell()
build cell2cell topology, with node-neighbors included
std::vector< DNDS::MPI_int > cellPartition
std::vector< DNDS::MPI_int > bndPartition
tAdj1 node2nodeOrigSerial
tAdj1 cell2cellOrigSerial
void _detail_GetCoordsSerial(const tC2n &c2n, tSmallCoords &cs, tCoordExt &coo)
directly load coords; gets faulty if isPeriodic!, analog of mesh's method
UnstructuredMeshSerialRW(decltype(mesh) n_mesh, DNDS::MPI_int n_mRank)
tElemInfoArray cellElemInfoSerial
std::vector< DNDS::MPI_int > nodePartition
RBF::RBFKernelType kernel
DNDS_DECLARE_CONFIG(WallDistOptions)
index NumFaceGhost() const
tCoordPair nodeWallDist
wall dist:
void AdjLocal2GlobalN2CB()
UnstructuredMeshDeviceView< B > t_deviceView
index BndIndexGlobal2Local_NoSon(index i)
index NodeIndexGlobal2Local_NoSon(index i)
auto device_array_list_facial()
void BuildGhostPrimaryLegacy()
tCoordPair coordsPeriodicRecreated
auto device_array_list_primary()
Elem::Element GetCellElement(index iC)
void RecreatePeriodicNodes()
tPbiPair cell2nodePbi
periodic only, after reader
AdjPairTracked< tAdjPair > cell2cellFace
constructed on demand
UnstructuredMesh(const DNDS::MPIInfo &n_mpi, int n_dim)
tCoordPair coordsElevDisp
only elevation
void fillRegistry(MeshConnectivity &dag) const
Populate a MeshConnectivity registry from this mesh's currently-built adjacencies.
void ElevatedNodesSolveInternalSmooth()
std::unordered_map< index, index > face2bndM
void RecoverCell2CellAndBnd2CellLegacy()
void ReorderLocalCellsLegacy(int nParts=1, int nPartsInner=1)
Legacy implementation preserved for reference/fallback.
void GetCoordsOnCell(index iCell, tSmallCoords &cs, tCoordPair &coo)
index NumNodeProc() const
index CellIndexLocal2Global_NoSon(index i)
tPbiPair face2nodePbi
periodic only, after interpolated
AdjPairTracked< tAdj1Pair > face2bnd
static void ConvertAdjEntriesOMP(TAdj &adj, index nRows, TFn &&fn)
OpenMP-parallelized variant of ConvertAdjEntries.
std::vector< index > node2bndNode
tPoint GetCoordNodeOnFace(index iFace, rowsize if2n)
auto CellOtherCellPeriodicHandle(index iFace, rowsize if2c, FA &&fA, FB &&fB, F0 &&f0=[]() {})
fA executes when if2c points to the donor side; fB the main side
index NumNodeGhost() const
void AdjGlobal2LocalN2CB()
std::vector< index > cell2parentCell
void GetCoordsOnCell(index iCell, tSmallCoords &cs)
void AdjLocal2GlobalC2F()
auto device_array_list_C2F()
void AdjGlobal2LocalPrimaryForBnd()
std::vector< uint8_t > vtkCellType
MeshAdjState adjC2CFaceState
std::vector< index > node2parentNode
parent built
auto getBnd2NodeIndexPbiRow(index iBnd)
tAdjPair cell2nodePeriodicRecreated
AdjPairTracked< tAdj2Pair > face2cell
void _detail_GetCoords(const tC2n &c2n, tSmallCoords &cs, tCoordExt &coo)
directly load coords; gets faulty if isPeriodic!
index LocalPartStart(int iPart) const
index NumCellProc() const
index NodeIndexLocal2Global_NoSon(index i)
void AdjLocal2GlobalFacial()
index FaceIndexGlobal2Local(DNDS::index i)
index NodeIndexGlobal2Local(DNDS::index i)
void AdjGlobal2LocalPrimary()
void ElevatedNodesSolveInternalSmoothV1Old()
tLocalMatStruct cell2cellFaceVLocalParts
for cell local factorization
void _detail_GetCoordsOnElem(const tC2n &c2n, const tC2nPbi &c2nPbi, tSmallCoords &cs)
specially for periodicity
void ReorderEntities(const ReorderInput &input)
Reorder entities using the general framework.
std::vector< index > vtkCell2nodeOffsets
for parallel out
void ElevatedNodesGetBoundarySmooth(const std::function< bool(t_index)> &FiFBndIdNeedSmooth)
ReorderInput resolveFollows(const ReorderInput &input, const ReorderRegistry ®)
Augment a ReorderInput with default follows and compute follow maps.
index BndIndexLocal2Global_NoSon(index i)
index CellIndexGlobal2Local(DNDS::index i)
tLocalMatStruct GetCell2CellFaceVLocal(bool onLocalPartition=false)
void ElevatedNodesSolveInternalSmoothV1()
index IndexGlobal2Local(TPair &pair, DNDS::index iGlobal)
Global-to-local conversion using father+son ghost mapping.
void RecoverNode2CellAndNode2Bnd()
only requires father part of cell2node, bnd2node and coords generates node2cell and node2bnd (father ...
MeshAdjState adjN2CBState
void for_each_device_member(F &&f)
void ReorderLocalCells(int nParts=1, int nPartsInner=1)
index IndexLocal2Global_NoSon(TPair &pair, index iLocal)
Local-to-global conversion using only the father's global mapping (no son / ghost layer).
AdjPairTracked< tAdjPair > cell2face
interpolated
void op_on_device_arrays(F &&f)
index NumFaceProc() const
void AdjGlobal2LocalC2F()
struct DNDS::Geom::UnstructuredMesh::HDF5OutSetting hdf5OutSetting
void BuildBisectO1FormO2(UnstructuredMesh &meshO2)
void BuildGhostPrimary(int nGhostLayers=1)
building ghost (son) from primary (currently only cell2cell)
void GetCoordsOnFace(index iFace, tSmallCoords &cs)
void SetHDF5OutSetting(size_t chunkSiz, int deflateLevel, bool coll_on_data, bool coll_on_meta)
ReorderRegistry buildReorderRegistry(const std::unordered_set< EntityKind > &destroyKinds={})
Build a ReorderRegistry containing all mesh members.
tPoint GetCoordNodeOnCell(index iCell, rowsize ic2n)
void ReadSerialize(Serializer::SerializerBaseSSP serializerP, const std::string &name)
void PrintParallelVTKHDFDataArray(std::string fname, std::string seriesName, int arraySiz, int vecArraySiz, int arraySizPoint, int vecArraySizPoint, const tFGetName &names, const tFGetData &data, const tFGetName &vectorNames, const tFGetVecData &vectorData, const tFGetName &namesPoint, const tFGetData &dataPoint, const tFGetName &vectorNamesPoint, const tFGetVecData &vectorDataPoint, double t, MPI_Comm commDup)
auto getCell2NodeIndexPbiRow(index iCell)
void RecoverNode2CellAndNode2BndLegacy()
index CellIndexGlobal2Local_NoSon(index i)
bool CellIsFaceBack(index iCell, index iFace) const
t_index GetFaceZone(index iF)
Elem::Element GetBndElement(index iB)
index BndIndexLocal2Global(DNDS::index i)
index FaceIndexLocal2Global(DNDS::index i)
void ElevatedNodesSolveInternalSmoothV2()
AdjPairTracked< tAdjPair > cell2cell
std::vector< index > bnd2faceV
Elem::Element GetFaceElement(index iF)
void _detail_GetCoordsOnElem(const tC2n &c2n, const tC2nPbi &c2nPbi, tSmallCoords &cs, tCoordExt &coo)
specially for periodicity
index CellIndexLocal2Global(DNDS::index i)
index IndexLocal2Global(TPair &pair, DNDS::index iLocal)
Local-to-global conversion using father+son ghost mapping.
void AdjLocal2GlobalPrimary()
void _detail_GetCoords(const tC2n &c2n, tSmallCoords &cs)
directly load coords; gets faulty if isPeriodic!
AdjPairTracked< tAdjPair > face2node
MeshAdjState adjPrimaryState
void ObtainSymmetricSymbolicFactorization(Direct::SerialSymLUStructure &symLU, Direct::DirectPrecControl control) const
AdjPairTracked< tAdj1Pair > bnd2face
index CellFaceOther(index iCell, index iFace) const
tElemInfoArrayPair faceElemInfo
void SetPeriodicGeometry(const tPoint &translation1, const tPoint &rotationCenter1, const tPoint &eulerAngles1, const tPoint &translation2, const tPoint &rotationCenter2, const tPoint &eulerAngles2, const tPoint &translation3, const tPoint &rotationCenter3, const tPoint &eulerAngles3)
void BuildCell2CellFace()
struct DNDS::Geom::UnstructuredMesh::ElevationInfo elevationInfo
void AdjGlobal2LocalC2CFace()
std::vector< index > localPartitionStarts
MeshAdjState adjFacialState
index BndIndexGlobal2Local(DNDS::index i)
void BuildO2FromO1Elevation(UnstructuredMesh &meshO1)
AdjPairTracked< tAdjPair > cell2node
void RecoverCell2CellAndBnd2Cell()
needs to use RecoverNode2CellAndNode2Bnd before doing this. Requires node2cell.father and builds a ve...
void WriteSerialize(Serializer::SerializerBaseSSP serializerP, const std::string &name)
tElemInfoArrayPair cellElemInfo
void ObtainLocalFactFillOrdering(Direct::SerialSymLUStructure &symLU, Direct::DirectPrecControl control)
void PrintMeshCGNS(std::string fname, const t_FBCID_2_Name &fbcid2name, const std::vector< std::string > &allNames)
static void ConvertAdjEntries(TAdj &adj, index nRows, TFn &&fn)
Apply a conversion function to every entry of an adjacency array's first nRows rows.
AdjPairTracked< tAdjPair > node2bnd
index NumCellGhost() const
index vtkCell2NodeGlobalSiz
index NumBndGhost() const
void AdjLocal2GlobalC2CFace()
void InterpolateFaceLegacy()
void ReadSerializeAndDistribute(Serializer::SerializerBaseSSP serializerP, const std::string &name, const PartitionOptions &partitionOptions)
Reads mesh from an H5 serializer using even-split distribution, then repartitions via ParMetis for lo...
static void PermuteRows(TPair &pair, index nRows, TFn &&old2new)
Permute the father rows of an ArrayPair according to a mapping function.
AdjPairTracked< tAdjPair > bnd2node
AdjPairTracked< tAdjPair > node2cell
inverse relations
index LocalPartEnd(int iPart) const
void AdjGlobal2LocalFacial()
tPoint GetCoordWallDistOnFace(index iFace, rowsize if2n)
ReorderPlan buildReorderPlan(const ReorderInput &input)
Build a ReorderPlan without applying it.
t_index GetCellZone(index iC)
index IndexGlobal2Local_NoSon(TPair &pair, index iGlobal)
Global-to-local conversion using only the father's global mapping (no son / ghost layer).
void ConstructBndMesh(UnstructuredMesh &bMesh)
tElemInfoArrayPair bndElemInfo
void AdjLocal2GlobalPrimaryForBnd()
void BuildVTKConnectivity()
tPoint GetCoordWallDistOnCell(index iCell, rowsize ic2n)
t_index GetBndZone(index iB)
void EnsureGhostMapping(TPair &pair)
Ensure a pair has a ghost mapping on its transformer.
auto device_array_list_N2CB()
MeshElevationState elevState
void BuildNodeWallDist(const std::function< bool(Geom::t_index)> &fBndIsWall, WallDistOptions options=WallDistOptions{})
index NodeIndexLocal2Global(DNDS::index i)
std::vector< index > vtkCell2node
std::vector< index > nodeRecreated2nodeLocal
AdjPairTracked< tAdj2Pair > bnd2cell
void TransformCoords(TFTrans &&FTrans)
Lightweight bundle of an MPI communicator and the calling rank's coordinates.
int rank
This rank's 0-based index within comm (-1 until initialised).
Eigen::Matrix< real, 5, 1 > v
std::vector< MPI_int > nodePartition(nNode, mpi.rank)
std::vector< MPI_int > cellPartition(nCellBefore)
Eigen::Vector3d n(1.0, 0.0, 0.0)