34 void Foam::fvMeshAdder::MapVolField
36 const mapAddedPolyMesh& meshMap,
38 GeometricField<Type, fvPatchField, volMesh>& fld,
39 const GeometricField<Type, fvPatchField, volMesh>& fldToAdd
42 const fvMesh& mesh = fld.mesh();
49 Field<Type> oldInternalField(fld.primitiveField());
52 Field<Type>& intFld = fld.primitiveFieldRef();
54 intFld.setSize(mesh.nCells());
56 intFld.rmap(oldInternalField, meshMap.oldCellMap());
57 intFld.rmap(fldToAdd.primitiveField(), meshMap.addedCellMap());
64 typename GeometricField<Type, fvPatchField, volMesh>::
65 Boundary& bfld = fld.boundaryFieldRef();
68 const labelList& oldPatchMap = meshMap.oldPatchMap();
69 const labelList& oldPatchStarts = meshMap.oldPatchStarts();
70 const labelList& oldPatchSizes = meshMap.oldPatchSizes();
74 label unusedPatchi = 0;
86 label nUsedPatches = unusedPatchi;
97 oldToNew[
patchi] = newPatchi;
101 oldToNew[
patchi] = unusedPatchi++;
107 bfld.reorder(oldToNew);
109 bfld.setSize(mesh.boundaryMesh().size());
113 label newPatchi = nUsedPatches;
114 newPatchi < bfld.size();
118 bfld.set(newPatchi,
nullptr);
136 oldPatchSizes[patchi],
137 meshMap.oldFaceMap(),
138 mesh.boundaryMesh()[newPatchi],
143 directFvPatchFieldMapper patchMapper(newToOld);
159 mesh.boundary()[newPatchi],
174 const labelList& addedPatchMap = meshMap.addedPatchMap();
183 const polyPatch& newPatch = mesh.boundaryMesh()[newPatchi];
184 const polyPatch& oldPatch =
185 fldToAdd.mesh().boundaryMesh()[
patchi];
187 if (!bfld(newPatchi))
199 meshMap.addedFaceMap(),
205 directFvPatchFieldMapper patchMapper(newToAdded);
212 fldToAdd.boundaryField()[
patchi],
213 mesh.boundary()[newPatchi],
224 labelList addedToNew(oldPatch.size(), -1);
227 label addedFacei = oldPatch.start()+i;
228 label newFacei = meshMap.addedFaceMap()[addedFacei];
229 label patchFacei = newFacei-newPatch.start();
230 if (patchFacei >= 0 && patchFacei < newPatch.size())
232 addedToNew[i] = patchFacei;
238 fldToAdd.boundaryField()[
patchi],
258 mesh.objectRegistry::lookupClass
265 meshToAdd.objectRegistry::lookupClass
278 iterator fieldIter = fields.
begin();
279 fieldIter != fields.
end();
285 Pout<<
"MapVolFields : Storing old time for " << fieldIter()->
name()
297 iterator fieldIter = fields.
begin();
298 fieldIter != fields.
end();
311 *fieldsToAdd[fld.
name()];
315 Pout<<
"MapVolFields : mapping " << fld.
name()
316 <<
" and " << fldToAdd.
name() <<
endl;
319 MapVolField<Type>(meshMap,
fld, fldToAdd);
324 <<
"Not mapping field " << fld.
name()
325 <<
" since not present on mesh to add" 333 void Foam::fvMeshAdder::MapSurfaceField
378 intFld[newFacei] = pf[i];
394 label unusedPatchi = 0;
406 label nUsedPatches = unusedPatchi;
417 oldToNew[
patchi] = newPatchi;
421 oldToNew[
patchi] = unusedPatchi++;
427 bfld.reorder(oldToNew);
433 label newPatchi = nUsedPatches;
434 newPatchi < bfld.
size();
438 bfld.set(newPatchi,
nullptr);
456 oldPatchSizes[patchi],
506 if (!bfld(newPatchi))
543 labelList addedToNew(oldPatch.size(), -1);
549 if (patchFacei >= 0 && patchFacei < newPatch.size())
551 addedToNew[i] = patchFacei;
579 mesh.objectRegistry::lookupClass<fldType>()
584 meshToAdd.objectRegistry::lookupClass<fldType>()
595 iterator fieldIter = fields.
begin();
596 fieldIter != fields.
end();
602 Pout<<
"MapSurfaceFields : Storing old time for " 606 const_cast<fldType*
>(fieldIter())->storeOldTimes();
613 iterator fieldIter = fields.
begin();
614 fieldIter != fields.
end();
618 fldType& fld =
const_cast<fldType&
>(*fieldIter());
620 if (fieldsToAdd.
found(fld.name()))
622 const fldType& fldToAdd = *fieldsToAdd[fld.name()];
626 Pout<<
"MapSurfaceFields : mapping " << fld.
name()
627 <<
" and " << fldToAdd.
name() <<
endl;
630 MapSurfaceField<Type>(meshMap,
fld, fldToAdd);
635 <<
"Not mapping field " << fld.name()
636 <<
" since not present on mesh to add" 644 void Foam::fvMeshAdder::MapDimField
678 mesh.objectRegistry::lookupClass<fldType>(
true)
683 meshToAdd.objectRegistry::lookupClass<fldType>(
true)
689 iterator fieldIter = fields.
begin();
690 fieldIter != fields.
end();
694 fldType& fld =
const_cast<fldType&
>(*fieldIter());
696 if (fieldsToAdd.
found(fld.name()))
698 const fldType& fldToAdd = *fieldsToAdd[fld.name()];
702 Pout<<
"MapDimFields : mapping " << fld.
name()
703 <<
" and " << fldToAdd.
name() <<
endl;
706 MapDimField<Type>(meshMap,
fld, fldToAdd);
710 WarningIn(
"fvMeshAdder::MapDimFields(..)")
711 <<
"Not mapping field " << fld.name()
712 <<
" since not present on mesh to add"
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const fileName & name() const
Return the name of the stream.
#define WarningIn(functionName)
Report a warning using Foam::Warning.
#define forAll(list, i)
Loop across all elements in list.
const labelList & oldPatchSizes() const
Return list of the old patch sizes.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
label nInternalFaces() const
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void size(const label)
Override size to be inconsistent with allocated storage.
const labelList & oldCellMap() const
Ostream & endl(Ostream &os)
Add newline and flush stream.
const labelList & addedPatchMap() const
From added mesh patch index to new patch index or -1 if.
const labelList & addedCellMap() const
Class containing mesh-to-mesh mapping information after a mesh addition where we add a mesh ('added m...
const labelList & oldPatchStarts() const
Return list of the old patch start labels.
Generic GeometricField class.
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
bool found(const Key &) const
Return true if hashedEntry is found in table.
Pre-declare SubField and related Field type.
word name() const
Return file name (part beyond last /)
const labelList & oldPatchMap() const
From old patch index to new patch index or -1 if patch.
const labelList & oldFaceMap() const
static tmp< fvPatchField< Type > > New(const word &, const fvPatch &, const DimensionedField< Type, volMesh > &)
Return a pointer to a new patchField created on freestore given.
List< label > labelList
A List of labels.
iterator begin()
Iterator set to the beginning of the HashTable.
An STL-conforming hash table.
Internal::FieldType & primitiveFieldRef()
Return a reference to the internal field.
const Mesh & mesh() const
Return mesh.
direct fvPatchFieldMapper
label size() const
Return the number of elements in the UPtrList.
void setSize(const label)
Reset size of List.
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
#define WarningInFunction
Report a warning using Foam::Warning.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
prefixOSstream Pout(cout, "Pout")
Mesh data needed to do the Finite Volume discretisation.
label start() const
Return start label of this patch in the polyMesh face list.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static void MapSurfaceFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd)
Map all surfaceFields of Type.
static void MapDimFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd)
Map all DimensionedFields of Type.
static void MapVolFields(const mapAddedPolyMesh &, const fvMesh &mesh, const fvMesh &meshToAdd)
Map all volFields of Type.
A patch is a list of labels that address the faces in the global face list.
const labelList & addedFaceMap() const
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.