DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
test_MeshIndexConversion.cpp File Reference

Parameterized doctest-based unit tests for UnstructuredMesh index conversion and adjacency Global2Local / Local2Global methods. More...

#include "doctest.h"
#include "Geom/Mesh.hpp"
#include <string>
#include <vector>
Include dependency graph for test_MeshIndexConversion.cpp:

Go to the source code of this file.

Classes

struct  MeshConfig
 

Macros

#define DOCTEST_CONFIG_IMPLEMENT
 
#define FOR_EACH_MESH_CONFIG(body)
 

Functions

int main (int argc, char **argv)
 
 TEST_CASE ("Mesh setup: every rank has cells and nodes")
 
 TEST_CASE ("Mesh setup: multi-rank produces ghosts")
 
 TEST_CASE ("Mesh setup: periodic state matches configuration")
 
 TEST_CASE ("Ball2: mixed 3D element types")
 
 TEST_CASE ("NodeIndex: Global2Local round-trip on father nodes")
 
 TEST_CASE ("NodeIndex: Global2Local round-trip on ghost nodes")
 
 TEST_CASE ("NodeIndex: _NoSon round-trip on father nodes")
 
 TEST_CASE ("NodeIndex: _NoSon returns negative for non-local global")
 
 TEST_CASE ("NodeIndex: Global2Local returns negative for unknown global")
 
 TEST_CASE ("CellIndex: Global2Local round-trip on father cells")
 
 TEST_CASE ("CellIndex: Global2Local round-trip on ghost cells")
 
 TEST_CASE ("CellIndex: _NoSon round-trip on father cells")
 
 TEST_CASE ("CellIndex: _NoSon returns negative for non-local global")
 
 TEST_CASE ("BndIndex: Global2Local round-trip on father bnds")
 
 TEST_CASE ("BndIndex: _NoSon round-trip on father bnds")
 
 TEST_CASE ("UnInitIndex pass-through for all 12 conversion methods")
 
 TEST_CASE ("Local2Global: negative local index decodes via -1-x encoding")
 
 TEST_CASE ("AdjPrimary: cell2node local indices are in valid range")
 
 TEST_CASE ("AdjPrimary: cell2cell local entries are valid or not-found")
 
 TEST_CASE ("AdjPrimary: bnd2cell owner cell is a local father cell")
 
 TEST_CASE ("AdjPrimary: bnd2node local indices are in valid range")
 
 TEST_CASE ("AdjPrimary: Local2Global then Global2Local is identity")
 
 TEST_CASE ("AdjPrimary: three consecutive round-trips are stable")
 
 TEST_CASE ("AdjPrimaryForBnd: round-trip on cell2node only")
 

Detailed Description

Parameterized doctest-based unit tests for UnstructuredMesh index conversion and adjacency Global2Local / Local2Global methods.

Tests run against 4 mesh configurations (same as test_MeshPipeline): [0] UniformSquare_10 – 2D, 100 quad cells, non-periodic [1] IV10_10 – 2D, 100 quad cells, periodic (isentropic vortex) [2] NACA0012_H2 – 2D, 20816 unstructured quad cells, non-periodic [3] IV10U_10 – 2D, 322 unstructured tri cells, periodic

Each mesh is partitioned with Metis, ghost layers built, then exercises:

  1. Per-entity index conversions (Global2Local, Local2Global, _NoSon)
  2. Adjacency state-machine round-trips (Primary, ForBnd)
  3. Round-trip stability under repeated conversions
  4. UnInitIndex pass-through
  5. Negative encoding for not-found globals
  6. Local index range validity after AdjGlobal2LocalPrimary

All meshes are pre-built in main() and destroyed together after tests. This avoids an OpenMPI resource exhaustion observed when building/destroying 20+ meshes in a single process at np=8.

Run under mpirun with 1, 2, 4, and 8 ranks.

Definition in file test_MeshIndexConversion.cpp.

Macro Definition Documentation

◆ DOCTEST_CONFIG_IMPLEMENT

