46 const GeometricField<Type, fvPatchField, volMesh>& vf,
51 const bool allowUnmapped
55 PtrList<fvPatchField<Type>> patchFields(
patchMap.
size());
57 forAll(patchFields, patchi)
67 new emptyFvPatchField<Type>
69 sMesh.boundary()[patchi],
82 sMesh.boundary()[patchi],
89 auto tresult = tmp<GeometricField<Type, fvPatchField, volMesh>>
::New 94 sMesh.time().timeName(),
101 Field<Type>(vf.primitiveField(),
cellMap),
104 auto& result = tresult.ref();
105 result.oriented() = vf.oriented();
111 auto& bf = result.boundaryFieldRef();
115 const label basePatchId =
patchMap[patchi];
117 if (basePatchId != -1)
120 const fvPatch& subPatch = sMesh.boundary()[patchi];
121 const fvPatch& basePatch = vf.mesh().boundary()[basePatchId];
122 const label baseStart = basePatch.start();
123 const label baseSize = basePatch.
size();
125 labelList directAddressing(subPatch.size());
127 forAll(directAddressing, i)
129 const label baseFacei =
faceMap[subPatch.start()+i];
131 if (baseFacei >= baseStart && baseFacei < baseStart+baseSize)
133 directAddressing[i] = baseFacei-baseStart;
139 directAddressing[i] = -1;
149 const bool hasUnmapped = mapper.hasUnmapped();
152 mapper.hasUnmapped() =
false;
160 vf.boundaryField()[basePatchId],
167 if (allowUnmapped && hasUnmapped)
174 tmp<Field<Type>> tfld(bf[patchi].patchInternalField());
175 const Field<Type>&
fld = tfld();
177 Field<Type> value(bf[patchi]);
178 forAll(directAddressing, i)
180 if (directAddressing[i] == -1)
185 bf[patchi].fvPatchField<Type>::operator=(value);
203 const GeometricField<Type, fvPatchField, volMesh>& vf,
204 const bool allowUnmapped
228 const GeometricField<Type, fvsPatchField, surfaceMesh>& vf,
236 PtrList<fvsPatchField<Type>> patchFields(patchMap.size());
238 forAll(patchFields, patchi)
243 if (patchMap[patchi] == -1)
248 new emptyFvsPatchField<Type>
250 sMesh.boundary()[patchi],
263 sMesh.boundary()[patchi],
271 auto tresult = tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
::New 276 sMesh.time().timeName(),
286 SubList<label>(
faceMap, sMesh.nInternalFaces())
290 auto& result = tresult.ref();
291 result.oriented() = vf.oriented();
297 auto& bf = result.boundaryFieldRef();
301 if (patchMap[patchi] != -1)
304 const fvPatch& subPatch = sMesh.boundary()[patchi];
305 const fvPatch& basePatch = vf.mesh().boundary()[patchMap[patchi]];
306 const label baseStart = basePatch.start();
307 const label baseSize = basePatch.size();
309 labelList directAddressing(subPatch.size());
311 forAll(directAddressing, i)
313 label baseFacei =
faceMap[subPatch.start()+i];
315 if (baseFacei >= baseStart && baseFacei < baseStart+baseSize)
317 directAddressing[i] = baseFacei-baseStart;
324 directAddressing[i] = -1;
333 vf.boundaryField()[patchMap[patchi]],
343 fvsPatchField<Type>& pfld = bf[patchi];
344 const labelUList& fc = bf[patchi].patch().faceCells();
345 const labelList& own = vf.mesh().faceOwner();
349 label baseFacei =
faceMap[subPatch.start()+i];
350 if (baseFacei < vf.primitiveField().size())
352 Type val = vf.internalField()[baseFacei];
354 if (cellMap[fc[i]] == own[baseFacei] || !vf.is_oriented())
360 pfld[i] = flipOp()(val);
367 label patchi = vf.mesh().boundaryMesh().whichPatch
371 const fvPatch& otherPatch = vf.mesh().boundary()[patchi];
372 label patchFacei = otherPatch.patch().whichFace(baseFacei);
373 pfld[i] = vf.boundaryField()[patchi][patchFacei];
392 const GeometricField<Type, fvsPatchField, surfaceMesh>& sf,
393 const bool allowUnmapped
416 const GeometricField<Type, pointPatchField, pointMesh>& vf,
417 const pointMesh& sMesh,
423 PtrList<pointPatchField<Type>> patchFields(patchMap.size());
425 forAll(patchFields, patchi)
430 if (patchMap[patchi] == -1)
435 new emptyPointPatchField<Type>
437 sMesh.boundary()[patchi],
449 calculatedPointPatchField<Type>::typeName,
450 sMesh.boundary()[patchi],
458 auto tresult = tmp<GeometricField<Type, pointPatchField, pointMesh>>
::New 463 sMesh.time().timeName(),
470 Field<Type>(vf.primitiveField(), pointMap),
473 auto& result = tresult.ref();
474 result.oriented() = vf.oriented();
480 auto& bf = result.boundaryFieldRef();
487 if (patchMap[patchi] != -1)
490 const pointPatch& basePatch =
491 vf.mesh().boundary()[patchMap[patchi]];
493 const labelList& meshPoints = basePatch.meshPoints();
496 Map<label> meshPointMap(2*meshPoints.size());
497 forAll(meshPoints, localI)
499 meshPointMap.insert(meshPoints[localI], localI);
503 const pointPatch& subPatch = sMesh.boundary()[patchi];
504 const labelList& subMeshPoints = subPatch.meshPoints();
507 labelList directAddressing(subPatch.size(), -1);
509 forAll(subMeshPoints, localI)
512 label meshPointi = pointMap[subMeshPoints[localI]];
514 const auto iter = meshPointMap.cfind(meshPointi);
518 directAddressing[localI] = *iter;
527 vf.boundaryField()[patchMap[patchi]],
549 const GeometricField<Type, pointPatchField, pointMesh>& sf,
550 const bool allowUnmapped
572 const DimensionedField<Type, volMesh>& df,
577 auto tresult = tmp<DimensionedField<Type, volMesh>>
::New 582 sMesh.time().timeName(),
589 Field<Type>(df, cellMap)
591 tresult.ref().oriented() = df.oriented();
606 const DimensionedField<Type, volMesh>& df,
607 const bool allowUnmapped
static tmp< DimensionedField< Type, volMesh > > interpolate(const DimensionedField< Type, volMesh > &, const fvMesh &sMesh, const labelUList &cellMap)
Map volume internal (dimensioned) field.
void size(const label n)
Older name for setAddressableSize.
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
Ignore writing from objectRegistry::writeObject()
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
DirectFieldMapper< fvPatchFieldMapper > directFvPatchFieldMapper
A fvPatchFieldMapper with direct mapping.
const labelList & faceMap() const
Return face map.
UList< label > labelUList
A UList of labels.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
#define forAll(list, i)
Loop across all elements in list.
const labelList & patchMap() const
Return patch map.
static const char *const typeName
Typename for Field.
static const DimensionedField< Type, GeoMesh > & null()
Return a NullObjectRef DimensionedField.
static autoPtr< pointPatchField< Type > > New(const word &patchFieldType, const pointPatch &p, const DimensionedField< Type, pointMesh > &iF)
Return a pointer to a new patchField created on freestore given.
const labelList & cellMap() const
Return cell map.
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;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
List< label > labelList
A List of labels.
DirectFieldMapper< pointPatchFieldMapper > directPointPatchFieldMapper
A direct pointPatchFieldMapper.
A class for managing temporary objects.
static tmp< fvPatchField< Type > > New(const word &patchFieldType, const fvPatch &, const DimensionedField< Type, volMesh > &)
Return a pointer to a new patchField created on freestore given.
static tmp< fvsPatchField< Type > > New(const word &patchFieldType, const fvPatch &, const DimensionedField< Type, surfaceMesh > &)
Return a pointer to a new patchField created on freestore given.