19 #ifndef la_bddcml_wrapper_h 20 #define la_bddcml_wrapper_h 22 #include <boost/numeric/ublas/matrix.hpp> 23 #include <boost/numeric/ublas/vector.hpp> 35 #include <bddcml_interface_c.h> 41 namespace ublas = boost::numeric::ublas;
45 template<
typename DOFHOLDER,
typename MAPTYPE >
48 unsigned globalIndex = np -> giveId( );
50 typename MAPTYPE::iterator pos = map.find( globalIndex );
52 "Cannot remap node index %d to local indices. \n ", globalIndex );
53 int localIndexInt = pos -> second;
87 SPD_VIA_SYMMETRICGENERAL
106 const unsigned numDofsSub,
107 const MatrixType matrixType = GENERAL,
115 void loadRawMesh(
const int nDim,
const int numNodes,
124 const int meshDim = 0 );
127 void prepareMatAssembly(
unsigned numElements,
unsigned elMatSize );
130 void insertToMatrix(
const SubMat_ & eStiff,
131 const VecUint_ & rowIndices,
132 const VecUint_ & colIndices );
135 void finishMatAssembly( );
138 void insertToRhs(
const SubVec_ & eForce,
const VecUint_ & dofIndices );
149 void applyConstraints( ConstraintVec_ & constraints,
const double factor,
const double scalar );
155 void fixDOF(
const unsigned index,
const double scalar = 1. );
161 void insertToDiagonalWeights(
const int & index,
const double &
value );
164 void finishDiagAssembly( );
167 void solveSystem(
double tol = 1.e-7,
170 int verboseLevel = 0,
177 bool use_adaptive =
false 198 unsigned length = coo_.nnz( );
200 coo_.prepareAssembly( length );
204 std::fill( rhsVec_.begin( ), rhsVec_.end( ), 0. );
210 std::fill( ifix_.begin(), ifix_.end(), 0 );
211 std::fill( fixv_.begin(), fixv_.end(), 0. );
216 { std::fill( sol_.begin( ), sol_.end( ), 0. );
235 template<
typename VEC1,
typename VEC2>
236 void giveSolution(
const VEC1 & dofIndices, VEC2 & result )
const;
301 #include "bddcml_wrapper.ipp" double giveCondNumber()
Give estimate of condition number.
void destroyRhs()
Destroy RHS.
double normSol()
Get norm of solution.
double normRhs()
Get norm of right-hand side.
std::vector< double > fixv_
values of fixed boundary conditions at places of ifix_ - values outside fixed dofs are ignored ...
int giveConvergedReason()
Give reason of convergence.
int numIter_
required number of iterations
int nProc_
number of processors in communicator
int rank_
ID of processors in communicator.
std::vector< int > inet_
safety state variable to warn if solver is called without loading subdomain mesh
std::vector< double > xyz_
int numNodes_
total number of nodes
void destroySol()
Destroy solution.
Global2LocalMap_ global2LocalDofMap_
type for storage of global to local map
enum matrixTypeEnum MatrixType
la::MatrixCoo< int, double > coo_
matrix in coordinate format (COO)
double normSol_
norm of the global solution
I/O functions with filename storing, able to track current line in opened file. All standard stdio fu...
const MatrixType matrixType_
type of matrix
static constexpr bool value
int numElem_
total number of elements
int numSubLoc_
number of subdomains on process
std::vector< double > sol_
distributed solution vector
Global macros to enhance readability and debugging, general constants.
std::vector< int > isvgvn_
Indices of Subdomain Variables in Global Variable Numbering ( i.e. dof mapping )
std::vector< int > isegn_
Indices of Subdomain Elements in Global Numbering.
int numElemSub_
number of elements in subdomain
void clearSol()
Fill solution with zeros.
int getLocalNumber(DOFHOLDER *np, MAPTYPE &map)
std::vector< double > rhsVec_
vector with RHS values restricted to subdomain, i.e. values are repeated at shared nodes ...
bool isMatAssembled_
true if matrix is assembled
std::vector< int > ifix_
indices of fixed boundary conditions - ( 0 for free variable, 1 for constrained dof ) ...
symmetric positive definite,
general symmetric ( e.g. saddle point ),
void clearMatrix()
Fill matrix with zeros.
bool isDiagAssembled_
true if diagonal is assembled
void destroyBC()
Destroy boundary conditions.
std::vector< int > isngn_
Indices of Subdomain Nodes in Global Numbering.
std::vector< unsigned > VecUint_
int meshDim_
mesh dimension, may differ from space dimension - e.g. 2 for shells in 3D
int numNodesSub_
number of nodes in subdomain
std::map< unsigned, unsigned > Global2LocalMap_
int giveNumIterations()
Give number of iteration.
const MPI_Comm comm_
communicator
ublas::vector< double > SubVec_
void clearRhs()
Fill RHS with zeros.
std::vector< double > element_data_
array with data on elements, here used for permeability for each element
void finishAssembly()
Compatibility call which does absolutely nothing.
la::MatrixCoo< int, double > diagWeightsCoo_
diagonal of subdomain matrix in sparse format and global numbers
void clearBC()
Blank arrays for boundary conditions.
void writeMatrix(std::ostream &out)
Outputs.
const int numDofsSub_
number of subdomain dofs
void destroyMatrix()
Destroy matrix.
Multilevel BDDC based linear system solver.
const int numDofs_
number of total dofs
ublas::matrix< double > SubMat_
double normRhs_
norm of the global right-hand side
std::vector< std::pair< unsigned, double > > ConstraintVec_