Loading...
Searching...
No Matches
decompositionMethod Class Referenceabstract

Abstract base class for domain decomposition. More...

#include <decompositionMethod.H>

Inheritance diagram for decompositionMethod:
Collaboration diagram for decompositionMethod:

Public Member Functions

 decompositionMethod (const decompositionMethod &)=delete
 No copy construct.
void operator= (const decompositionMethod &)=delete
 No copy assignment.
 TypeName ("decompositionMethod")
 Runtime type information.
 declareRunTimeSelectionTable (autoPtr, decompositionMethod, dictionary,(const dictionary &decompDict, const word &regionName),(decompDict, regionName))
 decompositionMethod (const dictionary &decompDict, const word &regionName="")
 Construct given the decomposition dictionary, optionally region-specific.
virtual ~decompositionMethod ()=default
 Destructor.
label nDomains () const noexcept
 Number of domains.
label nDomains (const label n)
 Set number of domains. Return old value.
virtual bool geometric () const
 True if the method is purely geometric, often using cell centre points.
virtual bool parallelAware () const =0
 Is method parallel aware?
virtual labelList decompose (const pointField &points, const scalarField &pointWeights=scalarField::null()) const
 Return the wanted processor number for every coordinate, using uniform or specified point weights.
virtual labelList decompose (const polyMesh &mesh, const pointField &points, const scalarField &pointWeights=scalarField::null()) const =0
 Return for every coordinate the wanted processor number, using uniform or specified point weights.
virtual labelList decompose (const polyMesh &mesh, const labelList &cellToRegion, const pointField &regionPoints, const scalarField &regionWeights=scalarField::null()) const
 Return for every coordinate the wanted processor number.
virtual labelList decompose (const CompactListList< label > &globalCellCells, const pointField &cc, const scalarField &cWeights=scalarField::null()) const =0
 Return for every coordinate the wanted processor number.
virtual labelList decompose (const labelListList &globalCellCells, const pointField &cc, const scalarField &cWeights=scalarField::null()) const =0
 Return for every coordinate the wanted processor number.
void setConstraints (const polyMesh &mesh, boolList &blockedFace, PtrList< labelList > &specifiedProcessorFaces, labelList &specifiedProcessor, List< labelPair > &explicitConnections) const
 Helper: extract constraints:
void applyConstraints (const polyMesh &mesh, const boolList &blockedFace, const PtrList< labelList > &specifiedProcessorFaces, const labelList &specifiedProcessor, const List< labelPair > &explicitConnections, labelList &finalDecomp) const
 Helper: apply constraints to a decomposition.
virtual labelList decompose (const polyMesh &mesh, const scalarField &cellWeights, const boolList &blockedFace, const PtrList< labelList > &specifiedProcessorFaces, const labelList &specifiedProcessor, const List< labelPair > &explicitConnections) const
labelList decompose (const polyMesh &mesh, const scalarField &cWeights) const
 Decompose a mesh.

Static Public Member Functions

static label nDomains (const dictionary &decompDict, const word &regionName="")
 Return region-specific or top-level numberOfSubdomains entry.
static const dictionaryoptionalRegionDict (const dictionary &decompDict, const word &regionName)
 Return an optional region-specific dictionary from "regions" sub-dictionary, or dictionary::null on failure.
static autoPtr< decompositionMethodNew (const dictionary &decompDict, const word &regionName="")
 Return a reference to the selected decomposition method, optionally region-specific.
static void calcCellCells (const polyMesh &mesh, const labelList &agglom, const label nLocalCoarse, const bool parallel, CompactListList< label > &cellCells)
 Determine (local or global) cellCells from mesh agglomeration.
static void calcCellCells (const polyMesh &mesh, const labelList &agglom, const label nLocalCoarse, const bool parallel, CompactListList< label > &cellCells, CompactListList< scalar > &cellCellWeights)
 Determine (local or global) cellCells and face weights from mesh agglomeration.

Protected Types

enum  selectionType { DEFAULT = 0 , EXACT = 1 , MANDATORY = 2 , NULL_DICT = 4 }
 Selection type when handling the coefficients dictionary. More...

