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, NULL);
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++;
433 label newPatchi = nUsedPatches;
434 newPatchi < bfld.
size();
438 bfld.
set(newPatchi, NULL);
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"
#define WarningIn(functionName)
Report a warning using Foam::Warning.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
void reorder(const labelUList &)
Reorders elements. Ordering does not have to be done in.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Class containing mesh-to-mesh mapping information after a mesh addition where we add a mesh ('added m...
Generic GeometricField class.
const labelList & oldCellMap() const
const labelList & oldFaceMap() const
const labelList & addedCellMap() const
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const labelList & addedFaceMap() const
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
word name() const
Return file name (part beyond last /)
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))
label start() const
Return start label of this patch in the polyMesh face list.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Pre-declare SubField and related Field type.
virtual const fileName & name() const
Return the name of the stream.
bool set(const label) const
Is element set.
const labelList & oldPatchMap() const
From old patch index to new patch index or -1 if patch.
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.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
bool found(const Key &) const
Return true if hashedEntry is found in table.
prefixOSstream Pout(cout,"Pout")
Internal::FieldType & primitiveFieldRef()
Return a reference to the internal field.
const labelList & addedPatchMap() const
From added mesh patch index to new patch index or -1 if.
direct fvPatchFieldMapper
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.
const Mesh & mesh() const
Return mesh.
Mesh data needed to do the Finite Volume discretisation.
const labelList & oldPatchSizes() const
Return list of the old patch sizes.
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 fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
label nInternalFaces() const
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
const word & name() const
Return name.
const labelList & oldPatchStarts() const
Return list of the old patch start labels.
label size() const
Return the number of elements in the UPtrList.