GEOS
Namespaces | Functions
MsrsbUtils.hpp File Reference
#include "common/DataTypes.hpp"
#include "linearAlgebra/common/LinearOperator.hpp"
#include "linearAlgebra/multiscale/mesh/MeshObjectManager.hpp"
#include "linearAlgebra/utilities/LinearSolverParameters.hpp"
#include "linearAlgebra/utilities/TransposeOperator.hpp"
#include "mesh/DomainPartition.hpp"
#include "mesh/mpiCommunications/CommunicationTools.hpp"

Go to the source code of this file.

Namespaces

 geos
 

Functions

ArrayOfSets< localIndex > geos::multiscale::msrsb::buildLocalConnectivity (MeshObjectManager const &nodeManager, bool ghostNodes, MeshObjectManager const &dualManager, bool ghostDuals)
 Construct a local adjacency map between points (e.g. vertices) connected by duals (e.g. cells). More...
 
array1d< localIndex > geos::multiscale::msrsb::makeSeededPartition (ArrayOfSetsView< localIndex const > const &connectivity, arrayView1d< localIndex const > const &seeds, ArrayOfSetsView< localIndex const > const &supports)
 Construct a non-overlapping partitioning (clustering) of points using point connectivity and a set of partition seeds. More...
 
ArrayOfSets< localIndex > geos::multiscale::msrsb::buildSupports (ArrayOfSetsView< localIndex const > const &fineObjectToSubdomain, ArrayOfSetsView< localIndex const > const &subdomainToCoarseObject, ArrayOfSetsView< localIndex const > const &coarseObjectToSubdomain)
 Build a map of support regions through subdomain adjacency. More...
 
array1d< integer > geos::multiscale::msrsb::findGlobalSupportBoundary (ArrayOfSetsView< localIndex const > const &fineObjectToSubdomain)
 Compute an array of global support boundary indicators. More...
 
SparsityPattern< globalIndex > geos::multiscale::msrsb::buildProlongationSparsity (DofManager const &fineDofManager, DofManager const &coarseDofManager, string const &fieldName, ArrayOfSetsView< localIndex const > const &supports)
 Compute the sparsity pattern of the prolongation operator. More...
 
CRSMatrix< real64, globalIndex > geos::multiscale::msrsb::buildTentativeProlongation (DofManager const &fineDofManager, DofManager const &coarseDofManager, string const &fieldName, ArrayOfSetsView< localIndex const > const &supports, arrayView1d< localIndex const > const &initPart)
 Initialize a tentative prolongation operator according to a non-overlapping partitioning of points. More...
 
void geos::multiscale::msrsb::makeGlobalDofLists (DofManager const &dofManager, string const &fieldName, arrayView1d< integer const > const &indicator, array1d< globalIndex > &boundaryDof, array1d< globalIndex > &interiorDof)
 Build lists of boundary and interior dof indices to use in MsRSB basis smoothing iteration. More...
 
ArrayOfSets< localIndex > geos::multiscale::msrsb::buildLayeredSupport (integer numLayers, ArrayOfSetsView< localIndex const > const &connectivity, arrayView1d< localIndex const > const &initialPartition)
 Build (possibly overlapping) supports consisting of a fixed number of layers added to initial (non-overlapping) partitions. More...
 
array1d< integer > geos::multiscale::msrsb::findLayeredSupportBoundary (ArrayOfSetsView< localIndex const > const &connectivity, ArrayOfSetsView< localIndex const > const &support)
 Given a layered support, find the global support boundary. More...
 
template<typename MATRIX >
std::unique_ptr< LinearOperator< typename MATRIX::Vector > > geos::multiscale::msrsb::makeRestriction (LinearSolverParameters::Multiscale const &params, MATRIX const &prolongation)
 Make a restriction operator. More...
 
CRSMatrix< real64, globalIndex > geos::multiscale::msrsb::dropEntries (CRSMatrixView< real64 const, globalIndex const > const &mat, real64 relTol)
 Drop entries from the matrix that are below relTol times max abs value in current row. More...
 
template<typename MATRIX >
MATRIX geos::multiscale::msrsb::computeRAP (LinearSolverParameters::Multiscale const &params, MATRIX const &fineMatrix, MATRIX const &prolongation, LinearOperator< typename MATRIX::Vector > const &restrictionOp)
 Compute the triple product R*A*P with optional post-filtering. More...
 