Protected Member Functions

FOAM_NO_DANGLING_REFERENCE const dictionaryfindCoeffsDict (const word &coeffsName, int select=selectionType::DEFAULT) const
 Locate coeffsName dictionary or the fallback "coeffs" dictionary.
 decompositionMethod (const label numDomains)
 Construct with specified number of domains, no coefficients or constraints.

Static Protected Member Functions

static FOAM_NO_DANGLING_REFERENCE const dictionaryfindCoeffsDict (const dictionary &dict, const word &coeffsName, int select=selectionType::DEFAULT)
 Locate coeffsName dictionary or the fallback "coeffs" dictionary within an enclosing dictionary.

Protected Attributes

const dictionarydecompDict_
 Top-level decomposition dictionary (eg, decomposeParDict).
const dictionarydecompRegionDict_
 Region-specific decomposition dictionary information.
label nDomains_
 Number of domains for the decomposition.
PtrList< decompositionConstraintconstraints_
 Optional constraints.

Detailed Description

Abstract base class for domain decomposition.

Source files

Definition at line 47 of file decompositionMethod.H.

Member Enumeration Documentation

◆ selectionType

enum selectionType
protected

Selection type when handling the coefficients dictionary.

To be used as a bit-mask for findCoeffsDict

Enumerator
DEFAULT 

Default request.

EXACT 

No fallback to "coeffs" if main name not found.

MANDATORY 

Fatal if dictionary could not be found.

NULL_DICT 

On failure, return dictionary::null instead of the top-level enclosing dictionary.

Definition at line 74 of file decompositionMethod.H.

Constructor & Destructor Documentation

◆ decompositionMethod() [1/3]

◆ decompositionMethod() [2/3]

decompositionMethod ( const decompositionMethod & )
delete

No copy construct.

References decompositionMethod().

Here is the call graph for this function:

◆ decompositionMethod() [3/3]

decompositionMethod ( const dictionary & decompDict,
const word & regionName = "" )
explicit

Construct given the decomposition dictionary, optionally region-specific.

Definition at line 336 of file decompositionMethod.C.

References decompDict_, decompRegionDict_, nDomains(), nDomains_, optionalRegionDict(), and regionName.

Here is the call graph for this function:

◆ ~decompositionMethod()

virtual ~decompositionMethod ( )
virtualdefault

Destructor.

Member Function Documentation

◆ findCoeffsDict() [1/2]

const Foam::dictionary & findCoeffsDict ( const dictionary & dict,
const word & coeffsName,
int select = selectionType::DEFAULT )
staticprotected

Locate coeffsName dictionary or the fallback "coeffs" dictionary within an enclosing dictionary.

Parameters
selectchoose to include "coeffs" in the search, make failure a FatalError, return dictionary::null instead on failure.
Returns
the coefficients dictionary found. If nothing was found, return the enclosing dictionary or dictionary::null (depending on the select parameter).

Definition at line 247 of file decompositionMethod.C.

References Foam::abort(), Foam::cfindCoeffsDict(), dict, Foam::endl(), EXACT, Foam::FatalIOError, MANDATORY, dictionary::null, and NULL_DICT.

Referenced by geomDecomp::geomDecomp(), geomDecomp::geomDecomp(), manualDecomp::manualDecomp(), metisLikeDecomp::metisLikeDecomp(), multiLevelDecomp::multiLevelDecomp(), ptscotchDecomp::ptscotchDecomp(), randomDecomp::randomDecomp(), and structuredDecomp::structuredDecomp().

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

◆ findCoeffsDict() [2/2]

const Foam::dictionary & findCoeffsDict ( const word & coeffsName,
int select = selectionType::DEFAULT ) const
protected

Locate coeffsName dictionary or the fallback "coeffs" dictionary.

Searches both the region-specific decomposition dictionary and the top-level decomposition dictionary.

Parameters
selectchoose to include "coeffs" in the search, make failure a FatalError, return dictionary::null instead on failure.
Returns
the coefficients dictionary found. If nothing was found, return the top-level (non-region) dictionary or dictionary::null (depending on the select parameter).

Definition at line 282 of file decompositionMethod.C.

