36 void Foam::volPointInterpolation::pushUntransformedData
44 const labelList& meshPoints = cpp.meshPoints();
46 const distributionMap& slavesMap = gmd.globalCoPointSlavesMap();
49 List<Type> elems(slavesMap.constructSize());
52 elems[i] = pointData[meshPoints[i]];
63 elems[slavePoints[j]] = elems[i];
68 slavesMap.reverseDistribute(elems.size(), elems,
false);
73 pointData[meshPoints[i]] = elems[i];
79 void Foam::volPointInterpolation::addSeparated
81 GeometricField<Type, pointPatchField, pointMesh>& pf
86 Pout<<
"volPointInterpolation::addSeparated" <<
endl;
89 typename GeometricField<Type, pointPatchField, pointMesh>::
90 Internal& pfi = pf.ref();
92 typename GeometricField<Type, pointPatchField, pointMesh>::
93 Boundary& pfbf = pf.boundaryFieldRef();
97 if (pfbf[patchi].coupled())
99 refCast<coupledPointPatchField<Type>>
100 (pfbf[
patchi]).initSwapAddSeparated
113 if (pfbf[patchi].coupled())
115 refCast<coupledPointPatchField<Type>>
116 (pfbf[
patchi]).swapAddSeparated
127 void Foam::volPointInterpolation::interpolateInternalField
129 const GeometricField<Type, fvPatchField, volMesh>& vf,
130 GeometricField<Type, pointPatchField, pointMesh>& pf
135 Pout<<
"volPointInterpolation::interpolateInternalField(" 136 <<
"const GeometricField<Type, fvPatchField, volMesh>&, " 137 <<
"GeometricField<Type, pointPatchField, pointMesh>&) : " 138 <<
"interpolating field from cells to points" 145 forAll(pointCells, pointi)
147 if (!isPatchPoint_[pointi])
150 const labelList& ppc = pointCells[pointi];
156 pf[pointi] += pw[pointCelli]*vf[ppc[pointCelli]];
166 const GeometricField<Type, fvPatchField, volMesh>& vf
169 const fvMesh& mesh = vf.mesh();
170 const fvBoundaryMesh& bm = mesh.boundary();
172 tmp<Field<Type>> tboundaryVals
174 new Field<Type>(mesh.nFaces()-mesh.nInternalFaces())
176 Field<Type>& boundaryVals = tboundaryVals.ref();
180 label bFacei = bm[
patchi].patch().start() - mesh.nInternalFaces();
184 !isA<emptyFvPatch>(bm[patchi])
185 && !vf.boundaryField()[
patchi].coupled()
191 vf.boundaryField()[
patchi].size(),
193 ) = vf.boundaryField()[
patchi];
197 const polyPatch& pp = bm[
patchi].patch();
201 boundaryVals[bFacei++] =
Zero;
206 return tboundaryVals;
211 void Foam::volPointInterpolation::interpolateBoundaryField
213 const GeometricField<Type, fvPatchField, volMesh>& vf,
214 GeometricField<Type, pointPatchField, pointMesh>& pf
219 Field<Type>& pfi = pf.primitiveFieldRef();
222 tmp<Field<Type>> tboundaryVals(flatBoundaryField(vf));
223 const Field<Type>& boundaryVals = tboundaryVals();
226 forAll(boundary.meshPoints(), i)
228 const label pointi = boundary.meshPoints()[i];
230 if (isPatchPoint_[pointi])
232 const labelList& pFaces = boundary.pointFaces()[i];
233 const scalarList& pWeights = boundaryPointWeights_[i];
235 Type& val = pfi[pointi];
240 if (boundaryIsPatchFace_[pFaces[j]])
242 val += pWeights[j]*boundaryVals[pFaces[j]];
257 pushUntransformedData(pfi);
262 bool havePatchTypes =
false;
266 if (pf.boundaryField()[
patchi].overridesConstraint())
268 havePatchTypes =
true;
283 "volPointSumWeights",
291 pf.boundaryField().size(),
292 calculatedPointPatchField<scalar>::typeName
299 forAll(boundary.meshPoints(), i)
301 const label pointi = boundary.meshPoints()[i];
303 if (isPatchPoint_[pointi])
305 pswi[pointi] =
sum(boundaryPointWeights_[i]);
313 pushUntransformedData(pswi);
316 forAll(boundary.meshPoints(), i)
318 const label pointi = boundary.meshPoints()[i];
320 if (isPatchPoint_[pointi])
322 pfi[pointi] /= pswi[pointi];
329 void Foam::volPointInterpolation::interpolateBoundaryField
331 const GeometricField<Type, fvPatchField, volMesh>& vf,
332 GeometricField<Type, pointPatchField, pointMesh>& pf,
333 const bool overrideFixedValue
336 interpolateBoundaryField(vf, pf);
354 Pout<<
"volPointInterpolation::interpolate(" 355 <<
"const GeometricField<Type, fvPatchField, volMesh>&, " 356 <<
"GeometricField<Type, pointPatchField, pointMesh>&) : " 357 <<
"interpolating field from cells to points" 361 interpolateInternalField(vf, pf);
364 interpolateBoundaryField(vf, pf,
false);
383 "volPointInterpolate(" + vf.
name() +
')',
390 interpolateInternalField(vf, tpf());
393 interpolateBoundaryField(vf, tpf(),
true);
429 if (!cache || vf.
mesh().changing())
432 if (db.objectRegistry::template foundObject<PointFieldType>(name))
435 db.objectRegistry::template lookupObjectRef<PointFieldType>
440 if (pf.ownedByRegistry())
465 if (!db.objectRegistry::template foundObject<PointFieldType>(name))
469 PointFieldType* pfPtr = tpf.
ptr();
476 db.objectRegistry::template lookupObjectRef<PointFieldType>
496 PointFieldType* pfPtr = tpf.
ptr();
514 return interpolate(vf,
"volPointInterpolate(" + vf.
name() +
')',
false);
List< labelList > labelListList
A List of labelList.
tmp< GeometricField< Type, pointPatchField, pointMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &) const
Interpolate volField using inverse distance weighting.
#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.
const word & name() const
Return name.
T & ref() const
Return non-const reference or generate a fatal error.
IOobject(const word &name, const fileName &instance, const objectRegistry ®istry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
Construct from name, instance, registry, io options.
wordList patchTypes(nPatches)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Generic GeometricField class.
const dimensionSet dimless
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Mesh representing a set of points created from polyMesh.
const dimensionSet & dimensions() const
Return dimensions.
A class for handling words, derived from string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static void syncUntransformedData(const polyMesh &mesh, List< Type > &pointData, const CombineOp &cop)
Helper: sync data on collocated points only.
List< scalar > scalarList
A List of scalars.
const objectRegistry & thisDb() const
Return database. For now is its polyMesh.
static const word null
An empty word.
const globalMeshData & globalData() const
Return parallel info.
List< label > labelList
A List of labels.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
void store()
Transfer ownership of this object to its registry.
const Mesh & mesh() const
Return mesh.
static pointMesh & New(polyMesh &mesh)
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
Addressing for a faceList slice.
List< word > wordList
A List of words.
const fvMesh & mesh() const
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
prefixOSstream Pout(cout, "Pout")
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
T * ptr() const
Return tmp pointer for reuse.
A class for managing temporary objects.
Registry of regIOobjects.
const objectRegistry & db() const
Return the local objectRegistry.
static void cachePrintMessage(const char *message, const word &name, const FieldType &vf)
Helper for printing cache message.
void constrain(GeometricField< Type, pointPatchField, pointMesh > &pf, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints) and.