60 Foam::functionObjects::cellDecomposer::interpolate
62 const GeometricField<Type, fvPatchField, volMesh>& vf,
67 const bool allowUnmapped
71 PtrList<fvPatchField<Type>> patchFields(patchMap.size());
73 forAll(patchFields, patchi)
78 if (patchMap[patchi] == -1)
83 new emptyFvPatchField<Type>
85 sMesh.boundary()[patchi],
98 sMesh.boundary()[patchi],
105 auto tresult = tmp<GeometricField<Type, fvPatchField, volMesh>>
::New 110 sMesh.time().timeName(),
117 Field<Type>(vf.primitiveField(), cellMap),
120 auto& result = tresult.ref();
121 result.oriented() = vf.oriented();
127 auto& bf = result.boundaryFieldRef();
131 const label basePatchId = patchMap[patchi];
133 if (basePatchId != -1)
136 const fvPatch& subPatch = sMesh.boundary()[patchi];
137 const fvPatch& basePatch = vf.mesh().boundary()[basePatchId];
138 const label baseStart = basePatch.start();
139 const label baseSize = basePatch.size();
141 labelList directAddressing(subPatch.size());
143 forAll(directAddressing, i)
145 const label baseFacei =
faceMap[subPatch.start()+i];
147 if (baseFacei >= baseStart && baseFacei < baseStart+baseSize)
149 directAddressing[i] = baseFacei-baseStart;
155 directAddressing[i] = -1;
165 const bool hasUnmapped = mapper.hasUnmapped();
168 mapper.hasUnmapped() =
false;
176 vf.boundaryField()[basePatchId],
178 result.internalField(),
183 if (allowUnmapped && hasUnmapped)
190 tmp<Field<Type>> tfld(bf[patchi].patchInternalField());
191 const Field<Type>&
fld = tfld();
193 Field<Type> value(bf[patchi]);
194 forAll(directAddressing, i)
196 if (directAddressing[i] == -1)
201 bf[patchi].fvPatchField<Type>::operator=(value);
211 bool Foam::functionObjects::cellDecomposer::mapFieldType()
const 213 typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
215 const fvMesh& mapRegion =
216 this->mesh_.time().lookupObject<fvMesh>(mapRegion_);
222 this->mesh_.sortedNames<VolFieldType>(fieldNames_)
225 const bool processed = !fieldNames.empty();
227 for (
const word& fieldName : fieldNames)
229 const VolFieldType&
field = lookupObject<VolFieldType>(fieldName);
231 auto* mapFieldPtr = mapRegion.getObjectPtr<VolFieldType>(fieldName);
235 mapFieldPtr =
new VolFieldType
247 dimensioned<Type>(
field.dimensions(),
Zero)
250 mapFieldPtr->store();
253 auto& mappedField = *mapFieldPtr;
264 Log <<
" " << fieldName <<
": interpolated" <<
nl;
274 bool Foam::functionObjects::cellDecomposer::writeFieldType()
const 276 typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
278 const fvMesh& mapRegion =
279 this->mesh_.time().lookupObject<fvMesh>(mapRegion_);
283 this->mesh_.sortedNames<VolFieldType>(fieldNames_)
286 const bool processed = !fieldNames.empty();
288 for (
const word& fieldName : fieldNames)
290 const VolFieldType& mappedField =
291 mapRegion.template lookupObject<VolFieldType>(fieldName);
295 Log <<
" " << fieldName <<
": written" <<
nl;
static const this_type & 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)
constexpr char nl
The newline '\n' character (0x0a)
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)