42 cellVolumeWeightMethod,
53 const label startSeedI,
62 for (label i = startSeedI; i < srcCellIDs.
size(); ++i)
64 const label srcI = srcCellIDs[i];
87 Pout<<
"could not find starting seed" <<
endl;
100 const label srcSeedI,
101 const label tgtSeedI,
107 label srcCelli = srcSeedI;
108 label tgtCelli = tgtSeedI;
110 List<DynamicList<label>> srcToTgtAddr(src_.nCells());
111 List<DynamicList<scalar>> srcToTgtWght(src_.nCells());
113 List<DynamicList<label>> tgtToSrcAddr(tgt_.nCells());
114 List<DynamicList<scalar>> tgtToSrcWght(tgt_.nCells());
117 DynamicList<label> nbrTgtCells(10);
120 DynamicList<label> visitedTgtCells(10);
124 seedCells[srcCelli] = tgtCelli;
131 visitedTgtCells.clear();
134 nbrTgtCells.append(tgtCelli);
135 appendNbrCells(tgtCelli, tgt_, visitedTgtCells, nbrTgtCells);
139 tgtCelli = nbrTgtCells.remove();
140 visitedTgtCells.append(tgtCelli);
142 scalar vol = interVol(srcCelli, tgtCelli);
145 if (vol/srcVol[srcCelli] > tolerance_)
148 srcToTgtAddr[srcCelli].
append(tgtCelli);
149 srcToTgtWght[srcCelli].
append(vol);
151 tgtToSrcAddr[tgtCelli].
append(srcCelli);
152 tgtToSrcWght[tgtCelli].
append(vol);
154 appendNbrCells(tgtCelli, tgt_, visitedTgtCells, nbrTgtCells);
160 while (!nbrTgtCells.empty());
162 mapFlag[srcCelli] =
false;
176 while (srcCelli != -1);
179 forAll(srcToTgtCellAddr, i)
181 srcToTgtCellAddr[i].transfer(srcToTgtAddr[i]);
182 srcToTgtCellWght[i].transfer(srcToTgtWght[i]);
185 forAll(tgtToSrcCellAddr, i)
187 tgtToSrcCellAddr[i].transfer(tgtToSrcAddr[i]);
188 tgtToSrcCellWght[i].transfer(tgtToSrcWght[i]);
196 forAll(srcToTgtCellAddr, cellI)
198 scalar srcVol = src_.cellVolumes()[cellI];
199 scalar tgtVol =
sum(srcToTgtCellWght[cellI]);
201 if (
mag(srcVol) > ROOTVSMALL &&
mag((tgtVol-srcVol)/srcVol) > 1
e-6)
204 <<
"At cell " << cellI <<
" cc:" 205 << src_.cellCentres()[cellI]
207 <<
" total overlap volume:" << tgtVol
212 forAll(tgtToSrcCellAddr, cellI)
214 scalar tgtVol = tgt_.cellVolumes()[cellI];
215 scalar srcVol =
sum(tgtToSrcCellWght[cellI]);
217 if (
mag(tgtVol) > ROOTVSMALL &&
mag((srcVol-tgtVol)/tgtVol) > 1
e-6)
220 <<
"At cell " << cellI <<
" cc:" 221 << tgt_.cellCentres()[cellI]
223 <<
" total overlap volume:" << srcVol
238 const DynamicList<label>& visitedCells,
242 const labelList& srcNbrCells = src_.cellCells()[srcCelli];
246 bool valuesSet =
false;
249 label cellS = srcNbrCells[i];
251 if (mapFlag[cellS] && seedCells[cellS] == -1)
255 label cellT = visitedCells[j];
257 if (intersect(cellS, cellT))
259 seedCells[cellS] = cellT;
280 bool foundNextSeed =
false;
281 for (label i = startSeedI; i < srcCellIDs.size(); i++)
283 label cellS = srcCellIDs[i];
290 foundNextSeed =
true;
293 if (seedCells[cellS] != -1)
296 tgtCelli = seedCells[cellS];
306 Pout<<
"Advancing front stalled: searching for new " 307 <<
"target cell" <<
endl;
335 Foam::cellVolumeWeightMethod::cellVolumeWeightMethod
380 boolList mapFlag(src_.nCells(),
false);
386 label startSeedI = 0;
List< labelList > labelListList
A List of labelList.
void size(const label n)
Older name for setAddressableSize.
const polyMesh & src_
Reference to the source mesh.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
virtual ~cellVolumeWeightMethod()
Destructor.
void append(const T &val)
Append an element at the end of the list.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
const cellList & cells() const
Macros for easy insertion into run-time selection tables.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
const dimensionedScalar e
Elementary charge.
void clear()
Clear the list, i.e. set size to zero.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual const faceList & faces() const
Return raw faces.
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)
Base class for mesh-to-mesh calculation methods.
void setNextCells(label &startSeedI, label &srcCelli, label &tgtCelli, const labelList &srcCellIDs, const boolList &mapFlag, const DynamicList< label > &visitedCells, labelList &seedCells) const
Set the next cells in the advancing front algorithm.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
const indexedOctree< treeDataCell > & cellTree() const
Return the cell search tree.
List< scalarList > scalarListList
A List of scalarList.
#define WarningInFunction
Report a warning using Foam::Warning.
virtual void calculate(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, pointListList &srcToTgtVec, labelListList &tgtToSrcAddr, scalarListList &tgtToSrcWght, pointListList &tgtToSrcVec)
Calculate addressing and weights and optionally offset vectors.
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
virtual bool intersect(const label srcCelli, const label tgtCelli) const
Return the true if cells intersect.
List< bool > boolList
A List of bools.
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.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
UIndirectList< bool > boolUIndList
UIndirectList of bools.