35 namespace cellsToCellss
45 bool Foam::cellsToCellss::matching::intersect
47 const polyMesh& srcMesh,
48 const polyMesh& tgtMesh,
55 srcMesh.cellCentres()[srcCelli],
62 bool Foam::cellsToCellss::matching::findInitialSeeds
64 const polyMesh& srcMesh,
65 const polyMesh& tgtMesh,
68 const label startSeedI,
73 const cellList& srcCells = srcMesh.cells();
74 const faceList& srcFaces = srcMesh.faces();
79 for (
label i = startSeedI; i < srcCellIDs.size(); i++)
81 label srcI = srcCellIDs[i];
85 const point srcCtr(srcCells[srcI].centre(srcPts, srcFaces));
87 label tgtI = tgtSearchEngine.findCell(srcCtr);
89 if (tgtI != -1 && intersect(srcMesh, tgtMesh, srcI, tgtI))
101 Pout<<
"could not find starting seed" <<
endl;
108 Foam::scalar Foam::cellsToCellss::matching::calculateAddressing
110 const polyMesh& srcMesh,
111 const polyMesh& tgtMesh,
116 const label srcSeedI,
117 const label tgtSeedI,
126 labelList srcTgtSeed(srcMesh.nCells(), -1);
131 DynamicList<label> srcSeeds(10);
135 label srcCelli = srcSeedI;
136 label tgtCelli = tgtSeedI;
141 srcToTgt[srcCelli].append(tgtCelli);
142 tgtToSrc[tgtCelli].append(srcCelli);
145 mapFlag[srcCelli] =
false;
148 V += srcVc[srcCelli];
162 while (srcCelli >= 0);
165 forAll(srcToTgtCellAddr, i)
167 srcToTgtCellWght[i] =
scalarList(srcToTgt[i].size(), scalar(1));
168 srcToTgtCellAddr[i].transfer(srcToTgt[i]);
171 forAll(tgtToSrcCellAddr, i)
173 tgtToSrcCellWght[i] =
scalarList(tgtToSrc[i].size(), scalar(1));
174 tgtToSrcCellAddr[i].transfer(tgtToSrc[i]);
181 void Foam::cellsToCellss::matching::appendToDirectSeeds
183 const polyMesh& srcMesh,
184 const polyMesh& tgtMesh,
187 DynamicList<label>& srcSeeds,
192 const labelList& srcNbr = srcMesh.cellCells()[srcSeedI];
193 const labelList& tgtNbr = tgtMesh.cellCells()[tgtSeedI];
197 label srcI = srcNbr[i];
199 if (mapFlag[srcI] && (srcTgtSeed[srcI] == -1))
207 label tgtI = tgtNbr[j];
209 if (intersect(srcMesh, tgtMesh, srcI, tgtI))
214 srcTgtSeed[srcI] = tgtI;
215 srcSeeds.append(srcI);
224 mapFlag[srcI] =
false;
231 srcSeedI = srcSeeds.remove();
232 tgtSeedI = srcTgtSeed[srcSeedI];
249 initialise(srcMesh, tgtMesh);
252 const labelList srcCellIDs(maskCells(srcMesh, tgtMesh));
261 label startSeedI = 0;
306 forAll(srcToTgtWght, srcCelli)
308 if (srcToTgtWght[srcCelli].size() > 1)
310 srcToTgtAddr[srcCelli].
resize(1);
311 srcToTgtWght[srcCelli].
resize(1);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
void resize(const label)
Alias for setSize(const label)
A List with indirect addressing.
Class to calculate interpolative addressing and weights between the cells of two overlapping meshes.
Matching, one-to-one, cells-to-cells interpolation class.
virtual scalar calculate(const polyMesh &srcMesh, const polyMesh &tgtMesh)
Calculate the addressing and weights.
virtual void normalise(const polyMesh &mesh, labelListList &localOtherCells, scalarListList &weights) const
Normalise the weights for a given mesh.
virtual ~matching()
Destructor.
matching()
Construct null.
static const meshSearch & New(const polyMesh &mesh, const pointInCellShapes=pointInCellShapes::tets)
Lookup or construct from mesh and cell decomposition option.
Motion of the mesh specified as a list of pointMeshMovers.
Mesh consisting of general polyhedral cells.
A class for handling words, derived from string.
defineTypeNameAndDebug(intersection, 0)
addToRunTimeSelectionTable(cellsToCells, intersection, word)
List< scalarList > scalarListList
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
List< cell > cellList
list of cells
Ostream & endl(Ostream &os)
Add newline and flush stream.
vectorField pointField
pointField is a vectorField.
List< bool > boolList
Bool container classes.
List< scalar > scalarList
A List of scalars.
vector point
Point is a vector.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
List< labelList > labelListList
A List of labelList.
bool pointInCellFacePlanes(const point &p, const polyMesh &mesh, const label celli)
Test if a point is in a given cell. For each of the cell's faces, define a.
prefixOSstream Pout(cout, "Pout")
Function for determining if a point is within a cell of a polyMesh.