62 const label startSeedI,
67 const cellList& srcCells = src_.cells();
68 const faceList& srcFaces = src_.faces();
71 for (label i = startSeedI; i < srcCellIDs.
size(); i++)
73 label srcI = srcCellIDs[i];
77 const point srcCtr(srcCells[srcI].centre(srcPts, srcFaces));
78 label tgtI = tgt_.cellTree().findInside(srcCtr);
80 if (tgtI != -1 && intersect(srcI, tgtI))
92 Pout<<
"could not find starting seed" <<
endl;
105 const label srcSeedI,
106 const label tgtSeedI,
115 List<DynamicList<label>> srcToTgt(src_.nCells());
116 List<DynamicList<label>> tgtToSrc(tgt_.nCells());
118 DynamicList<label> srcSeeds(10);
123 label srcCelli = srcSeedI;
124 label tgtCelli = tgtSeedI;
129 srcToTgt[srcCelli].
append(tgtCelli);
130 tgtToSrc[tgtCelli].append(srcCelli);
133 mapFlag[srcCelli] =
false;
136 V_ += srcVc[srcCelli];
148 while (srcCelli >= 0);
151 forAll(srcToTgtCellAddr, i)
153 srcToTgtCellWght[i] =
scalarList(srcToTgt[i].size(), srcVc[i]);
154 srcToTgtCellAddr[i].transfer(srcToTgt[i]);
157 forAll(tgtToSrcCellAddr, i)
159 tgtToSrcCellWght[i] =
scalarList(tgtToSrc[i].size(), tgtVc[i]);
160 tgtToSrcCellAddr[i].transfer(tgtToSrc[i]);
169 DynamicList<label>& srcSeeds,
174 const labelList& srcNbr = src_.cellCells()[srcSeedI];
175 const labelList& tgtNbr = tgt_.cellCells()[tgtSeedI];
177 for (
const label srcI : srcNbr)
179 if (mapFlag[srcI] && (srcTgtSeed[srcI] == -1))
185 for (
const label tgtI : tgtNbr)
187 if (intersect(srcI, tgtI))
192 srcTgtSeed[srcI] = tgtI;
193 srcSeeds.push_back(srcI);
202 mapFlag[srcI] =
false;
207 if (!srcSeeds.empty())
209 srcSeedI = srcSeeds.back();
210 tgtSeedI = srcTgtSeed[srcSeedI];
222 Foam::directMethod::directMethod
267 boolList mapFlag(src_.nCells(),
false);
273 label startSeedI = 0;
List< scalar > scalarList
List of scalar.
void size(const label n)
Older name for setAddressableSize.
const polyMesh & src_
Reference to the source mesh.
void append(const T &val)
Append an element at the end of the list.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void calculate(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, pointListList &srcToTgtVec, labelListList &tgtToSrcAddr, scalarListList &tgtToSrcWght, pointListList &tgtToSrcVec)
Calculate addressing and weights and optionally offset vectors.
bool pointInCell(const point &p, label celli, const cellDecomposition=CELL_TETS) const
Test if point p is in the celli.
List< labelList > labelListList
List of labelList.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
virtual bool intersect(const label srcCelli, const label tgtCelli) const
Return the true if cells intersect.
virtual bool findInitialSeeds(const labelList &srcCellIDs, const boolList &mapFlag, const label startSeedI, label &srcSeedI, label &tgtSeedI) const
Find indices of overlapping cells in src and tgt meshes - returns.
List< scalarList > scalarListList
List of scalarList.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual void calculateAddressing(labelListList &srcToTgtCellAddr, scalarListList &srcToTgtCellWght, labelListList &tgtToSrcCellAddr, scalarListList &tgtToSrcCellWght, const label srcSeedI, const label tgtSeedI, const labelList &srcCellIDs, boolList &mapFlag, label &startSeedI)
Calculate the mesh-to-mesh addressing and weights.
virtual void appendToDirectSeeds(boolList &mapFlag, labelList &srcTgtSeed, DynamicList< label > &srcSeeds, label &srcSeedI, label &tgtSeedI) const
Append to list of src mesh seed indices.
const vectorField & cellCentres() const
const polyMesh & tgt_
Reference to the target mesh.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
defineTypeNameAndDebug(combustionModel, 0)
virtual ~directMethod()
Destructor.
Base class for mesh-to-mesh calculation methods.
Direct (one-to-one cell correspondence) mesh-to-mesh interpolation class.
List< label > labelList
A List of labels.
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
UIndirectList< bool > boolUIndList
UIndirectList of bools.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)