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
86 Pout<<
"volPointInterpolation::addSeparated" <<
endl;
89 typename PointField<Type>::
90 Internal& pfi = pf.ref();
92 typename PointField<Type>::
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 VolField<Type>& vf,
135 Pout<<
"volPointInterpolation::interpolateInternalField("
136 <<
"const VolField<Type>&, "
137 <<
"PointField<Type>&) : "
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 VolField<Type>& 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 VolField<Type>& vf,
219 Field<Type>& pfi = pf.primitiveFieldRef();
222 tmp<Field<Type>> tboundaryVals(flatBoundaryField(vf));
223 const Field<Type>& boundaryVals = tboundaryVals();
230 if (isPatchPoint_[pointi])
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
303 if (isPatchPoint_[pointi])
305 pswi[pointi] =
sum(boundaryPointWeights_[i]);
313 pushUntransformedData(pswi);
320 if (isPatchPoint_[pointi])
322 pfi[pointi] /= pswi[pointi];
329 void Foam::volPointInterpolation::interpolateBoundaryField
331 const VolField<Type>& vf,
332 PointField<Type>& pf,
333 const bool overrideFixedValue
336 interpolateBoundaryField(vf, pf);
341 pcs.constrain(pf, overrideFixedValue);
354 Pout<<
"volPointInterpolation::interpolate("
355 <<
"const VolField<Type>&, "
356 <<
"PointField<Type>&) : "
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);
427 if (!cache || vf.
mesh().changing())
433 db.objectRegistry::template lookupObjectRef<PointField<Type>>
474 db.objectRegistry::template lookupObjectRef<PointField<Type>>
512 return interpolate(vf,
"volPointInterpolate(" + vf.
name() +
')',
false);
#define forAll(list, i)
Loop across all elements in list.
const fvMesh & mesh() const
static pointMesh & New(const word &name, const polyMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
const dimensionSet & dimensions() const
Return dimensions.
const Mesh & mesh() const
Return mesh.
Generic GeometricField class.
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
const word & name() const
Return name.
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
Registry of regIOobjects.
static void syncUntransformedData(const polyMesh &mesh, List< Type > &pointData, const CombineOp &cop)
Helper: sync data on collocated points only.
Mesh representing a set of points created from polyMesh.
const objectRegistry & thisDb() const
Return database. For now is its polyMesh.
const globalMeshData & globalData() const
Return parallel info.
bool ownedByRegistry() const
Is this object owned by the registry?
void release()
Release ownership of this object from its registry.
bool upToDate(const regIOobject &) const
Return true if up-to-date with respect to given object.
void store()
Transfer ownership of this object to its registry.
static void cachePrintMessage(const char *message, const word &name, const FieldType &vf)
Helper for printing cache message.
A class for managing temporary objects.
T * ptr() const
Return tmp pointer for reuse.
T & ref() const
Return non-const reference or generate a fatal error.
tmp< PointField< Type > > interpolate(const VolField< Type > &) const
Interpolate volField using inverse distance weighting.
A class for handling words, derived from string.
static const word null
An empty word.
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
List< word > wordList
A List of words.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
const dimensionSet dimless
List< scalar > scalarList
A List of scalars.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
PointField< scalar > pointScalarField
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
Addressing for a faceList slice.
List< labelList > labelListList
A List of labelList.
prefixOSstream Pout(cout, "Pout")
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
wordList patchTypes(nPatches)
faceListList boundary(nPatches)
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< small) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &mergedCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]