-
Notifications
You must be signed in to change notification settings - Fork 5
Index Cheatsheet
Piet Jarmatz edited this page Feb 23, 2024
·
10 revisions
For the following (default / template configuration):
- an MD30 domain
- cell size 2.5 (i.e. linked cell size and macroscopic cell size)
- outermost-overlap-layer="2"
- innermost-overlap-layer="3"
you will yield this structure:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
GL | M | VEL | VEL | MD2M | MD2M | MD2M | MD2M | MD2M | MD2M | VEL | VEL | M | GL |
where the upper row contains the global index of the macroscopic cell (in one of the spatial dimensions, i.e. one of the components of a vector index), and the lower row contains the type of the cell:
- GL = ghost layer, i.e. macroscopic cell outside the MD domain
- M = mass transfer, cell where USHER is active, if enabled
- VEL = velocity transfer cell, macro -> MD
- MD2M = 'MD -> Macro' domain = i.e. filtering domain = 'inner' MD domain
Legacy | New System | |
---|---|---|
indexConversion.getRank() |
= > | IDXS.getRank() |
indexConversion.getLocalNumberCouplingCells() |
= > | I11::numberCellsInDomain |
TransferStrategy::getLocalNumberCouplingCells() |
= > | I02::linearNumberCellsInDomain |
indexConversion.getCouplingCellSize() |
= > | IDXS.getCouplingCellSize() |
_indexConversion->getRanksForCouplingCell() |
= > | IDXS.getRanksForGlobalIndex(idx) |
_indexConversion->getUniqueRankForCouplingCell(idx) |
= > | IDXS.getUniqueRankForCouplingCell(idx) |
Legacy
const tarch::la::Vector<3, unsigned int> globalIndex(indexConversion.getGlobalVectorCellIndex(_buf.globalCellIndices4RecvBuffer[i]));
tarch::la::Vector<3, double> cellMidPoint(domainOffset - 0.5 * macroscopicCellSize);
for (unsigned int d = 0; d < 3; d++) {
cellMidPoint[d] = cellMidPoint[d] + ((double)globalIndex[d]) * macroscopicCellSize[d];
}
New System
auto midPoint = _buf.globalCellIndices4RecvBuffer[i].getCellMidPoint();
Legacy
const tarch::la::Vector<3, unsigned int> cells(indexConversion.getGlobalNumberMacroscopicCells() + tarch::la::Vector<3, unsigned int>(2));
const unsigned int num = cells[0] * cells[1] * cells[2];
unsigned int numCellsSent = 0;
for (unsigned int i = 0; i < num; i++) {
if (couetteSolverInterface.sendMacroscopicQuantityToMDSolver(indexConversion.getGlobalVectorCellIndex(i))) {
std::vector<unsigned int> ranks = couetteSolverInterface.getSourceRanks(indexConversion.getGlobalVectorCellIndex(i));
bool containsThisRank = false;
for (unsigned int k = 0; k < ranks.size(); k++) {
containsThisRank = containsThisRank || (ranks[k] == (unsigned int)_rank);
}
if (containsThisRank) {
numCellsSent++;
}
}
}
New System
for (auto idx : I00())
if (!I12::contains(idx))
if (tarch::utils::contains(msi.getSourceRanks(idx), (unsigned int)_rank))
numCellsSent++;
Legacy
some_function(const unsigned int index) {
const tarch::la::Vector<dim, unsigned int> globalIndex(
coupling::transferstrategies::TransferStrategy<LinkedCell, dim>::_indexConversion.convertLocalToGlobalVectorCellIndex(
coupling::transferstrategies::TransferStrategy<LinkedCell, dim>::_indexConversion.getLocalVectorCellIndex(index)));
const tarch::la::Vector<dim, unsigned int> globalNumberCells(
coupling::transferstrategies::TransferStrategy<LinkedCell, dim>::_indexConversion.getGlobalNumberMacroscopicCells());
const tarch::la::Vector<dim, double> meshsize(coupling::transferstrategies::TransferStrategy<LinkedCell,dim>
::_indexConversion.getMacroscopicCellSize());
if(globalIndex[0] == globalNumberCells[0]) do_sth();
}
New System
some_function(I01 index) {
const tarch::la::Vector<dim, double> meshsize(IDXS.getCouplingCellSize());
if(index.get()[0] == I09::numberCellsInDomain[0]) do_sth();
}