fvMeshSubset Class Reference

Post-processing mesh subset tool. Given the original mesh and the list of selected cells, it creates the mesh consisting only of the desired cells, with the mapping list for points, faces, and cells. More...

Public Member Functions

 TypeName ("fvMeshSubset")
 Runtime type information. More...
 
 fvMeshSubset (const fvMesh &)
 Construct given a mesh to subset. More...
 
 fvMeshSubset (const fvMeshSubset &)=delete
 Disallow default bitwise copy construction. More...
 
virtual ~fvMeshSubset ()
 Destructor. More...
 
void setCellSubset (const labelHashSet &globalCellMap, const label patchID=-1, const bool syncPar=true)
 Set the subset. Create "oldInternalFaces" patch for exposed. More...
 
void setLargeCellSubset (const labelList &region, const label currentRegion, const label patchID=-1, const bool syncCouples=true)
 Set the subset from all cells with region == currentRegion. More...
 
void setLargeCellSubset (const labelHashSet &globalCellMap, const label patchID=-1, const bool syncPar=true)
 setLargeCellSubset but with labelHashSet. More...
 
labelList getExposedFaces (const labelList &region, const label currentRegion, const bool syncCouples=true) const
 Get labels of exposed faces. More...
 
void setLargeCellSubset (const labelList &region, const label currentRegion, const labelList &exposedFaces, const labelList &patchIDs, const bool syncCouples=true)
 For every exposed face (from above getExposedFaces) More...
 
const fvMeshbaseMesh () const
 Original mesh. More...
 
bool hasSubMesh () const
 Have subMesh? More...
 
const fvMeshsubMesh () const
 Return reference to subset mesh. More...
 
fvMeshsubMesh ()
 
const labelListpointMap () const
 Return point map. More...
 
const labelListfaceMap () const
 Return face map. More...
 
const labelListfaceFlipMap () const
 Return face map with sign to encode flipped faces. More...
 
const labelListcellMap () const
 Return cell map. More...
 
const labelListpatchMap () const
 Return patch map. More...
 
template<class Type >
tmp< VolField< Type > > interpolate (const VolField< Type > &) const
 
template<class Type >
tmp< SurfaceField< Type > > interpolate (const SurfaceField< Type > &) const
 
template<class Type >
tmp< PointField< Type > > interpolate (const PointField< Type > &) const
 
template<class Type >
tmp< DimensionedField< Type, volMesh > > interpolate (const DimensionedField< Type, volMesh > &) const
 
void operator= (const fvMeshSubset &)=delete
 Disallow default bitwise assignment. More...
 
template<class Type >
Foam::tmp< Foam::VolField< Type > > interpolate (const VolField< Type > &vf, const fvMesh &sMesh, const labelList &patchMap, const labelList &cellMap, const labelList &faceMap)
 
template<class Type >
Foam::tmp< Foam::VolField< Type > > interpolate (const VolField< Type > &vf) const
 
template<class Type >
Foam::tmp< Foam::SurfaceField< Type > > interpolate (const SurfaceField< Type > &sf, const fvMesh &sMesh, const labelList &patchMap, const labelList &cellMap, const labelList &faceMap)
 
template<class Type >
Foam::tmp< Foam::SurfaceField< Type > > interpolate (const SurfaceField< Type > &sf) const
 
template<class Type >
Foam::tmp< Foam::PointField< Type > > interpolate (const PointField< Type > &pf, const pointMesh &sMesh, const labelList &patchMap, const labelList &pointMap)
 
template<class Type >
Foam::tmp< Foam::PointField< Type > > interpolate (const PointField< Type > &sf) const
 
template<class Type >
Foam::tmp< Foam::DimensionedField< Type, Foam::volMesh > > interpolate (const DimensionedField< Type, volMesh > &df, const fvMesh &sMesh, const labelList &cellMap)
 
