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 const label addedFacei = oldPatch.start() + i;
229 const label newFacei =
230 meshMap.addedFaceMap()[addedFacei];
231 const label patchFacei = newFacei-newPatch.start();
233 if (patchFacei >= 0 && patchFacei < newPatch.size())
235 addedToNew[i] = patchFacei;
241 fldToAdd.boundaryField()[
patchi],
261 mesh.objectRegistry::lookupClass
268 meshToAdd.objectRegistry::lookupClass
281 iterator fieldIter = fields.
begin();
282 fieldIter != fields.
end();
288 Pout<<
"MapVolFields : Storing old time for " << fieldIter()->
name()
300 iterator fieldIter = fields.
begin();
301 fieldIter != fields.
end();
314 *fieldsToAdd[fld.
name()];
318 Pout<<
"MapVolFields : mapping " << fld.
name()
319 <<
" and " << fldToAdd.
name() <<
endl;
322 MapVolField<Type>(meshMap,
fld, fldToAdd);
327 <<
"Not mapping field " << fld.
name()
328 <<
" since not present on mesh to add" 336 void Foam::fvMeshAdder::MapSurfaceField
381 intFld[newFacei] = pf[i];
397 label unusedPatchi = 0;
409 label nUsedPatches = unusedPatchi;
420 oldToNew[
patchi] = newPatchi;
424 oldToNew[
patchi] = unusedPatchi++;
430 bfld.reorder(oldToNew);
436 label newPatchi = nUsedPatches;
437 newPatchi < bfld.
size();
441 bfld.set(newPatchi,
nullptr);
459 oldPatchSizes[patchi],
509 if (!bfld(newPatchi))
546 labelList addedToNew(oldPatch.size(), -1);
549 const label addedFacei = oldPatch.
start() + i;
550 const label newFacei =
552 const label patchFacei = newFacei-newPatch.
start();
554 if (patchFacei >= 0 && patchFacei < newPatch.size())
556 addedToNew[i] = patchFacei;
584 mesh.objectRegistry::lookupClass<fldType>()
589 meshToAdd.objectRegistry::lookupClass<fldType>()
600 iterator fieldIter = fields.
begin();
601 fieldIter != fields.
end();
607 Pout<<
"MapSurfaceFields : Storing old time for " 611 const_cast<fldType*
>(fieldIter())->storeOldTimes();
618 iterator fieldIter = fields.
begin();
619 fieldIter != fields.
end();
623 fldType& fld =
const_cast<fldType&
>(*fieldIter());
625 if (fieldsToAdd.
found(fld.name()))
627 const fldType& fldToAdd = *fieldsToAdd[fld.name()];
631 Pout<<
"MapSurfaceFields : mapping " << fld.
name()
632 <<
" and " << fldToAdd.
name() <<
endl;
635 MapSurfaceField<Type>(meshMap,
fld, fldToAdd);
640 <<
"Not mapping field " << fld.name()
641 <<
" since not present on mesh to add" 649 void Foam::fvMeshAdder::MapPointField
691 label unusedPatchi = 0;
703 label nUsedPatches = unusedPatchi;
714 oldToNew[
patchi] = newPatchi;
718 oldToNew[
patchi] = unusedPatchi++;
724 bfld.reorder(oldToNew);
732 label newPatchi = nUsedPatches;
733 newPatchi < bfld.
size();
737 bfld.set(newPatchi,
nullptr);
756 forAll(newMeshPoints, ppi)
758 newMeshPointMap.insert(newMeshPoints[ppi], ppi);
767 newMeshPointMap.
find(newPointi);
769 if (fnd == newMeshPointMap.
end())
776 newToOld[fnd()] = oldPointi;
826 forAll(newMeshPoints, ppi)
828 newMpm.insert(newMeshPoints[ppi], ppi);
831 if (!bfld(newPatchi))
842 if (fnd == newMpm.
end())
849 newToAdded[fnd()] = oldPointi;
878 if (fnd != newMpm.
end())
881 oldToNew[oldPointi] = fnd();
919 iterator fieldIter = fields.
begin();
920 fieldIter != fields.
end();
926 Pout<<
"MapPointFields : Storing old time for " 930 const_cast<fldType*
>(fieldIter())->storeOldTimes();
937 iterator fieldIter = fields.
begin();
938 fieldIter != fields.
end();
942 fldType& fld =
const_cast<fldType&
>(*fieldIter());
944 if (fieldsToAdd.
found(fld.name()))
946 const fldType& fldToAdd = *fieldsToAdd[fld.name()];
950 Pout<<
"MapPointFields : mapping " << fld.
name()
951 <<
" and " << fldToAdd.
name() <<
endl;
959 <<
"Not mapping field " << fld.name()
960 <<
" since not present on mesh to add" 968 void Foam::fvMeshAdder::MapDimField
1002 mesh.objectRegistry::lookupClass<fldType>(
true)
1007 meshToAdd.objectRegistry::lookupClass<fldType>(
true)
1013 iterator fieldIter = fields.
begin();
1014 fieldIter != fields.
end();
1018 fldType& fld =
const_cast<fldType&
>(*fieldIter());
1020 if (fieldsToAdd.
found(fld.name()))
1022 const fldType& fldToAdd = *fieldsToAdd[fld.name()];
1026 Pout<<
"MapDimFields : mapping " << fld.
name()
1027 <<
" and " << fldToAdd.
name() <<
endl;
1030 MapDimField<Type>(meshMap,
fld, fldToAdd);
1034 WarningIn(
"fvMeshAdder::MapDimFields(..)")
1035 <<
"Not mapping field " << fld.name()
1036 <<
" 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.
FvWallInfoData< WallInfo, label > 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.
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
Info<< "Reading field p_rgh\"<< endl;volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);pressureReference pressureReference(p, p_rgh, pimple.dict(), thermo.incompressible());mesh.schemes().setFluxRequired(p_rgh.name());hydrostaticInitialisation(p_rgh, p, rho, U, gh, ghf, pRef, thermo, pimple.dict());Info<< "Creating field dpdt\"<< endl;volScalarField dpdt(IOobject("dpdt", runTime.timeName(), mesh), mesh, dimensionedScalar(p.dimensions()/dimTime, 0));Info<< "Creating field kinetic energy K\"<< endl;volScalarField K("K", 0.5 *magSqr(U));dimensionedScalar initialMass=fvc::domainIntegrate(rho);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
#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.