void geos::multiscale::msrsb::writeProlongation (CRSMatrixView< real64 const, globalIndex const > const &prolongation, multiscale::DofManager const &dofManager, string const &fieldName, string const &prefix, multiscale::MeshLevel &mesh, multiscale::MeshObjectManager &fineManager, std::function< void(multiscale::MeshLevel &, std::vector< string > const &) > const &writeFunc)
 Write the prolongation operator as a collection of fine-level fields (one per coarse point) More...
 

Detailed Description

Contains various utility functions used by MsRSB level builders.

Definition in file MsrsbUtils.hpp.

Function Documentation

◆ buildLayeredSupport()

ArrayOfSets< localIndex > geos::multiscale::msrsb::buildLayeredSupport ( integer  numLayers,
ArrayOfSetsView< localIndex const > const &  connectivity,
arrayView1d< localIndex const > const &  initialPartition 
)

Build (possibly overlapping) supports consisting of a fixed number of layers added to initial (non-overlapping) partitions.

Parameters
numLayersnumber of layers to add
connectivitypoint connectivity map
initialPartitioninitial non-overlapping partition of the points
Returns
support map (for each fine point, a list of coarse points that interpolate it)

◆ buildLocalConnectivity()

ArrayOfSets< localIndex > geos::multiscale::msrsb::buildLocalConnectivity ( MeshObjectManager const &  nodeManager,
bool  ghostNodes,
MeshObjectManager const &  dualManager,
bool  ghostDuals 
)

Construct a local adjacency map between points (e.g. vertices) connected by duals (e.g. cells).

Parameters
nodeManagerobject manager for points (nodes)
ghostNodeswhether to include ghosted points in the map
dualManagerobject manager for duals (cells)
ghostDualswhether to include connections via ghosted duals
Returns
the constructed map

◆ buildProlongationSparsity()

SparsityPattern< globalIndex > geos::multiscale::msrsb::buildProlongationSparsity ( DofManager const &  fineDofManager,
DofManager const &  coarseDofManager,
string const &  fieldName,
ArrayOfSetsView< localIndex const > const &  supports 
)

Compute the sparsity pattern of the prolongation operator.

Parameters
fineDofManagerfine level DofManager
coarseDofManagercoarse level DofManager
fieldNamedof field name to extract info from DofManagers
supportssupport map (for each fine point, a list of coarse points that interpolate it)
Returns
the local sparsity pattern

◆ buildSupports()

ArrayOfSets< localIndex > geos::multiscale::msrsb::buildSupports ( ArrayOfSetsView< localIndex const > const &  fineObjectToSubdomain,
ArrayOfSetsView< localIndex const > const &  subdomainToCoarseObject,
ArrayOfSetsView< localIndex const > const &  coarseObjectToSubdomain 
)

Build a map of support regions through subdomain adjacency.

Parameters
fineObjectToSubdomainmap of fine-scale objects (points) to adjacent subdomains ("virtual" boundary subdomains, if included, must have negative indices)
subdomainToCoarseObjectmap of subdomains to adjacent coarse-scale objects (points). Does not need to include boundary subdomains.
coarseObjectToSubdomainmap of coarse-scale objects (points) to adjacent subdomains (generally a transpose of subdomainToCoarseObject)
Returns
a map of fine objects (points) to a list of coarse objects (points) to the support of which they belong

◆ buildTentativeProlongation()

CRSMatrix< real64, globalIndex > geos::multiscale::msrsb::buildTentativeProlongation ( DofManager const &  fineDofManager,
DofManager const &  coarseDofManager,
string const &  fieldName,
ArrayOfSetsView< localIndex const > const &  supports,
arrayView1d< localIndex const > const &  initPart 
)

Initialize a tentative prolongation operator according to a non-overlapping partitioning of points.

Parameters
fineDofManagerfine level DofManager
coarseDofManagercoarse level DofManager
fieldNamefield name for the dof registered in DofManager
supportssupport map (for each fine point, a list of coarse points that interpolate it)
initPartnon-overlapping partition of fine points that defines the initial interpolation
Returns
local part of the prolongation operator

◆ computeRAP()

template<typename MATRIX >
MATRIX geos::multiscale::msrsb::computeRAP ( LinearSolverParameters::Multiscale const &  params,
MATRIX const &  fineMatrix,
MATRIX const &  prolongation,
LinearOperator< typename MATRIX::Vector > const &  restrictionOp 
)

Compute the triple product R*A*P with optional post-filtering.

Template Parameters
MATRIXtype of sparse matrix
Parameters
paramsmultiscale parameters
fineMatrixthe fine-scale system matrix
prolongationthe prolongation operator
restrictionOpthe restriction operator
Returns
the coarse-level matrix

