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

Unit tests for MeshConnectivity Interpolate (local) and InterpolateGlobal (distributed). More...

#include "doctest.h"
#include "SyntheticMeshBuilders.hpp"
#include "Geom/Mesh/MeshConnectivity.hpp"
#include "Geom/Mesh/Mesh.hpp"
Include dependency graph for test_MeshConnectivity_Interpolate.cpp:

Go to the source code of this file.

Classes

struct  GhostCell
 

Macros

#define DOCTEST_CONFIG_IMPLEMENT
 

Typedefs

using tPoint = Eigen::Vector3d
 

Functions

 CHECK (res.nEntities==12)
 
 for (DNDS::index i=0;i< 4;i++)
 
 CHECK (nInternal==4)
 
 CHECK (res.nEntities - nInternal==8)
 
 CHECK (actualFaces==expectedFaces)
 
 CHECK (actualEdges==expectedEdges)
 
 CHECK (nShared==3)
 
 CHECK (actualShared==expectedShared)
 
 TEST_CASE ("Regression: Interpolate matches InterpolateFace on UniformSquare_10")
 
 TEST_CASE ("Interpolate: 2x2 periodic quad mesh — collaborating check required")
 
 CHECK (hasMultiParent==true)
 
std::vector< int > edgeRefCount (res.nEntities, 0)
 
