|
DNDSR 0.2.1
Distributed Numeric Data Structure for CFV
|
Unit tests for ReorderPlan, ReorderRegistry, and classification. More...
#include "doctest.h"#include "Geom/Mesh/ReorderPlan.hpp"#include "Geom/Mesh/Mesh.hpp"#include <numeric>#include <set>Go to the source code of this file.
Macros | |
| #define | DOCTEST_CONFIG_IMPLEMENT |
Typedefs | |
| using | idx = DNDS::index |
Functions | |
| int | main (int argc, char **argv) |
| TEST_CASE ("classifyAdj basic classification") | |
| TEST_CASE ("ReorderRegistry register and query") | |
| TEST_CASE ("ReorderPlan::apply cell-only local permutation") | |
| TEST_CASE ("ReorderPlan::apply node-only remap") | |
| TEST_CASE ("ReorderEntities cell-only local on UniformSquare_10") | |
| TEST_CASE ("ReorderEntities cell-only with face destruction on UniformSquare_10") | |
| TEST_CASE ("ReorderEntities cell distributed round-robin with follow") | |
| TEST_CASE ("ReorderEntities node-only local on UniformSquare_10") | |
| TEST_CASE ("PermutationTransfer + buildLookup: reverse permutation value tracking") | |
| TEST_CASE ("PermutationTransfer distributed value tracking cross-rank") | |
| TEST_CASE ("PermutationTransfer::buildLookup cross-rank resolve with pullSet") | |
| solverDOF | InitPair ("solverDOF", mpi) |
| solverDOF father | Resize (nCellBefore) |
| mesh | AdjLocal2GlobalPrimary () |
| for (DNDS::index i=0;i< nCellBefore;i++) | |
| std::vector< MPI_int > | cellPartition (nCellBefore) |
| input explicitMaps | push_back (EntityReorderMap{EntityKind::Cell, cellPartition}) |
| reg | registerCompanion (EntityKind::Cell, [&](const PermutationTransfer &t, const MPIInfo &m) { t.transferRows(solverDOF, m);}, "solverDOF") |
| plan | apply (reg, mpi) |
| cell2node | InitPair ("cell2node", mpi) |
| cell2node father | Resize (nCell) |
| cell2node father | createGlobalMapping () |
| nodeArr | InitPair ("nodeArr", mpi) |
| nodeArr father | Resize (nNode) |
| reg | registerGlobalMapping (EntityKind::Cell, cell2node.father->pLGlobalMapping) |
| reg | registerGlobalMapping (EntityKind::Node, nodeArr.father->pLGlobalMapping) |
| reg | registerAdj (Adj::Cell2Node, [&](const PermutationTransfer::LookupResult &lookup) { for(DNDS::index i=0;i< cell2node.father->Size();i++) for(rowsize j=0;j< 2;j++) { DNDS::index &v=cell2node(i, j);if(v !=UnInitIndex) v=lookup.resolve(v);} }, [&](const PermutationTransfer &t, const MPIInfo &m) { t.transferRows(cell2node, m);}, "cell2node") |
| std::vector< MPI_int > | cellPartition (nCell, mpi.rank) |
| std::vector< MPI_int > | nodePartition (nNode, mpi.rank) |
| input explicitMaps | push_back (EntityReorderMap{EntityKind::Node, nodePartition}) |
| CHECK (plan.reorderedKinds.count(EntityKind::Cell)) | |
| CHECK (plan.reorderedKinds.count(EntityKind::Node)) | |
| CHECK (classifyAdj(Adj::Cell2Node, plan.reorderedKinds)==AdjAction::RELOCATE_REMAP) | |
| TEST_CASE ("buildReorderRegistry populates pullSets for off-rank references") | |
Variables | |
| auto | mesh = buildMeshPrimary(mpi, "UniformSquare_10.cgns", 2, false) |
| DNDS::index | nCellBefore = mesh->NumCell() |
| ArrayAdjacencyPair< 3 > | solverDOF |
| solverDOF father | pLGlobalMapping = mesh->cell2node.father->pLGlobalMapping |
| DNDS::index | cellOffset = (*mesh->cell2node.father->pLGlobalMapping)(mpi.rank, 0) |
| std::map< DNDS::index, std::array< DNDS::index, 3 > > | expectedByOldGlobal |
| ReorderInput | input |
| auto | plan = mesh->buildReorderPlan(input) |
| auto | reg = mesh->buildReorderRegistry(input.destroyKinds) |
| const auto & | transfer = plan.transfers.at(EntityKind::Cell) |
| DNDS::index | nAfter = solverDOF.father->Size() |
| const DNDS::index | nCell = 4 |
| const DNDS::index | nNode = 6 |
| ArrayAdjacencyPair< 2 > | cell2node |
| ArrayAdjacencyPair< 1 > | nodeArr |
| DNDS::index | nodeOffset = (*nodeArr.father->pLGlobalMapping)(mpi.rank, 0) |
| std::map< DNDS::index, std::array< DNDS::index, 2 > > | oldCell2NodeByGlobal |
Unit tests for ReorderPlan, ReorderRegistry, and classification.
Tests:
Definition in file test_MeshReorder.cpp.
| #define DOCTEST_CONFIG_IMPLEMENT |
Definition at line 12 of file test_MeshReorder.cpp.
| using idx = DNDS::index |
Definition at line 24 of file test_MeshReorder.cpp.
| mesh AdjLocal2GlobalPrimary | ( | ) |
| std::vector< MPI_int > cellPartition | ( | nCellBefore | ) |
| CHECK | ( | classifyAdj(Adj::Cell2Node, plan.reorderedKinds) | = =AdjAction::RELOCATE_REMAP | ) |
| CHECK | ( | plan.reorderedKinds. | countEntityKind::Cell | ) |
| CHECK | ( | plan.reorderedKinds. | countEntityKind::Node | ) |
| for | ( | ) |
Definition at line 850 of file test_MeshReorder.cpp.
| cell2node InitPair | ( | "cell2node" | , |
| mpi | |||
| ) |
| nodeArr InitPair | ( | "nodeArr" | , |
| mpi | |||
| ) |
| solverDOF InitPair | ( | "solverDOF" | , |
| mpi | |||
| ) |
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Definition at line 26 of file test_MeshReorder.cpp.
| input explicitMaps push_back | ( | EntityReorderMap{EntityKind::Cell, cellPartition} | ) |
| input explicitMaps push_back | ( | EntityReorderMap{EntityKind::Node, nodePartition} | ) |
| reg registerAdj | ( | Adj::Cell2Node | , |
| [&] (const PermutationTransfer::LookupResult &lookup) { for(DNDS::index i=0;i< cell2node.father->Size();i++) for(rowsize j=0;j< 2;j++) { DNDS::index &v=cell2node(i, j);if(v !=UnInitIndex) v=lookup.resolve(v);} } | , | ||
| [&] (const PermutationTransfer &t, const MPIInfo &m) { t.transferRows(cell2node, m);} | , | ||
| "cell2node" | |||
| ) |
| reg registerCompanion | ( | EntityKind::Cell | , |
| [&] (const PermutationTransfer &t, const MPIInfo &m) { t.transferRows(solverDOF, m);} | , | ||
| "solverDOF" | |||
| ) |
| reg registerGlobalMapping | ( | EntityKind::Cell | , |
| cell2node.father-> | pLGlobalMapping | ||
| ) |
| reg registerGlobalMapping | ( | EntityKind::Node | , |
| nodeArr.father-> | pLGlobalMapping | ||
| ) |
| solverDOF father Resize | ( | nCellBefore | ) |
| TEST_CASE | ( | "buildReorderRegistry populates pullSets for off-rank references" | ) |
| TEST_CASE | ( | "classifyAdj basic classification" | ) |
| TEST_CASE | ( | "PermutationTransfer + buildLookup: reverse permutation value tracking" | ) |
| TEST_CASE | ( | "PermutationTransfer distributed value tracking cross-rank" | ) |
| TEST_CASE | ( | "PermutationTransfer::buildLookup cross-rank resolve with pullSet" | ) |
| TEST_CASE | ( | "ReorderEntities cell distributed round-robin with follow" | ) |
| TEST_CASE | ( | "ReorderEntities cell-only local on UniformSquare_10" | ) |
| TEST_CASE | ( | "ReorderEntities cell-only with face destruction on UniformSquare_10" | ) |
| TEST_CASE | ( | "ReorderEntities node-only local on UniformSquare_10" | ) |
| TEST_CASE | ( | "ReorderPlan::apply cell-only local permutation" | ) |
| TEST_CASE | ( | "ReorderPlan::apply node-only remap" | ) |
| TEST_CASE | ( | "ReorderRegistry register and query" | ) |
| ArrayAdjacencyPair<2> cell2node |
Definition at line 930 of file test_MeshReorder.cpp.
| DNDS::index cellOffset = (*mesh->cell2node.father->pLGlobalMapping)(mpi.rank, 0) |
Definition at line 847 of file test_MeshReorder.cpp.
| std::map<DNDS::index, std::array<DNDS::index, 3> > expectedByOldGlobal |
Definition at line 858 of file test_MeshReorder.cpp.
| ReorderInput input |
Definition at line 871 of file test_MeshReorder.cpp.
| auto mesh = buildMeshPrimary(mpi, "UniformSquare_10.cgns", 2, false) |
Definition at line 834 of file test_MeshReorder.cpp.
| DNDS::index nAfter = solverDOF.father->Size() |
Definition at line 903 of file test_MeshReorder.cpp.
| const DNDS::index nCell = 4 |
Definition at line 926 of file test_MeshReorder.cpp.
| DNDS::index nCellBefore = mesh->NumCell() |
Definition at line 836 of file test_MeshReorder.cpp.
| const DNDS::index nNode = 6 |
Definition at line 927 of file test_MeshReorder.cpp.
| ArrayAdjacencyPair<1> nodeArr |
Definition at line 935 of file test_MeshReorder.cpp.
| DNDS::index nodeOffset = (*nodeArr.father->pLGlobalMapping)(mpi.rank, 0) |
Definition at line 941 of file test_MeshReorder.cpp.
| std::map<DNDS::index, std::array<DNDS::index, 2> > oldCell2NodeByGlobal |
Definition at line 951 of file test_MeshReorder.cpp.
Definition at line 875 of file test_MeshReorder.cpp.
| solverDOF father pLGlobalMapping = mesh->cell2node.father->pLGlobalMapping |
Definition at line 844 of file test_MeshReorder.cpp.
| ReorderRegistry reg = mesh->buildReorderRegistry(input.destroyKinds) |
Definition at line 878 of file test_MeshReorder.cpp.
| ArrayAdjacencyPair<3> solverDOF |
Definition at line 840 of file test_MeshReorder.cpp.
| const auto& transfer = plan.transfers.at(EntityKind::Cell) |
Definition at line 895 of file test_MeshReorder.cpp.