template<class Type >
Foam::tmp< Foam::DimensionedField< Type, Foam::volMesh > > interpolate (const DimensionedField< Type, volMesh > &df) const
 

Static Public Member Functions

template<class Type >
static tmp< VolField< Type > > interpolate (const VolField< Type > &, const fvMesh &sMesh, const labelList &patchMap, const labelList &cellMap, const labelList &faceMap)
 Map volume field. More...
 
template<class Type >
static tmp< SurfaceField< Type > > interpolate (const SurfaceField< Type > &, const fvMesh &sMesh, const labelList &patchMap, const labelList &cellMap, const labelList &faceMap)
 Map surface field. Optionally negates value if flipping. More...
 
template<class Type >
static tmp< PointField< Type > > interpolate (const PointField< Type > &, const pointMesh &sMesh, const labelList &patchMap, const labelList &pointMap)
 Map point field. More...
 
template<class Type >
static tmp< DimensionedField< Type, volMesh > > interpolate (const DimensionedField< Type, volMesh > &, const fvMesh &sMesh, const labelList &cellMap)
 Map dimensioned field. More...
 

Detailed Description

Post-processing mesh subset tool. Given the original mesh and the list of selected cells, it creates the mesh consisting only of the desired cells, with the mapping list for points, faces, and cells.

Puts all exposed internal faces into either

  • a user supplied patch
  • a newly created patch "oldInternalFaces"
  • setCellSubset is for small subsets. Uses Maps to minimise memory.
  • setLargeCellSubset is for largish subsets (>10% of mesh). Uses labelLists instead.
  • setLargeCellSubset does coupled patch subsetting as well. If it detects a face on a coupled patch 'losing' its neighbour it will move the face into the oldInternalFaces patch.
  • if a user supplied patch is used it is up to the destination patchField to handle exposed internal faces (mapping from face -1). If not provided the default is to assign the internalField. All the basic patch field types (e.g. fixedValue) will give a warning and preferably derived patch field types should be used that know how to handle exposed faces (e.g. use uniformFixedValue instead of fixedValue)
Source files

Definition at line 73 of file fvMeshSubset.H.

Constructor & Destructor Documentation

◆ fvMeshSubset() [1/2]

fvMeshSubset ( const fvMesh baseMesh)
explicit

Construct given a mesh to subset.

Definition at line 472 of file fvMeshSubset.C.

◆ fvMeshSubset() [2/2]

fvMeshSubset ( const fvMeshSubset )
delete

Disallow default bitwise copy construction.

◆ ~fvMeshSubset()

~fvMeshSubset ( )
virtual

Destructor.

Definition at line 486 of file fvMeshSubset.C.

Member Function Documentation

◆ TypeName()

TypeName ( "fvMeshSubset"  )

Runtime type information.

◆ setCellSubset()

void setCellSubset ( const labelHashSet globalCellMap,
const label  patchID = -1,
const bool  syncPar = true 
)

Set the subset. Create "oldInternalFaces" patch for exposed.

internal faces (patchID==-1) or use supplied patch. Does not handle coupled patches correctly if only one side gets deleted.

Definition at line 492 of file fvMeshSubset.C.