for(DNDS::index iCell=0;iCell< 8;iCell++) for(DNDS j< res.parent2entity.father-> RowSize (iCell)
 
mesh build (4, false, g_mpi)
 
 CHECK (globalOwned==expectedFaces)
 
 CHECK (globalBnd==expectedBnd)
 
 CHECK (globalInt==expectedFaces - expectedBnd)
 
mesh build (4, true, g_mpi)
 
cellGM setMPIAlignBcast (g_mpi, nCellLocal)
 
nodeGM setMPIAlignBcast (g_mpi, nNodeLocal)
 
cell2node InitPair ("c2n", g_mpi)
 
cell2node father Resize (nCellLocal, 8)
 
cell2nodePbi InitPair ("c2nPbi", g_mpi)
 
cellElemInfo InitPair ("cInfo", g_mpi)
 
cellElemInfo father Resize (nCellLocal)
 
for(DNDS::index ix=0;ix< N;ix++) for(DNDS iy< N;iy++) for(DNDS::index iz=0;iz< N;iz++) { DNDS::index iCell=ix *N *N+iy *N+iz;DNDS::index gx=g_mpi.rank *N+ix;for(int k=0;k< 8;k++) { cell2node.father-> operator() (iCell, k)
 
cellElemInfo father operator() (iCell, 0)
 
 addGhostLayer (leftRank, N - 1, g_mpi.rank *N - 1)
 
 addGhostLayer (rightRank, 0,(g_mpi.rank+1) *N)
 
k< 8;k++) allNodeGlobals.insert(cell2node.father->operator()(iCell, k));for(auto &gc :ghostCells) for(auto ng :gc.nodes) allNodeGlobals.insert(ng);std::vector< DNDS::index > ghostNodeGlobals;for(auto ng :allNodeGlobals) { DNDS::MPI_int r;DNDS::index v;if(nodeGM->search(ng, r, v) &&r !=g_mpi.rank) ghostNodeGlobals.push_back(ng);} tAdjPair dummyNode;dummyNode.InitPair("dn", g_mpi);dummyNode.father-> Resize (nNodeLocal)
 
dummyNode TransAttach ()
 
dummyNode trans createFatherGlobalMapping ()
 
dummyNode trans createGhostMapping (ghostNodeGlobals)
 
dummyNode trans createMPITypes ()
 
 for (auto &gc :ghostCells) ghostGlobals.push_back(gc.global)
 
cell2node son Resize (static_cast< DNDS::index >(ghostCells.size()), 8)
 
cellElemInfo son Resize (static_cast< DNDS::index >(ghostCells.size()))
 
cell2node trans createGhostMapping (ghostGlobals)
 
cell2nodePbi trans BorrowGGIndexing (cell2node.trans)
 
k< 8;k++) { DNDS::index &ng=cell2node(iCell, k);auto[found, r, la]=nodeGhostMapping-> search_indexAppend (ng)
 
 DNDS_assert (found)
 
 CHECK (globalNBnd==0)
 
 CHECK (globalNFail==0)
 
 REQUIRE (bool(result.parent2entityPbi.father))
 
 CHECK (edgeGlobalOwned==expectedEdges)
 
 if (bits > 1) nMultiBit++
 
 CHECK (globalMultiBit==0)
 
int main (int argc, char **argv)
 

Variables

auto m
 
auto query = makeFaceQuery(m.cellElemInfo)
 
auto res = MeshConnectivity::Interpolate(m.cell2node, query, 4, 9, g_mpi)
 
int nInternal = 0
 
std::set< std::set< DNDS::index > > allVertSets
 
std::set< std::set< DNDS::index > > expectedFaces
 
std::set< std::set< DNDS::index > > actualFaces
 
res entityElemInfo
 
res i
 
std::set< std::set< DNDS::index > > expectedEdges
 
std::set< std::set< DNDS::index > > actualEdges
 
int nShared = 0
 
std::set< std::set< DNDS::index > > expectedShared = {{1, 2}, {1, 3}, {2, 3}}
 
std::set< std::set< DNDS::index > > actualShared
 
auto pm = makePeriodic2x2x2Mesh(g_mpi)
 
bool hasMultiParent = false
 
matchExtra = makePeriodicMatchExtra(pm.cellElemInfo, pm.cell2node, pm.cell2nodePbi, false)
 
std::map< DNDS::index, std::set< DNDS::index > > cellFN
 
j edgeRefCount [res.parent2entity.father->operator()(iCell, j)]
 
DNDS::index N = 4
 
DNDS::index np = g_mpi.size
 
DNDS::index nCellAll = mesh.cell2node.Size()
 
DNDS::index nLocalCells = mesh.nCellLocal
 
auto faceQuery = makeHex8FaceQueryPbi(mesh.cellElemInfo)
 
OwnershipResolverMulti resolver
 
auto result
 
DNDS::index localOwned = result.nOwnedEntities
 
DNDS::index globalOwned = 0
 
DNDS::index nBndFaces = 0
 
DNDS::index nIntFaces = 0
 
DNDS::index globalBnd = 0
 
DNDS::index globalInt = 0
 
DNDS::index expectedBnd = 2 * N * N + 2 * np * N * N + 2 * np * N * N
 
DistributedHex3D mesh
 
auto edgeQuery = makeHex8EdgeQueryPbi(mesh.cellElemInfo)
 
const DNDS::index nCellLocal = N * N * N
 
const DNDS::index nNodeLocal = N * N * N
 
auto cellGM = std::make_shared<GlobalOffsetsMapping>()
 
auto nodeGM = std::make_shared<GlobalOffsetsMapping>()
 
DNDS::index cellOff = (*cellGM)(g_mpi.rank, 0)
 
DNDS::index nodeOff = (*nodeGM)(g_mpi.rank, 0)
 
auto nodeGlobal
 
auto nodePbi
 
tAdjPair cell2node
 
tPbiPair cell2nodePbi
 
tElemInfoArrayPair cellElemInfo
 
const int di8 [8] = {0, 1, 1, 0, 0, 1, 1, 0}
 
const int dj8 [8] = {0, 0, 1, 1, 0, 0, 1, 1}
 
const int dk8 [8] = {0, 0, 0, 0, 1, 1, 1, 1}
 
DNDS::MPI_int leftRank = (g_mpi.rank - 1 + g_mpi.size) % g_mpi.size
 
DNDS::MPI_int rightRank = (g_mpi.rank + 1) % g_mpi.size
 
std::vector< GhostCellghostCells
 
auto addGhostLayer
 
std::set< DNDS::indexallNodeGlobals
 
auto nodeGhostMapping = dummyNode.trans.pLGhostMapping
 
DNDS::index nNodeTotal = nNodeLocal + static_cast<DNDS::index>(ghostNodeGlobals.size())
 
std::vector< DNDS::indexghostGlobals
 
cell2node son = std::make_shared<tAdj::element_type>(ObjName{"c2n.son"}, g_mpi)
 
auto cellGhostMapping = cell2node.trans.pLGhostMapping
 
 ng = la
 
faceQuery extractPbi
 
DNDS::index nBnd = 0
 
DNDS::index globalNBnd = 0
 
DNDS::index globalNFail = 0
 
MPI_Allreduce & nFail
 
auto edgeResult
 
DNDS::index edgeLocalOwned = edgeResult.nOwnedEntities
 
DNDS::index edgeGlobalOwned = 0
 
 j
 
int bits = __builtin_popcount(v)
 
DNDS::index globalMultiBit = 0
 
MPI_Allreduce & nMultiBit
 
auto makeCoord
 
auto applyPbi
 

Detailed Description

Unit tests for MeshConnectivity Interpolate (local) and InterpolateGlobal (distributed).

Tests cover face and edge extraction from 2D/3D meshes, periodic dedup with pbi collaborating check, and distributed interpolation with ownership resolution.

Definition in file test_MeshConnectivity_Interpolate.cpp.

Macro Definition Documentation

◆ DOCTEST_CONFIG_IMPLEMENT

#define DOCTEST_CONFIG_IMPLEMENT

Definition at line 9 of file test_MeshConnectivity_Interpolate.cpp.

Typedef Documentation

◆ tPoint

using tPoint = Eigen::Vector3d

Definition at line 1771 of file test_MeshConnectivity_Interpolate.cpp.

Function Documentation

◆ addGhostLayer() [1/2]

addGhostLayer ( leftRank  ,
N 1,
g_mpi.rank *N 1 
)

◆ addGhostLayer() [2/2]

addGhostLayer ( rightRank  ,
,
(g_mpi.rank+1) *  N 
)

◆ BorrowGGIndexing()

cellElemInfo trans BorrowGGIndexing ( cell2node.  trans)

◆ build() [1/2]

mesh build ( ,
false  ,
g_mpi   
)

◆ build() [2/2]

mesh build ( ,
true  ,
g_mpi   
)

◆ CHECK() [1/15]

CHECK ( actualEdges  = =expectedEdges)

◆ CHECK() [2/15]

CHECK ( actualFaces  = =expectedFaces)

◆ CHECK() [3/15]

◆ CHECK() [4/15]

◆ CHECK() [5/15]

CHECK ( globalBnd  = =expectedBnd)

◆ CHECK() [6/15]

CHECK ( globalInt  = =expectedFaces - expectedBnd)

◆ CHECK() [7/15]

CHECK ( globalMultiBit  = =0)

◆ CHECK() [8/15]

CHECK ( globalNBnd  = =0)

◆ CHECK() [9/15]

CHECK ( globalNFail  = =0)

◆ CHECK() [10/15]

CHECK ( globalOwned  = =expectedFaces)

◆ CHECK() [11/15]

CHECK ( hasMultiParent  = =true)

◆ CHECK() [12/15]

CHECK ( nInternal  = =4)

◆ CHECK() [13/15]

CHECK ( nShared  = =3)

◆ CHECK() [14/15]

CHECK ( res.nEntities -  nInternal = =8)

◆ CHECK() [15/15]

CHECK ( res.  nEntities = =12)
Here is the caller graph for this function:

◆ createFatherGlobalMapping()

dummyNode trans createFatherGlobalMapping ( )

◆ createGhostMapping() [1/2]

cell2node trans createGhostMapping ( ghostGlobals  )

◆ createGhostMapping() [2/2]

dummyNode trans createGhostMapping ( ghostNodeGlobals  )

◆ createMPITypes()

dummyNode trans createMPITypes ( )

◆ DNDS_assert()

DNDS_assert ( found  )

◆ edgeRefCount()

std::vector< int > edgeRefCount ( res.  nEntities,
 
)

◆ for() [1/2]

for ( auto &gc :ghostCells  )

◆ for() [2/2]

for ( )

Definition at line 61 of file test_MeshConnectivity_Interpolate.cpp.

Here is the call graph for this function:

◆ if()

if ( bits  ,
 
)

◆ InitPair() [1/3]

cell2node InitPair ( "c2n"  ,
g_mpi   
)

◆ InitPair() [2/3]

cell2nodePbi InitPair ( "c2nPbi"  ,
g_mpi   
)

◆ InitPair() [3/3]

cellElemInfo InitPair ( "cInfo"  ,
g_mpi   
)

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 1920 of file test_MeshConnectivity_Interpolate.cpp.

Here is the call graph for this function:

◆ operator()() [1/2]

cellElemInfo father operator() ( iCell  ,
 
)

◆ operator()() [2/2]

cell2nodePbi father operator() ( iCell  ,
 
)
Initial value:
=
nodePbi(gx, iy, iz, di8[k], dj8[k], dk8[k])

◆ REQUIRE()

REQUIRE ( bool(result.parent2entityPbi.father )
Here is the caller graph for this function:

◆ Resize() [1/5]

◆ Resize() [2/5]

cell2nodePbi father Resize ( nCellLocal  ,
 
)

◆ Resize() [3/5]

k< 8;k++) allNodeGlobals.insert(cell2node.father->operator()(iCell, k)); for(auto &gc :ghostCells) for(auto ng :gc.nodes) allNodeGlobals.insert(ng); std::vector< DNDS::index > ghostNodeGlobals; for(auto ng :allNodeGlobals) { DNDS::MPI_int r;DNDS::index v; if(nodeGM->search(ng, r, v) &&r !=g_mpi.rank) ghostNodeGlobals.push_back(ng); } tAdjPair dummyNode; dummyNode.InitPair("dn", g_mpi); dummyNode.father-> Resize ( nNodeLocal  )

◆ Resize() [4/5]

cellElemInfo son Resize ( static_cast< DNDS::index ghostCells.size())

◆ Resize() [5/5]

cell2nodePbi son Resize ( static_cast< DNDS::index ghostCells.size(),
 
)

◆ RowSize()

j< result.parent2entity.father-> RowSize ( iCell  )

◆ search_indexAppend()

k< 8;k++) { DNDS::index &ng=cell2node(iCell, k); auto[found, r, la]=nodeGhostMapping-> search_indexAppend ( ng  )

◆ setMPIAlignBcast() [1/2]

cellGM setMPIAlignBcast ( g_mpi  ,
nCellLocal   
)

◆ setMPIAlignBcast() [2/2]

nodeGM setMPIAlignBcast ( g_mpi  ,
nNodeLocal   
)

◆ TEST_CASE() [1/2]

TEST_CASE ( "Interpolate: 2x2 periodic quad mesh — collaborating check required"  )

Build a 2×2 quad mesh on [0,2]×[0,2], doubly-periodic (X period 2, Y period 2).

After periodic deduplication, 9 original nodes collapse to 4:

Original layout: After dedup (4 nodes): 6—7—8 0=(0,0) 1=(1,0) | 2 | 3 | 2=(0,1) 3=(1,1) 3—4—5 | 0 | 1 | Right col → left col + P1 0—1—2 Top row → bottom row + P2 Corner 8 → 0 + P1|P2

cell2node (deduped):

Definition at line 528 of file test_MeshConnectivity_Interpolate.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [2/2]

TEST_CASE ( "Regression: Interpolate matches InterpolateFace on UniformSquare_10"  )

Definition at line 425 of file test_MeshConnectivity_Interpolate.cpp.

Here is the call graph for this function:

◆ TransAttach()

dummyNode TransAttach ( )

Variable Documentation

◆ actualEdges

std::set<std::set<DNDS::index> > actualEdges

Definition at line 315 of file test_MeshConnectivity_Interpolate.cpp.

◆ actualFaces

std::set< std::set< DNDS::index > > actualFaces

Definition at line 203 of file test_MeshConnectivity_Interpolate.cpp.

◆ actualShared

std::set<std::set<DNDS::index> > actualShared

Definition at line 359 of file test_MeshConnectivity_Interpolate.cpp.

◆ addGhostLayer

auto addGhostLayer
Initial value:
= [&](DNDS::MPI_int srcRank, DNDS::index srcIx, DNDS::index physX)
{
for (DNDS::index iy = 0; iy < N; iy++)
for (DNDS::index iz = 0; iz < N; iz++)
{
gc.global = (*cellGM)(srcRank, 0) + srcIx * N * N + iy * N + iz;
for (int k = 0; k < 8; k++)
{
gc.nodes[k] = nodeGlobal(physX + di8[k], iy + dj8[k], iz + dk8[k]);
gc.pbi[k] = nodePbi(physX, iy, iz, di8[k], dj8[k], dk8[k]);
}
ghostCells.push_back(gc);
}
}
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
Definition Defines.hpp:112
int MPI_int
MPI counterpart type for MPI_int (= C int). Used for counts and ranks in MPI calls.
Definition MPI.hpp:54
std::array< NodePeriodicBits, 8 > pbi
std::array< DNDS::index, 8 > nodes
std::vector< GhostCell > ghostCells

Definition at line 1280 of file test_MeshConnectivity_Interpolate.cpp.

◆ allNodeGlobals

std::set<DNDS::index> allNodeGlobals

Definition at line 1303 of file test_MeshConnectivity_Interpolate.cpp.

◆ allVertSets

std::set<std::set<DNDS::index> > allVertSets

Definition at line 85 of file test_MeshConnectivity_Interpolate.cpp.

◆ applyPbi

auto applyPbi
Initial value:
= [&](const tPoint &c, NodePeriodicBits pbi) -> tPoint
{
tPoint ret = c;
if (pbi.getP1()) ret(0) += double(np * N);
if (pbi.getP2()) ret(1) += double(N);
if (pbi.getP3()) ret(2) += double(N);
return ret;
}
Eigen::Vector3d tPoint
Definition Geometric.hpp:9

Definition at line 1783 of file test_MeshConnectivity_Interpolate.cpp.

◆ bits

int bits = __builtin_popcount(v)

Definition at line 1758 of file test_MeshConnectivity_Interpolate.cpp.

◆ cell2node

tAdjPair cell2node

Definition at line 1241 of file test_MeshConnectivity_Interpolate.cpp.

◆ cell2nodePbi

tPbiPair cell2nodePbi

Definition at line 1244 of file test_MeshConnectivity_Interpolate.cpp.

◆ cellElemInfo

tElemInfoArrayPair cellElemInfo

Definition at line 1247 of file test_MeshConnectivity_Interpolate.cpp.

◆ cellFN

std::map<DNDS::index, std::set<DNDS::index> > cellFN

Definition at line 737 of file test_MeshConnectivity_Interpolate.cpp.

◆ cellGhostMapping

auto cellGhostMapping = cell2node.trans.pLGhostMapping

Definition at line 1365 of file test_MeshConnectivity_Interpolate.cpp.

◆ cellGM

auto cellGM = std::make_shared<GlobalOffsetsMapping>()

Definition at line 1205 of file test_MeshConnectivity_Interpolate.cpp.

◆ cellOff

DNDS::index cellOff = (*cellGM)(g_mpi.rank, 0)

Definition at line 1210 of file test_MeshConnectivity_Interpolate.cpp.

◆ di8

const int di8[8] = {0, 1, 1, 0, 0, 1, 1, 0}

Definition at line 1252 of file test_MeshConnectivity_Interpolate.cpp.

◆ dj8

const int dj8[8] = {0, 0, 1, 1, 0, 0, 1, 1}

Definition at line 1253 of file test_MeshConnectivity_Interpolate.cpp.

◆ dk8

const int dk8[8] = {0, 0, 0, 0, 1, 1, 1, 1}

Definition at line 1254 of file test_MeshConnectivity_Interpolate.cpp.

◆ edgeGlobalOwned

DNDS::index edgeGlobalOwned = 0

Definition at line 1669 of file test_MeshConnectivity_Interpolate.cpp.

◆ edgeLocalOwned

MPI_Allreduce & edgeLocalOwned = edgeResult.nOwnedEntities

Definition at line 1668 of file test_MeshConnectivity_Interpolate.cpp.

◆ edgeQuery

auto edgeQuery = makeHex8EdgeQueryPbi(mesh.cellElemInfo)

Definition at line 1022 of file test_MeshConnectivity_Interpolate.cpp.

◆ edgeRefCount

j edgeRefCount[res.parent2entity.father->operator()(iCell, j)]

Definition at line 805 of file test_MeshConnectivity_Interpolate.cpp.

◆ edgeResult

auto edgeResult
Initial value:
resolver, g_mpi)
static InterpolateGlobalResultT< e2p_rs > InterpolateGlobal(const ArrayAdjacencyPair< p2n_rs > &parent2node, const tPbiPair &parent2nodePbi, const OffsetAscendIndexMapping &parentGhostMapping, const GlobalOffsetsMapping &parentGlobalMapping, const OffsetAscendIndexMapping &nodeGhostMapping, const SubEntityQueryPbi &query, index nLocalParents, index nTotalParents, index nNode, const OwnershipResolverMulti &resolver, const MPIInfo &mpi)
const DNDS::index nCellLocal
OwnershipResolverMulti resolver

Definition at line 1661 of file test_MeshConnectivity_Interpolate.cpp.

◆ entityElemInfo

res entityElemInfo

Definition at line 205 of file test_MeshConnectivity_Interpolate.cpp.

◆ expectedBnd

DNDS::index expectedBnd = 2 * N * N + 2 * np * N * N + 2 * np * N * N

Definition at line 903 of file test_MeshConnectivity_Interpolate.cpp.

◆ expectedEdges

DNDS::index expectedEdges
Initial value:
= {
{0, 1}, {1, 2}, {0, 2}, {0, 3}, {1, 3}, {2, 3}}

Definition at line 313 of file test_MeshConnectivity_Interpolate.cpp.

◆ expectedFaces

DNDS::index expectedFaces
Initial value:
= {
{0, 1, 2}, {0, 1, 3}, {1, 2, 3}, {0, 2, 3}}

Definition at line 201 of file test_MeshConnectivity_Interpolate.cpp.

◆ expectedShared

std::set<std::set<DNDS::index> > expectedShared = {{1, 2}, {1, 3}, {2, 3}}

Definition at line 358 of file test_MeshConnectivity_Interpolate.cpp.

◆ extractPbi

edgeQuery extractPbi
Initial value:
= [&](DNDS::index iP, int iSub,
const std::function<NodePeriodicBits(int)> &pPbi,
{
auto e = Elem::Element{cellElemInfo[iP]->getElemType()};
auto f = e.ObtainFace(iSub);
std::vector<NodePeriodicBits> pp(e.GetNumNodes());
for (int i = 0; i < e.GetNumNodes(); i++) pp[i] = pPbi(i);
std::vector<NodePeriodicBits> fp(f.GetNumNodes());
e.ExtractFaceNodes(iSub, pp, fp);
for (int i = 0; i < f.GetNumNodes(); i++) out[i] = fp[i];
}
tElemInfoArrayPair cellElemInfo

Definition at line 1406 of file test_MeshConnectivity_Interpolate.cpp.

◆ faceQuery

auto faceQuery = makeHex8FaceQueryPbi(mesh.cellElemInfo)

Definition at line 832 of file test_MeshConnectivity_Interpolate.cpp.

◆ ghostCells

std::vector<GhostCell> ghostCells

Definition at line 1278 of file test_MeshConnectivity_Interpolate.cpp.

◆ ghostGlobals

std::vector<DNDS::index> ghostGlobals

Definition at line 1330 of file test_MeshConnectivity_Interpolate.cpp.

◆ globalBnd

DNDS::index globalBnd = 0

Definition at line 899 of file test_MeshConnectivity_Interpolate.cpp.

◆ globalInt

DNDS::index globalInt = 0

Definition at line 899 of file test_MeshConnectivity_Interpolate.cpp.

◆ globalMultiBit

DNDS::index globalMultiBit = 0

Definition at line 1762 of file test_MeshConnectivity_Interpolate.cpp.

◆ globalNBnd

DNDS::index globalNBnd = 0

Definition at line 1460 of file test_MeshConnectivity_Interpolate.cpp.

◆ globalNFail

DNDS::index globalNFail = 0

Definition at line 1535 of file test_MeshConnectivity_Interpolate.cpp.

◆ globalOwned

DNDS::index globalOwned = 0

Definition at line 867 of file test_MeshConnectivity_Interpolate.cpp.

◆ hasMultiParent

bool hasMultiParent = false

Definition at line 681 of file test_MeshConnectivity_Interpolate.cpp.

◆ i

res i

Definition at line 205 of file test_MeshConnectivity_Interpolate.cpp.

◆ j

j
Initial value:
{
uint8_t v = uint8_t(result.parent2entityPbi.father->operator()(iCell, j))
Eigen::Matrix< real, 5, 1 > v

Definition at line 1755 of file test_MeshConnectivity_Interpolate.cpp.

◆ leftRank

DNDS::MPI_int leftRank = (g_mpi.rank - 1 + g_mpi.size) % g_mpi.size

Definition at line 1274 of file test_MeshConnectivity_Interpolate.cpp.

◆ localOwned

MPI_Allreduce & localOwned = result.nOwnedEntities

Definition at line 866 of file test_MeshConnectivity_Interpolate.cpp.

◆ m

auto m
Initial value:
= makeHandCraftedMesh(g_mpi,
{
{Elem::Quad4, {0, 1, 4, 3}},
{Elem::Quad4, {1, 2, 5, 4}},
{Elem::Quad4, {3, 4, 7, 6}},
{Elem::Quad4, {4, 5, 8, 7}},
}, 9)

Definition at line 45 of file test_MeshConnectivity_Interpolate.cpp.

◆ makeCoord

auto makeCoord
Initial value:
= [&](DNDS::index nodeGlobalIdx) -> tPoint
{
nodeGM->search(nodeGlobalIdx, r, v);
DNDS::index localIdx = nodeGlobalIdx - (*nodeGM)(r, 0);
DNDS::index ix = localIdx / (N * N);
DNDS::index iy = (localIdx / N) % N;
DNDS::index iz = localIdx % N;
return tPoint(double(r * N + ix), double(iy), double(iz));
}
tVec r(NCells)

Definition at line 1772 of file test_MeshConnectivity_Interpolate.cpp.

◆ matchExtra

edgeQuery matchExtra = makePeriodicMatchExtra(pm.cellElemInfo, pm.cell2node, pm.cell2nodePbi, false)

Definition at line 691 of file test_MeshConnectivity_Interpolate.cpp.

◆ mesh

Initial value:
{
if (g_mpi.size < 2)
return
int size
Number of ranks in comm (-1 until initialised).
Definition MPI.hpp:237

Definition at line 929 of file test_MeshConnectivity_Interpolate.cpp.

◆ N

const DNDS::index N = 4

Definition at line 827 of file test_MeshConnectivity_Interpolate.cpp.

◆ nBnd

MPI_Allreduce & nBnd = 0

Definition at line 1456 of file test_MeshConnectivity_Interpolate.cpp.

◆ nBndFaces

MPI_Allreduce & nBndFaces = 0

Definition at line 887 of file test_MeshConnectivity_Interpolate.cpp.

◆ nCellAll

DNDS::index nCellAll = mesh.cell2node.Size()

Definition at line 829 of file test_MeshConnectivity_Interpolate.cpp.

◆ nCellLocal

const DNDS::index nCellLocal = N * N * N

Definition at line 1202 of file test_MeshConnectivity_Interpolate.cpp.

◆ nFail

MPI_Allreduce & nFail

Definition at line 1536 of file test_MeshConnectivity_Interpolate.cpp.

◆ ng

ng = la

Definition at line 1375 of file test_MeshConnectivity_Interpolate.cpp.

◆ nInternal

int nInternal = 0

Definition at line 75 of file test_MeshConnectivity_Interpolate.cpp.

◆ nIntFaces

MPI_Allreduce & nIntFaces = 0

Definition at line 887 of file test_MeshConnectivity_Interpolate.cpp.

◆ nLocalCells

Definition at line 830 of file test_MeshConnectivity_Interpolate.cpp.

◆ nMultiBit

MPI_Allreduce& nMultiBit

Definition at line 1763 of file test_MeshConnectivity_Interpolate.cpp.

◆ nNodeLocal

const DNDS::index nNodeLocal = N * N * N

Definition at line 1203 of file test_MeshConnectivity_Interpolate.cpp.

◆ nNodeTotal

DNDS::index nNodeTotal = nNodeLocal + static_cast<DNDS::index>(ghostNodeGlobals.size())

Definition at line 1327 of file test_MeshConnectivity_Interpolate.cpp.

◆ nodeGhostMapping

auto nodeGhostMapping = dummyNode.trans.pLGhostMapping

Definition at line 1326 of file test_MeshConnectivity_Interpolate.cpp.

◆ nodeGlobal

auto nodeGlobal
Initial value:
{
DNDS::index totalNx = np * N;
gx = ((gx % totalNx) + totalNx) % totalNx;
gy = ((gy % N) + N) % N;
gz = ((gz % N) + N) % N;
DNDS::MPI_int ownerRank = static_cast<DNDS::MPI_int>(gx / N);
DNDS::index localIx = gx - ownerRank * N;
return (*nodeGM)(ownerRank, 0) + localIx * N * N + gy * N + gz;
}

Definition at line 1214 of file test_MeshConnectivity_Interpolate.cpp.

◆ nodeGM

auto nodeGM = std::make_shared<GlobalOffsetsMapping>()

Definition at line 1207 of file test_MeshConnectivity_Interpolate.cpp.

◆ nodeOff

DNDS::index nodeOff = (*nodeGM)(g_mpi.rank, 0)

Definition at line 1211 of file test_MeshConnectivity_Interpolate.cpp.

◆ nodePbi

auto nodePbi
Initial value:
int di, int dj, int dk) -> NodePeriodicBits
{
DNDS::index totalNx = np * N;
if ((gx + di) >= totalNx || (gx + di) < 0)
pbi.setP1True();
if ((gy + dj) >= N || (gy + dj) < 0)
pbi.setP2True();
if ((gz + dk) >= N || (gz + dk) < 0)
pbi.setP3True();
return pbi;
}

Definition at line 1226 of file test_MeshConnectivity_Interpolate.cpp.

◆ np

const DNDS::index np = g_mpi.size

Definition at line 828 of file test_MeshConnectivity_Interpolate.cpp.

◆ nShared

int nShared = 0

Definition at line 351 of file test_MeshConnectivity_Interpolate.cpp.

◆ pm

auto pm = makePeriodic2x2x2Mesh(g_mpi)

Build a 2×2×2 Hex8 mesh on [0,2]³, triply-periodic (P1=X, P2=Y, P3=Z).

After periodic dedup: 27 nodes → 8 nodes, 8 cells. All 8 cells reference all 8 nodes (with varying pbi).

Definition at line 673 of file test_MeshConnectivity_Interpolate.cpp.

◆ query

auto query = makeFaceQuery(m.cellElemInfo)

Definition at line 53 of file test_MeshConnectivity_Interpolate.cpp.

◆ res

auto res = MeshConnectivity::Interpolate(m.cell2node, query, 4, 9, g_mpi)

Definition at line 54 of file test_MeshConnectivity_Interpolate.cpp.

◆ resolver

Initial value:
=
[&](const std::vector<DNDS::index> &parents,
const std::vector<DNDS::MPI_int> &parentRanks,
{
DNDS::MPI_int minRank = *std::min_element(parentRanks.begin(), parentRanks.end());
bool anyLocal = false;
for (auto p : parents)
if (p < nLocal)
anyLocal = true;
if (!anyLocal)
return {false, {}};
if (minRank != g_mpi.rank)
return {false, {}};
std::vector<DNDS::MPI_int> peers;
for (size_t i = 0; i < parents.size(); i++)
if (parents[i] >= nLocal && parentRanks[i] != g_mpi.rank)
peers.push_back(parentRanks[i]);
std::sort(peers.begin(), peers.end());
peers.erase(std::unique(peers.begin(), peers.end()), peers.end());
return {true, std::move(peers)};
}
int rank
This rank's 0-based index within comm (-1 until initialised).
Definition MPI.hpp:235
constexpr DNDS::index nLocal
if(bits > 1) nMultiBit++
const tPoint const tPoint const tPoint & p

Definition at line 835 of file test_MeshConnectivity_Interpolate.cpp.

◆ result

◆ rightRank

DNDS::MPI_int rightRank = (g_mpi.rank + 1) % g_mpi.size

Definition at line 1275 of file test_MeshConnectivity_Interpolate.cpp.

◆ son

cellElemInfo son = std::make_shared<tAdj::element_type>(ObjName{"c2n.son"}, g_mpi)

Definition at line 1334 of file test_MeshConnectivity_Interpolate.cpp.