![]() |
|
#include <block_preconditioner.h>
Public Member Functions | |
BlockPreconditioner () | |
Constructor. More... | |
virtual | ~BlockPreconditioner () |
Destructor. More... | |
BlockPreconditioner (const BlockPreconditioner &)=delete | |
Broken copy constructor. More... | |
void | operator= (const BlockPreconditioner &)=delete |
Broken assignment operator. More... | |
MATRIX * | matrix_pt () const |
void | turn_on_recursive_debug_flag () |
void | turn_off_recursive_debug_flag () |
void | turn_on_debug_flag () |
Toggles on the debug flag. More... | |
void | turn_off_debug_flag () |
Toggles off the debug flag. More... | |
void | turn_into_subsidiary_block_preconditioner (BlockPreconditioner< MATRIX > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse) |
void | turn_into_subsidiary_block_preconditioner (BlockPreconditioner< MATRIX > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse, const Vector< Vector< unsigned >> &doftype_coarsen_map_coarse) |
virtual void | block_setup () |
void | block_setup (const Vector< unsigned > &dof_to_block_map) |
void | get_block (const unsigned &i, const unsigned &j, MATRIX &output_matrix, const bool &ignore_replacement_block=false) const |
MATRIX | get_block (const unsigned &i, const unsigned &j, const bool &ignore_replacement_block=false) const |
void | set_master_matrix_pt (MATRIX *in_matrix_pt) |
Set the matrix_pt in the upper-most master preconditioner. More... | |
void | get_block_other_matrix (const unsigned &i, const unsigned &j, MATRIX *in_matrix_pt, MATRIX &output_matrix) |
void | get_blocks (DenseMatrix< bool > &required_blocks, DenseMatrix< MATRIX * > &block_matrix_pt) const |
void | get_dof_level_block (const unsigned &i, const unsigned &j, MATRIX &output_block, const bool &ignore_replacement_block=false) const |
MATRIX | get_concatenated_block (const VectorMatrix< BlockSelector > &selected_block) |
void | get_concatenated_block_vector (const Vector< unsigned > &block_vec_number, const DoubleVector &v, DoubleVector &b) |
void | return_concatenated_block_vector (const Vector< unsigned > &block_vec_number, const DoubleVector &b, DoubleVector &v) const |
Takes concatenated block ordered vector, b, and copies its. More... | |
void | get_block_vectors (const Vector< unsigned > &block_vec_number, const DoubleVector &v, Vector< DoubleVector > &s) const |
void | get_block_vectors (const DoubleVector &v, Vector< DoubleVector > &s) const |
void | return_block_vectors (const Vector< unsigned > &block_vec_number, const Vector< DoubleVector > &s, DoubleVector &v) const |
void | return_block_vectors (const Vector< DoubleVector > &s, DoubleVector &v) const |
void | get_block_vector (const unsigned &n, const DoubleVector &v, DoubleVector &b) const |
void | return_block_vector (const unsigned &n, const DoubleVector &b, DoubleVector &v) const |
void | get_block_ordered_preconditioner_vector (const DoubleVector &v, DoubleVector &w) |
void | return_block_ordered_preconditioner_vector (const DoubleVector &w, DoubleVector &v) const |
unsigned | nblock_types () const |
Return the number of block types. More... | |
unsigned | ndof_types () const |
Return the total number of DOF types. More... | |
const Mesh * | mesh_pt (const unsigned &i) const |
unsigned | nmesh () const |
int | block_number (const unsigned &i_dof) const |
Return the block number corresponding to a global index i_dof. More... | |
int | index_in_block (const unsigned &i_dof) const |
const LinearAlgebraDistribution * | block_distribution_pt (const unsigned &b) const |
Access function to the block distributions (const version). More... | |
LinearAlgebraDistribution * | block_distribution_pt (const unsigned b) |
Access function to the block distributions (non-const version). More... | |
LinearAlgebraDistribution * | dof_block_distribution_pt (const unsigned &b) |
Access function to the dof-level block distributions. More... | |
const LinearAlgebraDistribution * | master_distribution_pt () const |
unsigned | ndof_types_in_mesh (const unsigned &i) const |
bool | is_subsidiary_block_preconditioner () const |
bool | is_master_block_preconditioner () const |
void | set_block_output_to_files (const std::string &basefilename) |
void | disable_block_output_to_files () |
Turn off output of blocks (by clearing the basefilename string). More... | |
bool | block_output_on () const |
Test if output of blocks is on or not. More... | |
void | output_blocks_to_files (const std::string &basefilename, const unsigned &precision=8) const |
void | post_block_matrix_assembly_partial_clear () |
BlockPreconditioner< MATRIX > * | master_block_preconditioner_pt () const |
Access function to the master block preconditioner pt. More... | |
void | clear_block_preconditioner_base () |
void | document () |
Vector< Vector< unsigned > > | doftype_coarsen_map_fine () const |
Vector< unsigned > | get_fine_grain_dof_types_in (const unsigned &i) const |
unsigned | nfine_grain_dof_types_in (const unsigned &i) const |
MapMatrix< unsigned, CRDoubleMatrix * > | replacement_dof_block_pt () const |
Access function to the replaced dof-level blocks. More... | |
void | setup_matrix_vector_product (MatrixVectorProduct *matvec_prod_pt, CRDoubleMatrix *block_pt, const Vector< unsigned > &block_col_indices) |
void | setup_matrix_vector_product (MatrixVectorProduct *matvec_prod_pt, CRDoubleMatrix *block_pt, const unsigned &block_col_index) |
void | internal_get_block_ordered_preconditioner_vector (const DoubleVector &v, DoubleVector &w) const |
void | internal_return_block_ordered_preconditioner_vector (const DoubleVector &w, DoubleVector &v) const |
unsigned | internal_nblock_types () const |
unsigned | internal_ndof_types () const |
void | internal_return_block_vector (const unsigned &n, const DoubleVector &b, DoubleVector &v) const |
void | internal_get_block_vector (const unsigned &n, const DoubleVector &v, DoubleVector &b) const |
void | internal_get_block_vectors (const Vector< unsigned > &block_vec_number, const DoubleVector &v, Vector< DoubleVector > &s) const |
void | internal_get_block_vectors (const DoubleVector &v, Vector< DoubleVector > &s) const |
void | internal_return_block_vectors (const Vector< unsigned > &block_vec_number, const Vector< DoubleVector > &s, DoubleVector &v) const |
void | internal_return_block_vectors (const Vector< DoubleVector > &s, DoubleVector &v) const |
void | internal_get_block (const unsigned &i, const unsigned &j, MATRIX &output_block) const |
int | internal_block_number (const unsigned &i_dof) const |
int | internal_index_in_block (const unsigned &i_dof) const |
const LinearAlgebraDistribution * | internal_block_distribution_pt (const unsigned &b) const |
Access function to the internal block distributions. More... | |
void | insert_auxiliary_block_distribution (const Vector< unsigned > &block_vec_number, LinearAlgebraDistribution *dist_pt) |
void | block_matrix_test (const unsigned &i, const unsigned &j, const MATRIX *block_matrix_pt) const |
template<typename myType > | |
int | get_index_of_value (const Vector< myType > &vec, const myType val, const bool sorted=false) const |
void | internal_get_block (const unsigned &block_i, const unsigned &block_j, CRDoubleMatrix &output_block) const |
void | get_dof_level_block (const unsigned &block_i, const unsigned &block_j, CRDoubleMatrix &output_block, const bool &ignore_replacement_block) const |
![]() | |
Preconditioner () | |
Constructor. More... | |
Preconditioner (const Preconditioner &)=delete | |
Broken copy constructor. More... | |
void | operator= (const Preconditioner &)=delete |
Broken assignment operator. More... | |
virtual | ~Preconditioner () |
Destructor (empty) More... | |
virtual void | preconditioner_solve (const DoubleVector &r, DoubleVector &z)=0 |
virtual void | preconditioner_solve_transpose (const DoubleVector &r, DoubleVector &z) |
void | setup (DoubleMatrixBase *matrix_pt) |
void | setup (const Problem *problem_pt, DoubleMatrixBase *matrix_pt) |
void | enable_silent_preconditioner_setup () |
Set up the block preconditioner quietly! More... | |
void | disable_silent_preconditioner_setup () |
Be verbose in the block preconditioner setup. More... | |
virtual void | setup ()=0 |
virtual void | clean_up_memory () |
Clean up memory (empty). Generic interface function. More... | |
virtual void | set_matrix_pt (DoubleMatrixBase *matrix_pt) |
Set the matrix pointer. More... | |
virtual const OomphCommunicator * | comm_pt () const |
Get function for comm pointer. More... | |
virtual void | set_comm_pt (const OomphCommunicator *const comm_pt) |
Set the communicator pointer. More... | |
double | setup_time () const |
Returns the time to setup the preconditioner. More... | |
virtual void | turn_into_subsidiary_block_preconditioner (BlockPreconditioner< CRDoubleMatrix > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse) |
virtual void | turn_into_subsidiary_block_preconditioner (BlockPreconditioner< CRDoubleMatrix > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse, const Vector< Vector< unsigned >> &doftype_coarsen_map_coarse) |
![]() | |
DistributableLinearAlgebraObject () | |
Default constructor - create a distribution. More... | |
DistributableLinearAlgebraObject (const DistributableLinearAlgebraObject &matrix)=delete | |
Broken copy constructor. More... | |
void | operator= (const DistributableLinearAlgebraObject &)=delete |
Broken assignment operator. More... | |
virtual | ~DistributableLinearAlgebraObject () |
Destructor. More... | |
LinearAlgebraDistribution * | distribution_pt () const |
access to the LinearAlgebraDistribution More... | |
unsigned | nrow () const |
access function to the number of global rows. More... | |
unsigned | nrow_local () const |
access function for the num of local rows on this processor. More... | |
unsigned | nrow_local (const unsigned &p) const |
access function for the num of local rows on this processor. More... | |
unsigned | first_row () const |
access function for the first row on this processor More... | |
unsigned | first_row (const unsigned &p) const |
access function for the first row on this processor More... | |
bool | distributed () const |
distribution is serial or distributed More... | |
bool | distribution_built () const |
void | build_distribution (const LinearAlgebraDistribution *const dist_pt) |
void | build_distribution (const LinearAlgebraDistribution &dist) |
Protected Member Functions | |
void | set_nmesh (const unsigned &n) |
void | set_mesh (const unsigned &i, const Mesh *const mesh_pt, const bool &allow_multiple_element_type_in_mesh=false) |
void | set_replacement_dof_block (const unsigned &block_i, const unsigned &block_j, CRDoubleMatrix *replacement_dof_block_pt) |
bool | any_mesh_distributed () const |
int | internal_dof_number (const unsigned &i_dof) const |
unsigned | internal_index_in_dof (const unsigned &i_dof) const |
unsigned | internal_block_dimension (const unsigned &b) const |
unsigned | internal_dof_block_dimension (const unsigned &i) const |
unsigned | master_nrow () const |
unsigned | internal_master_dof_number (const unsigned &b) const |
const LinearAlgebraDistribution * | internal_preconditioner_matrix_distribution_pt () const |
const LinearAlgebraDistribution * | preconditioner_matrix_distribution_pt () const |
![]() | |
void | clear_distribution () |
Private Attributes | |
bool | Recursive_debug_flag |
bool | Debug_flag |
std::map< Vector< unsigned >, LinearAlgebraDistribution * > | Auxiliary_block_distribution_pt |
unsigned | Nrow |
BlockPreconditioner< MATRIX > * | Master_block_preconditioner_pt |
Vector< unsigned > | Doftype_in_master_preconditioner_fine |
Vector< unsigned > | Doftype_in_master_preconditioner_coarse |
Vector< unsigned > | Index_in_dof_block_dense |
Vector< unsigned > | Dof_number_dense |
Vector< unsigned > | Dof_dimension |
Vector< Vector< unsigned > > | Global_index |
Vector< Vector< unsigned > > | Block_number_to_dof_number_lookup |
Vector< unsigned > | Dof_number_to_block_number_lookup |
Vector to the mapping from DOF number to block number. More... | |
Vector< unsigned > | Ndof_in_block |
Number of types of degree of freedom associated with each block. More... | |
LinearAlgebraDistribution * | Internal_preconditioner_matrix_distribution_pt |
LinearAlgebraDistribution * | Preconditioner_matrix_distribution_pt |
std::string | Output_base_filename |
Static Private Attributes | |
static bool | Run_block_matrix_test = false |
Block Preconditioner base class. The block structure of the overall problem is determined from the Mesh's
constituent elements. Each constituent element must be block-preconditionable - i.e must implement the GeneralisedElements
functions ndof_types()
and get_dof_numbers_for_unknowns(...). A Problem
can have several Meshes
, but each Mesh
must contain elements with the same DOF types. The association between global degrees of freedom and their unique local dof numbers is therefore based on information provided by the elements. We refer to the local dof numbers provided by the elements as the elemental dof numbers.
By default each type of DOF is assumed to be unique type of block, but DOF types can be grouped together in a single block when block_setup(...) is called.
This class can function in one of two ways. Either it acts as a stand-alone block preconditioner which computes and stores the association between global degrees of freedom and their unique global block numbers itself. Alternatively, the block preconditioner can act as a subsidiary block preconditioner within a (larger) master block preconditioner (pointed to by Master_block_preconditioner_pt). The master block preconditioner must have an equal or greater number of block types. Examples are the FSI preconditioner which is the 3x3 "master block preconditioner" for the Navier-Stokes preconditioners which deals with the 2x2 fluid-blocks within the overall structure. In this case, only the master block preconditioner computes and stores the master lookup schemes. All block preconditioners compute and store their own optimised lookup schemes.
In cases where a Problem
contains elements of different element types (e.g. fluid and solid elements in a fluid-structure interaction problem), access to the elements of the same type must be provided via pointers to (possibly auxiliary) Meshes
that only contain elements of a single type. The block preconditioner will then create global block numbers by concatenating the block types. Consider, e.g. a fluid-structure interaction problem in which the first Mesh
contains (fluid) elements whose degrees of freedom have been subdivided into types "0" (the velocity, say) and "1" (the pressure say), while the second Mesh
contains (solid) elements whose degrees of freedom are the nodal displacements, classified as its type "0". The combined block preconditioner then has three "block types": "0": Fluid velocity, "1": Fluid pressure, "2": Solid nodal positions. NOTE: currently this preconditioner uses the same communicator as the underlying problem. We may need to change this in the future.
|
inline |
Constructor.
References oomph::BlockPreconditioner< MATRIX >::Block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::Block_to_dof_map_coarse, oomph::BlockPreconditioner< MATRIX >::Block_to_dof_map_fine, oomph::BlockPreconditioner< MATRIX >::Debug_flag, oomph::BlockPreconditioner< MATRIX >::Dof_block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::Internal_block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::Internal_nblock_types, oomph::BlockPreconditioner< MATRIX >::Internal_ndof_types, oomph::BlockPreconditioner< MATRIX >::Internal_preconditioner_matrix_distribution_pt, oomph::BlockPreconditioner< MATRIX >::Master_block_preconditioner_pt, oomph::BlockPreconditioner< MATRIX >::Nrow, oomph::BlockPreconditioner< MATRIX >::Preconditioner_matrix_distribution_pt, and oomph::BlockPreconditioner< MATRIX >::Recursive_debug_flag.
|
inlinevirtual |
Destructor.
References oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base().
|
delete |
Broken copy constructor.
|
inlineprotected |
Check if any of the meshes are distributed. This is equivalent to problem.distributed() and is used as a replacement.
References i, oomph::BlockPreconditioner< MATRIX >::mesh_pt(), n, and oomph::BlockPreconditioner< MATRIX >::nmesh().
|
inline |
Access function to the block distributions (const version).
References b, oomph::BlockPreconditioner< MATRIX >::Block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::nblock_types(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::get_concatenated_block().
|
inline |
Access function to the block distributions (non-const version).
References b, oomph::BlockPreconditioner< MATRIX >::Block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::nblock_types(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
void oomph::BlockPreconditioner< MATRIX >::block_matrix_test | ( | const unsigned & | block_i, |
const unsigned & | block_j, | ||
const MATRIX * | block_matrix_pt | ||
) | const |
Private helper function to check that every element in the block matrix (i,j) matches the corresponding element in the original matrix
test function to check that every element in the block matrix (block_i,block_j) matches the corresponding element in the original matrix
References check(), i, j, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
|
inline |
Return the block number corresponding to a global index i_dof.
References oomph::BlockPreconditioner< MATRIX >::Block_to_dof_map_fine, Eigen::placeholders::end, and oomph::BlockPreconditioner< MATRIX >::internal_block_number().
Referenced by oomph::BlockPreconditioner< MATRIX >::index_in_block().
|
inline |
Test if output of blocks is on or not.
References oomph::BlockPreconditioner< MATRIX >::Output_base_filename.
|
virtual |
Determine the size of the matrix blocks and setup the lookup schemes relating the global degrees of freedom with their "blocks" and their indices (row/column numbers) in those blocks. The distributions of the preconditioner and the internal blocks are automatically specified (and assumed to be uniform) at this stage. This method should be used if the identity dof-to-block mapping is okay, i.e. dof number 0 corresponds to block number 0 dof number 1 corresponds to block number 1 dof number 2 corresponds to block number 2 etc...
Determine the size of the matrix blocks and setup the lookup schemes relating the global degrees of freedom with their "blocks" and their indices (row/column numbers) in those blocks. The distributions of the preconditioner and the blocks are automatically specified (and assumed to be uniform) at this stage. This method should be used if each DOF type corresponds to a unique block type.
References m, n, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::GeneralPurposeBlockPreconditioner< MATRIX >::gp_preconditioner_block_setup(), oomph::DummyBlockPreconditioner< MATRIX >::setup(), oomph::HelmholtzGMRESMG< MATRIX >::solve(), and oomph::HelmholtzFGMRESMG< MATRIX >::solve().
void oomph::BlockPreconditioner< MATRIX >::block_setup | ( | const Vector< unsigned > & | dof_to_block_map_in | ) |
Determine the size of the matrix blocks and setup the lookup schemes relating the global degrees of freedom with their "blocks" and their indices (row/column numbers) in those blocks. The distributions of the preconditioner and the blocks are automatically specified (and assumed to be uniform) at this stage. This method should be used if anything other than the identity dof-to-block mapping is required. The argument vector dof_to_block_map should be of length ndof. The indices represents the dof types whilst the value represents the block types. In general we want:
dof_to_block_map[dof_number] = block_number.
Determine the size of the matrix blocks and setup the lookup schemes relating the global degrees of freedom with their "blocks" and their indices (row/column numbers) in those blocks. The distributions of the preconditioner and the blocks are automatically specified (and assumed to be uniform) at this stage. This method should be used if any block contains more than one type of DOF. The argument vector dof_to_block_map should be of length ndof. Each element should contain an integer indicating the block number corresponding to that type of DOF.
References b, i, j, m, n, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and size.
|
inline |
Clears all BlockPreconditioner data. Called by the destructor and the block_setup(...) methods
References oomph::BlockPreconditioner< MATRIX >::Auxiliary_block_distribution_pt, b, oomph::BlockPreconditioner< MATRIX >::Block_distribution_pt, oomph::DistributableLinearAlgebraObject::clear_distribution(), oomph::BlockPreconditioner< MATRIX >::Dof_block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::Global_index, i, oomph::BlockPreconditioner< MATRIX >::Internal_block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::Internal_nblock_types, oomph::BlockPreconditioner< MATRIX >::Internal_ndof_types, oomph::BlockPreconditioner< MATRIX >::Internal_preconditioner_matrix_distribution_pt, oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::Nrow, p, oomph::BlockPreconditioner< MATRIX >::post_block_matrix_assembly_partial_clear(), oomph::BlockPreconditioner< MATRIX >::Preconditioner_matrix_distribution_pt, and oomph::BlockPreconditioner< MATRIX >::Replacement_dof_block_pt.
Referenced by oomph::GeneralPurposeBlockPreconditioner< MATRIX >::clean_up_memory(), and oomph::BlockPreconditioner< MATRIX >::~BlockPreconditioner().
|
inline |
Turn off output of blocks (by clearing the basefilename string).
References oomph::BlockPreconditioner< MATRIX >::Output_base_filename.
|
inline |
debugging method to document the setup. Should only be called after block_setup(...).
References b, oomph::BlockPreconditioner< MATRIX >::Block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::Block_number_to_dof_number_lookup, i, oomph::BlockPreconditioner< MATRIX >::Internal_block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::internal_master_dof_number(), oomph::BlockPreconditioner< MATRIX >::internal_nblock_types(), oomph::BlockPreconditioner< MATRIX >::Internal_nblock_types, oomph::BlockPreconditioner< MATRIX >::internal_ndof_types(), oomph::BlockPreconditioner< MATRIX >::Internal_ndof_types, oomph::BlockPreconditioner< MATRIX >::internal_preconditioner_matrix_distribution_pt(), oomph::BlockPreconditioner< MATRIX >::is_subsidiary_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::master_distribution_pt(), oomph::BlockPreconditioner< MATRIX >::nblock_types(), oomph::oomph_info, and oomph::BlockPreconditioner< MATRIX >::preconditioner_matrix_distribution_pt().
|
inline |
Access function to the dof-level block distributions.
References b, oomph::BlockPreconditioner< MATRIX >::Dof_block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::Internal_block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::ndof_types(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::set_replacement_dof_block().
|
inline |
Access function for the Doftype_coarsen_map_fine variable.
References oomph::BlockPreconditioner< MATRIX >::Doftype_coarsen_map_fine.
|
inline |
Return block (i,j). If the optional argument ignore_replacement_block is true, then any blocks in Replacement_dof_block_pt will be ignored throughout the preconditioning hierarchy.
References oomph::BlockPreconditioner< MATRIX >::get_block(), i, and j.
|
inline |
Put block (i,j) into output_matrix. This block accounts for any coarsening of dof types and any replaced dof-level blocks above this preconditioner.
References oomph::BlockPreconditioner< MATRIX >::Block_to_dof_map_coarse, oomph::CRDoubleMatrixHelpers::concatenate_without_communication(), oomph::CRDoubleMatrixHelpers::deep_copy(), oomph::BlockPreconditioner< MATRIX >::Dof_block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::get_dof_level_block(), i, oomph::BlockPreconditioner< MATRIX >::Internal_block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner(), j, oomph::BlockPreconditioner< MATRIX >::nblock_types(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::BlockPreconditioner< MATRIX >::Replacement_dof_block_pt.
Referenced by oomph::BlockPreconditioner< MATRIX >::get_block(), oomph::BlockPreconditioner< MATRIX >::get_block_other_matrix(), oomph::BlockPreconditioner< MATRIX >::get_concatenated_block(), oomph::BlockPreconditioner< MATRIX >::output_blocks_to_files(), oomph::HelmholtzGMRESMG< MATRIX >::solve(), and oomph::HelmholtzFGMRESMG< MATRIX >::solve().
void oomph::BlockPreconditioner< MATRIX >::get_block_ordered_preconditioner_vector | ( | const DoubleVector & | v, |
DoubleVector & | w | ||
) |
Given the naturally ordered vector, v, return the vector rearranged in block order in w. This function calls get_concatenated_block_vector(...) with the identity block mapping.
This function has been re-written to work with the new dof type coarsening feature. The old function is kept alive in internal_get_block_ordered_preconditioner_vector(...) and is moved to the private section of the code. The differences between the two are:
1) This function extracts all the block vectors (in one go) via the function internal_get_block_vectors(...), and concatenates them.
2) The old function makes use of the variables ending in "get_ordered", thus is slightly more efficient since it does not have to concatenate any block vectors.
3) The old function no longer respect the new indirections if dof types have been coarsened.
4) This function extracts the most fine grain dof-level vectors and concatenates them. These dof-level vectors respect the re-ordering caused by the coarsening of dof types. The overhead associated with concatenating DoubleVectors without communication is very small.
This function should be used.
References b, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, v, and w.
|
inline |
Get a block from a different matrix using the blocking scheme that has already been set up.
References oomph::BlockPreconditioner< MATRIX >::get_block(), i, j, oomph::BlockPreconditioner< MATRIX >::matrix_pt(), and oomph::BlockPreconditioner< MATRIX >::set_master_matrix_pt().
void oomph::BlockPreconditioner< MATRIX >::get_block_vector | ( | const unsigned & | b, |
const DoubleVector & | v, | ||
DoubleVector & | w | ||
) | const |
Takes the naturally ordered vector, v and returns the n-th block vector, b. Here n is the block number in the current preconditioner.
References b, oomph::DoubleVectorHelpers::concatenate_without_communication(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, v, and w.
void oomph::BlockPreconditioner< MATRIX >::get_block_vectors | ( | const DoubleVector & | v, |
Vector< DoubleVector > & | s | ||
) | const |
Takes the naturally ordered vector and rearranges it into a vector of sub vectors corresponding to the blocks, so s[b][i] contains the i-th entry in the vector associated with block b. Note: If the preconditioner is a subsidiary preconditioner then only the sub-vectors associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas the total length of the s vectors is Nrow. This is simply a wrapper around the other get_block_vectors(...) function where the block_vec_number Vector is the identity, i.e. block_vec_number is [0, 1, ..., nblock_types - 1].
void oomph::BlockPreconditioner< MATRIX >::get_block_vectors | ( | const Vector< unsigned > & | block_vec_number, |
const DoubleVector & | v, | ||
Vector< DoubleVector > & | s | ||
) | const |
Takes the naturally ordered vector and rearranges it into a vector of sub vectors corresponding to the blocks, so s[b][i] contains the i-th entry in the vector associated with block b. Note: If the preconditioner is a subsidiary preconditioner then only the sub-vectors associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas the total length of the s vectors is the sum of the lengths of the individual block vectors defined in block_vec_number.
References b, oomph::DoubleVectorHelpers::concatenate_without_communication(), i, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, s, and v.
Referenced by oomph::HelmholtzGMRESMG< MATRIX >::update().
void oomph::BlockPreconditioner< MATRIX >::get_blocks | ( | DenseMatrix< bool > & | required_blocks, |
DenseMatrix< MATRIX * > & | block_matrix_pt | ||
) | const |
Get all the block matrices required by the block preconditioner. Takes a pointer to a matrix of bools that indicate if a specified sub-block is required for the preconditioning operation. Computes the required block matrices, and stores pointers to them in the matrix block_matrix_pt. If an entry in block_matrix_pt is equal to NULL on return, that sub-block has not been requested and is therefore not available.
WARNING: the matrix pointers are created using new so you must delete them all manually!
WARNING 2: the matrix pointers in block_matrix_pt MUST be null because Richard in all his wisdom decided to call delete on any non-null pointers. Presumably to avoid fixing his memory leaks properly...
Get the block matrices required for the block preconditioner. Takes a pointer to a matrix of bools that indicate if a specified sub-block is required for the preconditioning operation. Computes the required block matrices, and stores pointers to them in the matrix block_matrix_pt. If an entry in block_matrix_pt is equal to NULL that sub-block has not been requested and is therefore not available.
References i, j, oomph::DenseMatrix< T >::ncol(), oomph::DenseMatrix< T >::nrow(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
|
inline |
Returns a concatenation of the block matrices specified by the argument selected_block. The VectorMatrix selected_block must be correctly sized as it is used to determine the number of sub block matrices to concatenate.
For each entry in the VectorMatrix, the following variables must correctly set: BlockSelector::Row_index - Refers to the row index of the block. BlockSelector::Column_index - Refers to the column index of the block. BlockSelector::Wanted - Do we want the block? BlockSelector::Replacement_block_pt - If not null, this block will be used instead of get_block(Row_index,Column_index).
For example, assume that we have a matrix of the following blocking: 0 1 2 3 4 | a | b | c | d | e | –|—|—|—|—|—|
0 a | |||||
---|---|---|---|---|---|
1 b | |||||
– | — | — | — | — | — |
2 c | |||||
– | — | — | — | — | — |
3 d | |||||
– | — | — | — | — | — |
4 e | |||||
– | — | — | — | — | — |
If we want a block matrix corresponding to the concatenation of the blocks [(a,d), (a,e) , (b,e)* ] where top left and top right blocks comes from the function get_block(...), the bottom left entry is empty, and the bottom right is a modified block.
Then we create a VectorMatrix of size 2 by 2 VectorMatrix<BlockSelector> selected_block(2,2);
In the [0][0] entry: row index is 0, column index is 3, do we want this block? - yes (true). selected_block[0][0].select_block(0,3,true);
In the [0][1] entry: row index is 0, column index is 4, do we want this block? - yes (true). selected_block[0][0].select_block(0,4,true);
In the [1][0] entry: row index is 1, column index is 3, do we want this block? - no (false). selected_block[0][0].select_block(1,3,false);
In the [1][1] entry: row index is 1, column index is 4, do we want this block? - yes (true). selected_block[0][0].select_block(1,4,true,block_pt);
where block_pt is a pointer to the modified block.
Then we can call:
CRDoubleMatrix my_block = get_concatenated_block(selected_block);
NOTE: It is important to set the row and column indices even if you do not want the block. This is because, if we allow the row and column indices to be "not set", then we can have a whole empty block row without any indices. But concatenation of blocks without communication requires both the row and column distributions, so we know how to permute the rows and columns. So in short, we require that the column and row indices to always be set for every entry in the VectorMatrix<BlockSelector> object for convenience and consistency checks.
References oomph::BlockPreconditioner< MATRIX >::Auxiliary_block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::block_distribution_pt(), oomph::BlockPreconditioner< MATRIX >::Block_distribution_pt, oomph::CRDoubleMatrix::built(), oomph::LinearAlgebraDistributionHelpers::concatenate(), oomph::CRDoubleMatrixHelpers::concatenate_without_communication(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::BlockPreconditioner< MATRIX >::get_block(), oomph::BlockPreconditioner< MATRIX >::insert_auxiliary_block_distribution(), oomph::BlockPreconditioner< MATRIX >::nblock_types(), oomph::CRDoubleMatrix::ncol(), oomph::VectorMatrix< VALUE_TYPE >::ncol(), oomph::LinearAlgebraDistribution::nrow(), oomph::VectorMatrix< VALUE_TYPE >::nrow(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
void oomph::BlockPreconditioner< MATRIX >::get_concatenated_block_vector | ( | const Vector< unsigned > & | block_vec_number, |
const DoubleVector & | v, | ||
DoubleVector & | w | ||
) |
Takes the naturally ordered vector and extracts the blocks indicated by the block number (the values) in the Vector block_vec_number all at once, then concatenates them without communication. Here, the values in block_vec_number is the block number in the current preconditioner. This is a non-const function because distributions may be created and stored in Auxiliary_block_distribution_pt for future use.
void oomph::BlockPreconditioner< CRDoubleMatrix >::get_dof_level_block | ( | const unsigned & | block_i, |
const unsigned & | block_j, | ||
CRDoubleMatrix & | output_block, | ||
const bool & | ignore_replacement_block | ||
) | const |
Gets dof-level block (i,j). If Replacement_dof_block_pt(i,j) is not null, then the replacement block is returned via a deep copy.
Otherwise if this is the uppermost block preconditioner then it calls internal_get_block(i,j), else if it is a subsidiary block preconditioner, it will call it's master block preconditioners' get_dof_level_block function.
References oomph::DoubleVectorHelpers::concatenate_without_communication(), oomph::CRDoubleMatrixHelpers::deep_copy(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
void oomph::BlockPreconditioner< MATRIX >::get_dof_level_block | ( | const unsigned & | i, |
const unsigned & | j, | ||
MATRIX & | output_block, | ||
const bool & | ignore_replacement_block = false |
||
) | const |
Gets dof-level block (i,j). If Replacement_dof_block_pt(i,j) is not null, then the replacement block is returned via a deep copy.
Otherwise if this is the uppermost block preconditioner then it calls internal_get_block(i,j), else if it is a subsidiary block preconditioner, it will call it's master block preconditioners' get_dof_level_block function.
Referenced by oomph::BlockPreconditioner< MATRIX >::get_block().
|
inline |
Returns the most fine grain dof types in a (possibly coarsened) dof type.
References oomph::BlockPreconditioner< MATRIX >::Doftype_coarsen_map_fine, i, oomph::BlockPreconditioner< MATRIX >::ndof_types(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
|
inline |
Get the index of first occurrence of value in a vector. If the element does not exist, -1 is returned. The optional parameter indicates of the Vector is sorted or not. Complexity: if the Vector is sorted, then on average, logarithmic in the distance between first and last: Performs approximately log2(N)+2 element comparisons. Otherwise, up to linear in the distance between first and last: Compares elements until a match is found.
References calibrate::val.
|
inline |
Given a global dof number, returns the index in the block it belongs to. This is the overall index, not local block (in parallel).
References oomph::BlockPreconditioner< MATRIX >::block_number(), oomph::BlockPreconditioner< MATRIX >::Block_to_dof_map_fine, oomph::LinearAlgebraDistribution::first_row(), oomph::BlockPreconditioner< MATRIX >::internal_block_distribution_pt(), oomph::BlockPreconditioner< MATRIX >::internal_dof_number(), oomph::BlockPreconditioner< MATRIX >::internal_index_in_dof(), j, oomph::LinearAlgebraDistribution::nrow_local(), and oomph::LinearAlgebraDistribution::rank_of_global_row().
|
inline |
insert a Vector<unsigned> and LinearAlgebraDistribution* pair into Auxiliary_block_distribution_pt. The Auxiliary_block_distribution_pt should only contain pointers to distributions concatenated at this block level. We try to ensure this by checking if the block_vec_number vector is within the range nblock_types(). Of course, this does not guarantee correctness, but this is the least we can do.
References oomph::BlockPreconditioner< MATRIX >::Auxiliary_block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::nblock_types(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::get_concatenated_block(), and oomph::BlockPreconditioner< MATRIX >::setup_matrix_vector_product().
|
inlineprotected |
Return the number of degrees of freedom in block b. Note that if this preconditioner acts as a subsidiary preconditioner then b refers to the block number in the subsidiary preconditioner not the master block preconditioner.
References b, oomph::BlockPreconditioner< MATRIX >::Internal_block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::internal_nblock_types(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
|
inline |
Access function to the internal block distributions.
References b, oomph::BlockPreconditioner< MATRIX >::Internal_block_distribution_pt, oomph::BlockPreconditioner< MATRIX >::internal_nblock_types(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::index_in_block().
|
inline |
Return the block number corresponding to a global index i_dof. This returns the block number corresponding to the internal blocks. What this means is that this returns the most fine grain dof-block number which this global index i_dof corresponds to. Since the writer of the preconditioner does not need to care about the internal block types, this function should not be used and thus moved to private. This function should not be removed since it is still used deep within the inner workings of the block preconditioning framework.
References oomph::BlockPreconditioner< MATRIX >::Dof_number_to_block_number_lookup, and oomph::BlockPreconditioner< MATRIX >::internal_dof_number().
Referenced by oomph::BlockPreconditioner< MATRIX >::block_number(), and oomph::BlockPreconditioner< MATRIX >::internal_index_in_block().
|
inlineprotected |
Return the size of the dof "block" i, i.e. how many degrees of freedom are associated with it. Note that if this preconditioner acts as a subsidiary preconditioner, then i refers to the block number in the subsidiary preconditioner not the master block preconditioner
References oomph::BlockPreconditioner< MATRIX >::Dof_dimension, i, oomph::BlockPreconditioner< MATRIX >::internal_master_dof_number(), oomph::BlockPreconditioner< MATRIX >::internal_ndof_types(), oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::Master_block_preconditioner_pt, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::internal_index_in_block().
|
inlineprotected |
Return the number of the block associated with global unknown i_dof. If this preconditioner is a subsidiary block preconditioner then the block number in the subsidiary block preconditioner is returned. If a particular global DOF is not associated with this preconditioner then -1 is returned
References oomph::Preconditioner::comm_pt(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::BlockPreconditioner< MATRIX >::Dof_number_dense, oomph::BlockPreconditioner< MATRIX >::Doftype_in_master_preconditioner_fine, oomph::LinearAlgebraDistribution::first_row(), oomph::DistributableLinearAlgebraObject::first_row(), i, oomph::BlockPreconditioner< MATRIX >::internal_ndof_types(), oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::Master_block_preconditioner_pt, oomph::OomphCommunicator::my_rank(), oomph::LinearAlgebraDistribution::nrow_local(), oomph::DistributableLinearAlgebraObject::nrow_local(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::index_in_block(), oomph::BlockPreconditioner< MATRIX >::internal_block_number(), and oomph::BlockPreconditioner< MATRIX >::internal_index_in_block().
void oomph::BlockPreconditioner< CRDoubleMatrix >::internal_get_block | ( | const unsigned & | block_i, |
const unsigned & | block_j, | ||
CRDoubleMatrix & | output_block | ||
) | const |
Gets block (i,j) from the matrix pointed to by Matrix_pt and returns it in output_block. This is associated with the internal blocks. Please use the other get_block(...) function.
References oomph::CRDoubleMatrix::build(), oomph::CRDoubleMatrix::build_without_copy(), calibrate::c, oomph::CRDoubleMatrix::column_index(), oomph::LinearAlgebraDistribution::communicator_pt(), oomph::LinearAlgebraDistribution::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), i, k, oomph::OomphCommunicator::nproc(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, p, UniformPSDSelfTest::r, row(), oomph::CRDoubleMatrix::row_start(), oomph::Global_string_for_annotation::string(), and oomph::CRDoubleMatrix::value().
void oomph::BlockPreconditioner< MATRIX >::internal_get_block | ( | const unsigned & | i, |
const unsigned & | j, | ||
MATRIX & | output_block | ||
) | const |
Gets block (i,j) from the matrix pointed to by Matrix_pt and returns it in output_block. This is associated with the internal blocks. Please use the other get_block(...) function.
void oomph::BlockPreconditioner< MATRIX >::internal_get_block_ordered_preconditioner_vector | ( | const DoubleVector & | v, |
DoubleVector & | w | ||
) | const |
Given the naturally ordered vector, v, return the vector rearranged in block order in w. This is a legacy function from the old block preconditioning framework. Kept alive in case it may be needed again.
This uses the variables ending in "get_ordered". We no longer use this type of method. This function copy values from v and re-order them in "block order" and place them in w. Block order means that the values in w are the same as the concatenated block vectors.
I.e. - v is naturally ordered. v -> s_b, v is ordered into blocks vectors (requires communication) concatenate_without_communication(s_{0,...,nblocks},w) gives w.
But this function skips out the concatenation part and builds w directly from v.
This is nice but the function is implemented in such a way that it always use all the (internal) blocks and concatenated with the identity ordering. I.e. if this preconditioner has 3 block types, then w will always be: concatenate_without_communication([s_0, s_1, s_2], w). There is easy way to change this.
Furthermore, it does not take into account the new dof type coarsening feature. So this function will most likely produce the incorrect vector w from what the user intended. It still works, but w will be the concatenation of the most fine grain dof block vectors with the "natural" dof type ordering.
This has been superseded by the function get_block_ordered_preconditioner_vector(...) which does the correct thing.
References b, calibrate::c, i, max, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, p, v, and w.
void oomph::BlockPreconditioner< MATRIX >::internal_get_block_vector | ( | const unsigned & | b, |
const DoubleVector & | v, | ||
DoubleVector & | w | ||
) | const |
A helper function, takes the naturally ordered vector, v, and extracts the n-th block vector, b. Here n is the block number in the current preconditioner. NOTE: The ordering of the vector b is the same as the ordering of the block matrix from internal_get_block(...).
References b, calibrate::c, i, max, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, p, v, and w.
void oomph::BlockPreconditioner< MATRIX >::internal_get_block_vectors | ( | const DoubleVector & | v, |
Vector< DoubleVector > & | s | ||
) | const |
A helper function, takes the naturally ordered vector and rearranges it into a vector of sub vectors corresponding to the blocks, so s[b][i] contains the i-th entry in the vector associated with block b. The block_vec_number indicates which blocks we want. These blocks and vectors are those corresponding to the internal blocks. Note: If the preconditioner is a subsidiary preconditioner then only the sub-vectors associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas the total length of the s vectors is the sum of the Nrow of the sub vectors. This is simply a wrapper around the other internal_get_block_vectors(...) function with the identity block_vec_number vector.
void oomph::BlockPreconditioner< MATRIX >::internal_get_block_vectors | ( | const Vector< unsigned > & | block_vec_number, |
const DoubleVector & | v, | ||
Vector< DoubleVector > & | s | ||
) | const |
Takes the naturally ordered vector and rearranges it into a vector of sub vectors corresponding to the blocks, so s[b][i] contains the i-th entry in the vector associated with block b. The block_vec_number indicates which blocks we want. These blocks and vectors are those corresponding to the internal blocks. Note: If the preconditioner is a subsidiary preconditioner then only the sub-vectors associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas the total length of the s vectors is the sum of the Nrow of the sub vectors.
References b, calibrate::c, i, max, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, p, s, and v.
|
inline |
Return the index in the block corresponding to a global block number i_dof. The index returned corresponds to the internal blocks, which is the most fine grain dof blocks.
References oomph::BlockPreconditioner< MATRIX >::Block_number_to_dof_number_lookup, oomph::BlockPreconditioner< MATRIX >::internal_block_number(), oomph::BlockPreconditioner< MATRIX >::internal_dof_block_dimension(), oomph::BlockPreconditioner< MATRIX >::internal_dof_number(), oomph::BlockPreconditioner< MATRIX >::internal_index_in_dof(), and j.
|
inlineprotected |
Return the row/column number of global unknown i_dof within it's block.
References oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearAlgebraDistribution::first_row(), oomph::DistributableLinearAlgebraObject::first_row(), oomph::BlockPreconditioner< MATRIX >::Index_in_dof_block_dense, oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::Master_block_preconditioner_pt, oomph::LinearAlgebraDistribution::nrow_local(), oomph::DistributableLinearAlgebraObject::nrow_local(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::index_in_block(), and oomph::BlockPreconditioner< MATRIX >::internal_index_in_block().
|
inlineprotected |
Takes the block number within this preconditioner and returns the corresponding block number in the master preconditioner. If this preconditioner does not have a master block preconditioner then the block number passed is returned
References b, oomph::BlockPreconditioner< MATRIX >::Doftype_in_master_preconditioner_fine, and oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner().
Referenced by oomph::BlockPreconditioner< MATRIX >::document(), and oomph::BlockPreconditioner< MATRIX >::internal_dof_block_dimension().
|
inline |
Return the number internal blocks. This should be the same as the number of internal dof types. Internally, the block preconditioning framework always work with the most fine grain blocks. I.e. it always deal with the most fine grain dof-level blocks. This allows for coarsening of dof types. When we extract a block, we look at the Block_to_dof_map_fine vector to find out which most fine grain dof types belongs to this block.
The preconditioner writer should not have to deal with internal dof/block types and thus this function has been moved to private.
This is legacy code from before the coarsening dof type functionality was added. This is kept alive because it is still used in the internal workings of the block preconditioning framework.
The function nblock_types(...) should be used if the number of block types is required.
References oomph::BlockPreconditioner< MATRIX >::Internal_nblock_types, oomph::BlockPreconditioner< MATRIX >::internal_ndof_types(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::document(), oomph::BlockPreconditioner< MATRIX >::internal_block_dimension(), oomph::BlockPreconditioner< MATRIX >::internal_block_distribution_pt(), and oomph::BlockPreconditioner< MATRIX >::output_blocks_to_files().
|
inline |
Return the number of internal dof types. This is the number of most fine grain dof types. The preconditioner writer should not have to concern him/her-self with the internal dof/block types. Thus this fuction is moved to private. We have kept this function alive since it it still used deep within the inner workings of the block preconditioning framework.
References i, oomph::BlockPreconditioner< MATRIX >::Internal_ndof_types, oomph::BlockPreconditioner< MATRIX >::is_subsidiary_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::ndof_types_in_mesh(), oomph::BlockPreconditioner< MATRIX >::nmesh(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::document(), oomph::BlockPreconditioner< MATRIX >::internal_dof_block_dimension(), oomph::BlockPreconditioner< MATRIX >::internal_dof_number(), oomph::BlockPreconditioner< MATRIX >::internal_nblock_types(), and oomph::BlockPreconditioner< MATRIX >::ndof_types().
|
inlineprotected |
access function to the internal preconditioner matrix distribution pt. preconditioner_matrix_distribution_pt always returns the concatenation of the internal block distributions. Since the writer of the preconditioner does not need to concern themselves with the internal dof/block, please use preconditioner_matrix_distribution_pt().
References oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::BlockPreconditioner< MATRIX >::Internal_preconditioner_matrix_distribution_pt, and oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner().
Referenced by oomph::BlockPreconditioner< MATRIX >::document().
void oomph::BlockPreconditioner< MATRIX >::internal_return_block_ordered_preconditioner_vector | ( | const DoubleVector & | w, |
DoubleVector & | v | ||
) | const |
Takes the block ordered vector, w, and reorders it in the natural order. Reordered vector is returned in v. Note: If the preconditioner is a subsidiary preconditioner then only the components of the vector associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas that of the vector w is of length this->nrow().
This is the return function for the function internal_get_block_ordered_preconditioner_vector(...). Both internal_get_block_ordered_preconditioner_vector(...) and internal_return_block_ordered_preconditioner_vector(...) has been superseded by the functions
get_block_ordered_preconditioner_vector(...) and return_block_ordered_preconditioner_vector(...),
Thus this function is moved to the private section of the code.
References b, calibrate::c, i, max, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, p, v, and w.
void oomph::BlockPreconditioner< MATRIX >::internal_return_block_vector | ( | const unsigned & | b, |
const DoubleVector & | w, | ||
DoubleVector & | v | ||
) | const |
Takes the n-th block ordered vector, b, and copies its entries to the appropriate entries in the naturally ordered vector, v. Here n is the block number in the current block preconditioner. If the preconditioner is a subsidiary block preconditioner the other entries in v that are not associated with it are left alone.
This version works with the internal block types. This is legacy code but is kept alive, hence moved to private. Please use the function "return_block_vector(...)".
References b, calibrate::c, i, max, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, p, v, and w.
void oomph::BlockPreconditioner< MATRIX >::internal_return_block_vectors | ( | const Vector< DoubleVector > & | s, |
DoubleVector & | v | ||
) | const |
A helper function, takes the vector of block vectors, s, and copies its entries into the naturally ordered vector, v. If this is a subsidiary block preconditioner only those entries in v that are associated with its blocks are affected. This is simple a wrapper around the other internal_return_block_vectors(...) function with the identity block_vec_number vector.
A helper function, takes the naturally ordered vector and rearranges it into a vector of sub vectors corresponding to the blocks, so s[b][i] contains the i-th entry in the vector associated with block b. The block_vec_number indicates which blocks we want. These blocks and vectors are those corresponding to the internal blocks. Note: If the preconditioner is a subsidiary preconditioner then only the sub-vectors associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas the total length of the s vectors is the sum of the Nrow of the sub vectors. This is simply a wrapper around the other internal_get_block_vectors(...) function with the identity block_vec_number vector.
void oomph::BlockPreconditioner< MATRIX >::internal_return_block_vectors | ( | const Vector< unsigned > & | block_vec_number, |
const Vector< DoubleVector > & | s, | ||
DoubleVector & | v | ||
) | const |
A helper function, takes the vector of block vectors, s, and copies its entries into the naturally ordered vector, v. If this is a subsidiary block preconditioner only those entries in v that are associated with its blocks are affected.
Takes the naturally ordered vector and rearranges it into a vector of sub vectors corresponding to the blocks, so s[b][i] contains the i-th entry in the vector associated with block b. The block_vec_number indicates which blocks we want. These blocks and vectors are those corresponding to the internal blocks. Note: If the preconditioner is a subsidiary preconditioner then only the sub-vectors associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas the total length of the s vectors is the sum of the Nrow of the sub vectors.
References b, calibrate::c, i, max, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, p, s, and v.
|
inline |
Return true if this preconditioner is the master block preconditioner.
References oomph::BlockPreconditioner< MATRIX >::Master_block_preconditioner_pt.
Referenced by oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), oomph::BlockPreconditioner< MATRIX >::dof_block_distribution_pt(), oomph::BlockPreconditioner< MATRIX >::get_block(), oomph::BlockPreconditioner< MATRIX >::internal_dof_block_dimension(), oomph::BlockPreconditioner< MATRIX >::internal_dof_number(), oomph::BlockPreconditioner< MATRIX >::internal_index_in_dof(), oomph::BlockPreconditioner< MATRIX >::internal_master_dof_number(), oomph::BlockPreconditioner< MATRIX >::internal_preconditioner_matrix_distribution_pt(), oomph::BlockPreconditioner< MATRIX >::master_block_preconditioner_pt(), oomph::BlockPreconditioner< MATRIX >::master_distribution_pt(), oomph::BlockPreconditioner< MATRIX >::master_nrow(), oomph::BlockPreconditioner< MATRIX >::ndof_types(), and oomph::BlockPreconditioner< MATRIX >::post_block_matrix_assembly_partial_clear().
|
inline |
Return true if this preconditioner is a subsidiary preconditioner.
References oomph::BlockPreconditioner< MATRIX >::Master_block_preconditioner_pt.
Referenced by oomph::BlockPreconditioner< MATRIX >::document(), oomph::BlockPreconditioner< MATRIX >::internal_ndof_types(), oomph::BlockPreconditioner< MATRIX >::matrix_pt(), oomph::BlockPreconditioner< MATRIX >::mesh_pt(), oomph::BlockPreconditioner< MATRIX >::ndof_types(), oomph::BlockPreconditioner< MATRIX >::ndof_types_in_mesh(), oomph::BlockPreconditioner< MATRIX >::set_master_matrix_pt(), oomph::BlockPreconditioner< MATRIX >::turn_off_recursive_debug_flag(), and oomph::BlockPreconditioner< MATRIX >::turn_on_recursive_debug_flag().
|
inline |
Access function to the master block preconditioner pt.
References oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::Master_block_preconditioner_pt, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::matrix_pt(), oomph::BlockPreconditioner< MATRIX >::set_master_matrix_pt(), oomph::BlockPreconditioner< MATRIX >::turn_off_recursive_debug_flag(), and oomph::BlockPreconditioner< MATRIX >::turn_on_recursive_debug_flag().
|
inline |
Access function to the distribution of the master preconditioner. If this preconditioner does not have a master preconditioner then the distribution of this preconditioner is returned.
References oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner(), and oomph::BlockPreconditioner< MATRIX >::Master_block_preconditioner_pt.
Referenced by oomph::BlockPreconditioner< MATRIX >::document().
|
inlineprotected |
Return the number of dofs (number of rows or columns) in the overall problem. The prefix "master_" is sort of redundant when used as a stand-alone block preconditioner but is required to avoid ambiguities. The latter is stored (and maintained) separately for each specific block preconditioner regardless of its role.
References oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::Master_block_preconditioner_pt, and oomph::BlockPreconditioner< MATRIX >::Nrow.
|
inlinevirtual |
Access function to matrix_pt. If this is the master then cast the matrix pointer to MATRIX*, error check and return. Otherwise ask the master for its matrix pointer.
Reimplemented from oomph::Preconditioner.
References oomph::BlockPreconditioner< MATRIX >::is_subsidiary_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::master_block_preconditioner_pt(), oomph::Preconditioner::matrix_pt(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::get_block_other_matrix(), oomph::HelmholtzGMRESMG< MATRIX >::resolve(), oomph::HelmholtzGMRESMG< MATRIX >::solve(), and oomph::HelmholtzFGMRESMG< MATRIX >::solve().
|
inline |
Access to i-th mesh (of the various meshes that contain block preconditionable elements of the same number of dof type).
WARNING: This should only be used if the derived class is the upper-most master block preconditioner. An error is thrown is this function is called from a subsidiary preconditioner. They (and since every block preconditioner can in principle be used as s subsidiary preconditioner: all block preconditioners) should store local copies of "their meshes" (if they're needed for anything)
References i, oomph::BlockPreconditioner< MATRIX >::is_subsidiary_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::Mesh_pt, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::SimpleBlockDiagonalPreconditioner< MATRIX >::add_mesh(), oomph::GeneralPurposeBlockPreconditioner< MATRIX >::add_mesh(), oomph::BlockPreconditioner< MATRIX >::any_mesh_distributed(), oomph::BlockPreconditioner< MATRIX >::ndof_types_in_mesh(), oomph::BlockPreconditioner< MATRIX >::set_mesh(), SimpleFSIPreconditioner< MATRIX >::set_navier_stokes_mesh(), oomph::SimpleFSIPreconditioner< MATRIX >::set_navier_stokes_mesh(), SimpleFSIPreconditioner< MATRIX >::set_solid_mesh(), and oomph::SimpleFSIPreconditioner< MATRIX >::set_wall_mesh().
|
inline |
Return the number of block types.
References oomph::BlockPreconditioner< MATRIX >::Block_to_dof_map_coarse, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::block_distribution_pt(), oomph::BlockPreconditioner< MATRIX >::document(), oomph::BlockPreconditioner< MATRIX >::get_block(), oomph::BlockPreconditioner< MATRIX >::get_concatenated_block(), oomph::BlockPreconditioner< MATRIX >::insert_auxiliary_block_distribution(), oomph::BlockPreconditioner< MATRIX >::set_replacement_dof_block(), oomph::HelmholtzGMRESMG< MATRIX >::solve(), and oomph::HelmholtzFGMRESMG< MATRIX >::solve().
|
inline |
Return the total number of DOF types.
References oomph::BlockPreconditioner< MATRIX >::Doftype_coarsen_map_coarse, oomph::BlockPreconditioner< MATRIX >::internal_ndof_types(), oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::is_subsidiary_block_preconditioner(), m, oomph::BlockPreconditioner< MATRIX >::Mesh_pt, n, oomph::BlockPreconditioner< MATRIX >::nmesh(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::dof_block_distribution_pt(), oomph::BlockPreconditioner< MATRIX >::get_fine_grain_dof_types_in(), oomph::BlockPreconditioner< MATRIX >::nfine_grain_dof_types_in(), and oomph::BlockPreconditioner< MATRIX >::set_replacement_dof_block().
|
inline |
Return the number of DOF types in mesh i. WARNING: This should only be used by the upper-most master block preconditioner. An error is thrown is this function is called from a subsidiary preconditioner. They (and since every block preconditioner can in principle be used as s subsidiary preconditioner: all block preconditioners) should store local copies of "their meshes" (if they're needed for anything)
References i, oomph::BlockPreconditioner< MATRIX >::is_subsidiary_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::mesh_pt(), oomph::Mesh::ndof_types(), oomph::BlockPreconditioner< MATRIX >::Ndof_types_in_mesh, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::BlockPreconditioner< MATRIX >::internal_ndof_types().
|
inline |
Access function for the number of most fine grain dof types in a (possibly coarsened) dof type.
References oomph::BlockPreconditioner< MATRIX >::Doftype_coarsen_map_fine, i, oomph::BlockPreconditioner< MATRIX >::ndof_types(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
|
inline |
Return the number of meshes in Mesh_pt.
WARNING: This should only be used if the derived class is the upper-most master block preconditioner. All block preconditioners) should store local copies of "their meshes" (if they're needed for anything)
References oomph::BlockPreconditioner< MATRIX >::Mesh_pt.
Referenced by oomph::BlockPreconditioner< MATRIX >::any_mesh_distributed(), oomph::GeneralPurposeBlockPreconditioner< MATRIX >::gp_preconditioner_set_all_meshes(), oomph::BlockPreconditioner< MATRIX >::internal_ndof_types(), oomph::BlockPreconditioner< MATRIX >::ndof_types(), and oomph::BlockPreconditioner< MATRIX >::set_mesh().
|
delete |
Broken assignment operator.
|
inline |
Output all blocks to numbered files. Called at the end of get blocks if an output filename has been set.
References MergeRestartFiles::filename, oomph::BlockPreconditioner< MATRIX >::get_block(), i, oomph::BlockPreconditioner< MATRIX >::internal_nblock_types(), j, oomph::Global_string_for_annotation::string(), and oomph::StringConversion::to_string().
|
inline |
A helper method to reduce the memory requirements of block preconditioners. Once the methods get_block(...), get_blocks(...) and build_preconditioner_matrix(...) have been called in this and all subsidiary block preconditioners this method can be called to clean up.
References oomph::BlockPreconditioner< MATRIX >::Block_number_to_dof_number_lookup, oomph::BlockPreconditioner< MATRIX >::Dof_dimension, oomph::BlockPreconditioner< MATRIX >::Dof_number_dense, oomph::BlockPreconditioner< MATRIX >::Dof_number_to_block_number_lookup, oomph::BlockPreconditioner< MATRIX >::Index_in_dof_block_dense, oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner(), and oomph::BlockPreconditioner< MATRIX >::Ndof_in_block.
Referenced by oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base().
|
inlineprotected |
Access function to the preconditioner matrix distribution pointer. This is the concatenation of the block distributions with the identity ordering. I.e. if this preconditioner has three block types, with the three associated block distributions dist_b0, dist_b1 and dist_b2, then this distribution is: LinearAlgebraDistributionHelpers::concatenate(dist_b0, dist_b1, dist_b2).
References oomph::BlockPreconditioner< MATRIX >::Preconditioner_matrix_distribution_pt.
Referenced by oomph::BlockPreconditioner< MATRIX >::document().
|
inline |
Access function to the replaced dof-level blocks.
References oomph::BlockPreconditioner< MATRIX >::Replacement_dof_block_pt.
Referenced by oomph::BlockPreconditioner< MATRIX >::set_replacement_dof_block().
void oomph::BlockPreconditioner< MATRIX >::return_block_ordered_preconditioner_vector | ( | const DoubleVector & | w, |
DoubleVector & | v | ||
) | const |
Takes the block ordered vector, w, and reorders it in natural order. Reordered vector is returned in v. Note: If the preconditioner is a subsidiary preconditioner then only the components of the vector associated with the blocks of the subsidiary preconditioner will be included. Hence the length of v is master_nrow() whereas that of the vector w is of length this->nrow().
This is the return function for the function get_block_ordered_preconditioner_vector(...).
It calls the function return_concatenated_block_vector(...) with the identity block number ordering.
References b, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, v, and w.
void oomph::BlockPreconditioner< MATRIX >::return_block_vector | ( | const unsigned & | n, |
const DoubleVector & | b, | ||
DoubleVector & | v | ||
) | const |
Takes the n-th block ordered vector, b, and copies its entries to the appropriate entries in the naturally ordered vector, v. Here n is the block number in the current block preconditioner. If the preconditioner is a subsidiary block preconditioner the other entries in v that are not associated with it are left alone.
References b, n, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::DoubleVectorHelpers::split_without_communication(), and v.
void oomph::BlockPreconditioner< MATRIX >::return_block_vectors | ( | const Vector< DoubleVector > & | s, |
DoubleVector & | v | ||
) | const |
Takes the vector of block vectors, s, and copies its entries into the naturally ordered vector, v. If this is a subsidiary block preconditioner only those entries in v that are associated with its blocks are affected. The block_vec_number indicates which block the vectors in s came from. The block number corresponds to the block numbers in this preconditioner. This is simply a wrapper around the other return_block_vectors(...) function where the block_vec_number Vector is the identity, i.e. block_vec_number is [0, 1, ..., nblock_types - 1].
void oomph::BlockPreconditioner< MATRIX >::return_block_vectors | ( | const Vector< unsigned > & | block_vec_number, |
const Vector< DoubleVector > & | s, | ||
DoubleVector & | v | ||
) | const |
Takes the vector of block vectors, s, and copies its entries into the naturally ordered vector, v. If this is a subsidiary block preconditioner only those entries in v that are associated with its blocks are affected. The block_vec_number indicates which block the vectors in s came from. The block number corresponds to the block numbers in this preconditioner.
References b, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, s, oomph::DoubleVectorHelpers::split_without_communication(), and v.
Referenced by oomph::HelmholtzGMRESMG< MATRIX >::update().
void oomph::BlockPreconditioner< MATRIX >::return_concatenated_block_vector | ( | const Vector< unsigned > & | block_vec_number, |
const DoubleVector & | b, | ||
DoubleVector & | v | ||
) | const |
Takes concatenated block ordered vector, b, and copies its.
Takes concatenated block ordered vector, b, and copies its entries to the appropriate entries in the naturally ordered vector, v. Here the values in block_vec_number indicates which blocks the vector b is a concatenation of. The block number are those in the current preconditioner. If the preconditioner is a subsidiary block preconditioner the other entries in v that are not associated with it are left alone.
References OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and v.
|
inline |
Set the base part of the filename to output blocks to. If it is set then all blocks will be output at the end of block_setup. If it is left empty nothing will be output.
References oomph::BlockPreconditioner< MATRIX >::Output_base_filename.
|
inline |
Set the matrix_pt in the upper-most master preconditioner.
References oomph::BlockPreconditioner< MATRIX >::is_subsidiary_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::master_block_preconditioner_pt(), and oomph::Preconditioner::set_matrix_pt().
Referenced by oomph::BlockPreconditioner< MATRIX >::get_block_other_matrix().
|
inlineprotected |
Set the i-th mesh for this block preconditioner. Note: The method set_nmesh(...) must be called before this method to specify the number of meshes. By default, it is assumed that each mesh only contains elements of the same type. This condition may be relaxed by setting the boolean allow_multiple_element_type_in_mesh to true, however, each mesh must only contain elements with the same number of dof types.
References oomph::BlockPreconditioner< MATRIX >::Allow_multiple_element_type_in_mesh, i, oomph::BlockPreconditioner< MATRIX >::mesh_pt(), oomph::BlockPreconditioner< MATRIX >::Mesh_pt, oomph::BlockPreconditioner< MATRIX >::nmesh(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
Referenced by oomph::GeneralPurposeBlockPreconditioner< MATRIX >::gp_preconditioner_set_all_meshes(), oomph::HelmholtzGMRESMG< MATRIX >::solve(), and oomph::HelmholtzFGMRESMG< MATRIX >::solve().
|
inlineprotected |
Specify the number of meshes required by this block preconditioner. Note: elements in different meshes correspond to different types of DOF.
References oomph::BlockPreconditioner< MATRIX >::Allow_multiple_element_type_in_mesh, oomph::BlockPreconditioner< MATRIX >::Mesh_pt, and n.
Referenced by oomph::GeneralPurposeBlockPreconditioner< MATRIX >::gp_preconditioner_set_all_meshes(), oomph::SimpleFSIPreconditioner< MATRIX >::SimpleFSIPreconditioner(), oomph::HelmholtzGMRESMG< MATRIX >::solve(), and oomph::HelmholtzFGMRESMG< MATRIX >::solve().
|
inlineprotected |
Set replacement dof-level blocks. Only dof-level blocks can be set. This is important due to how the dof type coarsening feature operates.
IMPORTANT: The block indices (block_i, block_j) is the dof-level ordering, NOT the block-ordering. The block-ordering is determined by the parameters given to block_setup(...). The DOF-ordering is determined by the two-level ordering scheme of first the elements, then the meshes.
References oomph::BlockPreconditioner< MATRIX >::dof_block_distribution_pt(), oomph::BlockPreconditioner< MATRIX >::nblock_types(), oomph::BlockPreconditioner< MATRIX >::ndof_types(), oomph::LinearAlgebraDistribution::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::BlockPreconditioner< MATRIX >::replacement_dof_block_pt(), and oomph::BlockPreconditioner< MATRIX >::Replacement_dof_block_pt.
|
inline |
Setup matrix vector product. This is simply a wrapper around the other setup_matrix_vector_product function.
References oomph::BlockPreconditioner< MATRIX >::setup_matrix_vector_product().
|
inline |
Setup a matrix vector product. matvec_prod_pt is a pointer to the MatrixVectorProduct, block_pt is a pointer to the block matrix, block_col_indices is a vector indicating which block indices does the RHS vector we want to multiply the matrix by.
The distribution of the block column must be the same as the RHS vector being solved. By default, OOMPH-LIB's uniform row distribution is employed. When block matrices are concatenated without communication, the columns are permuted, as a result, the distribution of the columns may no longer be uniform.
References oomph::BlockPreconditioner< MATRIX >::Auxiliary_block_distribution_pt, b, oomph::BlockPreconditioner< MATRIX >::Block_distribution_pt, oomph::LinearAlgebraDistributionHelpers::concatenate(), oomph::BlockPreconditioner< MATRIX >::insert_auxiliary_block_distribution(), and oomph::MatrixVectorProduct::setup().
Referenced by oomph::BlockPreconditioner< MATRIX >::setup_matrix_vector_product().
void oomph::BlockPreconditioner< MATRIX >::turn_into_subsidiary_block_preconditioner | ( | BlockPreconditioner< MATRIX > * | master_block_prec_pt, |
const Vector< unsigned > & | doftype_in_master_preconditioner_coarse | ||
) |
Function to turn this preconditioner into a subsidiary preconditioner that operates within a bigger "master block preconditioner (e.g. a Navier-Stokes 2x2 block preconditioner dealing with the fluid sub-blocks within a 3x3 FSI preconditioner. Once this is done the master block preconditioner deals with the block setup etc. The vector doftype_in_master_preconditioner_coarse must specify the dof number in the master preconditioner that corresponds to a dof number in this preconditioner. 1. The length of the vector is used to determine the number of blocks in this preconditioner therefore it must be correctly sized. 2. block_setup(...) should be called in the master preconditioner before this method is called. 3. block_setup(...) should be called in the corresponding subsidiary preconditioner after this method is called.
This calls the other turn_into_subsidiary_block_preconditioner function with the identity mapping for doftype_coarsen_map_coarse vector.
Function to turn this preconditioner into a subsidiary preconditioner that operates within a bigger "master block preconditioner (e.g. a Navier-Stokes 2x2 block preconditioner dealing with the fluid sub-blocks within a 3x3 FSI preconditioner. Once this is done the master block preconditioner deals with the block setup etc. The vector block_map must specify the dof number in the master preconditioner that corresponds to a block number in this preconditioner. ??ds horribly misleading comment! The length of the vector is used to determine the number of blocks in this preconditioner therefore it must be correctly sized. This calls the other turn_into_subsidiary_block_preconditioner(...) function providing an empty doftype_to_doftype_map vector.
Referenced by oomph::CoarseTwoIntoOne< MATRIX >::setup(), oomph::TwoPlusThreeUpperTriangularWithOneLevelSubsidiary< MATRIX >::setup(), oomph::TwoPlusOneUpperTriangularPreconditioner< MATRIX >::setup(), oomph::TwoPlusThreeUpperTriangularWithTwoLevelSubsidiary< MATRIX >::setup(), oomph::TwoPlusThreeUpperTriangularWithReplace< MATRIX >::setup(), oomph::CoarseTwoPlusTwoPlusOne< MATRIX >::setup(), oomph::OnePlusFourWithTwoCoarse< MATRIX >::setup(), oomph::FSIPreconditioner::setup(), oomph::PseudoElasticFSIPreconditioner::setup(), oomph::PseudoElasticPreconditioner::setup(), oomph::PseudoElasticPreconditionerOld::setup(), oomph::LagrangeEnforcedFlowPreconditioner::setup(), oomph::PressureBasedSolidLSCPreconditioner::setup(), and oomph::GMRESBlockPreconditioner::setup().
void oomph::BlockPreconditioner< MATRIX >::turn_into_subsidiary_block_preconditioner | ( | BlockPreconditioner< MATRIX > * | master_block_prec_pt, |
const Vector< unsigned > & | doftype_in_master_preconditioner_coarse, | ||
const Vector< Vector< unsigned >> & | doftype_coarsen_map_coarse | ||
) |
Function to turn this preconditioner into a subsidiary preconditioner that operates within a bigger "master block preconditioner (e.g. a Navier-Stokes 2x2 block preconditioner dealing with the fluid sub-blocks within a 3x3 FSI preconditioner. Once this is done the master block preconditioner deals with the block setup etc. The vector doftype_in_master_preconditioner_coarse must specify the dof number in the master preconditioner that corresponds to a dof number in this preconditioner. 1. The length of the vector is used to determine the number of blocks in this preconditioner therefore it must be correctly sized. 2. block_setup(...) should be called in the master preconditioner before this method is called. 3. block_setup(...) should be called in the corresponding subsidiary preconditioner after this method is called.
The doftype_coarsen_map_coarse is a mapping of the dof numbers in the master preconditioner to the dof numbers REQUIRED by THIS preconditioner. This allows for coarsening of the dof types if the master preconditioner has a more fine grain dof type splitting.
For example, the Lagrangian preconditioner (in 3D with one constraint) has doftypes: 0 1 2 3 4 5 6 7 ub vb wb uc vc wc p Lc
We wish to use an existing Navier-Stokes preconditioner, for example, LSC, to solve the sub-system associated with the dof numbers 0, 1, 2, 3, 4, 5, 6. But the existing LSC preconditioner only works with four dof types (3 velocity dof types and 1 pressure dof types). We need to coarsen the number of dof types in the master preconditioner.
If the LSC preconditioner requires the dof ordering: u, v, w, p. Then the doftype_coarsen_map_coarse will be: [0 3] -> u velocity dof type [1 4] -> v velocity dof type [2 5] -> w velocity dof type [6] -> pressure dof type.
Function to turn this block preconditioner into a subsidiary block preconditioner that operates within a bigger master block preconditioner (e.g. a Navier-Stokes 2x2 block preconditioner dealing with the fluid sub-blocks within a 3x3 FSI preconditioner. Once this is done the master block preconditioner deals with the block setup etc.
The vector doftype_map must specify the dof type in the master preconditioner that corresponds to a dof type in this block preconditioner.
In general, we want: doftype_map[doftype in subsidiary prec] = doftype in master prec.
It tells this block preconditioner which dof types of the master block preconditioner it is working with.
The length of the vector is used to determine the number of dof types in THIS block preconditioner therefore it must be correctly sized.
For example, let the master block preconditioner have 5 dof types in total and a 1-4 dof type splitting where the block (0,0) corresponds to dof type 0 and the block (1,1) corresponds to dof types 1, 2, 3 and 4 (i.e. it would have given to block_setup the vector [0,1,1,1,1]). Furthermore, it solves (1,1) block with subsidiary block preconditioner. Then the doftype_map passed to this function of the subsidiary block preconditioner would be [1, 2, 3, 4].
Dof type coarsening (following on from the example above): Let the subsidiary block preconditioner (THIS block preconditioner) only works with two DOF types, then the master block preconditioner must "coarsen" the dof types by providing the optional argument doftype_coarsen_map vector.
The doftype_coarsen_map vector (in this case) might be [[0,1], [2,3]] telling the subsidiary block preconditioner that the SUBSIDIARY dof types 0 and 1 should be treated as dof type 0 and the subsidiary dof types 2 and 3 should be treated as subsidiary dof type 1.
If no doftype_coarsen_map vector is provided, then the identity is used automatically (see the turn_into_subsidiary_block_preconditioner(...) function with only two arguments). In the above case, the identity doftype_coarsen_map vector for the subsidiary block preconditioner would be the 2D vector [[0], [1], [2], [3]] which means dof type 0 is treated as dof type 0, dof type 1 is treated as dof type 1, dof type 2 is treated as dof type 2, and dof type 3 is treated as dof type 3.
|
inline |
Toggles off the debug flag.
References oomph::BlockPreconditioner< MATRIX >::Debug_flag.
|
inline |
Toggles off the recursive debug flag. The change goes up the block preconditioning hierarchy.
References oomph::BlockPreconditioner< MATRIX >::is_subsidiary_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::master_block_preconditioner_pt(), and oomph::BlockPreconditioner< MATRIX >::Recursive_debug_flag.
|
inline |
Toggles on the debug flag.
References oomph::BlockPreconditioner< MATRIX >::Debug_flag.
|
inline |
Toggles on the recursive debug flag. The change goes up the block preconditioning hierarchy.
References oomph::BlockPreconditioner< MATRIX >::is_subsidiary_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::master_block_preconditioner_pt(), and oomph::BlockPreconditioner< MATRIX >::Recursive_debug_flag.
|
protected |
Vector of unsigned to indicate which meshes contain multiple element types.
Referenced by oomph::BlockPreconditioner< MATRIX >::set_mesh(), and oomph::BlockPreconditioner< MATRIX >::set_nmesh().
|
private |
Stores any block-level distributions / concatenation of block-level distributions required. The first in the pair (Vector<unsigned>) represents the block numbers of the distributions concatenated to get the second in the pair (LinearAlgebraDistribution*).
Referenced by oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), oomph::BlockPreconditioner< MATRIX >::get_concatenated_block(), oomph::BlockPreconditioner< MATRIX >::insert_auxiliary_block_distribution(), and oomph::BlockPreconditioner< MATRIX >::setup_matrix_vector_product().
|
protected |
The distribution for the blocks.
Referenced by oomph::BlockPreconditioner< MATRIX >::block_distribution_pt(), oomph::BlockPreconditioner< MATRIX >::BlockPreconditioner(), oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), oomph::BlockPreconditioner< MATRIX >::document(), oomph::BlockPreconditioner< MATRIX >::get_concatenated_block(), and oomph::BlockPreconditioner< MATRIX >::setup_matrix_vector_product().
|
private |
Vector of vectors to store the mapping from block number to the DOF number (each element could be a vector because we allow multiple DOFs types in a single block).
Referenced by oomph::BlockPreconditioner< MATRIX >::document(), oomph::BlockPreconditioner< MATRIX >::internal_index_in_block(), and oomph::BlockPreconditioner< MATRIX >::post_block_matrix_assembly_partial_clear().
|
protected |
Mapping for block types to dof types. These are the dof types the writer of the preconditioner expects. For the upper-most master block preconditioner, this would be the sum of the dof types in the meshes. For subsidiary block preconditioners, this is determined by the parent preconditioner when passing in the doftype_coarsen_map_coarse vector in turn_into_subsidiary_block_preconditioner(...).
Referenced by oomph::BlockPreconditioner< MATRIX >::BlockPreconditioner(), oomph::BlockPreconditioner< MATRIX >::get_block(), and oomph::BlockPreconditioner< MATRIX >::nblock_types().
|
protected |
Mapping for the block types to the most fine grain dof types.
Referenced by oomph::BlockPreconditioner< MATRIX >::block_number(), oomph::BlockPreconditioner< MATRIX >::BlockPreconditioner(), and oomph::BlockPreconditioner< MATRIX >::index_in_block().
|
private |
Debugging variable. Set true or false via the access functions turn_on_debug_flag(...) turn_off_debug_flag(...)
Referenced by oomph::BlockPreconditioner< MATRIX >::BlockPreconditioner(), oomph::BlockPreconditioner< MATRIX >::turn_off_debug_flag(), and oomph::BlockPreconditioner< MATRIX >::turn_on_debug_flag().
|
protected |
Storage for the default distribution for each dof block at this level.
Referenced by oomph::BlockPreconditioner< MATRIX >::BlockPreconditioner(), oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), oomph::BlockPreconditioner< MATRIX >::dof_block_distribution_pt(), and oomph::BlockPreconditioner< MATRIX >::get_block().
|
private |
Vector containing the size of each block, i.e. the number of global DOFs associated with it. (Empty if this preconditioner has a master preconditioner as this information is obtain from the master preconditioner.)
Referenced by oomph::BlockPreconditioner< MATRIX >::internal_dof_block_dimension(), and oomph::BlockPreconditioner< MATRIX >::post_block_matrix_assembly_partial_clear().
|
private |
Vector to store the mapping from the global DOF number to its block. Empty if this preconditioner has a master preconditioner, in this case the information is obtained from the master preconditioner.
Referenced by oomph::BlockPreconditioner< MATRIX >::internal_dof_number(), and oomph::BlockPreconditioner< MATRIX >::post_block_matrix_assembly_partial_clear().
|
private |
Vector to the mapping from DOF number to block number.
Referenced by oomph::BlockPreconditioner< MATRIX >::internal_block_number(), and oomph::BlockPreconditioner< MATRIX >::post_block_matrix_assembly_partial_clear().
|
protected |
Mapping for dof types within THIS precondition. This is usually passed down from the parent preconditioner. This list is used to tell which does types should be considered as a single dof type within this preconditioner. I.e. we "coarsen" the dof types. The values are local to this preconditioner, for example, even if the Doftype_in_master_preconditioner_coarse = [2,3,4], the vector Doftype_coarsen_map_coarse = [[0],[1,2]], saying your local dof types 0 should be considered as dof type 0 and dof types 1 and 2 are considered as dof type 1.
Furthermore, the dof types are that the preconditioner above this one knows; these dof types may or may not be coarsened. For example, say that this preconditioner expects two dof types, 0 and 1. The preconditioner above this one wishes to use this preconditioner to solve the block associated with it's dof types 2, 3 and 4. It passes the Vector [2,3,4] to this preconditioner via the function turn_into_subsidiary_block_preconditioner(...), this list is to be stored in Doftype_in_master_preconditioner_coarse. It also passes in the 2D vector [[0][1,2]] (as described above), this list is to be stored in Doftype_coarsen_map_coarse. BUT, the master's preconditioner dof types may also be coarsened. I.e. the underlying dof types of the master block preconditioner may be [0,1,2,3,4,5,6,7], for which it may have the Doftype_coarsen_map_coarse = [[0,1][2,3][4,5][6,7]].
An additional list has to be kept for the most fine grain dof type mapping. This is stored in Doftype_coarsen_map_fine, in this case it would be:
Doftype_coarsen_map_fine = [[0,1][2,3,4,5]], since the dof types passed to this preconditioner is [2, 3, 4] from the master preconditioner, but it actually refers to the underlying dof types [2,3,4,5,6,7].
In the case of the top most master block preconditioner, the block_setup(...) function fills the vector with the identity mapping.
Referenced by oomph::BlockPreconditioner< MATRIX >::ndof_types().
|
protected |
Mapping the dof types within this preconditioner. The values in here refers to the most grain dof types. This list is automatically generated either in block_setup(...) (for the top-most preconditioner) or the turn_into_subsidiary_block_preconditioner(...) function. Please refer to the comment above Doftype_coarsen_map_coarse for more details.
Referenced by oomph::BlockPreconditioner< MATRIX >::doftype_coarsen_map_fine(), oomph::BlockPreconditioner< MATRIX >::get_fine_grain_dof_types_in(), and oomph::BlockPreconditioner< MATRIX >::nfine_grain_dof_types_in().
|
private |
The map between the dof types in this preconditioner and the master preconditioner. If there is no master preconditioner, it remains empty. This is the version for which the master preconditioner expects. The dof types in here may or may not be coarsened in the preconditioner above this one.
|
private |
The map between the dof types in this preconditioner and the master preconditioner. If there is no master preconditioner it remains empty. This list contains the mapping for the underlying dof types.
Referenced by oomph::BlockPreconditioner< MATRIX >::internal_dof_number(), and oomph::BlockPreconditioner< MATRIX >::internal_master_dof_number().
|
private |
Vectors of vectors for the mapping from block number and block row to global row number. Empty if this preconditioner has a master preconditioner as this information is obtain from the master preconditioner.
Referenced by oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base().
|
private |
This was uncommented Presumably a non-distributed analogue of Index_in_dof_block_sparse.
Referenced by oomph::BlockPreconditioner< MATRIX >::internal_index_in_dof(), and oomph::BlockPreconditioner< MATRIX >::post_block_matrix_assembly_partial_clear().
|
protected |
Storage for the default distribution for each internal block.
Referenced by oomph::BlockPreconditioner< MATRIX >::BlockPreconditioner(), oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), oomph::BlockPreconditioner< MATRIX >::document(), oomph::BlockPreconditioner< MATRIX >::dof_block_distribution_pt(), oomph::BlockPreconditioner< MATRIX >::get_block(), oomph::BlockPreconditioner< MATRIX >::internal_block_dimension(), and oomph::BlockPreconditioner< MATRIX >::internal_block_distribution_pt().
|
protected |
Number of different block types in this preconditioner. Note that this information is maintained if used as a subsidiary or stand-alone block preconditioner, in the latter case it stores the number of blocks within the subsidiary preconditioner.
Referenced by oomph::BlockPreconditioner< MATRIX >::BlockPreconditioner(), oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), oomph::BlockPreconditioner< MATRIX >::document(), and oomph::BlockPreconditioner< MATRIX >::internal_nblock_types().
|
protected |
Number of different DOF types in this preconditioner. Note that this information is maintained if used as a subsidiary or stand-alone block preconditioner, in the latter case it stores the number of dofs within the subsidiary preconditioner.
Referenced by oomph::BlockPreconditioner< MATRIX >::BlockPreconditioner(), oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), oomph::BlockPreconditioner< MATRIX >::document(), and oomph::BlockPreconditioner< MATRIX >::internal_ndof_types().
|
private |
The distribution of the (internal) preconditioner matrix. This is formed by concatenating the distribution of the internal blocks. This is obsolete code, maintained for backwards compatibility. Below is the old comment:
Referenced by oomph::BlockPreconditioner< MATRIX >::BlockPreconditioner(), oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), and oomph::BlockPreconditioner< MATRIX >::internal_preconditioner_matrix_distribution_pt().
|
private |
If the block preconditioner is acting a subsidiary block preconditioner then a pointer to the master preconditioner is stored here. If the preconditioner does not have a master block preconditioner then this pointer remains null.
Referenced by oomph::BlockPreconditioner< MATRIX >::BlockPreconditioner(), oomph::BlockPreconditioner< MATRIX >::internal_dof_block_dimension(), oomph::BlockPreconditioner< MATRIX >::internal_dof_number(), oomph::BlockPreconditioner< MATRIX >::internal_index_in_dof(), oomph::BlockPreconditioner< MATRIX >::is_master_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::is_subsidiary_block_preconditioner(), oomph::BlockPreconditioner< MATRIX >::master_block_preconditioner_pt(), oomph::BlockPreconditioner< MATRIX >::master_distribution_pt(), and oomph::BlockPreconditioner< MATRIX >::master_nrow().
|
protected |
Vector of pointers to the meshes containing the elements used in the block preconditioner. Const pointers to prevent modification of the mesh by the preconditioner (this could be relaxed if needed). If this is a subsidiary preconditioner, then the information is looked up in the master preconditioner.
Referenced by oomph::BlockPreconditioner< MATRIX >::mesh_pt(), oomph::BlockPreconditioner< MATRIX >::ndof_types(), oomph::BlockPreconditioner< MATRIX >::nmesh(), oomph::BlockPreconditioner< MATRIX >::set_mesh(), and oomph::BlockPreconditioner< MATRIX >::set_nmesh().
|
private |
Number of types of degree of freedom associated with each block.
Referenced by oomph::BlockPreconditioner< MATRIX >::post_block_matrix_assembly_partial_clear().
|
protected |
Storage for number of types of degree of freedom of the elements in each mesh.
Referenced by oomph::BlockPreconditioner< MATRIX >::ndof_types_in_mesh().
|
private |
Number of DOFs (# of rows or columns in the matrix) in this preconditioner. Note that this information is maintained if used as a subsidiary or stand-alone block preconditioner, in the latter case it stores the number of rows within the subsidiary preconditioner.
Referenced by oomph::BlockPreconditioner< MATRIX >::BlockPreconditioner(), oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), and oomph::BlockPreconditioner< MATRIX >::master_nrow().
|
private |
String giving the base of the files to write block data into. If empty then do not output blocks. Default is empty.
Referenced by oomph::BlockPreconditioner< MATRIX >::block_output_on(), oomph::BlockPreconditioner< MATRIX >::disable_block_output_to_files(), and oomph::BlockPreconditioner< MATRIX >::set_block_output_to_files().
|
private |
The distribution of the preconditioner matrix. This is the concatenation of the block distribution.
Referenced by oomph::BlockPreconditioner< MATRIX >::BlockPreconditioner(), oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), and oomph::BlockPreconditioner< MATRIX >::preconditioner_matrix_distribution_pt().
|
private |
Debugging variable. Set true or false via the access functions turn_on_recursive_debug_flag(...) turn_off_recursive_debug_flag(...) These will turn on/off the debug flag up the hierarchy.
Referenced by oomph::BlockPreconditioner< MATRIX >::BlockPreconditioner(), oomph::BlockPreconditioner< MATRIX >::turn_off_recursive_debug_flag(), and oomph::BlockPreconditioner< MATRIX >::turn_on_recursive_debug_flag().
|
protected |
The replacement dof-level blocks.
Referenced by oomph::BlockPreconditioner< MATRIX >::clear_block_preconditioner_base(), oomph::BlockPreconditioner< MATRIX >::get_block(), oomph::BlockPreconditioner< MATRIX >::replacement_dof_block_pt(), and oomph::BlockPreconditioner< MATRIX >::set_replacement_dof_block().
|
staticprivate |
Static boolean to allow block_matrix_test(...) to be run. Defaults to false.