References Foam::cfindCoeffsDict(), decompRegionDict_, and EXACT.

Here is the call graph for this function:

◆ operator=()

void operator= ( const decompositionMethod & )
delete

No copy assignment.

References decompositionMethod().

Here is the call graph for this function:

◆ TypeName()

TypeName ( "decompositionMethod" )

Runtime type information.

◆ declareRunTimeSelectionTable()

declareRunTimeSelectionTable ( autoPtr ,
decompositionMethod ,
dictionary ,
(const dictionary &decompDict, const word &regionName) ,
(decompDict, regionName)  )

References decompositionMethod(), and regionName.

Here is the call graph for this function:

◆ nDomains() [1/3]

Foam::label nDomains ( const dictionary & decompDict,
const word & regionName = "" )
static

Return region-specific or top-level numberOfSubdomains entry.

The region-specific version is found within the "regions" sub-dictionary.

Definition at line 75 of file decompositionMethod.C.

References Foam::endl(), IOobjectOption::LAZY_READ, IOobjectOption::MUST_READ, Foam::nl, UPstream::nProcs(), optionalRegionDict(), UPstream::parRun(), dictionary::readEntry(), dictionary::readIfPresent(), keyType::REGEX, regionName, and WarningInFunction.

Referenced by decompositionMethod(), and New().

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

◆ optionalRegionDict()

const Foam::dictionary & optionalRegionDict ( const dictionary & decompDict,
const word & regionName )
static

Return an optional region-specific dictionary from "regions" sub-dictionary, or dictionary::null on failure.

Definition at line 119 of file decompositionMethod.C.

References dictionary::findDict(), dictionary::null, and regionName.

Referenced by decompositionMethod(), nDomains(), and New().

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

◆ New()

Foam::autoPtr< Foam::decompositionMethod > New ( const dictionary & decompDict,
const word & regionName = "" )
static

Return a reference to the selected decomposition method, optionally region-specific.

Definition at line 355 of file decompositionMethod.C.

References Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInLookup, dictionary::get(), Foam::Info, nDomains(), optionalRegionDict(), dictionary::readIfPresent(), and regionName.

Referenced by structuredDecomp::structuredDecomp().

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

◆ nDomains() [2/3]

label nDomains ( ) const
inlinenoexcept

Number of domains.

Definition at line 260 of file decompositionMethod.H.

References nDomains_, and Foam::noexcept.

Referenced by scotchDecomp::decomposeSerial(), and structuredDecomp::structuredDecomp().

Here is the caller graph for this function:

◆ nDomains() [3/3]

label nDomains ( const label n)
inline

Set number of domains. Return old value.

Definition at line 268 of file decompositionMethod.H.

References n, and nDomains_.

◆ geometric()

virtual bool geometric ( ) const
inlinevirtual

True if the method is purely geometric, often using cell centre points.

Reimplemented in geomDecomp.

Definition at line 279 of file decompositionMethod.H.

◆ parallelAware()

virtual bool parallelAware ( ) const
pure virtual

Is method parallel aware?

(i.e. does it synchronize domains across proc boundaries)

Implemented in hierarchGeomDecomp, kahipDecomp, manualDecomp, metisDecomp, multiLevelDecomp, noDecomp, ptscotchDecomp, randomDecomp, scotchDecomp, simpleGeomDecomp, and structuredDecomp.

References Field< scalar >::null(), and points.

Here is the call graph for this function:

◆ decompose() [1/7]

Foam::labelList decompose ( const pointField & points,
const scalarField & pointWeights = scalarField::null() ) const
virtual

Return the wanted processor number for every coordinate, using uniform or specified point weights.

Reimplemented in geomDecomp, hierarchGeomDecomp, metisLikeDecomp, multiLevelDecomp, noDecomp, ptscotchDecomp, randomDecomp, scotchDecomp, and simpleGeomDecomp.

Definition at line 940 of file decompositionMethod.C.

References NotImplemented, and points.

Referenced by meshRefinement::balance(), decompose(), decompose(), decompose(), metisLikeDecomp::~metisLikeDecomp(), and multiLevelDecomp::~multiLevelDecomp().

