62 label srcCellI = srcSeedI;
63 label tgtCellI = tgtSeedI;
81 seedCells[srcCellI] = tgtCellI;
93 queuedCells.push_back(tgtCellI);
96 while (!queuedCells.empty())
99 tgtCellI = queuedCells.back();
100 queuedCells.pop_back();
101 visitedCells.push_back(tgtCellI);
113 srcToTgtAddr[srcCellI].append(tgtCellI);
114 srcToTgtWght[srcCellI].append(vol.
first());
115 srcToTgtVec[srcCellI].append(vol.
second()-tgtCc[tgtCellI]);
117 tgtToSrcAddr[tgtCellI].append(srcCellI);
118 tgtToSrcWght[tgtCellI].append(vol.
first());
119 tgtToSrcVec[tgtCellI].append(vol.
second()-srcCc[srcCellI]);
128 mapFlag[srcCellI] =
false;
142 while (srcCellI != -1);
145 forAll(srcToTgtCellAddr, i)
147 srcToTgtCellAddr[i].
transfer(srcToTgtAddr[i]);
148 srcToTgtCellWght[i].
transfer(srcToTgtWght[i]);
149 srcToTgtCellVec[i].
transfer(srcToTgtVec[i]);
152 forAll(tgtToSrcCellAddr, i)
154 tgtToSrcCellAddr[i].
transfer(tgtToSrcAddr[i]);
155 tgtToSrcCellWght[i].
transfer(tgtToSrcWght[i]);
156 tgtToSrcCellVec[i].
transfer(tgtToSrcVec[i]);
164 forAll(srcToTgtCellAddr, cellI)
166 scalar srcVol =
src_.cellVolumes()[cellI];
167 scalar tgtVol =
sum(srcToTgtCellWght[cellI]);
169 if (
mag(srcVol) > ROOTVSMALL &&
mag((tgtVol-srcVol)/srcVol) > 1
e-6)
172 <<
"At cell " << cellI <<
" cc:"
173 <<
src_.cellCentres()[cellI]
175 <<
" total overlap volume:" << tgtVol
180 forAll(tgtToSrcCellAddr, cellI)
182 scalar tgtVol =
tgt_.cellVolumes()[cellI];
183 scalar srcVol =
sum(tgtToSrcCellWght[cellI]);
185 if (
mag(tgtVol) > ROOTVSMALL &&
mag((srcVol-tgtVol)/tgtVol) > 1
e-6)
188 <<
"At cell " << cellI <<
" cc:"
189 <<
tgt_.cellCentres()[cellI]
191 <<
" total overlap volume:" << srcVol
207 cellVolumeWeightMethod(
src,
tgt)
251 boolList mapFlag(src_.nCells(),
false);
257 label startSeedI = 0;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void pop_back(label n=1)
Reduce size by 1 or more elements. Can be called on an empty list.
void push_back(const T &val)
Copy append an element to the end of this list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
void append(const T &val)
Append an element at the end of the list.
void setSize(label n)
Alias for resize().
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
const T1 & first() const noexcept
Access the first element.
const T2 & second() const noexcept
Access the second element.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
T & back()
Access last element of the list, position [size()-1].
void size(const label n)
Older name for setAddressableSize.
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.
void setNextCells(label &startSeedI, label &srcCelli, label &tgtCelli, const labelList &srcCellIDs, const boolList &mapFlag, const labelUList &visitedCells, labelList &seedCells) const
Set the next cells in the advancing front algorithm.
Cell-volume-weighted mesh-to-mesh interpolation class.
correctedCellVolumeWeightMethod(const correctedCellVolumeWeightMethod &)=delete
No copy construct.
void calculateAddressing(labelListList &srcToTgtCellAddr, scalarListList &srcToTgtCellWght, pointListList &srcToTgtCellVec, labelListList &tgtToSrcCellAddr, scalarListList &tgtToSrcCellWght, pointListList &tgtToSrcCellVec, const label srcSeedI, const label tgtSeedI, const labelList &srcCellIDs, boolList &mapFlag, label &startSeedI)
Calculate the mesh-to-mesh addressing and weights.
virtual void calculate(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, pointListList &srcToTgtVec, labelListList &tgtToSrcAddr, scalarListList &tgtToSrcWght, pointListList &tgtToSrcVec)
Calculate addressing and weights and optionally offset vectors.
virtual ~correctedCellVolumeWeightMethod()
Destructor.
Base class for mesh-to-mesh calculation methods.
const polyMesh & tgt_
Reference to the target mesh.
const polyMesh & src() const
Return const access to the source mesh.
const polyMesh & src_
Reference to the source mesh.
static scalar tolerance_
Tolerance used in volume overlap calculations.
const polyMesh & tgt() const
Return const access to the target mesh.
labelList maskCells() const
Return src cell IDs for the overlap region.
scalar V_
Cell total volume in overlap region [m3].
virtual bool initialise(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, labelListList &tgtToTgtAddr, scalarListList &tgtToTgtWght) const
virtual Tuple2< scalar, point > interVolAndCentroid(const label srcCellI, const label tgtCellI)
Return the intersection volume and centroid between two cells.
virtual void appendNbrCells(const label tgtCelli, const polyMesh &mesh, const labelUList &visitedTgtCells, DynamicList< label > &nbrTgtCellIDs) const
Append target cell neighbour cells to cellIDs list.
Mesh consisting of general polyhedral cells.
const scalarField & cellVolumes() const
const vectorField & cellCentres() const
label nCells() const noexcept
Number of mesh cells.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for handling debugging switches.
List< scalarList > scalarListList
List of scalarList.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
List< bool > boolList
A List of bools.
UIndirectList< bool > boolUIndList
UIndirectList of bools.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
vectorField pointField
pointField is a vectorField.
List< pointList > pointListList
List of pointList.
#define forAll(list, i)
Loop across all elements in list.