DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
Mesh.hpp
Go to the documentation of this file.
1#pragma once
4#include "Elements.hpp"
5#include "DNDS/Array.hpp"
9#include "DNDS/ArrayPair.hpp"
10#include "PeriodicInfo.hpp"
12#include "DNDS/ObjectUtils.hpp"
13#include "DNDS/ConfigParam.hpp"
14
15namespace DNDS::Direct
16{
18 struct DirectPrecControl;
19}
20#include "Mesh_DeviceView.hpp"
21
22namespace DNDS::Geom
23{
24 enum class MeshLoc : uint8_t
25 {
26 Unknown = 0,
27 Node = 1,
28 Face = 3,
29 Cell = 4
30 };
31
32 struct PartitionOptions; // forward declaration; defined after UnstructuredMesh
33
34 struct UnstructuredMesh : public DeviceTransferable<UnstructuredMesh>
35 {
38 int dim;
39 bool isPeriodic{false};
40 // state of: cell2node, cell2cell, bnd2node (only for non-bnd mesh object), bnd2cell (only for non-bnd mesh object)
42 // state of: face2cell, face2node, face2bnd
44 // state of: cell2face, bnd2face
46 // state of: node2cell, node2bnd
48 // state of: cell2cellFace
53 /// reader
63 tAdj1Pair bnd2bndOrig; // no device
64 /// periodic only, after reader
67
81
82 /// inverse relations
85
87 {
88 return std::make_tuple(
91 }
92
93 /// interpolated
100
101 std::vector<index> bnd2faceV; // no device
102 std::unordered_map<index, index> face2bndM; // no device
103 /// periodic only, after interpolated
105
115
117 {
118 return std::make_tuple(
121 }
122
123 /// constructed on demand
125
126 /// parent built
127 std::vector<index> node2parentNode; // from local-appended iNode to local-appended iNode in parent
128 std::vector<index> node2bndNode; // from local-appended iNode to local-appended iNode in bnd
129 std::vector<index> cell2parentCell;
130
131 /// for parallel out
132 std::vector<index> vtkCell2nodeOffsets;
133 std::vector<uint8_t> vtkCellType;
134 std::vector<index> vtkCell2node;
142 std::vector<index> nodeRecreated2nodeLocal;
143
145 {
146 size_t chunkSize = 128;
148 bool coll_on_data = false;
149 bool coll_on_meta = true;
151
152 /// only elevation
165
166 // tAdj1Pair bndFaces; // no comm needed for now
167
168 /// for cell local factorization
170
171 std::vector<index> localPartitionStarts;
172
173 /// wall dist:
175
178
179 int getDim() const { return dim; }
180
182 {
183 std::vector<Geom::NodeIndexPBI> ret;
184 ret.reserve(cell2node[iCell].size());
185 for (int ic2n = 0; ic2n < cell2node[iCell].size(); ic2n++)
186 if (isPeriodic)
188 else
190 return ret;
191 }
192
194 {
195 std::vector<Geom::NodeIndexPBI> ret;
196 ret.reserve(bnd2node[iBnd].size());
197 for (int ib2n = 0; ib2n < bnd2node[iBnd].size(); ib2n++)
198 if (isPeriodic)
200 else
202 return ret;
203 }
204
205 // =================================================================
206 // Generic index conversion templates
207 // =================================================================
208 // The 4 templates below replace 12 structurally identical methods
209 // (3 entity types x 4 variants). The old named methods are kept
210 // as thin inline wrappers so all existing call sites compile
211 // unchanged.
212
213 /**
214 * \brief Global-to-local conversion using father+son ghost mapping.
215 * \return local index, or (-1 - iGlobal) when not found in the pair.
216 * UnInitIndex passes through unchanged.
217 */
218 template <class TPair>
220 {
221 DNDS_assert(pair.trans.pLGhostMapping);
222 if (iGlobal == UnInitIndex)
223 return iGlobal;
224 DNDS::MPI_int rank;
225 DNDS::index val;
226 auto result = pair.trans.pLGhostMapping->search_indexAppend(iGlobal, rank, val);
227 if (result)
228 return val;
229 else
230 return -1 - iGlobal; // mapping to un-found in father-son
231 }
232
233 /**
234 * \brief Local-to-global conversion using father+son ghost mapping.
235 * \return global index, or the decoded global when the local is
236 * a negative "not-found" encoding. UnInitIndex passes through.
237 */
238 template <class TPair>
240 {
241 DNDS_assert(pair.trans.pLGhostMapping);
242 if (iLocal == UnInitIndex)
243 return iLocal;
244 if (iLocal < 0) // mapping to un-found in father-son
245 return -1 - iLocal;
246 else
247 return pair.trans.pLGhostMapping->operator()(-1, iLocal);
248 }
249
250 /**
251 * \brief Local-to-global conversion using only the father's global
252 * mapping (no son / ghost layer).
253 * \return global index. Asserts if iLocal exceeds father size.
254 * Negative "not-found" encoding and UnInitIndex pass through.
255 */
256 template <class TPair>
258 {
259 DNDS_assert(pair.father->pLGlobalMapping);
260 if (iLocal == UnInitIndex)
261 return UnInitIndex;
262 if (iLocal < 0)
263 return -1 - iLocal;
264 if (iLocal >= pair.father->Size())
265 DNDS_assert_info(false, "local idx not right: " + std::to_string(iLocal));
266 return pair.father->pLGlobalMapping->operator()(mpi.rank, iLocal);
267 }
268
269 /**
270 * \brief Global-to-local conversion using only the father's global
271 * mapping (no son / ghost layer).
272 * \return local index if the global maps to this rank, otherwise
273 * (-1 - iGlobal). UnInitIndex passes through.
274 */
275 template <class TPair>
277 {
278 DNDS_assert(pair.father->pLGlobalMapping);
279 if (iGlobal == UnInitIndex)
280 return UnInitIndex;
281 auto [ret, rank, val] = pair.father->pLGlobalMapping->search(iGlobal);
282 DNDS_assert_info(ret, "search failed with input: " + std::to_string(iGlobal));
283 if (rank == mpi.rank)
284 return val;
285 else
286 return -1 - iGlobal;
287 }
288
289 // =================================================================
290 // Named wrappers — Node
291 // =================================================================
296
297 // =================================================================
298 // Named wrappers — Cell
299 // =================================================================
304
305 // =================================================================
306 // Named wrappers — Bnd
307 // =================================================================
312
313 // =================================================================
314 // Adjacency bulk-conversion helper
315 // =================================================================
316
317 /**
318 * \brief Apply a conversion function to every entry of an adjacency
319 * array's first \p nRows rows.
320 *
321 * Replaces the recurring nested-loop pattern:
322 * \code
323 * for (index i = 0; i < nRows; i++)
324 * for (rowsize j = 0; j < adj.RowSize(i); j++)
325 * adj(i, j) = fn(adj(i, j));
326 * \endcode
327 *
328 * \tparam TAdj Any type with RowSize(index) and operator()(index, rowsize).
329 * \tparam TFn Callable index(index).
330 */
331 template <class TAdj, class TFn>
333 {
334 for (index i = 0; i < nRows; i++)
335 for (rowsize j = 0; j < adj.RowSize(i); j++)
336 adj(i, j) = fn(adj(i, j));
337 }
338
339 // =================================================================
340 // Row-permutation helper
341 // =================================================================
342
343 /**
344 * \brief Permute the father rows of an ArrayPair according to a
345 * mapping function.
346 *
347 * For each old row index \p i in [0, nRows), the row is moved to
348 * position old2new(i). Works with both CSR (variable-row-size)
349 * and fixed-row-size array pairs: CSR pairs are Decompressed before
350 * and Compressed after the permutation; fixed-size pairs are
351 * copied directly.
352 *
353 * \tparam TPair An ArrayPair-like type with father/son, IsCSR().
354 * \tparam TFn Callable index(index) returning the new row index.
355 */
356 template <class TPair, class TFn>
357 static void PermuteRows(TPair &pair, index nRows, TFn &&old2new)
358 {
359 using TArr = typename decltype(pair.father)::element_type;
360 auto tmp = std::make_shared<TArr>(*pair.father); // deep copy via copy ctor
361 if constexpr (TPair::IsCSR())
362 pair.father->Decompress();
363 for (index i = 0; i < nRows; i++)
364 {
365 index iNew = old2new(i);
366 if constexpr (TPair::IsCSR())
367 pair.father->ResizeRow(iNew, tmp->RowSize(i));
368 for (rowsize j = 0; j < tmp->RowSize(i); j++)
369 pair(iNew, j) = (*tmp)(i, j);
370 }
371 if constexpr (TPair::IsCSR())
372 pair.father->Compress();
373 }
374
376 const tPoint &translation1,
377 const tPoint &rotationCenter1,
378 const tPoint &eulerAngles1,
379 const tPoint &translation2,
380 const tPoint &rotationCenter2,
381 const tPoint &eulerAngles2,
382 const tPoint &translation3,
383 const tPoint &rotationCenter3,
384 const tPoint &eulerAngles3);
385
386 /**
387 * \brief only requires father part of cell2node, bnd2node and coords
388 * generates node2cell and node2bnd (father part)
389 */
391
392 /**
393 * \brief needs to use RecoverNode2CellAndNode2Bnd before doing this.
394 * Requires node2cell.father and builds a version of its son.
395 */
397
398 /**
399 * @brief building ghost (son) from primary (currently only cell2cell)
400 * @details
401 * the face and bnd parts are currently only local (no comm available)
402 * only builds comm data of cell and node
403 * cells: current-father and cell2cell neighbor (face or node neighbor)
404 * nodes: needed by all cells
405 * faces/bnds: needed by all father cells
406 *
407 */
408 void BuildGhostPrimary();
411 // ForBnd: reduction of primary version, only on cell2node
414
417 void AdjGlobal2LocalC2F();
418 void AdjLocal2GlobalC2F();
419
420 void BuildGhostN2CB();
421 void AdjGlobal2LocalN2CB();
422 void AdjLocal2GlobalN2CB();
423
424 void AssertOnN2CB();
425
426 void BuildCell2CellFace();
429
430 void InterpolateFace();
431 void AssertOnFaces();
432
434
435 // void ReorderCellLocal();
436
437 /**
438 * \return
439 * cell2cell for local mesh, which do not contain
440 * the diagonal part; should be a diag-less symmetric adjacency matrix
441 */
443
444 void ObtainLocalFactFillOrdering(Direct::SerialSymLUStructure &symLU, Direct::DirectPrecControl control); // 1 uses metis, 2 uses MMD, //TODO 10 uses geometric based searching
445 void ObtainSymmetricSymbolicFactorization(Direct::SerialSymLUStructure &symLU, Direct::DirectPrecControl control) const; // -1 use full LU, 0-3 use ilu(code),
446 /**
447 * \warning RecreatePeriodicNodes and BuildVTKConnectivity results are invalid after this;
448 * \warning bnd mesh's cell2parentCell is invalid after this
449 */
450 void ReorderLocalCells(int nParts = 1, int nPartsInner = 1);
451
452 int NLocalParts() const { return localPartitionStarts.size() ? localPartitionStarts.size() - 1 : 1; }
454 index LocalPartEnd(int iPart) const { return localPartitionStarts.size() ? localPartitionStarts.at(iPart + 1) : this->NumCell(); }
455
456 index NumNode() const { DNDS_check_throw_info(coords.father, "coords not initialized"); return coords.father->Size(); }
457 index NumCell() const { DNDS_check_throw_info(cell2node.father, "cell2node not initialized"); return cell2node.father->Size(); }
458 index NumFace() const { DNDS_check_throw_info(face2node.father, "face2node not initialized"); return face2node.father->Size(); }
459 index NumBnd() const { DNDS_check_throw_info(bnd2node.father, "bnd2node not initialized"); return bnd2node.father->Size(); }
460
461 index NumNodeGhost() const { DNDS_check_throw_info(coords.son, "coords not initialized"); return coords.son->Size(); }
462 index NumCellGhost() const { DNDS_check_throw_info(cell2node.son, "cell2node not initialized"); return cell2node.son->Size(); }
463 index NumFaceGhost() const { DNDS_check_throw_info(face2node.son, "face2node not initialized"); return face2node.son->Size(); }
464 index NumBndGhost() const { DNDS_check_throw_info(bnd2node.son, "bnd2node not initialized"); return bnd2node.son->Size(); }
465
466 index NumNodeProc() const { DNDS_check_throw_info(coords.father && coords.son, "coords not initialized"); return coords.Size(); }
467 index NumCellProc() const { DNDS_check_throw_info(cell2node.father && cell2node.son, "cell2node not initialized"); return cell2node.Size(); }
468 index NumFaceProc() const { DNDS_check_throw_info(face2node.father && face2node.son, "face2node not initialized"); return face2node.Size(); }
469 index NumBndProc() const { DNDS_check_throw_info(bnd2node.father && bnd2node.son, "bnd2node not initialized"); return bnd2node.Size(); }
470
471 /// @warning must collectively call
472 index NumCellGlobal() { DNDS_check_throw_info(cell2node.father, "cell2node not initialized"); return cell2node.father->globalSize(); }
473 /// @warning must collectively call
474 index NumNodeGlobal() { DNDS_check_throw_info(coords.father, "coords not initialized"); return coords.father->globalSize(); }
475 /// @warning must collectively call
476 index NumFaceGlobal() { DNDS_check_throw_info(face2node.father, "face2node not initialized"); return face2node.father->globalSize(); }
477 /// @warning must collectively call
478 index NumBndGlobal() { DNDS_check_throw_info(bnd2node.father, "bnd2node not initialized"); return bnd2node.father->globalSize(); }
479
483
486 t_index GetBndZone(index iB) { return bndElemInfo(iB, 0).zone; }
487
488 MPIInfo &getMPI() { return mpi; }
489
491 void ElevatedNodesGetBoundarySmooth(const std::function<bool(t_index)> &FiFBndIdNeedSmooth);
496
498
499 bool IsO1();
500 bool IsO2();
501
502 /**
503 * @brief directly load coords; gets faulty if isPeriodic!
504 */
505 template <class tC2n>
507 {
508 cs.resize(Eigen::NoChange, c2n.size());
509 for (rowsize i = 0; i < c2n.size(); i++)
510 {
511 index iNode = c2n[i];
513 iNode = NodeIndexGlobal2Local(iNode), DNDS_assert_info(iNode >= 0, "iNode not found in main/ghost pair");
514 cs(EigenAll, i) = coords[iNode];
515 }
516 }
517
518 /**
519 * @brief directly load coords; gets faulty if isPeriodic!
520 */
521 template <class tC2n, class tCoordExt>
523 {
524 cs.resize(Eigen::NoChange, c2n.size());
525 for (rowsize i = 0; i < c2n.size(); i++)
526 {
527 index iNode = c2n[i];
529 iNode = NodeIndexGlobal2Local(iNode), DNDS_assert_info(iNode >= 0, "iNode not found in main/ghost pair");
530 cs(EigenAll, i) = coo[iNode];
531 }
532 }
533
534 /**
535 * @brief specially for periodicity
536 */
537 template <class tC2n, class tC2nPbi>
539 {
540 cs.resize(Eigen::NoChange, c2n.size());
541 for (rowsize i = 0; i < c2n.size(); i++)
542 {
543 index iNode = c2n[i];
545 iNode = NodeIndexGlobal2Local(iNode), DNDS_assert_info(iNode >= 0, "iNode not found in main/ghost pair");
546 cs(EigenAll, i) = periodicInfo.GetCoordByBits(coords[iNode], c2nPbi[i]);
547 }
548 }
549
550 /**
551 * @brief specially for periodicity
552 */
553 template <class tC2n, class tC2nPbi, class tCoordExt>
555 {
556 cs.resize(Eigen::NoChange, c2n.size());
557 for (rowsize i = 0; i < c2n.size(); i++)
558 {
559 index iNode = c2n[i];
561 iNode = NodeIndexGlobal2Local(iNode), DNDS_assert_info(iNode >= 0, "iNode not found in main/ghost pair");
562 cs(EigenAll, i) = periodicInfo.GetCoordByBits(coo[iNode], c2nPbi[i]);
563 }
564 }
565
573
581
589
596
603
610
617
619 {
621 return face2cell(iFace, 0) == iCell;
622 }
623
625 {
626 return CellIsFaceBack(iCell, iFace)
627 ? face2cell(iFace, 1)
628 : face2cell(iFace, 0);
629 }
630
631 /**
632 * @brief fA executes when if2c points to the donor side; fB the main side
633 *
634 * @tparam FA
635 * @tparam FB
636 * @tparam F0
637 * @param iFace
638 * @param if2c
639 * @param fA
640 * @param fB
641 * @param f0
642 * @return auto
643 */
644 template <class FA, class FB, class F0 = std::function<void(void)>>
646 index iFace, rowsize if2c, FA &&fA, FB &&fB, F0 &&f0 = []() {})
647 {
648 if (!this->isPeriodic)
649 return f0();
650 auto faceID = this->GetFaceZone(iFace);
652 return f0();
653 if ((if2c == 1 && Geom::FaceIDIsPeriodicMain(faceID)) ||
654 (if2c == 0 && Geom::FaceIDIsPeriodicDonor(faceID))) // I am donor
655 return fA();
656 if ((if2c == 1 && Geom::FaceIDIsPeriodicDonor(faceID)) ||
657 (if2c == 0 && Geom::FaceIDIsPeriodicMain(faceID))) // I am main
658 return fB();
659 }
660
661 void WriteSerialize(Serializer::SerializerBaseSSP serializerP, const std::string &name);
662 void ReadSerialize(Serializer::SerializerBaseSSP serializerP, const std::string &name);
663
664 /**
665 * @brief Reads mesh from an H5 serializer using even-split distribution, then
666 * repartitions via ParMetis for locality.
667 *
668 * @details
669 * This method enables reading a mesh written with any number of MPI ranks
670 * into any number of MPI ranks, without requiring the original partition.
671 *
672 * Flow:
673 * 1. Even-split read of all primary arrays (coords, cell2node, cellElemInfo,
674 * bnd2node, bndElemInfo, cell2nodePbi, bnd2nodePbi, origIndex arrays).
675 * 2. Build distributed node2cell and cell2cell (node-neighbor) using existing
676 * RecoverNode2CellAndNode2Bnd() + RecoverCell2CellAndBnd2Cell().
677 * 3. Filter cell2cell to facial neighbors only (shared O1 vertices >= dim).
678 * 4. Call ParMETIS_V3_PartKway on the distributed facial graph.
679 * 5. Redistribute cells, nodes, and boundaries to the new partition
680 * via ArrayTransformer push-based transfer.
681 * 6. Set adjPrimaryState = Adj_PointToGlobal.
682 *
683 * After return, the caller should proceed with the standard rebuild sequence:
684 * RecoverNode2CellAndNode2Bnd -> RecoverCell2CellAndBnd2Cell ->
685 * BuildGhostPrimary -> AdjGlobal2LocalPrimary -> ...
686 *
687 * @param serializerP H5 serializer (must be collective / non-per-rank)
688 * @param name Path name in the serializer hierarchy
689 * @param partitionOptions ParMetis partitioning options
690 */
693 const std::string &name,
694 const PartitionOptions &partitionOptions);
695
696 template <class TFTrans>
697 void TransformCoords(TFTrans &&FTrans)
698 {
699 for (index iNode = 0; iNode < coords.Size(); iNode++)
701 }
702
704
706
708 std::string fname, std::string seriesName,
710 const tFGetName &names,
711 const tFGetData &data,
712 const tFGetName &vectorNames,
714 const tFGetName &namesPoint,
715 const tFGetData &dataPoint,
718 double t, MPI_Comm commDup);
719
720 void SetHDF5OutSetting(size_t chunkSiz, int deflateLevel, bool coll_on_data, bool coll_on_meta)
721 {
722 hdf5OutSetting.chunkSize = chunkSiz;
723 hdf5OutSetting.deflateLevel = deflateLevel;
724 hdf5OutSetting.coll_on_data = coll_on_data;
725 hdf5OutSetting.coll_on_meta = coll_on_meta;
726 }
727
728 void PrintMeshCGNS(std::string fname, const t_FBCID_2_Name &fbcid2name, const std::vector<std::string> &allNames);
729
731 {
733 int method = 0;
736 int verbose = 0;
737 WallDistOptions() {} //? why = default is not working
738
740 {
741 DNDS_FIELD(subdivide_quad, "Subdivide quads for wall distance computation",
743 DNDS_FIELD(method, "Wall distance computation method (0: brute, 1: tree)",
745 DNDS_FIELD(wallDistExecution, "MPI concurrency (0: all parallel, 1: serial, >1: batched N ranks)",
747 DNDS_FIELD(minWallDist, "Minimum wall distance clamp",
749 DNDS_FIELD(verbose, "Verbosity level for wall distance computation",
751 }
752 };
753 void BuildNodeWallDist(const std::function<bool(Geom::t_index)> &fBndIsWall, WallDistOptions options = WallDistOptions{});
754
755 template <class F>
766
767 template <typename F>
769 {
770 op_on_device_arrays(std::forward<F>(f));
771 }
772
773 // to_device(), to_host(), device() are provided by
774 // DeviceTransferable<UnstructuredMesh> via for_each_device_member().
775
776 template <DeviceBackend B>
778
779 template <DeviceBackend B>
781 {
782 return t_deviceView<B>(*this, UnInitIndex);
783 }
784
786 {
787 index bytes = 0;
788 auto acuumulate_bytes_arr = [&](auto &v)
789 {
790 if (v.ref.father)
791 bytes += v.ref.father->FullSizeBytes();
792 if (v.ref.son)
793 bytes += v.ref.son->FullSizeBytes();
794 };
802 this->device_array_list_C2F(),
808 return bytes;
809 }
810 };
811
812}
813namespace DNDS::Geom
814{
815 using tFDataFieldName = std::function<std::string(int)>;
817
824
826 {
827 std::string metisType = "KWAY";
828 int metisUfactor = 20;
829 int metisSeed = 0;
830 int edgeWeightMethod = 0; // 0:no weight 1: faceSize weight
831 int metisNcuts = 3;
832
834 {
835 DNDS_FIELD(metisType, "METIS partitioning method",
836 DNDS::Config::enum_values({"KWAY", "RB"}));
837 DNDS_FIELD(metisUfactor, "METIS imbalance factor (ufactor)",
839 DNDS_FIELD(metisSeed, "METIS random seed");
840 DNDS_FIELD(edgeWeightMethod, "Edge weight method (0: none, 1: face size)",
841 DNDS::Config::range(0, 1));
842 DNDS_FIELD(metisNcuts, "Number of cuts for METIS to try",
844 }
845 };
846
848 {
849 using PartitionOptions = Geom::PartitionOptions; // backward compatibility alias
850
851 private:
852 int ascii_precision{16};
853 std::string vtuFloatEncodeMode = "ascii";
854
855 public:
857
859
860 bool dataIsSerialOut = false;
861 bool dataIsSerialIn = false;
862
863 tCoord coordSerial; // created through reading
864 tAdj cell2nodeSerial; // created through reading
865 tAdj bnd2nodeSerial; // created through reading
866 tElemInfoArray cellElemInfoSerial; // created through reading
867 tElemInfoArray bndElemInfoSerial; // created through reading
868 tAdj2 bnd2cellSerial; // created through reading
869 tAdj1 cell2cellOrigSerial; // created through reading
870 tAdj1 node2nodeOrigSerial; // created through reading
871 tAdj1 bnd2bndOrigSerial; // created through reading
872 tPbi cell2nodePbiSerial; // created through reading-Deduplicate
873 tPbi bnd2nodePbiSerial; // created through reading-Deduplicate
874 /***************************************************************/
875 // Current Method: R/W don't manage actually used interpolation,
876 // but manually get cell2cell or node2node
877 // because: currently only support node based or cell based
878 /***************************************************************/
879
880 // tAdj face2nodeSerial; // created through InterpolateTopology
881 // tAdj2 face2cellSerial; // created through InterpolateTopology
882 // tAdj cell2faceSerial; // created through InterpolateTopology
883 // tElemInfoArray faceElemInfoSerial; // created through InterpolateTopology
884
885 tAdj cell2cellSerial; // optionally created with GetCell2Cell()
886 tAdj node2nodeSerial; // optionally created with GetNode2Node()
887
888 tAdj cell2cellSerialFacial; // optionally created with GetCell2Cell()
889
890 tAdj node2cellSerial; // not used for now
891 tAdj node2faceSerial; // not used for now
892 tAdj node2edgeSerial; // not used for now
893
894 tAdj cell2faceSerial; // not used for now
895 tAdj cell2edgeSerial; // not used for now
896
897 tAdj face2nodeSerial; // not used for now
898 tAdj face2faceSerial; // not used for now
899 tAdj face2edgeSerial; // not used for now
900 tAdj face2cellSerial; // not used for now
901
902 tAdj edge2nodeSerial; // not used for now
903 tAdj edge2cellSerial; // not used for now
904 tAdj edge2edgeSerial; // not used for now
905 tAdj edge2faceSerial; // not used for now
906
913
914 std::vector<DNDS::MPI_int> cellPartition;
915 std::vector<DNDS::MPI_int> nodePartition;
916 std::vector<DNDS::MPI_int> bndPartition;
917
919
920 /**
921 * @brief directly load coords; gets faulty if isPeriodic!, analog of mesh's method
922 */
923 template <class tC2n, class tCoordExt>
924 void __GetCoordsSerial(const tC2n &c2n, tSmallCoords &cs, tCoordExt &coo)
925 {
926 cs.resize(Eigen::NoChange, c2n.size());
927 for (rowsize i = 0; i < c2n.size(); i++)
928 {
929 index iNode = c2n[i];
930 cs(EigenAll, i) = coo->operator[](iNode);
931 }
932 }
933
934 /**
935 * @brief specially for periodicity, analog of mesh's method
936 */
937 template <class tC2n, class tC2nPbi, class tCoordExt>
938 void __GetCoordsOnElemSerial(const tC2n &c2n, const tC2nPbi &c2nPbi, tSmallCoords &cs, tCoordExt &coo)
939 {
940 cs.resize(Eigen::NoChange, c2n.size());
941 for (rowsize i = 0; i < c2n.size(); i++)
942 {
943 index iNode = c2n[i];
944 cs(EigenAll, i) = mesh->periodicInfo.GetCoordByBits(coo->operator[](iNode), c2nPbi[i]);
945 }
946 }
947 /**
948 * @brief analog of mesh's method
949 */
951 {
952 if (!mesh->isPeriodic)
953 __GetCoordsSerial((*cell2nodeSerial)[iCell], cs, coo);
954 else
955 __GetCoordsOnElemSerial((*cell2nodeSerial)[iCell], (*cell2nodePbiSerial)[iCell], cs, coo);
956 }
957
958 UnstructuredMeshSerialRW(const decltype(mesh) &n_mesh, DNDS::MPI_int n_mRank)
959 : mesh(n_mesh), mRank(n_mRank) {}
960
961 /// @brief reads a cgns file as serial input
962 /**
963 * @details
964 * the file MUST consist of one CGNS base node, and
965 * multiple zones within.
966 * All the zones are treated as a whole unstructured grid
967 * Proofed on .cgns files generated from Pointwise
968 * @warning //!Pointwise Options: with "Include Donor Information", "Treat Structured as Unstructured", "Unstructured Interfaces = Node-to-Node"
969 */
970 /// @todo //TODO Add some multi thread here!
971 /// @param fName file name of .cgns file
972 void ReadFromCGNSSerial(const std::string &fName, const t_FBCName_2_ID &FBCName_2_ID);
973
974 auto ReadFromCGNSSerial(const std::string &fName)
975 {
976 AutoAppendName2ID appended_name2id;
977 this->ReadFromCGNSSerial(fName, appended_name2id);
978 return appended_name2id;
979 }
980
981 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);
982
983 void Deduplicate1to1Periodic(real searchEps = 1e-8);
984
985 // void InterpolateTopology();
986
987 /**
988 * \brief build cell2cell topology, with node-neighbors included
989 * \todo add support for only face-neighbors
990 */
991 void BuildCell2Cell(); // For cell based purpose
992
993 void BuildNode2Node(); // For node based purpose //!not yet implemented
994
995 void MeshPartitionCell2Cell(const PartitionOptions &options);
996
998
1000 {
1001 coordSerial.reset();
1002 cell2nodeSerial.reset();
1003 cell2cellSerial.reset();
1004 cellElemInfoSerial.reset();
1005 bnd2nodeSerial.reset();
1006 bnd2cellSerial.reset();
1007 bndElemInfoSerial.reset();
1008 cell2cellOrigSerial.reset();
1009 node2nodeOrigSerial.reset();
1010 bnd2bndOrigSerial.reset();
1011 mode = UnknownMode;
1013 }
1014
1015 /**
1016 * @brief should be called to build data for serial out
1017 */
1018 void BuildSerialOut();
1019
1020 void GetCurrentOutputArrays(int flag,
1021 tCoordPair &coordOut,
1022 tAdjPair &cell2nodeOut,
1023 tPbiPair &cell2nodePbiOut,
1024 tElemInfoArrayPair &cellElemInfoOut,
1025 index &nCell, index &nNode);
1026
1027 // void WriteToCGNSSerial(const std::string &fName);
1028
1029 // void WriteSolutionToTecBinary(const std::string &fName,
1030 // int nField, const tFDataFieldName &names, const tFDataFieldQuery &data,
1031 // int nFieldBnd, const tFDataFieldName &namesBnd, const tFDataFieldQuery &dataBnd);
1032
1033 /**
1034 * @brief names(idata) data(idata, ivolume)
1035 * https://tecplot.azureedge.net/products/360/current/360_data_format_guide.pdf
1036 * @todo //TODO add support for bnd export
1037 */
1039 std::string fname,
1040 int arraySiz, int arraySizPoint,
1041 const tFGetName &names,
1042 const tFGetData &data,
1043 const tFGetName &namesPoint,
1044 const tFGetData &dataPoint,
1045 double t, int flag);
1046
1047 /**
1048 * @brief names(idata) data(idata, ivolume)
1049 * @todo //TODO add support for bnd export
1050 */
1052 std::string fname, std::string seriesName,
1053 int arraySiz, int vecArraySiz, int arraySizPoint, int vecArraySizPoint,
1054 const tFGetName &names,
1055 const tFGetData &data,
1056 const tFGetName &vectorNames,
1057 const tFGetVecData &vectorData,
1058 const tFGetName &namesPoint,
1059 const tFGetData &dataPoint,
1060 const tFGetName &vectorNamesPoint,
1061 const tFGetVecData &vectorDataPoint,
1062 double t, int flag = 0);
1063
1064 void SetASCIIPrecision(int n) { ascii_precision = n; }
1065 void SetVTKFloatEncodeMode(const std::string &v)
1066 {
1067 vtuFloatEncodeMode = v;
1068 DNDS_assert(v == "ascii" || v == "binary");
1069 }
1070 };
1071} // namespace geom
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.
Definition Errors.hpp:113
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
Definition Errors.hpp:108
#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.
Definition Errors.hpp:96
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.
Ghost-communication engine for a father / son ParArray pair.
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
Definition Mesh.hpp:816
int32_t t_index
Definition Geometric.hpp:6
@ SerialOutput
Definition Mesh.hpp:822
@ UnknownMode
Definition Mesh.hpp:820
@ SerialReadAndDistribute
Definition Mesh.hpp:821
std::function< std::string(int)> tFDataFieldName
Definition Mesh.hpp:815
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
Eigen::Vector3d tPoint
Definition Geometric.hpp:9
DNDS::ssp< DNDS::ParArray< ElemInfo > > tElemInfoArray
std::function< std::string(t_index)> t_FBCID_2_Name
Eigen::Matrix< real, 3, Eigen::Dynamic > tSmallCoords
Definition Geometric.hpp:50
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
Definition Geometric.hpp:66
void AllreduceOneIndex(index &v, MPI_Op op, const MPIInfo &mpi)
Single-scalar Allreduce helper for indices (in-place, count = 1).
Definition MPI.hpp:679
ssp< SerializerBase > SerializerBaseSSP
DNDS_CONSTANT const index UnInitIndex
Sentinel "not initialised" index value (= INT64_MIN).
Definition Defines.hpp:176
int32_t rowsize
Row-width / per-row element-count type (signed 32-bit).
Definition Defines.hpp:109
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
Definition Defines.hpp:107
std::shared_ptr< T > ssp
Shortened alias for std::shared_ptr used pervasively in DNDSR.
Definition Defines.hpp:138
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).
Definition Defines.hpp:105
int MPI_int
MPI counterpart type for MPI_int (= C int). Used for counts and ranks in MPI calls.
Definition MPI.hpp:43
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).
DNDS_DECLARE_CONFIG(PartitionOptions)
Definition Mesh.hpp:833
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 MeshPartitionCell2Cell(const PartitionOptions &options)
void GetCoordsOnCellSerial(index iCell, tSmallCoords &cs, tCoord &coo)
analog of mesh's method
Definition Mesh.hpp:950
DNDS::ArrayTransformerType< tCoord::element_type >::Type coordSerialOutTrans
Definition Mesh.hpp:907
void GetCurrentOutputArrays(int flag, tCoordPair &coordOut, tAdjPair &cell2nodeOut, tPbiPair &cell2nodePbiOut, tElemInfoArrayPair &cellElemInfoOut, index &nCell, index &nNode)
Definition Mesh_Plts.cpp:20
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
Definition Mesh.hpp:911
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
Definition Mesh.cpp:203
DNDS::ArrayTransformerType< tAdj::element_type >::Type cell2nodeSerialOutTrans
Definition Mesh.hpp:908
void SetVTKFloatEncodeMode(const std::string &v)
Definition Mesh.hpp:1065
DNDS::ssp< UnstructuredMesh > mesh
Definition Mesh.hpp:856
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
Definition Mesh.hpp:909
UnstructuredMeshSerialRW(const decltype(mesh) &n_mesh, DNDS::MPI_int n_mRank)
Definition Mesh.hpp:958
DNDS::ArrayTransformerType< tAdj::element_type >::Type bnd2nodeSerialOutTrans
Definition Mesh.hpp:910
DNDS::ArrayTransformerType< tElemInfoArray::element_type >::Type bndElemInfoSerialOutTrans
Definition Mesh.hpp:912
auto ReadFromCGNSSerial(const std::string &fName)
Definition Mesh.hpp:974
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 BuildCell2Cell()
build cell2cell topology, with node-neighbors included
std::vector< DNDS::MPI_int > cellPartition
Definition Mesh.hpp:914
void __GetCoordsSerial(const tC2n &c2n, tSmallCoords &cs, tCoordExt &coo)
directly load coords; gets faulty if isPeriodic!, analog of mesh's method
Definition Mesh.hpp:924
void __GetCoordsOnElemSerial(const tC2n &c2n, const tC2nPbi &c2nPbi, tSmallCoords &cs, tCoordExt &coo)
specially for periodicity, analog of mesh's method
Definition Mesh.hpp:938
std::vector< DNDS::MPI_int > bndPartition
Definition Mesh.hpp:916
std::vector< DNDS::MPI_int > nodePartition
Definition Mesh.hpp:915
index NumFaceGhost() const
Definition Mesh.hpp:463
tCoordPair nodeWallDist
wall dist:
Definition Mesh.hpp:174
MeshAdjState adjC2FState
Definition Mesh.hpp:45
UnstructuredMeshDeviceView< B > t_deviceView
Definition Mesh.hpp:777
void __GetCoordsOnElem(const tC2n &c2n, const tC2nPbi &c2nPbi, tSmallCoords &cs)
specially for periodicity
Definition Mesh.hpp:538
index BndIndexGlobal2Local_NoSon(index i)
Definition Mesh.hpp:311
index NodeIndexGlobal2Local_NoSon(index i)
Definition Mesh.hpp:295
tCoordPair coordsPeriodicRecreated
Definition Mesh.hpp:141
Elem::Element GetCellElement(index iC)
Definition Mesh.hpp:480
tPbiPair cell2nodePbi
periodic only, after reader
Definition Mesh.hpp:65
UnstructuredMesh(const DNDS::MPIInfo &n_mpi, int n_dim)
Definition Mesh.hpp:176
tCoordPair coordsElevDisp
only elevation
Definition Mesh.hpp:153
std::unordered_map< index, index > face2bndM
Definition Mesh.hpp:102
void GetCoordsOnCell(index iCell, tSmallCoords &cs, tCoordPair &coo)
Definition Mesh.hpp:574
void __GetCoords(const tC2n &c2n, tSmallCoords &cs)
directly load coords; gets faulty if isPeriodic!
Definition Mesh.hpp:506
index NumNodeProc() const
Definition Mesh.hpp:466
index CellIndexLocal2Global_NoSon(index i)
Definition Mesh.hpp:302
tPbiPair face2nodePbi
periodic only, after interpolated
Definition Mesh.hpp:104
std::vector< index > node2bndNode
Definition Mesh.hpp:128
void BuildGhostPrimary()
building ghost (son) from primary (currently only cell2cell)
Definition Mesh.cpp:802
tPoint GetCoordNodeOnFace(index iFace, rowsize if2n)
Definition Mesh.hpp:597
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
Definition Mesh.hpp:645
index NumNodeGhost() const
Definition Mesh.hpp:461
std::vector< index > cell2parentCell
Definition Mesh.hpp:129
void GetCoordsOnCell(index iCell, tSmallCoords &cs)
Definition Mesh.hpp:566
std::vector< uint8_t > vtkCellType
Definition Mesh.hpp:133
MeshAdjState adjC2CFaceState
Definition Mesh.hpp:49
std::vector< index > node2parentNode
parent built
Definition Mesh.hpp:127
auto getBnd2NodeIndexPbiRow(index iBnd)
Definition Mesh.hpp:193
tAdjPair cell2nodePeriodicRecreated
Definition Mesh.hpp:140
index LocalPartStart(int iPart) const
Definition Mesh.hpp:453
index NumCellProc() const
Definition Mesh.hpp:467
index NodeIndexLocal2Global_NoSon(index i)
Definition Mesh.hpp:294
index NodeIndexGlobal2Local(DNDS::index i)
Definition Mesh.hpp:292
tLocalMatStruct cell2cellFaceVLocalParts
for cell local factorization
Definition Mesh.hpp:169
std::vector< index > vtkCell2nodeOffsets
for parallel out
Definition Mesh.hpp:132
void ElevatedNodesGetBoundarySmooth(const std::function< bool(t_index)> &FiFBndIdNeedSmooth)
index BndIndexLocal2Global_NoSon(index i)
Definition Mesh.hpp:310
tCoordPair coords
reader
Definition Mesh.hpp:54
index CellIndexGlobal2Local(DNDS::index i)
Definition Mesh.hpp:300
tLocalMatStruct GetCell2CellFaceVLocal(bool onLocalPartition=false)
index IndexGlobal2Local(TPair &pair, DNDS::index iGlobal)
Global-to-local conversion using father+son ghost mapping.
Definition Mesh.hpp:219
void RecoverNode2CellAndNode2Bnd()
only requires father part of cell2node, bnd2node and coords generates node2cell and node2bnd (father ...
Definition Mesh.cpp:489
MeshAdjState adjN2CBState
Definition Mesh.hpp:47
void for_each_device_member(F &&f)
Definition Mesh.hpp:768
void ReorderLocalCells(int nParts=1, int nPartsInner=1)
Definition Mesh.cpp:2405
index IndexLocal2Global_NoSon(TPair &pair, index iLocal)
Local-to-global conversion using only the father's global mapping (no son / ghost layer).
Definition Mesh.hpp:257
void op_on_device_arrays(F &&f)
Definition Mesh.hpp:756
index NumFaceProc() const
Definition Mesh.hpp:468
struct DNDS::Geom::UnstructuredMesh::HDF5OutSetting hdf5OutSetting
void BuildBisectO1FormO2(UnstructuredMesh &meshO2)
void GetCoordsOnFace(index iFace, tSmallCoords &cs)
Definition Mesh.hpp:582
void SetHDF5OutSetting(size_t chunkSiz, int deflateLevel, bool coll_on_data, bool coll_on_meta)
Definition Mesh.hpp:720
tPoint GetCoordNodeOnCell(index iCell, rowsize ic2n)
Definition Mesh.hpp:590
void ReadSerialize(Serializer::SerializerBaseSSP serializerP, const std::string &name)
Definition Mesh.cpp:1970
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)
Definition Mesh.hpp:181
tAdjPair cell2cellFace
constructed on demand
Definition Mesh.hpp:124
index CellIndexGlobal2Local_NoSon(index i)
Definition Mesh.hpp:303
bool CellIsFaceBack(index iCell, index iFace) const
Definition Mesh.hpp:618
t_index GetFaceZone(index iF)
Definition Mesh.hpp:485
Elem::Element GetBndElement(index iB)
Definition Mesh.hpp:482
index BndIndexLocal2Global(DNDS::index i)
Definition Mesh.hpp:309
tAdjPair node2cell
inverse relations
Definition Mesh.hpp:83
std::vector< index > bnd2faceV
Definition Mesh.hpp:101
Elem::Element GetFaceElement(index iF)
Definition Mesh.hpp:481
index CellIndexLocal2Global(DNDS::index i)
Definition Mesh.hpp:301
index IndexLocal2Global(TPair &pair, DNDS::index iLocal)
Local-to-global conversion using father+son ghost mapping.
Definition Mesh.hpp:239
MeshAdjState adjPrimaryState
Definition Mesh.hpp:41
void ObtainSymmetricSymbolicFactorization(Direct::SerialSymLUStructure &symLU, Direct::DirectPrecControl control) const
Definition Mesh.cpp:2231
void __GetCoords(const tC2n &c2n, tSmallCoords &cs, tCoordExt &coo)
directly load coords; gets faulty if isPeriodic!
Definition Mesh.hpp:522
index CellFaceOther(index iCell, index iFace) const
Definition Mesh.hpp:624
tElemInfoArrayPair faceElemInfo
Definition Mesh.hpp:97
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)
Definition Mesh.cpp:457
struct DNDS::Geom::UnstructuredMesh::ElevationInfo elevationInfo
std::vector< index > localPartitionStarts
Definition Mesh.hpp:171
index NumBndProc() const
Definition Mesh.hpp:469
void __GetCoordsOnElem(const tC2n &c2n, const tC2nPbi &c2nPbi, tSmallCoords &cs, tCoordExt &coo)
specially for periodicity
Definition Mesh.hpp:554
MeshAdjState adjFacialState
Definition Mesh.hpp:43
index BndIndexGlobal2Local(DNDS::index i)
Definition Mesh.hpp:308
void BuildO2FromO1Elevation(UnstructuredMesh &meshO1)
void RecoverCell2CellAndBnd2Cell()
needs to use RecoverNode2CellAndNode2Bnd before doing this. Requires node2cell.father and builds a ve...
Definition Mesh.cpp:542
void WriteSerialize(Serializer::SerializerBaseSSP serializerP, const std::string &name)
Definition Mesh.cpp:1933
tElemInfoArrayPair cellElemInfo
Definition Mesh.hpp:59
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.
Definition Mesh.hpp:332
index NumCellGhost() const
Definition Mesh.hpp:462
index NumBndGhost() const
Definition Mesh.hpp:464
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.
Definition Mesh.hpp:357
index LocalPartEnd(int iPart) const
Definition Mesh.hpp:454
tPoint GetCoordWallDistOnFace(index iFace, rowsize if2n)
Definition Mesh.hpp:611
t_index GetCellZone(index iC)
Definition Mesh.hpp:484
index IndexGlobal2Local_NoSon(TPair &pair, index iGlobal)
Global-to-local conversion using only the father's global mapping (no son / ghost layer).
Definition Mesh.hpp:276
void ConstructBndMesh(UnstructuredMesh &bMesh)
Definition Mesh.cpp:2061
tElemInfoArrayPair bndElemInfo
Definition Mesh.hpp:60
tPoint GetCoordWallDistOnCell(index iCell, rowsize ic2n)
Definition Mesh.hpp:604
t_index GetBndZone(index iB)
Definition Mesh.hpp:486
MeshElevationState elevState
Definition Mesh.hpp:52
void BuildNodeWallDist(const std::function< bool(Geom::t_index)> &fBndIsWall, WallDistOptions options=WallDistOptions{})
index NodeIndexLocal2Global(DNDS::index i)
Definition Mesh.hpp:293
tAdjPair cell2face
interpolated
Definition Mesh.hpp:94
std::vector< index > vtkCell2node
Definition Mesh.hpp:134
std::vector< index > nodeRecreated2nodeLocal
Definition Mesh.hpp:142
void TransformCoords(TFTrans &&FTrans)
Definition Mesh.hpp:697
Lightweight bundle of an MPI communicator and the calling rank's coordinates.
Definition MPI.hpp:215
int rank
This rank's 0-based index within comm (-1 until initialised).
Definition MPI.hpp:219
Eigen::Matrix< real, 5, 1 > v
auto adj
auto result
Eigen::Vector3d n(1.0, 0.0, 0.0)