21 #ifndef GEOS_LINEARALGEBRA_MULTISCALE_MSRSBUTILS_HPP_
22 #define GEOS_LINEARALGEBRA_MULTISCALE_MSRSBUTILS_HPP_
30 #include "mesh/mpiCommunications/CommunicationTools.hpp"
38 class MeshObjectManager;
52 ArrayOfSets< localIndex >
105 string const & fieldName,
120 string const & fieldName,
133 string const & fieldName,
169 template<
typename MATRIX >
170 std::unique_ptr< LinearOperator< typename MATRIX::Vector > >
172 MATRIX
const & prolongation )
174 std::unique_ptr< LinearOperator< typename MATRIX::Vector > > restriction;
178 restriction = std::make_unique< TransposeOperator< MATRIX > >( prolongation );
184 prolongation.transpose( R );
185 restriction = std::make_unique< MATRIX >( std::move( R ) );
209 template<
typename MATRIX >
212 MATRIX
const & fineMatrix,
213 MATRIX
const & prolongation,
219 fineMatrix.multiplyPtAP( prolongation, coarseMatrix );
223 MATRIX
const & restriction = dynamicCast< MATRIX const & >( restrictionOp );
224 fineMatrix.multiplyRAP( restriction, prolongation, coarseMatrix );
231 coarseMatrix.create( mat.toViewConst(), coarseMatrix.numLocalCols(), coarseMatrix.comm() );
253 string const & fieldName,
254 string const & prefix,
257 std::function<
void (
multiscale::MeshLevel &, std::vector< string >
const & ) >
const & writeFunc );
void 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.
ArrayOfSets< localIndex > 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-ov...
ArrayOfSets< localIndex > 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....
std::unique_ptr< LinearOperator< typename MATRIX::Vector > > makeRestriction(LinearSolverParameters::Multiscale const ¶ms, MATRIX const &prolongation)
Make a restriction operator.
MATRIX computeRAP(LinearSolverParameters::Multiscale const ¶ms, MATRIX const &fineMatrix, MATRIX const &prolongation, LinearOperator< typename MATRIX::Vector > const &restrictionOp)
Compute the triple product R*A*P with optional post-filtering.
void 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)
CRSMatrix< real64, globalIndex > 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.
ArrayOfSets< localIndex > 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.
array1d< localIndex > 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...
SparsityPattern< globalIndex > buildProlongationSparsity(DofManager const &fineDofManager, DofManager const &coarseDofManager, string const &fieldName, ArrayOfSetsView< localIndex const > const &supports)
Compute the sparsity pattern of the prolongation operator.
array1d< integer > findLayeredSupportBoundary(ArrayOfSetsView< localIndex const > const &connectivity, ArrayOfSetsView< localIndex const > const &support)
Given a layered support, find the global support boundary.
array1d< integer > findGlobalSupportBoundary(ArrayOfSetsView< localIndex const > const &fineObjectToSubdomain)
Compute an array of global support boundary indicators.
CRSMatrix< real64, globalIndex > 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.
Abstract base class for linear operators.
Degree-of-freedom manager that works with multiscale mesh levels.
Mesh object manager used in multiscale preconditioners to keep a simplified (node/cell only) represen...
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
LvArray::CRSMatrix< T, COL_INDEX, INDEX_TYPE, LvArray::ChaiBuffer > CRSMatrix
Alias for CRS Matrix class.
LvArray::ArrayOfSetsView< T, INDEX_TYPE const, LvArray::ChaiBuffer > ArrayOfSetsView
View of array of variable-sized sets. See LvArray::ArrayOfSetsView for details.
LvArray::SparsityPattern< COL_INDEX, INDEX_TYPE, LvArray::ChaiBuffer > SparsityPattern
Alias for Sparsity pattern class.
double real64
64-bit floating point type.
LvArray::CRSMatrixView< T, COL_INDEX, INDEX_TYPE const, LvArray::ChaiBuffer > CRSMatrixView
Alias for CRS Matrix View.
LvArray::ArrayOfSets< T, INDEX_TYPE, LvArray::ChaiBuffer > ArrayOfSets
Array of variable-sized sets. See LvArray::ArrayOfSets for details.
int integer
Signed integer type.
Array< T, 1 > array1d
Alias for 1D array.
Multiscale preconditioner parameters.
integer galerkin
Whether to use Galerkin definition R = P^T (otherwise R = P_0^T)
real64 droptol
Dropping tolerance for coarse matrix values (relative to row max)