27#ifndef OOMPH_BLOCK_PRECONDITION_HEADER
28#define OOMPH_BLOCK_PRECONDITION_HEADER
33#include <oomph-lib-config.h>
134 this->
build(0, 0,
false);
150 err_msg <<
"Trying to construct a BlockSelector object with:\n"
151 <<
"replacement_block_pt != 0 and wanted == false"
152 <<
"If you require the block, please set wanted == true.\n";
174 warning_msg <<
"Warning: BlockSelector destructor is called but...\n"
175 <<
"replacement_block_pt() is not null.\n"
176 <<
"Please remember to null this via the function\n"
177 <<
"BlockSelector::null_replacement_block_pt()\n"
197 err_msg <<
"Trying to select block with:\n"
198 <<
"replacement_block_pt != 0 and wanted == false"
199 <<
"If you require the block, please set wanted == true.\n"
224 warning_msg <<
"Trying to set Wanted = false, but replacement_block_pt "
226 <<
"Please call null_replacement_block_pt()\n"
227 <<
"(remember to free memory if necessary)\n"
253 err_msg <<
"Trying to set replacement_block_pt, but Wanted == false.\n"
254 <<
"Please call want_block()\n"
313 <<
"Replacement_block_pt = ";
344 <<
"Trying to set replacement_block_pt, but Wanted == false.\n"
345 <<
"Please either not set the replacement_block_pt or call the "
347 <<
"do_not_want_block()\n"
420 template<
typename MATRIX>
533 error_msg <<
"Matrix is not correct type.";
685 err_msg <<
"Requested block(" <<
i <<
"," <<
j <<
")"
688 <<
"Maybe your argument to block_setup(...) is incorrect?"
1144 if (para_selected_block_nrow == 0)
1147 error_msg <<
"selected_block has nrow = 0.\n";
1162 <<
"but there are only " <<
para_nblocks <<
" block types.\n";
1188 <<
"But the row index for the first column is "
1215 <<
"But the col index for the first row is "
1243 <<
" nblock_types().\n";
1262 <<
" nblock_types().\n";
1326 <<
block_j <<
") is not built.\n";
1345 <<
"does not match the distribution from the block_pt() "
1391 <<
"But the corresponding block_distribution_pt("
1677 <<
"The Block_to_dof_map_coarse vector is not setup for \n"
1678 <<
"this block preconditioner.\n\n"
1680 <<
"This vector is always set up within block_setup(...).\n"
1681 <<
"If block_setup() is already called, then perhaps there is\n"
1682 <<
"something wrong with your block preconditionable elements.\n"
1704 err_msg <<
"No meshes have been set for this block preconditioner!\n"
1705 <<
"Set one with set_nmesh(...), set_mesh(...)" << std::endl;
1708 for (
unsigned m = 0;
m <
n;
m++)
1712 err_msg <<
"The mesh pointer to mesh " <<
m <<
" is null!\n"
1713 <<
"Set a non-null one with set_mesh(...)" << std::endl;
1738 <<
"The Doftype_coarsen_map_coarse vector is not setup for \n"
1739 <<
"this SUBSIDIARY block preconditioner.\n\n"
1741 <<
"For SUBSIDARY block preconditioners at any level, this\n"
1742 <<
"vector is set up in the function \n"
1743 <<
"turn_into_subsidiary_block_preconditioner(...).\n\n"
1745 <<
"Being a SUBSIDIARY block preconditioner means that \n"
1746 <<
"(Master_block_preconditioner_pt == 0) is true.\n"
1747 <<
"The Master_block_preconditioner_pt MUST be set in the "
1749 <<
"turn_into_subsidiary_block_preconditioner(...).\n\n"
1751 <<
"Somewhere, the Master_block_preconditioner_pt pointer is\n"
1752 <<
"set but not by the function\n"
1753 <<
"turn_into_subsidiary_block_preconditioner(...).\n"
1788 error_msg <<
"The mesh_pt() function should not be called on a\n"
1789 <<
"subsidiary block preconditioner." << std::endl;
1904 const unsigned& b)
const
1910 error_msg <<
"Block distributions are not set up.\n"
1911 <<
"Have you called block_setup(...)?\n"
1919 error_msg <<
"You requested the distribution for the block " << b
1922 <<
" block types.\n"
1939 error_msg <<
"Block distributions are not set up.\n"
1940 <<
"Have you called block_setup(...)?\n"
1948 error_msg <<
"You requested the distribution for the block " << b
1951 <<
" block types.\n"
1968 error_msg <<
"You requested the distribution for the dof block " << b
1970 <<
"But there are only " <<
ndof_types() <<
" DOF types.\n"
1984 error_msg <<
"Internal block distributions are not set up.\n"
1985 <<
"Have you called block_setup(...)?\n"
2002 error_msg <<
"Dof block distributions are not set up.\n"
2003 <<
"Have you called block_setup(...)?\n"
2043 err_msg <<
"A subsidiary block preconditioner should not care about\n"
2044 <<
"anything to do with meshes.";
2146 std::ostringstream error_message;
2147 error_message <<
"This block preconditioner does not have "
2148 <<
"a master preconditioner.";
2166 for (
unsigned b = 0; b <
nblock; b++)
2182 for (
unsigned p = 0;
p <
nc;
p++)
2186 for (
unsigned b = 0; b <
nr; b++)
2245 delete iter->second;
2272 oomph_info <<
"===========================================" << std::endl;
2273 oomph_info <<
"Block Preconditioner Documentation" << std::endl
2284 oomph_info <<
"Master DOF number " << d <<
" : "
2291 oomph_info <<
"Block " << b <<
" DOF types:";
2300 oomph_info <<
"Master block preconditioner distribution:" << std::endl;
2302 oomph_info <<
"Internal preconditioner matrix distribution:" << std::endl;
2305 oomph_info <<
"Preconditioner matrix distribution:" << std::endl;
2309 oomph_info <<
"Internal block " << b <<
" distribution:" << std::endl;
2314 oomph_info <<
"Block " << b <<
" distribution:" << std::endl;
2328 oomph_info <<
"===========================================" << std::endl;
2349 err_msg <<
"Trying to get the most fine grain dof types in dof type "
2351 <<
" number of dof types.\n";
2369 err_msg <<
"Trying to get the number of most fine grain dof types "
2370 <<
"in dof type " <<
i <<
",\n"
2372 <<
" number of dof types.\n";
2421 for (
unsigned b = 0; b <
nblock; b++)
2529 <<
"(Internal_nblock_types == 0) is true. \n"
2530 <<
"Did you remember to call the function block_setup(...)?\n\n"
2532 <<
"This variable is always set up within block_setup(...).\n"
2533 <<
"If block_setup() is already called, then perhaps there is\n"
2534 <<
"something wrong with your block preconditionable elements.\n"
2544 <<
"The number of internal block types and "
2545 <<
"internal dof types does not match... \n\n"
2546 <<
"Internally, the number of block types and the number of dof "
2547 <<
"types must be the same.\n"
2575 <<
"(Internal_ndof_types == 0) is true.\n"
2576 <<
"This means that the Master_block_preconditioner_pt pointer is\n"
2577 <<
"set but possibly not by the function\n"
2578 <<
"turn_into_subsidiary_block_preconditioner(...).\n\n"
2580 <<
"This goes against the block preconditioning framework "
2582 <<
"Many machinery relies on the look up lists set up by the \n"
2583 <<
"function turn_into_subsidiary_block_preconditioner(...) \n"
2584 <<
"between the parent and child block preconditioners.\n"
2597 for (
unsigned i = 0;
i <
nmesh();
i++)
2735 const unsigned& b)
const
2741 error_msg <<
"Internal block distributions are not set up.\n"
2742 <<
"Have you called block_setup(...)?\n"
2750 error_msg <<
"You requested the distribution for the internal block "
2753 <<
" block types.\n"
2781 err_msg <<
"Cannot insert into Auxiliary_block_distribution_pt\n"
2783 <<
"greater than " <<
nblocks <<
".\n";
2801 err_msg <<
"Cannot insert into Auxiliary_block_distribution_pt\n"
2802 <<
"because the first in the pair already exists.\n";
2826 template<
typename myType>
2829 const bool sorted =
false)
const
2834 std::lower_bound(
vec.begin(),
vec.end(),
val);
2875 err_msg <<
"The mesh pointer has space for " <<
nmesh() <<
" meshes.\n"
2876 <<
"Cannot store a mesh at entry " <<
i <<
"\n"
2877 <<
"Has set_nmesh(...) been called?";
2886 err_msg <<
"Tried to set the " <<
i
2887 <<
"-th mesh pointer, but it is null.";
2920 err_msg <<
"nblock_types() is 0, has block_setup(...) been called?\n";
2933 <<
") is outside of range:\n"
2959 <<
" but the pointer is NULL." << std::endl;
2969 <<
" is not built." << std::endl;
2985 err_msg <<
"The distribution of the replacement dof_block_pt\n"
2986 <<
"is different from the Dof_block_distribution_pt["
3001 err_msg <<
"Replacement dof block has ncol = "
3029 for (
unsigned i = 0,
n =
nmesh();
i <
n;
i++)
3031 if (
mesh_pt(
i)->is_mesh_distributed())
3070 std::ostringstream error_message;
3071 error_message <<
"Proc " <<
my_rank
3072 <<
": Requested internal_dof_number(...) for global DOF "
3074 <<
"cannot be found.\n";
3097 return static_cast<int>(
i);
3137 std::ostringstream error_message;
3138 error_message <<
"Requested internal_index_in_dof(...) for global DOF "
3140 <<
"cannot be found.\n";
3172 err_msg <<
"Trying to get internal block dimension for \n"
3173 <<
"internal block " << b <<
".\n"
3175 <<
" internal dof types.\n";
3194 err_msg <<
"Trying to get internal dof block dimension for \n"
3195 <<
"internal dof block " <<
i <<
".\n"
3197 <<
" internal dof types.\n";
Block Preconditioner base class. The block structure of the overall problem is determined from the Me...
Vector< Vector< unsigned > > Doftype_coarsen_map_coarse
Mapping for dof types within THIS precondition. This is usually passed down from the parent precondit...
Vector< unsigned > Nrows_to_recv_for_get_ordered
The number of preconditioner rows to be received from processor p for get_block_ordered_....
void internal_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 natu...
BlockPreconditioner(const BlockPreconditioner &)=delete
Broken copy constructor.
Vector< unsigned > Index_in_dof_block_sparse
Vector to store the mapping from the global DOF number to the index (row/column number) within its bl...
unsigned Internal_nblock_types
Number of different block types in this preconditioner. Note that this information is maintained if u...
Vector< unsigned > Index_in_dof_block_dense
This was uncommented Presumably a non-distributed analogue of Index_in_dof_block_sparse.
bool block_output_on() const
Test if output of blocks is on or not.
void turn_on_recursive_debug_flag()
Toggles on the recursive debug flag. The change goes up the block preconditioning hierarchy.
Vector< Vector< unsigned > > doftype_coarsen_map_fine() const
Access function for the Doftype_coarsen_map_fine variable.
unsigned nmesh() const
Return the number of meshes in Mesh_pt.
void 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 natu...
unsigned internal_index_in_dof(const unsigned &i_dof) const
Return the row/column number of global unknown i_dof within it's block.
const LinearAlgebraDistribution * preconditioner_matrix_distribution_pt() const
Access function to the preconditioner matrix distribution pointer. This is the concatenation of the b...
DenseMatrix< unsigned > Nrows_to_send_for_get_block
The number of global rows to be sent of block b to processor p (matrix indexed [b][p]).
Vector< LinearAlgebraDistribution * > Dof_block_distribution_pt
Storage for the default distribution for each dof block at this level.
void turn_on_debug_flag()
Toggles on the debug flag.
Vector< Vector< unsigned > > Block_to_dof_map_fine
Mapping for the block types to the most fine grain dof types.
void document()
debugging method to document the setup. Should only be called after block_setup(.....
const Mesh * mesh_pt(const unsigned &i) const
Access to i-th mesh (of the various meshes that contain block preconditionable elements of the same n...
void 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 or...
Vector< unsigned > Doftype_in_master_preconditioner_coarse
The map between the dof types in this preconditioner and the master preconditioner....
Vector< unsigned > Allow_multiple_element_type_in_mesh
Vector of unsigned to indicate which meshes contain multiple element types.
void 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 ...
Vector< unsigned > Dof_number_dense
Vector to store the mapping from the global DOF number to its block. Empty if this preconditioner has...
DenseMatrix< int * > Rows_to_recv_for_get_block
The block rows to be received from processor p for block b (matrix indexed [b][p]).
Vector< LinearAlgebraDistribution * > Internal_block_distribution_pt
Storage for the default distribution for each internal block.
unsigned Internal_ndof_types
Number of different DOF types in this preconditioner. Note that this information is maintained if use...
unsigned master_nrow() const
Return the number of dofs (number of rows or columns) in the overall problem. The prefix "master_" is...
LinearAlgebraDistribution * block_distribution_pt(const unsigned b)
Access function to the block distributions (non-const version).
Vector< unsigned > Ndof_types_in_mesh
Storage for number of types of degree of freedom of the elements in each mesh.
unsigned ndof_types_in_mesh(const unsigned &i) const
Return the number of DOF types in mesh i. WARNING: This should only be used by the upper-most master ...
void disable_block_output_to_files()
Turn off output of blocks (by clearing the basefilename string).
void turn_off_debug_flag()
Toggles off the debug flag.
Vector< int * > Rows_to_send_for_get_ordered
The global rows to be sent to processor p for get_block_ordered_... type methods.
unsigned Nrow
Number of DOFs (# of rows or columns in the matrix) in this preconditioner. Note that this informatio...
MATRIX get_block(const unsigned &i, const unsigned &j, const bool &ignore_replacement_block=false) const
Return block (i,j). If the optional argument ignore_replacement_block is true, then any blocks in Rep...
void block_matrix_test(const unsigned &i, const unsigned &j, const MATRIX *block_matrix_pt) const
Private helper function to check that every element in the block matrix (i,j) matches the correspondi...
unsigned internal_ndof_types() const
Return the number of internal dof types. This is the number of most fine grain dof types....
unsigned nfine_grain_dof_types_in(const unsigned &i) const
Access function for the number of most fine grain dof types in a (possibly coarsened) dof type.
MATRIX get_concatenated_block(const VectorMatrix< BlockSelector > &selected_block)
Returns a concatenation of the block matrices specified by the argument selected_block....
Vector< unsigned > Dof_dimension
Vector containing the size of each block, i.e. the number of global DOFs associated with it....
LinearAlgebraDistribution * Internal_preconditioner_matrix_distribution_pt
The distribution of the (internal) preconditioner matrix. This is formed by concatenating the distrib...
Vector< LinearAlgebraDistribution * > Block_distribution_pt
The distribution for the blocks.
Vector< unsigned > Dof_number_sparse
Vector to store the mapping from the global DOF number to its block (empty if this preconditioner has...
Vector< Vector< unsigned > > Block_number_to_dof_number_lookup
Vector of vectors to store the mapping from block number to the DOF number (each element could be a v...
void setup_matrix_vector_product(MatrixVectorProduct *matvec_prod_pt, CRDoubleMatrix *block_pt, const unsigned &block_col_index)
Setup matrix vector product. This is simply a wrapper around the other setup_matrix_vector_product fu...
void 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...
const LinearAlgebraDistribution * master_distribution_pt() const
Access function to the distribution of the master preconditioner. If this preconditioner does not hav...
Vector< int * > Rows_to_recv_for_get_ordered
The preconditioner rows to be received from processor p for get_block_ordered_... type methods.
void 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...
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 entries to the appropriate entries in the ...
static bool Run_block_matrix_test
Static boolean to allow block_matrix_test(...) to be run. Defaults to false.
bool any_mesh_distributed() const
Check if any of the meshes are distributed. This is equivalent to problem.distributed() and is used a...
void 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,...
unsigned internal_master_dof_number(const unsigned &b) const
Takes the block number within this preconditioner and returns the corresponding block number in the m...
void get_block(const unsigned &i, const unsigned &j, MATRIX &output_matrix, const bool &ignore_replacement_block=false) const
Put block (i,j) into output_matrix. This block accounts for any coarsening of dof types and any repla...
void set_master_matrix_pt(MATRIX *in_matrix_pt)
Set the matrix_pt in the upper-most master preconditioner.
BlockPreconditioner()
Constructor.
int index_in_block(const unsigned &i_dof) const
Given a global dof number, returns the index in the block it belongs to. This is the overall index,...
BlockPreconditioner< MATRIX > * Master_block_preconditioner_pt
If the block preconditioner is acting a subsidiary block preconditioner then a pointer to the master ...
void clear_block_preconditioner_base()
Clears all BlockPreconditioner data. Called by the destructor and the block_setup(....
virtual ~BlockPreconditioner()
Destructor.
Vector< Vector< unsigned > > Global_index
Vectors of vectors for the mapping from block number and block row to global row number....
unsigned internal_nblock_types() const
Return the number internal blocks. This should be the same as the number of internal dof types....
Vector< unsigned > get_fine_grain_dof_types_in(const unsigned &i) const
Returns the most fine grain dof types in a (possibly coarsened) dof type.
void get_block_vector(const unsigned &n, const DoubleVector &v, DoubleVector &b) const
Takes the naturally ordered vector, v and returns the n-th block vector, b. Here n is the block numbe...
BlockPreconditioner< MATRIX > * master_block_preconditioner_pt() const
Access function to the master block preconditioner pt.
bool is_master_block_preconditioner() const
Return true if this preconditioner is the master block preconditioner.
unsigned nblock_types() const
Return the number of block types.
Vector< unsigned > Ndof_in_block
Number of types of degree of freedom associated with each block.
Vector< const Mesh * > Mesh_pt
Vector of pointers to the meshes containing the elements used in the block preconditioner....
void set_replacement_dof_block(const unsigned &block_i, const unsigned &block_j, CRDoubleMatrix *replacement_dof_block_pt)
Set replacement dof-level blocks. Only dof-level blocks can be set. This is important due to how the ...
int block_number(const unsigned &i_dof) const
Return the block number corresponding to a global index i_dof.
void turn_off_recursive_debug_flag()
Toggles off the recursive debug flag. The change goes up the block preconditioning hierarchy.
void operator=(const BlockPreconditioner &)=delete
Broken assignment operator.
std::string Output_base_filename
String giving the base of the files to write block data into. If empty then do not output blocks....
const LinearAlgebraDistribution * internal_block_distribution_pt(const unsigned &b) const
Access function to the internal block distributions.
void 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 ...
DenseMatrix< unsigned > Nrows_to_recv_for_get_block
The number of block rows to be received from processor p for block b (matrix indexed [b][p]).
bool is_subsidiary_block_preconditioner() const
Return true if this preconditioner is a subsidiary preconditioner.
void insert_auxiliary_block_distribution(const Vector< unsigned > &block_vec_number, LinearAlgebraDistribution *dist_pt)
insert a Vector<unsigned> and LinearAlgebraDistribution* pair into Auxiliary_block_distribution_pt....
void get_block_other_matrix(const unsigned &i, const unsigned &j, MATRIX *in_matrix_pt, MATRIX &output_matrix)
Get a block from a different matrix using the blocking scheme that has already been set up.
Vector< Vector< unsigned > > Doftype_coarsen_map_fine
Mapping the dof types within this preconditioner. The values in here refers to the most grain dof typ...
void post_block_matrix_assembly_partial_clear()
A helper method to reduce the memory requirements of block preconditioners. Once the methods get_bloc...
const LinearAlgebraDistribution * internal_preconditioner_matrix_distribution_pt() const
access function to the internal preconditioner matrix distribution pt. preconditioner_matrix_distribu...
std::map< Vector< unsigned >, LinearAlgebraDistribution * > Auxiliary_block_distribution_pt
Stores any block-level distributions / concatenation of block-level distributions required....
void set_block_output_to_files(const std::string &basefilename)
Set the base part of the filename to output blocks to. If it is set then all blocks will be output at...
bool Debug_flag
Debugging variable. Set true or false via the access functions turn_on_debug_flag(....
unsigned ndof_types() const
Return the total number of DOF types.
void 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 "...
int internal_dof_number(const unsigned &i_dof) const
Return the number of the block associated with global unknown i_dof. If this preconditioner is a subs...
void 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....
unsigned internal_dof_block_dimension(const unsigned &i) const
Return the size of the dof "block" i, i.e. how many degrees of freedom are associated with it....
MapMatrix< unsigned, CRDoubleMatrix * > replacement_dof_block_pt() const
Access function to the replaced dof-level blocks.
DenseMatrix< int * > Rows_to_send_for_get_block
The global rows to be sent of block b to processor p (matrix indexed [b][p]).
unsigned internal_block_dimension(const unsigned &b) const
Return the number of degrees of freedom in block b. Note that if this preconditioner acts as a subsid...
int get_index_of_value(const Vector< myType > &vec, const myType val, const bool sorted=false) const
Get the index of first occurrence of value in a vector. If the element does not exist,...
void 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 th...
MapMatrix< unsigned, CRDoubleMatrix * > Replacement_dof_block_pt
The replacement dof-level blocks.
void 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 th...
LinearAlgebraDistribution * Preconditioner_matrix_distribution_pt
The distribution of the preconditioner matrix. This is the concatenation of the block distribution.
void setup_matrix_vector_product(MatrixVectorProduct *matvec_prod_pt, CRDoubleMatrix *block_pt, const Vector< unsigned > &block_col_indices)
Setup a matrix vector product. matvec_prod_pt is a pointer to the MatrixVectorProduct,...
void output_blocks_to_files(const std::string &basefilename, const unsigned &precision=8) const
Output all blocks to numbered files. Called at the end of get blocks if an output filename has been s...
Vector< Vector< unsigned > > Block_to_dof_map_coarse
Mapping for block types to dof types. These are the dof types the writer of the preconditioner expect...
void set_nmesh(const unsigned &n)
Specify the number of meshes required by this block preconditioner. Note: elements in different meshe...
Vector< unsigned > Nrows_to_send_for_get_ordered
The number global rows to be sent to processor p for get_block_ordered_... type methods.
Vector< unsigned > Dof_number_to_block_number_lookup
Vector to the mapping from DOF number to block number.
void internal_get_block_vector(const unsigned &n, const DoubleVector &v, DoubleVector &b) const
A helper function, takes the naturally ordered vector, v, and extracts the n-th block vector,...
bool Recursive_debug_flag
Debugging variable. Set true or false via the access functions turn_on_recursive_debug_flag(....
Vector< unsigned > Global_index_sparse
For global indices outside of the range this->first_row() to this->first_row()+this->nrow_local(),...
Vector< unsigned > Doftype_in_master_preconditioner_fine
The map between the dof types in this preconditioner and the master preconditioner....
MATRIX * matrix_pt() const
Access function to matrix_pt. If this is the master then cast the matrix pointer to MATRIX*,...
LinearAlgebraDistribution * dof_block_distribution_pt(const unsigned &b)
Access function to the dof-level block distributions.
int internal_block_number(const unsigned &i_dof) const
Return the block number corresponding to a global index i_dof. This returns the block number correspo...
const LinearAlgebraDistribution * block_distribution_pt(const unsigned &b) const
Access function to the block distributions (const version).
virtual void block_setup()
Determine the size of the matrix blocks and setup the lookup schemes relating the global degrees of f...
void get_concatenated_block_vector(const Vector< unsigned > &block_vec_number, const DoubleVector &v, DoubleVector &b)
Takes the naturally ordered vector and extracts the blocks indicated by the block number (the values)...
void set_mesh(const unsigned &i, const Mesh *const mesh_pt, const bool &allow_multiple_element_type_in_mesh=false)
Set the i-th mesh for this block preconditioner. Note: The method set_nmesh(...) must be called befor...
void 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....
void 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....
int internal_index_in_block(const unsigned &i_dof) const
Return the index in the block corresponding to a global block number i_dof. The index returned corres...
Data structure to store information about a certain "block" or sub-matrix from the overall matrix in ...
void null_replacement_block_pt()
Set Replacement_block_pt to null.
CRDoubleMatrix * replacement_block_pt() const
Returns Replacement_block_pt.
void do_not_want_block()
Indicate that we do not want the block (set Wanted to false).
void want_block()
Indicate that we require the block (set Wanted to true).
const unsigned & column_index() const
returns the column index.
friend std::ostream & operator<<(std::ostream &o_stream, const BlockSelector &block_selector)
Output function, outputs the Row_index, Column_index, Wanted and the address of the Replacement_block...
virtual ~BlockSelector()
Default destructor.
void build(const unsigned &row_index, const unsigned &column_index, const bool &wanted, CRDoubleMatrix *replacement_block_pt=0)
Build function, sets the Row_index, Column_index and Wanted variables. the Replacement_block_pt is on...
void select_block(const unsigned &row_index, const unsigned &column_index, const bool &wanted, CRDoubleMatrix *replacement_block_pt=0)
Select a block.
const unsigned & row_index() const
returns the row index.
BlockSelector(const unsigned &row_index, const unsigned &column_index, const bool &wanted, CRDoubleMatrix *replacement_block_pt=0)
Constructor, takes the row and column indices and a boolean indicating if the block is required or no...
const bool & wanted() const
returns whether the block is wanted or not.
BlockSelector()
Default constructor, initialise block index i, j to 0 and bool to false.
void set_column_index(const unsigned &column_index)
Set the column index.
void set_row_index(const unsigned &row_index)
Set the row index.
CRDoubleMatrix * Replacement_block_pt
Pointer to the block.
bool Wanted
Bool to indicate if we require this block.
unsigned Column_index
Column index of the block.
unsigned Row_index
Row index of the block.
void set_replacement_block_pt(CRDoubleMatrix *replacement_block_pt)
set Replacement_block_pt.
A class for compressed row matrices. This is a distributable object.
unsigned long nrow() const
Return the number of rows of the matrix.
unsigned long ncol() const
Return the number of columns of the matrix.
void resize(const unsigned long &n)
Resize to a square nxn matrix; any values already present will be transfered.
void clear_distribution()
clear the distribution of this distributable linear algebra object
unsigned nrow_local() const
access function for the num of local rows on this processor.
unsigned first_row() const
access function for the first row on this processor
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
A vector in the mathematical sense, initially developed for linear algebra type applications....
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
virtual unsigned ndof_types() const
The number of types of degrees of freedom in this element are sub-divided into.
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
unsigned first_row() const
access function for the first row on this processor. If not distributed then this is just zero.
unsigned nrow() const
access function to the number of global rows.
unsigned nrow_local() const
access function for the num of local rows on this processor. If no MPI then Nrow is returned.
Matrix vector product helper class - primarily a wrapper to Trilinos's Epetra matrix vector product m...
An OomphLibError object which should be thrown when an run-time error is encountered....
An OomphLibWarning object which should be created as a temporary object to issue a warning....
Preconditioner base class. Gives an interface to call all other preconditioners through and stores th...
virtual DoubleMatrixBase * matrix_pt() const
Get function for matrix pointer.
virtual const OomphCommunicator * comm_pt() const
Get function for comm pointer.
virtual void set_matrix_pt(DoubleMatrixBase *matrix_pt)
Set the matrix pointer.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
A slight extension to the standard template vector class so that we can include "graceful" array rang...
void deep_copy(const CRDoubleMatrix *const in_matrix_pt, CRDoubleMatrix &out_matrix)
Create a deep copy of the matrix pointed to by in_matrix_pt.
void concatenate_without_communication(const Vector< LinearAlgebraDistribution * > &row_distribution_pt, const Vector< LinearAlgebraDistribution * > &col_distribution_pt, const DenseMatrix< CRDoubleMatrix * > &matrix_pt, CRDoubleMatrix &result_matrix)
Concatenate CRDoubleMatrix matrices.
void concatenate(const Vector< LinearAlgebraDistribution * > &in_distribution_pt, LinearAlgebraDistribution &out_distribution)
Takes a vector of LinearAlgebraDistribution objects and concatenates them such that the nrow_local of...
std::string to_string(T object, unsigned float_precision=8)
Conversion function that should work for anything with operator<< defined (at least all basic types).
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...