46 namespace it = Input::Type;
52 "Maximum number of iterations of the linear solver with non-decreasing residual.")
54 "Number of levels in the multilevel method (=2 for the standard BDDC).")
56 "Use adaptive selection of constraints in BDDCML.")
58 "Level of verbosity of the BDDCML library: 0 - no output, 1 - mild output, 2 - detailed output.");
64 const int matrixTypeInt,
66 const bool swap_sign )
75 switch ( matrixTypeInt ) {
90 ASSERT(
true,
"Unknown matrix type %d", matrixTypeInt );
104 PetscInt numDofsSubInt =
static_cast<PetscInt
>( numDofsSub );
109 xprintf(
UsrErr,
"Compiled without support for BDDCML solver.\n");
110 #endif // HAVE_BDDCML
126 isngn_.resize(isngn.size());
127 std::copy( isngn.begin(), isngn.end(),
isngn_.begin() );
128 ASSERT( numDofs ==
size_,
"Global problem size mismatch!" );
130 bddcml_ -> loadRawMesh( nDim, numNodes, numDofs, inet, nnet, nndf, isegn, isngn, isvgvn, xyz, element_permeability, meshDim );
136 PetscInt numDofsSubInt =
static_cast<int>(
isngn_.size( ) );
139 ISLocalToGlobalMapping subdomainMapping;
140 ierr = ISLocalToGlobalMappingCreate(
comm_, numDofsSubInt, &(idx[0]), PETSC_COPY_VALUES, &subdomainMapping ); CHKERRV( ierr );
142 IS subdomainIndexSet;
144 ierr = ISCreateStride( PETSC_COMM_SELF, numDofsSubInt, 0, 1, &subdomainIndexSet );
145 ierr = ISLocalToGlobalMappingApplyIS( subdomainMapping, subdomainIndexSet, &from );
150 ierr = ISDestroy( &subdomainIndexSet ); CHKERRV( ierr );
151 ierr = ISDestroy( &from ); CHKERRV( ierr );
161 #endif // HAVE_BDDCML
167 namespace ublas = boost::numeric::ublas;
171 ublas::matrix< double > mat( nrow, ncol );
173 std::copy( &(rows[0]), &(rows[nrow]), myRows.begin() );
174 std::copy( &(cols[0]), &(cols[ncol]), myCols.begin() );
176 for (
int i = 0; i < nrow; i++ ) {
177 for (
int j = 0; j < ncol; j++ ) {
178 mat( i, j ) = vals[i*ncol + j];
185 bddcml_ -> insertToMatrix( mat, myRows, myCols );
186 #endif // HAVE_BDDCML
192 namespace ublas = boost::numeric::ublas;
195 ublas::vector< double > vec( nrow );
197 std::copy( &(rows[0]), &(rows[nrow]), myRows.begin() );
199 for (
int i = 0; i < nrow; i++ ) {
206 bddcml_ -> insertToRhs( vec, myRows );
207 #endif // HAVE_BDDCML
213 bddcml_ -> insertToDiagonalWeights( global_index, value );
214 #endif // HAVE_BDDCML
221 #endif // HAVE_BDDCML
229 #endif // HAVE_BDDCML
236 bddcml_ -> finishMatAssembly( );
237 #endif // HAVE_BDDCML
244 #endif // HAVE_BDDCML
258 xprintf(
MsgLog,
"BDDCML converged reason: %d ( 0 means OK ) \n",
bddcml_ -> giveConvergedReason() );
268 double * locSolVecArray;
271 VecRestoreArray(
locSolVec_, &locSolVecArray );
280 return bddcml_ -> giveConvergedReason();
283 #endif // HAVE_BDDCML
307 ierr = VecDestroy( &
locSolVec_ ); CHKERRV( ierr );
312 #endif // HAVE_BDDCML
int bddcml_verbosity_level_
SetValuesMode status_
Set value status of the linear system.
double normRhs()
Get norm of right-hand side.
void mat_set_values(int nrow, int *rows, int ncol, int *cols, double *vals)
VecScatter VSpetscToSubScatter_
scatter from solution_ to locSolVec_
std::vector< int > isngn_
indices of subdomain nodes in global numbering
PetscErrorCode rhs_zero_entries() override
Wrappers for linear systems based on MPIAIJ and MATIS format.
ConstraintVec_ constraints_
enum matrixTypeEnum MatrixType
#define ADD_CALLS(n_calls)
Increase number of calls in actual timer.
unsigned size_
global number of matrix rows, i.e. problem size
void load_mesh(const int nDim, const int numNodes, const int numDofs, const std::vector< int > &inet, const std::vector< int > &nnet, const std::vector< int > &nndf, const std::vector< int > &isegn, const std::vector< int > &isngn, const std::vector< int > &isvgvn, const std::vector< double > &xyz, const std::vector< double > &element_permeability, const int meshDim)
void rhs_set_values(int nrow, int *rows, double *vals)
bool use_adaptive_bddc_
should adaptive BDDC be used?
static Input::Type::AbstractRecord input_type
Vec locSolVec_
local solution PETSc vector - sequential
#define START_TIMER(tag)
Starts a timer with specified tag.
int max_nondecr_it_
parameters expected from input file:
void diagonal_weights_set_value(int global_index, double value)
double residual_norm_
local solution array pointing into Vec solution_
const bool swap_sign_
swap sign of matrix and rhs entries, e.g. to make the matrix SPD
double get_solution_precision()
int number_of_levels_
number of levels in the multilevel method
la::BddcmlWrapper Bddcml_
symmetric positive definite,
general symmetric ( e.g. saddle point ),
static Input::Type::Record input_type
Bddcml_ * bddcml_
BDDCML wrapper.
PetscErrorCode mat_zero_entries() override
MPI_Comm get_comm() const
Returns communicator.
Abstract linear system class.
void apply_constrains(double scalar=1.)
std::vector< double > locSolution_
subdomain solution
LinSys_BDDC(const unsigned numDofsSub, const Distribution *rows_ds, const int matrixTypeInt=0, const int numSubLoc=1, const bool swap_sign=false)
void set_from_input(const Input::Record in_rec)
Vec solution_
PETSc vector constructed with vb array.
Solver based on Multilevel BDDC - using corresponding class of OpenFTL package.