39void Foam::volPointInterpolation::pushUntransformedData
47 const labelList& meshPoints = cpp.meshPoints();
49 const mapDistribute& slavesMap = gmd.globalCoPointSlavesMap();
52 List<Type> elems(slavesMap.constructSize());
55 elems[i] = pointData[meshPoints[i]];
66 elems[slavePoints[j]] = elems[i];
71 slavesMap.reverseDistribute(elems.size(), elems,
false);
76 pointData[meshPoints[i]] = elems[i];
82void Foam::volPointInterpolation::addSeparated
89 Pout<<
"volPointInterpolation::addSeparated" <<
endl;
92 auto& pfi = pf.internalFieldRef();
93 auto& pfbf = pf.boundaryFieldRef();
102 (pfbf[patchi]).initSwapAddSeparated
118 (pfbf[patchi]).swapAddSeparated
137 Pout<<
"volPointInterpolation::interpolateInternalField("
138 <<
"const GeometricField<Type, fvPatchField, volMesh>&, "
139 <<
"GeometricField<Type, pointPatchField, pointMesh>&) : "
140 <<
"interpolating field " << vf.name()
141 <<
" from cells to points " << pf.name() <<
endl;
149 if (!isPatchPoint_[pointi])
158 pf[pointi] += pw[pointCelli]*vf[ppc[pointCelli]];
174 Pout<<
"volPointInterpolation::interpolateDimensionedInternalField("
175 <<
"const DimensionedField<Type, volMesh>&, "
176 <<
"DimensionedField<Type, pointMesh>&) : "
177 <<
"interpolating field " << vf.name() <<
" from cells to points "
178 << pf.name() <<
endl;
197 pf[pointi] = Type(
Zero);
201 label celli = ppc[pointCelli];
202 scalar pw = 1.0/
mag(
points[pointi] - cellCentres[celli]);
204 pf[pointi] += pw*vf[celli];
216 scalar
s = sumW[pointi];
226Foam::tmp<Foam::Field<Type>>
227Foam::volPointInterpolation::flatBoundaryField
235 auto&
values = tboundaryVals.ref();
237 forAll(vf.boundaryField(), patchi)
239 const auto&
pp =
pbm[patchi];
240 const auto& pfld = vf.boundaryField()[patchi];
257 return tboundaryVals;
264 const GeometricField<Type, fvPatchField, volMesh>& vf,
265 GeometricField<Type, pointPatchField, pointMesh>& pf
270 Field<Type>& pfi = pf.primitiveFieldRef();
273 tmp<Field<Type>> tboundaryVals(flatBoundaryField(vf));
274 const Field<Type>& boundaryVals = tboundaryVals();
284 label pointi = mp[i];
286 if (isPatchPoint_[pointi])
289 const scalarList& pWeights = boundaryPointWeights_[i];
291 Type& val = pfi[pointi];
296 if (boundaryIsPatchFace_[
pFaces[j]])
298 val += pWeights[j]*boundaryVals[
pFaces[j]];
311 if (normalisationPtr_)
313 const scalarField& normalisation = normalisationPtr_();
316 pfi[
mp[i]] *= normalisation[i];
324 pushUntransformedData(pfi);
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 " << vf.
name() <<
" from cells to points "
361 interpolateInternalField(vf, pf);
383 "volPointInterpolate(" + vf.
name() +
')',
392 interpolateInternalField(vf, tpf.ref());
395 interpolateBoundaryField(vf, tpf.ref(),
true);
431 PointFieldType* pfPtr =
432 db.objectRegistry::template getObjectPtr<PointFieldType>(
name);
434 if (!cache || vf.
mesh().changing())
437 if (pfPtr && pfPtr->ownedByRegistry())
470 PointFieldType& pf = *pfPtr;
494 return interpolate(vf,
"volPointInterpolate(" + vf.
name() +
')',
false);
528 PointFieldType* pfPtr =
529 db.objectRegistry::template getObjectPtr<PointFieldType>(
name);
531 if (!cache || vf.
mesh().changing())
534 if (pfPtr && pfPtr->ownedByRegistry())
552 interpolateDimensionedInternalField(vf, tpf.
ref());
567 PointFieldType& pf = *pfPtr;
576 interpolateDimensionedInternalField(vf, pf);
591 return interpolate(vf,
"volPointInterpolate(" + vf.
name() +
')',
false);
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyBoundaryMesh & pbm
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const Mesh & mesh() const noexcept
Return const reference to mesh.
const dimensionSet & dimensions() const noexcept
Return dimensions.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Generic GeometricField class.
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef().
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
const objectRegistry & db() const noexcept
Return the local objectRegistry.
const fileName & instance() const noexcept
Read access to instance path component.
static FOAM_NO_DANGLING_REFERENCE const pointConstraints & New(const pointMesh &mesh, Args &&... args)
const fvMesh & mesh() const noexcept
A non-owning sub-view of a List (allocated or unallocated storage).
void size(const label n)
Older name for setAddressableSize.
static label nRequests() noexcept
Number of outstanding requests (on the internal list of requests).
@ nonBlocking
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
static void waitRequests()
Wait for all requests to finish.
Mesh data needed to do the Finite Volume discretisation.
Registry of regIOobjects.
Smooth ATC in cells having a point to a set of patches supplied by type.
Application of (multi-)patch point constraints.
void constrain(GeometricField< Type, pointPatchField, pointMesh > &pf, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints) and.
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.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
label nFaces() const noexcept
The number of boundary faces in the underlying mesh.
const polyMesh & mesh() const noexcept
Return the mesh reference.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
const globalMeshData & globalData() const
Return parallel info (demand-driven).
virtual const pointField & points() const
Return raw points.
const labelListList & pointCells() const
const vectorField & cellCentres() const
bool store()
Register object with its registry and transfer ownership to the registry.
static void cachePrintMessage(const char *message, const word &name, const FieldType &fld)
Helper for printing cache message.
A class for managing temporary objects.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
tmp< GeometricField< Type, pointPatchField, pointMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &) const
Interpolate volField using inverse distance weighting.
void interpolateBoundaryField(const GeometricField< Type, fvPatchField, volMesh > &vf, GeometricField< Type, pointPatchField, pointMesh > &pf) const
Interpolate boundary field without applying constraints/boundary.
void interpolateInternalField(const GeometricField< Type, fvPatchField, volMesh > &, GeometricField< Type, pointPatchField, pointMesh > &) const
Interpolate internal field from volField to pointField.
void interpolateDimensionedInternalField(const DimensionedField< Type, volMesh > &vf, DimensionedField< Type, pointMesh > &pf) const
Interpolate dimensioned internal field from cells to points.
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
const dimensionedScalar mp
Proton mass.
Namespace for handling debugging switches.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
List< word > wordList
List of word.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
List< scalar > scalarList
List of scalar.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::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].reset(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];} pointMap[start]=pointMap[end]=Foam::min(start, end);} } 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};constexpr 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, &oldCyclicPolyPatch::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< DynamicList< face > > pFaces[nBCs]
#define forAll(list, i)
Loop across all elements in list.