DNDSR 0.2.1
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
test_MeshConnectivity.cpp File Reference

Unit tests for MeshConnectivity DSL operations: Inverse, Compose, ComposeFiltered. Also tests MeshConnectivity struct management (cone/support). More...

#include "doctest.h"
#include "SyntheticMeshBuilders.hpp"
#include "Geom/Mesh/MeshConnectivity.hpp"
#include "Geom/Mesh/Mesh.hpp"
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <unordered_set>
#include <numeric>
Include dependency graph for test_MeshConnectivity.cpp:

Go to the source code of this file.

Macros

#define DOCTEST_CONFIG_IMPLEMENT
 

Functions

 TEST_CASE ("Inverse: 4-quad serial correctness")
 
 TEST_CASE ("Inverse: round-trip covers original cell2node")
 
 TEST_CASE ("ComposeFiltered: 4-quad cell2cell via node-neighbor")
 
c2n father createGlobalMapping ()
 
 for (DNDS::index iCell=0;iCell< nCellLocal;iCell++) for(auto iNode
 
std::vector< DNDS::indexghostNodes (ghostNodeSet.begin(), ghostNodeSet.end())
 
n2c TransAttach ()
 
n2c trans createFatherGlobalMapping ()
 
n2c trans createGhostMapping (ghostNodes)
 
n2c trans createMPITypes ()
 
n2c trans pullOnce ()
 
std::vector< std::set< DNDS::index > > globalC2CFace (4)
 
 TEST_CASE ("Regression: Inverse matches RecoverNode2CellAndNode2Bnd on UniformSquare_10")
 
 TEST_CASE ("Regression: ComposeFiltered matches RecoverCell2CellAndBnd2Cell on UniformSquare_10")
 
 TEST_CASE ("MeshConnectivity: cone management")
 
 TEST_CASE ("MeshConnectivity: support management")
 
 TEST_CASE ("ConeAdj: AdjVariant typed access")
 
 TEST_CASE ("SupportAdj: no pbi member")
 
 TEST_CASE ("Inverse<2>: fixed-width face2cell input")
 
 TEST_CASE ("narrowAdjToFixed: variable-to-fixed-2 conversion")
 
 TEST_CASE ("Periodic 2x2x2: ComposeFiltered cell2cellFace is WRONG without pbi filter")
 
int main (int argc, char **argv)
 

Variables

auto nodeGM = makeNodeGlobalMapping4Quad(g_mpi)
 
DNDS::index nNodeLocal = nodeLocalCount4Quad(g_mpi)
 
DNDS::index nCellLocal = c2n.father->Size()
 
auto n2c
 
std::unordered_set< DNDS::indexghostNodeSet
 
n2c son = make_ssp<decltype(n2c.son)::element_type>(ObjName{"n2c.son"}, g_mpi)
 
std::unordered_map< DNDS::index, DNDS::indexnodeG2L
 
auto c2c_face
 
std::vector< std::set< DNDS::index > > expected
 

Detailed Description

Unit tests for MeshConnectivity DSL operations: Inverse, Compose, ComposeFiltered. Also tests MeshConnectivity struct management (cone/support).

Definition in file test_MeshConnectivity.cpp.

Macro Definition Documentation

◆ DOCTEST_CONFIG_IMPLEMENT

#define DOCTEST_CONFIG_IMPLEMENT

Definition at line 7 of file test_MeshConnectivity.cpp.

Function Documentation

◆ createFatherGlobalMapping()

n2c trans createFatherGlobalMapping ( )

◆ createGhostMapping()

n2c trans createGhostMapping ( ghostNodes  )

◆ createGlobalMapping()

c2n father createGlobalMapping ( )

◆ createMPITypes()

n2c trans createMPITypes ( )

◆ for()

for ( )

Definition at line 273 of file test_MeshConnectivity.cpp.

◆ ghostNodes()

std::vector< DNDS::index > ghostNodes ( ghostNodeSet.  begin(),
ghostNodeSet.  end() 
)
Here is the caller graph for this function:

◆ globalC2CFace()

std::vector< std::set< DNDS::index > > globalC2CFace ( )
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Verify that cell2cellFace on periodic meshes should be derived from Interpolate (face→cell), not from ComposeFiltered. The compose-based approach cannot correctly distinguish face-neighbors from non-face-neighbors when all cells share all nodes (as on 2×2 doubly-periodic or 2×2×2 triply-periodic meshes).

The correct cell2cellFace derivation is tested in "Periodic 2x2: cell2face from Interpolate" and "Periodic 2x2x2: face interpolation" tests above.

Definition at line 810 of file test_MeshConnectivity.cpp.

Here is the call graph for this function:

◆ pullOnce()

n2c trans pullOnce ( )

◆ TEST_CASE() [1/12]

TEST_CASE ( "ComposeFiltered: 4-quad cell2cell via node-neighbor"  )

Definition at line 150 of file test_MeshConnectivity.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [2/12]

TEST_CASE ( "ConeAdj: AdjVariant typed access"  )

Definition at line 544 of file test_MeshConnectivity.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [3/12]

TEST_CASE ( "Inverse: 4-quad serial correctness"  )

Definition at line 33 of file test_MeshConnectivity.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [4/12]

TEST_CASE ( "Inverse: round-trip covers original cell2node"  )

Definition at line 84 of file test_MeshConnectivity.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [5/12]

TEST_CASE ( "Inverse<2>: fixed-width face2cell input"  )

Definition at line 583 of file test_MeshConnectivity.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [6/12]

TEST_CASE ( "MeshConnectivity: cone management"  )

Definition at line 506 of file test_MeshConnectivity.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [7/12]

TEST_CASE ( "MeshConnectivity: support management"  )

Definition at line 527 of file test_MeshConnectivity.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [8/12]

TEST_CASE ( "narrowAdjToFixed: variable-to-fixed-2 conversion"  )

Definition at line 651 of file test_MeshConnectivity.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [9/12]

TEST_CASE ( "Periodic 2x2x2: ComposeFiltered cell2cellFace is WRONG without pbi filter"  )

Definition at line 684 of file test_MeshConnectivity.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [10/12]

TEST_CASE ( "Regression: ComposeFiltered matches RecoverCell2CellAndBnd2Cell on UniformSquare_10"  )

Definition at line 408 of file test_MeshConnectivity.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [11/12]

TEST_CASE ( "Regression: Inverse matches RecoverNode2CellAndNode2Bnd on UniformSquare_10"  )

Build a mesh through the legacy pipeline up to node2cell state, then compare with DSL Inverse.

Definition at line 356 of file test_MeshConnectivity.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [12/12]

TEST_CASE ( "SupportAdj: no pbi member"  )

Definition at line 568 of file test_MeshConnectivity.cpp.

Here is the call graph for this function:

◆ TransAttach()

cellElemInfo TransAttach ( )

Variable Documentation

◆ c2c_face

auto c2c_face
Initial value:
{ return cellLocal2Global4Quad(g_mpi, i); },
SharedCountPredicate{.minShared = 2, .removeSelf = true})
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
Definition Defines.hpp:112
static ArrayAdjacencyPair< out_rs > ComposeFiltered(const ArrayAdjacencyPair< rs_AB > &AB, const ArrayAdjacencyPair< rs_BC > &BC, index nALocal, const std::unordered_map< index, index > &bGlobal2Local, const std::function< index(index)> &aLocal2Global, Predicate &&pred, const std::function< bool(index aLocal, index cGlobal, const std::vector< index > &sharedBGlobals)> &matchExtra=nullptr)
DNDS::index nCellLocal
std::unordered_map< DNDS::index, DNDS::index > nodeG2L