#define DOCTEST_CONFIG_IMPLEMENT

Definition at line 27 of file test_MeshIndexConversion.cpp.

◆ FOR_EACH_MESH_CONFIG

#define FOR_EACH_MESH_CONFIG (   body)
Value:
for (int _ci = 0; _ci < N_CONFIGS; _ci++) \
{ \
/* Ball2 (index 4) is only tested with np=8 */ \
if (_ci == 4 && g_mpi.size != 8) continue; \
CAPTURE(_ci); \
const auto &cfg = g_configs[_ci]; \
auto m = g_meshes[_ci]; \
SUBCASE(cfg.name) { body } \
}
int size
Number of ranks in comm (-1 until initialised).
Definition MPI.hpp:221
if(g_mpi.rank==0) std auto[rhsDensity, rhsEnergy, incL2]

Definition at line 177 of file test_MeshIndexConversion.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 189 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [1/24]

TEST_CASE ( "AdjPrimary: bnd2cell owner cell is a local father cell"  )

Definition at line 548 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [2/24]

TEST_CASE ( "AdjPrimary: bnd2node local indices are in valid range"  )

Definition at line 561 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [3/24]

TEST_CASE ( "AdjPrimary: cell2cell local entries are valid or not-found"  )

Definition at line 533 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [4/24]

TEST_CASE ( "AdjPrimary: cell2node local indices are in valid range"  )

Definition at line 518 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [5/24]

TEST_CASE ( "AdjPrimary: Local2Global then Global2Local is identity"  )

Definition at line 579 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [6/24]

TEST_CASE ( "AdjPrimary: three consecutive round-trips are stable"  )

Definition at line 613 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [7/24]

TEST_CASE ( "AdjPrimaryForBnd: round-trip on cell2node only"  )

Definition at line 632 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [8/24]

TEST_CASE ( "Ball2: mixed 3D element types"  )

Definition at line 245 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [9/24]

TEST_CASE ( "BndIndex: _NoSon round-trip on father bnds"  )

Definition at line 467 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [10/24]

TEST_CASE ( "BndIndex: Global2Local round-trip on father bnds"  )

Definition at line 455 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [11/24]

TEST_CASE ( "CellIndex: _NoSon returns negative for non-local global"  )

Definition at line 441 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [12/24]

TEST_CASE ( "CellIndex: _NoSon round-trip on father cells"  )

Definition at line 429 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [13/24]

TEST_CASE ( "CellIndex: Global2Local round-trip on father cells"  )

Definition at line 402 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [14/24]

TEST_CASE ( "CellIndex: Global2Local round-trip on ghost cells"  )

Definition at line 414 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [15/24]

TEST_CASE ( "Local2Global: negative local index decodes via -1-x encoding"  )

Definition at line 503 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [16/24]

TEST_CASE ( "Mesh setup: every rank has cells and nodes"  )

Definition at line 217 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [17/24]

TEST_CASE ( "Mesh setup: multi-rank produces ghosts"  )

Definition at line 226 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [18/24]

TEST_CASE ( "Mesh setup: periodic state matches configuration"  )

Definition at line 236 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [19/24]

TEST_CASE ( "NodeIndex: _NoSon returns negative for non-local global"  )

Definition at line 378 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [20/24]

TEST_CASE ( "NodeIndex: _NoSon round-trip on father nodes"  )

Definition at line 366 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [21/24]

TEST_CASE ( "NodeIndex: Global2Local returns negative for unknown global"  )

Definition at line 389 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [22/24]

TEST_CASE ( "NodeIndex: Global2Local round-trip on father nodes"  )

Definition at line 340 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [23/24]

TEST_CASE ( "NodeIndex: Global2Local round-trip on ghost nodes"  )

Definition at line 352 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [24/24]

TEST_CASE ( "UnInitIndex pass-through for all 12 conversion methods"  )

Definition at line 482 of file test_MeshIndexConversion.cpp.

Here is the call graph for this function: