v0.16.3
Loading...
Searching...
No Matches
Classes | Namespaces | Typedefs | Functions | Variables
Schur.cpp File Reference

Implementation of Schur Complement. More...

Go to the source code of this file.

Classes

struct  MoFEM::OpSchurAssembleBaseImpl
 
struct  MoFEM::OpSchurAssembleBegin
 Clear Schur complement internal data. More...
 
struct  MoFEM::OpSchurZeroRowsAndCols
 
struct  MoFEM::OpSchurAssembleEndImpl< OP_SCHUR_ASSEMBLE_BASE >
 Assemble Schur complement (Implementation) More...
 
struct  MoFEM::OpSchurAssembleEnd< SchurDSYSV >
 
struct  MoFEM::OpSchurAssembleEnd< SchurDGESV >
 
struct  MoFEM::SchurElemMats
 Schur complement data storage. More...
 
struct  MoFEM::SchurElemMats::uid_mi_tag
 
struct  MoFEM::SchurElemMats::col_mi_tag
 
struct  MoFEM::BlockStorage
 Storage of block matrix, shared by block matrix and its nested (Schur) sub-matrices. More...
 
struct  MoFEM::BlockStorage::Indexes
 block data indexes More...
 
struct  MoFEM::BlockStorage::ElemEntity
 DOFs on one entity (node) of A00 element. More...
 
struct  MoFEM::BlockStorage::Pattern
 Block pattern of A00 element and layout of element buffer. More...
 
struct  MoFEM::BlockStorage::Elem
 A00 element. More...
 
struct  MoFEM::BlockStorage::RowUIdLess
 
struct  MoFEM::BlockStructure
 Context of block matrix shell. More...
 
struct  MoFEM::BlockStructure::Block
 block in numbering of this matrix (blocks not stored in element buffers) More...
 
struct  MoFEM::SchurDSYSV
 
struct  MoFEM::SchurDGESV
 
struct  MoFEM::SchurElemMatsBlock
 
struct  MoFEM::SchurElemMatsPreconditionedBlock
 

Namespaces

namespace  MoFEM
 implementation of Data Operators for Forces and Sources
 

Typedefs

using MoFEM::BlockPattern = BlockStorage::Pattern
 

Functions

static void MoFEM::apply_lu_factors (int n, const double *lu, const __CLPK_integer *ipiv, double *t, bool trans)
 Apply in place LU factors of element matrix.
 
static void MoFEM::copy_block (double *dst, int ld_dst, int ridx, int cidx, const double *src, int ld_src, int nb_rows, int nb_cols)
 copy row-major block into row-major matrix at (ridx, cidx)
 
static bool MoFEM::is_zero_matrix (const double *ptr, size_t size)
 
void MoFEM::dgecon_ (char *norm, __CLPK_integer *n, __CLPK_doublereal *a, __CLPK_integer *lda, __CLPK_doublereal *anorm, __CLPK_doublereal *rcond, __CLPK_doublereal *work, __CLPK_integer *iwork, __CLPK_integer *info)
 
static double MoFEM::norm1_block (int m, int n, const double *a, int ld)
 1-norm of column-major m x n block, infinity if block is not finite
 
static void MoFEM::add_gemv (bool trans_a, int m, int kk, const double *a, int lda, const double *x, double *y)
 y += op(A) x, op(A) is m x kk, A is column-major
 
static void MoFEM::sub_gemm (bool trans_a, int m, int kk, int nrhs, const double *a, int lda, const double *b, int ldb, double *c, int ldc)
 C -= op(A) B, op(A) is m x kk, A, B and C are column-major.
 
static bool MoFEM::factorise_pivot_block (int n, double *d, int ld, __CLPK_integer *piv, double coupling, double u, double rcond_min, std::vector< double > &work, std::vector< __CLPK_integer > &iwork, double *rcond_out=nullptr, double *anorm_out=nullptr)
 Factorise diagonal block in place and test it as block pivot.
 
static std::vector< int > MoFEM::natural_offsets (const BlockPattern &p)
 offsets of nodes in element vector in order of nodes
 
static size_t MoFEM::listed_size (const BlockPattern &p)
 doubles in listed blocks of one element
 
static void MoFEM::make_listed_layout (BlockPattern &p)
 layout with listed blocks only
 
static std::vector< char > MoFEM::symbolic_elimination (const BlockPattern &p, const std::vector< int > &order)
 Blocks of M = A^T present after eliminating nodes in given order.
 
static void MoFEM::make_block_layout (BlockPattern &p, const std::vector< int > &order)
 Layout for block elimination of nodes in order, followed by dense core of remaining nodes.
 
static std::vector< int > MoFEM::structural_order (const BlockPattern &p)
 elimination order by structure only (minimal fill, diagonal present)
 
static std::vector< int > MoFEM::analyse_pattern (const BlockPattern &p, double *w, double u, double rcond_min)
 Decide elimination order on probe element.
 
static void MoFEM::copy_listed (const BlockPattern &from, const double *src, const BlockPattern &to, double *dst)
 copy listed blocks of element buffer from one layout to another
 
static void MoFEM::elem_gather_dense (const BlockPattern &p, const double *buf, double *dense)
 dense element matrix (row-major A, size x size) from listed blocks
 
static void MoFEM::elem_mult_listed (const BlockPattern &p, const double *buf, const double *x, double *y, bool trans)
 y += A x (trans false) or y += A^T x (trans true) from listed blocks
 
static int MoFEM::elem_factorise (const BlockPattern &p, double *buf, __CLPK_integer *piv, double u, double rcond_min, std::vector< double > &work, std::vector< __CLPK_integer > &iwork)
 Factorise element buffer in place.
 
static MoFEMErrorCode MoFEM::elem_solve (const BlockPattern &p, const double *buf, const __CLPK_integer *piv, double *r, int ldr, int nrhs, bool trans, const std::vector< char > *nz_in)
 Solve with factorised element buffer.
 
static void MoFEM::elem_mult_factors (const BlockPattern &p, const double *buf, const __CLPK_integer *piv, double *v, bool trans)
 Product with factorised element buffer, in place.
 
static double MoFEM::backward_error_rhs (int i)
 right-hand side used to measure backward error
 
static double MoFEM::elem_backward_error (const BlockPattern &p, const double *orig, const double *lu, const __CLPK_integer *piv, std::vector< double > &x, std::vector< double > &r, std::vector< double > &rs)
 Normwise backward error of solve with factors of element.
 
static double MoFEM::accepted_backward_error (double be_dense, double be_tol)
 backward error accepted for block factors, given dense backward error
 
static bool MoFEM::backward_error_accepted (double be, double be_dense, double be_tol)
 true if backward error is finite and not larger than accepted
 
static bool MoFEM::verify_probe (const BlockPattern &nl, const std::vector< double > &mat, double u, double rcond_min, double be_tol, double &be_block, double &be_dense)
 Verify block layout on probe element.
 
static std::string MoFEM::describe_nodes (const BlockPattern &p, const std::vector< int > &nodes)
 
static void MoFEM::relayout_pattern (BlockStorage &s, int pi, BlockPattern nl)
 Relayout element buffers of pattern pi, element by element, in place.
 
static MoFEMErrorCode MoFEM::factorise_elems (BlockStorage &storage, BlockStorage::FactorStorage where)
 Factorise A00 elements in place.
 
static void MoFEM::set_block_orders (BlockStorage &storage)
 set orders of blocks by finite element and by column entity
 
static void MoFEM::set_parent_blocks (BlockStructure &s)
 set blocks of block matrix (parent numbering)
 
template<typename FUN >
static void MoFEM::for_each_block (const BlockStructure &ctx, FUN &&fun)
 Iterate all blocks of matrix, including listed blocks of A00 elements.
 
boost::shared_ptr< BlockStructure > MoFEM::createBlockMatStructure (DM dm, SchurFEOpsFEandFields schur_fe_op_vec)
 Create block matrix structure.
 
static MoFEMErrorCode MoFEM::mult_block_structure (Mat mat, Vec x, Vec y, InsertMode iora, bool trans)
 Matrix-vector product of block matrix.
 
static MoFEMErrorCode MoFEM::solve_block_structure (Mat mat, Vec f, Vec x, InsertMode iora, bool trans)
 Solve with A00, i.e. x = A00^{-1} f, element by element.
 
static PetscErrorCode MoFEM::mult (Mat mat, Vec x, Vec y)
 
static PetscErrorCode MoFEM::mult_add (Mat mat, Vec x, Vec y)
 
static PetscErrorCode MoFEM::mult_transpose (Mat mat, Vec x, Vec y)
 
static PetscErrorCode MoFEM::mult_transpose_add (Mat mat, Vec x, Vec y)
 
static PetscErrorCode MoFEM::solve (Mat mat, Vec x, Vec y)
 
static PetscErrorCode MoFEM::solve_add (Mat mat, Vec x, Vec y)
 
static PetscErrorCode MoFEM::solve_transpose (Mat mat, Vec x, Vec y)
 
static PetscErrorCode MoFEM::solve_transpose_add (Mat mat, Vec x, Vec y)
 
static PetscErrorCode MoFEM::zero_rows_columns (Mat A, PetscInt N, const PetscInt rows[], PetscScalar diag, Vec x, Vec b)
 
static PetscErrorCode MoFEM::mat_zero (Mat m)
 
static MoFEMErrorCode MoFEM::setSchurBlockMatOps (Mat mat_raw)
 
SchurShellMatData MoFEM::createBlockMat (DM dm, boost::shared_ptr< BlockStructure > data)
 Create a Schur Mat object.
 
MoFEMErrorCode MoFEM::assembleBlockMatSchur (MoFEM::Interface &m_field, Mat B, Mat S, std::vector< std::string > fields_name, std::vector< boost::shared_ptr< Range > > field_ents, SmartPetscObj< AO > ao)
 Assemble Schur complement S = A11 - A10 A00^{-1} A01 from block matrix.
 
boost::shared_ptr< std::vector< double > > MoFEM::getBlockMatStorageMat (Mat B)
 Get block values storage.
 
boost::shared_ptr< std::vector< double > > MoFEM::getBlockMatPrconditionerStorageMat (Mat B)
 Get preconditioner blocks storage.
 
MoFEMErrorCode MoFEM::shell_block_mat_asmb_wrap_impl (BlockStructure *ctx, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora, bool is_preconditioner)
 
MoFEMErrorCode MoFEM::shell_block_mat_asmb_wrap (Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora)
 
MoFEMErrorCode MoFEM::shell_block_preconditioner_mat_asmb_wrap (Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora)
 
boost::shared_ptr< NestSchurData > MoFEM::createSchurNestedMatrixStruture (std::pair< SmartPetscObj< DM >, SmartPetscObj< DM > > dms, boost::shared_ptr< BlockStructure > block_mat_data, std::vector< std::string > fields_name, std::vector< boost::shared_ptr< Range > > field_ents, bool add_preconditioner_block=false)
 Create structure of nested matrix [A11 A10; A01 A00].
 
std::pair< SmartPetscObj< Mat >, boost::shared_ptr< NestSchurData > > MoFEM::createSchurNestedMatrix (boost::shared_ptr< NestSchurData > schur_net_data_ptr)
 Create a Mat Diag Blocks object.
 
OpSchurAssembleBase * MoFEM::createOpSchurAssembleBegin ()
 
OpSchurAssembleBase * MoFEM::createOpSchurAssembleEnd (std::vector< std::string > fields_name, std::vector< boost::shared_ptr< Range > > field_ents, SmartPetscObj< AO > ao=SmartPetscObj< AO >(), SmartPetscObj< Mat > schur=SmartPetscObj< Mat >(), bool sym_schur=false, bool symm_op=false)
 Construct a new Op Schur Assemble End object.
 
OpSchurAssembleBase * MoFEM::createOpSchurZeroRowsAndCols (boost::shared_ptr< std::vector< unsigned char > > marker_ptr, double diag_val)
 Create a Op Schur Zero Rows And Cols object.
 
OpSchurAssembleBase * MoFEM::createOpSchurAssembleEnd (std::vector< std::string > fields_name, std::vector< boost::shared_ptr< Range > > field_ents, std::vector< SmartPetscObj< AO > > sequence_of_aos, std::vector< SmartPetscObj< Mat > > sequence_of_mats, std::vector< bool > sym_schur, bool symm_op, boost::shared_ptr< BlockStructure > diag_blocks)
 
OpSchurAssembleBase * MoFEM::createOpSchurAssembleEnd (std::vector< std::string > fields_name, std::vector< boost::shared_ptr< Range > > field_ents, std::vector< SmartPetscObj< AO > > sequence_of_aos, std::vector< SmartPetscObj< Mat > > sequence_of_mats, std::vector< bool > sym_schur, std::vector< double > diag_eps, bool symm_op, boost::shared_ptr< BlockStructure > diag_blocks)
 
MoFEMErrorCode MoFEM::setSchurA00MatSolvePC (SmartPetscObj< PC > pc)
 Set PC for A00 block.
 
template<>
MoFEMErrorCode MoFEM::MatSetValues< SchurElemMats > (Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora)
 
MoFEMErrorCode MoFEM::schur_mat_set_values_wrap (Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora)
 
template<>
MoFEMErrorCode MoFEM::MatSetValues< AssemblyTypeSelector< SCHUR > > (Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora)
 
template<>
MoFEMErrorCode MoFEM::MatSetValues< BlockStructure > (Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora)
 
template<>
MoFEMErrorCode MoFEM::MatSetValues< SchurElemMatsBlock > (Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora)
 
template<>
MoFEMErrorCode MoFEM::MatSetValues< SchurElemMatsPreconditionedBlock > (Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora)
 
MoFEMErrorCode MoFEM::schurSwitchPreconditioner (boost::shared_ptr< BlockStructure > block_mat_data)
 Switch preconditioner.
 
MoFEMErrorCode MoFEM::schurSaveBlockMesh (boost::shared_ptr< BlockStructure > block_mat_data, std::string filename)
 Save block matrix as a mesh.
 

Variables

constexpr bool MoFEM::debug_schur = false
 
constexpr double MoFEM::backward_error_factor = 100
 factor of dense backward error accepted for block factors
 

Detailed Description

Implementation of Schur Complement.

Date
2023-02-03

Definition in file Schur.cpp.