Definition at line 294 of file test_MeshConnectivity.cpp.

◆ expected

std::vector<std::set<DNDS::index> > expected
Initial value:
= {
{1, 2},
{0, 3},
{0, 3},
{1, 2},
}

Definition at line 331 of file test_MeshConnectivity.cpp.

◆ ghostNodeSet

std::unordered_set<DNDS::index> ghostNodeSet

Definition at line 272 of file test_MeshConnectivity.cpp.

◆ n2c

auto n2c
Initial value:
c2n, nNodeLocal, g_mpi,
{ return cellLocal2Global4Quad(g_mpi, i); },
{ return nodeLocal2Global4Quad(g_mpi, i); },
static tAdjPair Inverse(const ArrayAdjacencyPair< cone_rs > &cone, index nToLocal, const MPIInfo &mpi, const std::function< index(index)> &fromLocal2Global, const std::function< index(index)> &toLocal2Global, const ssp< GlobalOffsetsMapping > &toGlobalMapping)
DNDS::index nNodeLocal

Definition at line 263 of file test_MeshConnectivity.cpp.

◆ nCellLocal

DNDS::index nCellLocal = c2n.father->Size()

Definition at line 261 of file test_MeshConnectivity.cpp.

◆ nNodeLocal

DNDS::index nNodeLocal = nodeLocalCount4Quad(g_mpi)

Definition at line 260 of file test_MeshConnectivity.cpp.

◆ nodeG2L

std::unordered_map<DNDS::index, DNDS::index> nodeG2L

Definition at line 289 of file test_MeshConnectivity.cpp.

◆ nodeGM

auto nodeGM = makeNodeGlobalMapping4Quad(g_mpi)

Definition at line 258 of file test_MeshConnectivity.cpp.

◆ son

n2c son = make_ssp<decltype(n2c.son)::element_type>(ObjName{"n2c.son"}, g_mpi)

Definition at line 282 of file test_MeshConnectivity.cpp.