Here is the caller graph for this function:

◆ decompose() [2/7]

virtual labelList decompose ( const polyMesh & mesh,
const pointField & points,
const scalarField & pointWeights = scalarField::null() ) const
pure virtual

Return for every coordinate the wanted processor number, using uniform or specified point weights.

Use the mesh connectivity (if needed)

Implemented in hierarchGeomDecomp, manualDecomp, metisLikeDecomp, multiLevelDecomp, noDecomp, ptscotchDecomp, randomDecomp, scotchDecomp, simpleGeomDecomp, and structuredDecomp.

References mesh, Field< scalar >::null(), and points.

Here is the call graph for this function:

◆ decompose() [3/7]

Foam::labelList decompose ( const polyMesh & mesh,
const labelList & cellToRegion,
const pointField & regionPoints,
const scalarField & regionWeights = scalarField::null() ) const
virtual

Return for every coordinate the wanted processor number.

Gets passed agglomeration map (from fine to coarse cells) and coarse cell location. Can be overridden by decomposers that provide this functionality natively. Coarse cells are local to the processor (if in parallel). If you want to have coarse cells spanning processors use the globalCellCells instead.

Reimplemented in metisLikeDecomp, multiLevelDecomp, ptscotchDecomp, and scotchDecomp.

Definition at line 395 of file decompositionMethod.C.

References globalMeshData::calcCellCells(), decompose(), mesh, and UList< T >::size().

Here is the call graph for this function:

◆ decompose() [4/7]

virtual labelList decompose ( const CompactListList< label > & globalCellCells,
const pointField & cc,
const scalarField & cWeights = scalarField::null() ) const
pure virtual

Return for every coordinate the wanted processor number.

The connectivity is equal to mesh.cellCells() except for

  • in parallel the cell numbers are global cell numbers (starting from 0 at processor0 and then incrementing all through the processors)
  • the connections are across coupled patches

Implemented in hierarchGeomDecomp, manualDecomp, metisLikeDecomp, multiLevelDecomp, noDecomp, ptscotchDecomp, randomDecomp, scotchDecomp, simpleGeomDecomp, and structuredDecomp.

References Field< scalar >::null().

Here is the call graph for this function:

◆ decompose() [5/7]

virtual labelList decompose ( const labelListList & globalCellCells,
const pointField & cc,
const scalarField & cWeights = scalarField::null() ) const
pure virtual

Return for every coordinate the wanted processor number.

The connectivity is equal to mesh.cellCells() except for

  • in parallel the cell numbers are global cell numbers (starting from 0 at processor0 and then incrementing all through the processors)
  • the connections are across coupled patches

Implemented in hierarchGeomDecomp, manualDecomp, metisLikeDecomp, multiLevelDecomp, noDecomp, ptscotchDecomp, randomDecomp, scotchDecomp, simpleGeomDecomp, and structuredDecomp.

References calcCellCells(), FOAM_DEPRECATED_STRICT, mesh, and Field< scalar >::null().

Here is the call graph for this function:

◆ setConstraints()

void setConstraints ( const polyMesh & mesh,
boolList & blockedFace,
PtrList< labelList > & specifiedProcessorFaces,
labelList & specifiedProcessor,
List< labelPair > & explicitConnections ) const

Helper: extract constraints:

blockedface: existing faces where owner and neighbour on same proc explicitConnections: sets of boundary faces ,, ,, specifiedProcessorFaces: groups of faces with all cells on same processor.

Definition at line 832 of file decompositionMethod.C.

References List< T >::clear(), PtrList< T >::clear(), constraints_, mesh, and List< T >::resize_nocopy().

Referenced by meshRefinement::balance(), and decompose().

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

◆ applyConstraints()

void applyConstraints ( const polyMesh & mesh,
const boolList & blockedFace,
const PtrList< labelList > & specifiedProcessorFaces,
const labelList & specifiedProcessor,
const List< labelPair > & explicitConnections,
labelList & finalDecomp ) const

Helper: apply constraints to a decomposition.

This gives constraints opportunity to modify decomposition in case the native decomposition method has not obeyed all constraints

Definition at line 861 of file decompositionMethod.C.

References constraints_, and mesh.

Referenced by decompose().

Here is the caller graph for this function:

◆ decompose() [6/7]

Foam::labelList decompose ( const polyMesh & mesh,
const scalarField & cellWeights,
const boolList & blockedFace,
const PtrList< labelList > & specifiedProcessorFaces,
const labelList & specifiedProcessor,
const List< labelPair > & explicitConnections ) const
virtual
Parameters
blockedFaceWhether owner and neighbour should be on same processor

(takes priority over explicitConnections)

Parameters
specifiedProcessorFacesWhether whole sets of faces (and point neighbours) need to be kept

on single processor

Parameters
explicitConnectionsAdditional connections between boundary faces

Reimplemented in metisLikeDecomp, multiLevelDecomp, ptscotchDecomp, and scotchDecomp.

Definition at line 475 of file decompositionMethod.C.

References UList< T >::all(), Foam::BitOps::count(), FaceCellWave< Type, TrackingData >::data(), UList< T >::data(), decompose(), UList< T >::empty(), Foam::endl(), Foam::exit(), f(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::Info, VectorSpace< Form, Cmpt, Ncmpts >::max, mesh, Foam::nl, regionSplit::nLocalRegions(), UPstream::parRun(), patches, pFaces, pp(), Foam::reduce(), Foam::returnReduce(), Foam::returnReduceOr(), UList< T >::size(), and syncTools::swapBoundaryCellList().

Here is the call graph for this function:

◆ decompose() [7/7]

Foam::labelList decompose ( const polyMesh & mesh,
const scalarField & cWeights ) const

Decompose a mesh.

Apply all constraints from decomposeParDict ('preserveFaceZones' etc). Calls either

  • no constraints, empty weights: decompose(mesh, cellCentres())
  • no constraints, set weights: decompose(mesh, cellCentres(), cellWeights)
  • valid constraints: decompose(mesh, cellToRegion, regionPoints, regionWeights)

Definition at line 886 of file decompositionMethod.C.

References applyConstraints(), decompose(), mesh, and setConstraints().

Here is the call graph for this function:

◆ calcCellCells() [1/2]

void calcCellCells ( const polyMesh & mesh,
const labelList & agglom,
const label nLocalCoarse,
const bool parallel,
CompactListList< label > & cellCells )
static

Determine (local or global) cellCells from mesh agglomeration.

Agglomeration is local to the processor. local : connections are in local indices. Coupled across cyclics but not processor patches. global : connections are in global indices. Coupled across cyclics and processor patches.

Parameters
parallelUse global cell ids in parallel

Definition at line 429 of file decompositionMethod.C.

References globalMeshData::calcCellCells(), and mesh.

Referenced by decompose().

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

◆ calcCellCells() [2/2]

void calcCellCells ( const polyMesh & mesh,
const labelList & agglom,
const label nLocalCoarse,
const bool parallel,
CompactListList< label > & cellCells,
CompactListList< scalar > & cellCellWeights )
static

Determine (local or global) cellCells and face weights from mesh agglomeration.

Uses mag of faceArea as weights

Parameters
parallelUse global cell ids in parallel

Definition at line 449 of file decompositionMethod.C.

References globalMeshData::calcCellCells(), and mesh.

Here is the call graph for this function:

Member Data Documentation

◆ decompDict_

const dictionary& decompDict_
protected

Top-level decomposition dictionary (eg, decomposeParDict).

Definition at line 89 of file decompositionMethod.H.

Referenced by metisLikeDecomp::decompose(), multiLevelDecomp::decompose(), metisDecomp::decomposeSerial(), and decompositionMethod().

◆ decompRegionDict_

const dictionary& decompRegionDict_
protected

Region-specific decomposition dictionary information.

Definition at line 94 of file decompositionMethod.H.

Referenced by multiLevelDecomp::decompose(), decompositionMethod(), and findCoeffsDict().

◆ nDomains_

◆ constraints_

PtrList<decompositionConstraint> constraints_
protected

Optional constraints.

Definition at line 104 of file decompositionMethod.H.

Referenced by applyConstraints(), and setConstraints().


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