Definition at line 211 of file MsrsbUtils.hpp.

◆ dropEntries()

CRSMatrix< real64, globalIndex > geos::multiscale::msrsb::dropEntries ( CRSMatrixView< real64 const, globalIndex const > const &  mat,
real64  relTol 
)

Drop entries from the matrix that are below relTol times max abs value in current row.

Parameters
mattne input matrix view
relTolrelative tolerance parameter
Returns
the new matrix with remaining entries and compressed sparsity pattern

◆ findGlobalSupportBoundary()

array1d< integer > geos::multiscale::msrsb::findGlobalSupportBoundary ( ArrayOfSetsView< localIndex const > const &  fineObjectToSubdomain)

Compute an array of global support boundary indicators.

Parameters
fineObjectToSubdomainan adjacency map of fine mesh support points to coarse subdomains
Returns
an array of size fineObjectToSubdomain.size(), with 1s indicating boundary points

◆ findLayeredSupportBoundary()

array1d< integer > geos::multiscale::msrsb::findLayeredSupportBoundary ( ArrayOfSetsView< localIndex const > const &  connectivity,
ArrayOfSetsView< localIndex const > const &  support 
)

Given a layered support, find the global support boundary.

Parameters
connectivitypoint connectivity map
supportsupport map (for each fine point, a list of coarse points that interpolate it)
Returns
an array of size connectivity.size() with 1s indicating boundary points

◆ makeGlobalDofLists()

void geos::multiscale::msrsb::makeGlobalDofLists ( DofManager const &  dofManager,
string const &  fieldName,
arrayView1d< integer const > const &  indicator,
array1d< globalIndex > &  boundaryDof,
array1d< globalIndex > &  interiorDof 
)

Build lists of boundary and interior dof indices to use in MsRSB basis smoothing iteration.

Parameters
dofManagerthe current level DofManager
fieldNamefield name for the dof registered in DofManager
indicatorindicator array with 1s indicating global support boundary points
boundaryDofan output array to be populated with a list of locally present boundary dof indices
interiorDofan output array to be populated with a list of locally present interior dof indices

◆ makeRestriction()

template<typename MATRIX >
std::unique_ptr< LinearOperator< typename MATRIX::Vector > > geos::multiscale::msrsb::makeRestriction ( LinearSolverParameters::Multiscale const &  params,
MATRIX const &  prolongation 
)

Make a restriction operator.

Template Parameters
MATRIXtype of sparse matrix
Parameters
paramsmultiscale parameters
prolongationthe prolongation operator
Returns
the linear operator representing restriction

The operator returned may be an explicit matrix or an implicit operator wrapping prolongation, which must have appropriate lifetime.

Definition at line 171 of file MsrsbUtils.hpp.

◆ makeSeededPartition()

array1d< localIndex > geos::multiscale::msrsb::makeSeededPartition ( ArrayOfSetsView< localIndex const > const &  connectivity,
arrayView1d< localIndex const > const &  seeds,
ArrayOfSetsView< localIndex const > const &  supports 
)

Construct a non-overlapping partitioning (clustering) of points using point connectivity and a set of partition seeds.

Parameters
connectivitythe point connectivity graph
seedsa list of seed point indices, corresponding to the number of desired partitions
supportssupport regions for each partition, i.e. a set of points that the partition is constrained to (if empty, partition growth is unconstrained)
Returns
an array of partition indices for each point (of size connectivity.size())

◆ writeProlongation()

void geos::multiscale::msrsb::writeProlongation ( CRSMatrixView< real64 const, globalIndex const > const &  prolongation,
multiscale::DofManager const &  dofManager,
string const &  fieldName,
string const &  prefix,
multiscale::MeshLevel mesh,
multiscale::MeshObjectManager fineManager,
std::function< void(multiscale::MeshLevel &, std::vector< string > const &) > const &  writeFunc 
)

Write the prolongation operator as a collection of fine-level fields (one per coarse point)

Parameters
prolongationthe local prolongation operator
dofManagerthe fine-scale DofManager
fieldNamethe dof field name registered in DofManager
prefixstring prefix to use for all field names
meshthe fine-scale mesh
fineManagerthe fine-scale object manager to write fields into
writeFuncthe callback that will be triggered once all fields have been registered on mesh and written to and before they are remove, and passed the list of field names (keys). This can be used to propagate data further to finer level (or the original GEOS mesh).

This function should only be used for debugging purposes (e.g. to dump basis functions to 3d plot outputs). It is very slow as it has to write a massive amount of data.