35 void Foam::fvMeshAdder::MapVolField
37 const mapAddedPolyMesh& meshMap,
39 GeometricField<Type, fvPatchField, volMesh>& fld,
40 const GeometricField<Type, fvPatchField, volMesh>& fldToAdd
43 const fvMesh& mesh = fld.mesh();
50 Field<Type> oldInternalField(fld.primitiveField());
53 Field<Type>& intFld = fld.primitiveFieldRef();
55 intFld.setSize(mesh.nCells());
57 intFld.rmap(oldInternalField, meshMap.oldCellMap());
58 intFld.rmap(fldToAdd.primitiveField(), meshMap.addedCellMap());
65 typename GeometricField<Type, fvPatchField, volMesh>::
66 Boundary& bfld = fld.boundaryFieldRef();
69 const labelList& oldPatchMap = meshMap.oldPatchMap();
70 const labelList& oldPatchStarts = meshMap.oldPatchStarts();
71 const labelList& oldPatchSizes = meshMap.oldPatchSizes();
75 label unusedPatchi = 0;
87 label nUsedPatches = unusedPatchi;
98 oldToNew[
patchi] = newPatchi;
102 oldToNew[
patchi] = unusedPatchi++;
108 bfld.reorder(oldToNew);
110 bfld.setSize(mesh.boundaryMesh().size());
114 label newPatchi = nUsedPatches;
115 newPatchi < bfld.size();
119 bfld.set(newPatchi,
nullptr);
137 oldPatchSizes[patchi],
138 meshMap.oldFaceMap(),
139 mesh.boundaryMesh()[newPatchi],
144 directFvPatchFieldMapper patchMapper(newToOld);
160 mesh.boundary()[newPatchi],
175 const labelList& addedPatchMap = meshMap.addedPatchMap();
184 const polyPatch& newPatch = mesh.boundaryMesh()[newPatchi];
185 const polyPatch& oldPatch =
186 fldToAdd.mesh().boundaryMesh()[
patchi];
188 if (!bfld(newPatchi))
200 meshMap.addedFaceMap(),
206 directFvPatchFieldMapper patchMapper(newToAdded);
213 fldToAdd.boundaryField()[
patchi],
214 mesh.boundary()[newPatchi],
225 labelList addedToNew(oldPatch.size(), -1);
228 label addedFacei = oldPatch.start()+i;
229 label newFacei = meshMap.addedFaceMap()[addedFacei];
230 label patchFacei = newFacei-newPatch.start();
231 if (patchFacei >= 0 && patchFacei < newPatch.size())
233 addedToNew[i] = patchFacei;
239 fldToAdd.boundaryField()[
patchi],
259 mesh.objectRegistry::lookupClass
266 meshToAdd.objectRegistry::lookupClass
279 iterator fieldIter = fields.
begin();
280 fieldIter != fields.
end();
286 Pout<<
"MapVolFields : Storing old time for " << fieldIter()->
name()
298 iterator fieldIter = fields.
begin();
299 fieldIter != fields.
end();
312 *fieldsToAdd[fld.
name()];
316 Pout<<
"MapVolFields : mapping " << fld.
name()
317 <<
" and " << fldToAdd.
name() <<
endl;
320 MapVolField<Type>(meshMap,
fld, fldToAdd);
325 <<
"Not mapping field " << fld.
name()
326 <<
" since not present on mesh to add" 334 void Foam::fvMeshAdder::MapSurfaceField
379 intFld[newFacei] = pf[i];
395 label unusedPatchi = 0;
407 label nUsedPatches = unusedPatchi;
418 oldToNew[
patchi] = newPatchi;
422 oldToNew[
patchi] = unusedPatchi++;
428 bfld.reorder(oldToNew);
434 label newPatchi = nUsedPatches;
435 newPatchi < bfld.
size();
439 bfld.set(newPatchi,
nullptr);
457 oldPatchSizes[patchi],
507 if (!bfld(newPatchi))
544 labelList addedToNew(oldPatch.size(), -1);
550 if (patchFacei >= 0 && patchFacei < newPatch.size())
552 addedToNew[i] = patchFacei;
580 mesh.objectRegistry::lookupClass<fldType>()
585 meshToAdd.objectRegistry::lookupClass<fldType>()
596 iterator fieldIter = fields.
begin();
597 fieldIter != fields.
end();
603 Pout<<
"MapSurfaceFields : Storing old time for " 607 const_cast<fldType*
>(fieldIter())->storeOldTimes();
614 iterator fieldIter = fields.
begin();
615 fieldIter != fields.
end();
619 fldType& fld =
const_cast<fldType&
>(*fieldIter());
621 if (fieldsToAdd.
found(fld.name()))
623 const fldType& fldToAdd = *fieldsToAdd[fld.name()];
627 Pout<<
"MapSurfaceFields : mapping " << fld.
name()
628 <<
" and " << fldToAdd.
name() <<
endl;
631 MapSurfaceField<Type>(meshMap,
fld, fldToAdd);
636 <<
"Not mapping field " << fld.name()
637 <<
" since not present on mesh to add" 645 void Foam::fvMeshAdder::MapPointField
687 label unusedPatchi = 0;
699 label nUsedPatches = unusedPatchi;
710 oldToNew[
patchi] = newPatchi;
714 oldToNew[
patchi] = unusedPatchi++;
720 bfld.reorder(oldToNew);
726 label newPatchi = nUsedPatches;
727 newPatchi < bfld.
size();
731 bfld.set(newPatchi,
nullptr);
748 forAll(newMeshPoints, ppi)
750 newMeshPointMap.insert(newMeshPoints[ppi], ppi);
759 newMeshPointMap.
find(newPointi);
760 if (fnd == newMeshPointMap.
end())
767 newToOld[fnd()] = oldPointi;
815 forAll(newMeshPoints, ppi)
817 newMpm.insert(newMeshPoints[ppi], ppi);
820 if (!bfld(newPatchi))
830 if (fnd == newMpm.
end())
837 newToAdded[fnd()] = oldPointi;
865 if (fnd != newMpm.
end())
868 oldToNew[oldPointi] = fnd();
906 iterator fieldIter = fields.
begin();
907 fieldIter != fields.
end();
913 Pout<<
"MapPointFields : Storing old time for " 917 const_cast<fldType*
>(fieldIter())->storeOldTimes();
924 iterator fieldIter = fields.
begin();
925 fieldIter != fields.
end();
929 fldType& fld =
const_cast<fldType&
>(*fieldIter());
931 if (fieldsToAdd.
found(fld.name()))
933 const fldType& fldToAdd = *fieldsToAdd[fld.name()];
937 Pout<<
"MapPointFields : mapping " << fld.
name()
938 <<
" and " << fldToAdd.
name() <<
endl;
946 <<
"Not mapping field " << fld.name()
947 <<
" since not present on mesh to add" 955 void Foam::fvMeshAdder::MapDimField
989 mesh.objectRegistry::lookupClass<fldType>(
true)
994 meshToAdd.objectRegistry::lookupClass<fldType>(
true)
1000 iterator fieldIter = fields.
begin();
1001 fieldIter != fields.
end();
1005 fldType& fld =
const_cast<fldType&
>(*fieldIter());
1007 if (fieldsToAdd.
found(fld.name()))
1009 const fldType& fldToAdd = *fieldsToAdd[fld.name()];
1013 Pout<<
"MapDimFields : mapping " << fld.
name()
1014 <<
" and " << fldToAdd.
name() <<
endl;
1017 MapDimField<Type>(meshMap,
fld, fldToAdd);
1021 WarningIn(
"fvMeshAdder::MapDimFields(..)")
1022 <<
"Not mapping field " << fld.name()
1023 <<
" since not present on mesh to add" const labelList & oldPointMap() const
From old mesh point/face/cell to new mesh point/face/cell.
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
Map point field on topology change. This is a partial template specialisation for GeoMesh=pointMesh...
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.
const labelList & addedPointMap() const
From added mesh point/face/cell to new mesh point/face/cell.
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Mesh representing a set of points created from polyMesh.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
Abstract base class for point-mesh patch 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 objectRegistry & thisDb() const
Return database. For now is its polyMesh.
const labelList & oldFaceMap() const
static void MapPointFields(const mapAddedPolyMesh &, const pointMesh &mesh, const labelListList &oldMeshPoints, const objectRegistry &meshToAdd)
Map all surfaceFields of Type.
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.
direct PointPatchFieldMapper
label size() const
Return number of points.
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.
Basic pointPatch represents a set of points from the mesh.
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.
Registry of regIOobjects.
A patch is a list of labels that address the faces in the global face list.
const pointBoundaryMesh & boundary() const
Return reference to boundary mesh.
HashTable< const Type * > lookupClass(const bool strict=false) const
Lookup and return all objects of the given Type.
const labelList & addedFaceMap() const
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
virtual const labelList & meshPoints() const =0
Return mesh points.
virtual label size() const =0
Return size.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.