References Foam::abort(), IOobject::clone(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, polyBoundaryMesh::findPatchID(), forAll, HashTable< T, Key, Hash >::found(), HashTable< T, Key, Hash >::insert(), Foam::labelMax, Foam::name(), IOobject::NO_READ, IOobject::NO_WRITE, patchi, List< T >::setSize(), HashTable< T, Key, Hash >::size(), UPtrList< T >::size(), List< T >::size(), Foam::sort(), HashTable< T, Key, Hash >::toc(), and polyBoundaryMesh::whichPatch().

Here is the call graph for this function:

◆ setLargeCellSubset() [1/3]

void setLargeCellSubset ( const labelList region,
const label  currentRegion,
const label  patchID = -1,
const bool  syncCouples = true 
)

Set the subset from all cells with region == currentRegion.

Create "oldInternalFaces" patch for exposed internal faces (patchID==-1) or use supplied patch. Handles coupled patches by if necessary making coupled patch face part of patchID (so uncoupled)

Definition at line 895 of file fvMeshSubset.C.

References Foam::abort(), IOobject::clone(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, polyBoundaryMesh::findPatchID(), forAll, Pstream::gatherList(), Foam::identityMap(), Foam::labelMax, Pstream::listCombineGather(), Pstream::listCombineScatter(), UPstream::myProcNo(), Foam::name(), polyBoundaryMesh::names(), IOobject::NO_READ, IOobject::NO_WRITE, UPstream::nProcs(), UPstream::parRun(), patchi, patchNames(), Foam::reduce(), Pstream::scatterList(), List< T >::setSize(), UPtrList< T >::size(), List< T >::size(), and polyPatch::start().

Referenced by structuredDecomp::decompose(), fvMeshDistribute::distribute(), and structuredRenumber::renumber().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLargeCellSubset() [2/3]

void setLargeCellSubset ( const labelHashSet globalCellMap,
const label  patchID = -1,
const bool  syncPar = true 
)

setLargeCellSubset but with labelHashSet.

Definition at line 1484 of file fvMeshSubset.C.

References forAllConstIter.

◆ getExposedFaces()

Foam::labelList getExposedFaces ( const labelList region,
const label  currentRegion,
const bool  syncCouples = true 
) const

Get labels of exposed faces.

These are

  • internal faces that become boundary faces
  • coupled faces that become uncoupled (since one of the sides gets deleted)

Definition at line 1501 of file fvMeshSubset.C.

References removeCells::getExposedFaces().

Here is the call graph for this function:

◆ setLargeCellSubset() [3/3]

void setLargeCellSubset ( const labelList region,
const label  currentRegion,
const labelList exposedFaces,
const labelList patchIDs,
const bool  syncCouples = true 
)

For every exposed face (from above getExposedFaces)

used supplied (existing!) patch

Definition at line 1515 of file fvMeshSubset.C.

References Foam::identityMap(), polyTopoChange::makeMesh(), Foam::name(), IOobject::NO_READ, IOobject::NO_WRITE, and removeCells::setRefinement().

Here is the call graph for this function:

◆ baseMesh()

const fvMesh& baseMesh ( ) const
inline

Original mesh.

Definition at line 222 of file fvMeshSubset.H.

◆ hasSubMesh()

bool hasSubMesh ( ) const

Have subMesh?

Definition at line 1563 of file fvMeshSubset.C.

◆ subMesh() [1/2]

const Foam::fvMesh & subMesh ( ) const

Return reference to subset mesh.

Definition at line 1569 of file fvMeshSubset.C.

Referenced by structuredDecomp::decompose(), fvMeshDistribute::distribute(), vtkMesh::mesh(), and structuredRenumber::renumber().

Here is the caller graph for this function:

◆ subMesh() [2/2]

Foam::fvMesh & subMesh ( )

Definition at line 1577 of file fvMeshSubset.C.

◆ pointMap()

const Foam::labelList & pointMap ( ) const

Return point map.

Definition at line 1585 of file fvMeshSubset.C.

Referenced by fvMeshDistribute::distribute().

Here is the caller graph for this function:

◆ faceMap()

const Foam::labelList & faceMap ( ) const

Return face map.

Definition at line 1593 of file fvMeshSubset.C.

Referenced by fvMeshDistribute::distribute(), and fvMeshSubset::interpolate().

Here is the caller graph for this function:

◆ faceFlipMap()

const Foam::labelList & faceFlipMap ( ) const

Return face map with sign to encode flipped faces.

Definition at line 1601 of file fvMeshSubset.C.

References Foam::faceMap(), and List< T >::size().

Referenced by fvMeshDistribute::distribute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cellMap()

const Foam::labelList & cellMap ( ) const

Return cell map.

Definition at line 1639 of file fvMeshSubset.C.

Referenced by structuredDecomp::decompose(), fvMeshDistribute::distribute(), fvMeshSubset::interpolate(), and structuredRenumber::renumber().

Here is the caller graph for this function:

◆ patchMap()

const Foam::labelList & patchMap ( ) const

Return patch map.

Definition at line 1647 of file fvMeshSubset.C.

Referenced by fvMeshDistribute::distribute(), and fvMeshSubset::interpolate().

Here is the caller graph for this function:

◆ interpolate() [1/16]

static tmp<VolField<Type> > interpolate ( const VolField< Type > &  ,
const fvMesh sMesh,
const labelList patchMap,
const labelList cellMap,
const labelList faceMap 
)
static

Map volume field.

Referenced by vtkMesh::interpolate().

Here is the caller graph for this function:

◆ interpolate() [2/16]

tmp<VolField<Type> > interpolate ( const VolField< Type > &  ) const

◆ interpolate() [3/16]

static tmp<SurfaceField<Type> > interpolate ( const SurfaceField< Type > &  ,
const fvMesh sMesh,
const labelList patchMap,
const labelList cellMap,
const labelList faceMap 
)
static

Map surface field. Optionally negates value if flipping.

a face (from exposing an internal face)

◆ interpolate() [4/16]

tmp<SurfaceField<Type> > interpolate ( const SurfaceField< Type > &  ) const

◆ interpolate() [5/16]

static tmp<PointField<Type> > interpolate ( const PointField< Type > &  ,
const pointMesh sMesh,
const labelList patchMap,
const labelList pointMap 
)
static

Map point field.

◆ interpolate() [6/16]

tmp<PointField<Type> > interpolate ( const PointField< Type > &  ) const

◆ interpolate() [7/16]

static tmp<DimensionedField<Type, volMesh> > interpolate ( const DimensionedField< Type, volMesh > &  ,
const fvMesh sMesh,
const labelList cellMap 
)
static

Map dimensioned field.

◆ interpolate() [8/16]

tmp<DimensionedField<Type, volMesh> > interpolate ( const DimensionedField< Type, volMesh > &  ) const

◆ operator=()

void operator= ( const fvMeshSubset )
delete

Disallow default bitwise assignment.

◆ interpolate() [9/16]

◆ interpolate() [10/16]

Foam::tmp<Foam::VolField<Type> > interpolate ( const VolField< Type > &  vf) const

Definition at line 159 of file fvMeshSubsetInterpolate.C.

References Foam::faceMap(), and Foam::fvc::interpolate().

Here is the call graph for this function:

◆ interpolate() [11/16]

◆ interpolate() [12/16]

Foam::tmp<Foam::SurfaceField<Type> > interpolate ( const SurfaceField< Type > &  sf) const

Definition at line 341 of file fvMeshSubsetInterpolate.C.

References Foam::faceMap(), Foam::fvc::interpolate(), and sf().

Here is the call graph for this function:

◆ interpolate() [13/16]

◆ interpolate() [14/16]

Foam::tmp<Foam::PointField<Type> > interpolate ( const PointField< Type > &  sf) const

Definition at line 491 of file fvMeshSubsetInterpolate.C.

References Foam::fvc::interpolate(), DemandDrivenMeshObject< polyMesh, PatchMeshObject, pointMesh >::New(), and sf().

Here is the call graph for this function:

◆ interpolate() [15/16]

Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh> > interpolate ( const DimensionedField< Type, volMesh > &  df,
const fvMesh sMesh,
const labelList cellMap 
)

◆ interpolate() [16/16]

Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh> > interpolate ( const DimensionedField< Type, volMesh > &  df) const

Definition at line 540 of file fvMeshSubsetInterpolate.C.

References Foam::fvc::interpolate().

Here is the call graph for this function:

The documentation for this class was generated from the following files: