31 void Foam::meshToMesh0::calculateInverseDistanceWeights()
const 36 <<
"Calculating inverse distance weighting factors" <<
endl;
39 if (inverseDistanceWeightsPtr_)
42 <<
"weighting factors already calculated" 57 forAll(cellAddressing_, celli)
59 if (cellAddressing_[celli] != -1)
61 const vector& target = centreTo[celli];
62 scalar m =
mag(target - centreFrom[cellAddressing_[celli]]);
64 const labelList& neighbours = cc[cellAddressing_[celli]];
68 label directCelli = -1;
69 if (m < directHitTol || neighbours.empty())
77 scalar nm =
mag(target - centreFrom[neighbours[ni]]);
78 if (nm < directHitTol)
80 directCelli = neighbours[ni];
87 if (directCelli != -1)
90 invDistCoeffs[directCelli].setSize(1);
91 invDistCoeffs[directCelli][0] = 1.0;
92 V_ += fromMesh_.
V()[cellAddressing_[directCelli]];
96 invDistCoeffs[celli].setSize(neighbours.size() + 1);
100 scalar invDist = 1.0/m;
101 invDistCoeffs[celli][0] = invDist;
102 scalar sumInvDist = invDist;
107 invDist = 1.0/
mag(target - centreFrom[neighbours[ni]]);
108 invDistCoeffs[celli][ni + 1] = invDist;
109 sumInvDist += invDist;
113 forAll(invDistCoeffs[celli], i)
115 invDistCoeffs[celli][i] /= sumInvDist;
120 invDistCoeffs[celli][0]
121 *fromMesh_.
V()[cellAddressing_[celli]];
122 for (
label i = 1; i < invDistCoeffs[celli].size(); i++)
125 invDistCoeffs[celli][i]*fromMesh_.
V()[neighbours[i-1]];
133 void Foam::meshToMesh0::calculateInverseVolumeWeights()
const 138 <<
"Calculating inverse volume weighting factors" <<
endl;
141 if (inverseVolumeWeightsPtr_)
144 <<
"weighting factors already calculated" 156 tetOverlapVolume overlapEngine;
160 const labelList& overlapCells = cellToCell[celli];
162 if (overlapCells.size() > 0)
164 invVolCoeffs[celli].
setSize(overlapCells.size());
168 label cellFrom = overlapCells[j];
169 treeBoundBox bbFromMesh
178 scalar v = overlapEngine.cellCellOverlapVolumeMinDecomp
187 invVolCoeffs[celli][j] = v/toMesh_.
V()[celli];
196 void Foam::meshToMesh0::calculateCellToCellAddressing()
const 201 <<
"Calculating cell to cell addressing" <<
endl;
204 if (cellToCellAddressingPtr_)
207 <<
"addressing already calculated" 214 tetOverlapVolume overlapEngine;
223 overlapEngine.overlappingCells(fromMesh_, toMesh_, iTo);
224 if (overLapCells.size() > 0)
226 cellToCell[iTo].
setSize(overLapCells.size());
229 cellToCell[iTo][j] = overLapCells[j];
230 V_ += fromMesh_.
V()[overLapCells[j]];
240 if (!inverseDistanceWeightsPtr_)
242 calculateInverseDistanceWeights();
245 return *inverseDistanceWeightsPtr_;
251 if (!inverseVolumeWeightsPtr_)
253 calculateInverseVolumeWeights();
256 return *inverseVolumeWeightsPtr_;
262 if (!cellToCellAddressingPtr_)
264 calculateCellToCellAddressing();
267 return *cellToCellAddressingPtr_;
List< labelList > labelListList
A List of labelList.
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Vector< scalar > vector
A scalar version of the templated Vector.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
virtual const pointField & points() const
Return raw points.
vectorField pointField
pointField is a vectorField.
List< scalarList > scalarListList
List< label > labelList
A List of labels.
void setSize(const label)
Reset size of List.
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
const volVectorField & C() const
Return cell centres.
const labelListList & cellCells() const
const labelListList & cellPoints() const
#define InfoInFunction
Report an information message using Foam::Info.