122 Foam::functionObjects::cellDecomposer::interpolate
124 const GeometricField<Type, fvPatchField, volMesh>& vf,
129 const bool allowUnmapped
133 PtrList<fvPatchField<Type>> patchFields(patchMap.size());
135 forAll(patchFields, patchi)
140 if (patchMap[patchi] == -1)
145 new emptyFvPatchField<Type>
147 sMesh.boundary()[patchi],
160 sMesh.boundary()[patchi],
167 auto tresult = tmp<GeometricField<Type, fvPatchField, volMesh>>
::New 172 sMesh.time().timeName(),
179 Field<Type>(vf.primitiveField(), cellMap),
182 auto& result = tresult.ref();
183 result.oriented() = vf.oriented();
189 auto& bf = result.boundaryFieldRef();
193 const label basePatchId = patchMap[patchi];
195 if (basePatchId != -1)
198 const fvPatch& subPatch = sMesh.boundary()[patchi];
199 const fvPatch& basePatch = vf.mesh().boundary()[basePatchId];
200 const label baseStart = basePatch.start();
201 const label baseSize = basePatch.size();
203 labelList directAddressing(subPatch.size());
205 forAll(directAddressing, i)
207 const label baseFacei =
faceMap[subPatch.start()+i];
209 if (baseFacei >= baseStart && baseFacei < baseStart+baseSize)
211 directAddressing[i] = baseFacei-baseStart;
217 directAddressing[i] = -1;
227 const bool hasUnmapped = mapper.hasUnmapped();
230 mapper.hasUnmapped() =
false;
238 vf.boundaryField()[basePatchId],
240 result.internalField(),
245 if (allowUnmapped && hasUnmapped)
252 tmp<Field<Type>> tfld(bf[patchi].patchInternalField());
253 const Field<Type>&
fld = tfld();
255 Field<Type> value(bf[patchi]);
256 forAll(directAddressing, i)
258 if (directAddressing[i] == -1)
263 bf[patchi].fvPatchField<Type>::operator=(value);
273 bool Foam::functionObjects::cellDecomposer::mapFieldType()
const 275 typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
277 const fvMesh& mapRegion =
278 this->mesh_.time().lookupObject<fvMesh>(mapRegion_);
284 this->mesh_.sortedNames<VolFieldType>(fieldNames_)
287 const bool processed = !fieldNames.empty();
289 for (
const word& fieldName : fieldNames)
291 const VolFieldType&
field = lookupObject<VolFieldType>(fieldName);
293 auto* mapFieldPtr = mapRegion.getObjectPtr<VolFieldType>(fieldName);
297 mapFieldPtr =
new VolFieldType
309 dimensioned<Type>(
field.dimensions(),
Zero)
312 mapFieldPtr->store();
315 auto& mappedField = *mapFieldPtr;
326 Log <<
" " << fieldName <<
": interpolated";
336 bool Foam::functionObjects::cellDecomposer::writeFieldType()
const 338 typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
340 const fvMesh& mapRegion =
341 this->mesh_.time().lookupObject<fvMesh>(mapRegion_);
345 this->mesh_.sortedNames<VolFieldType>(fieldNames_)
348 const bool processed = !fieldNames.empty();
350 for (
const word& fieldName : fieldNames)
352 const VolFieldType& mappedField =
353 mapRegion.template lookupObject<VolFieldType>(fieldName);
357 Log <<
" " << fieldName <<
": written";
static const DimensionedField< Type, GeoMesh > & null() noexcept
Return a null DimensionedField (reference to a nullObject).
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
Ignore writing from objectRegistry::writeObject()
DirectFieldMapper< fvPatchFieldMapper > directFvPatchFieldMapper
A fvPatchFieldMapper with direct mapping.
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.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
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< word > wordList
List of word.
static const word & calculatedType() noexcept
The type name for calculated patch fields.
static autoPtr< functionObject > New(const word &name, const Time &runTime, const dictionary &dict)
Select from dictionary, based on its "type" entry.
List< label > labelList
A List of labels.
A class for managing temporary objects.
Request registration (bool: true)
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 constexpr const zero Zero
Global zero (0)