Flow123d
JS_before_hm-1788-g649f0a9d1
|
Go to the documentation of this file.
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>
34 #ifdef FLOW123D_HAVE_BDDCML
36 #include <bddcml_interface_c.h>
43 namespace ublas = boost::numeric::ublas;
47 template<
typename DOFHOLDER,
typename MAPTYPE >
50 unsigned globalIndex = np -> giveId( );
52 typename MAPTYPE::iterator pos =
map.find( globalIndex );
54 "Cannot remap node index %d to local indices. \n ", globalIndex );
55 int localIndexInt = pos -> second;
108 const unsigned numDofsSub,
117 void loadRawMesh(
const int nDim,
const int numNodes,
126 const int meshDim = 0 );
157 void fixDOF(
const unsigned index,
const double scalar = 1. );
172 int verboseLevel = 0,
179 bool use_adaptive =
false
218 { std::fill(
sol_.begin( ),
sol_.end( ), 0. );
237 template<
typename VEC1,
typename VEC2>
238 void giveSolution(
const VEC1 & dofIndices, VEC2 & result )
const;
304 template<
typename VEC1,
typename VEC2>
306 VEC2 & result )
const
309 typename VEC1::const_iterator dofIter = dofIndices.begin();
310 typename VEC1::const_iterator dofEnd = dofIndices.end();
311 typename VEC2::iterator valIter = result.begin();
312 for ( ; dofIter != dofEnd; ++dofIter ) {
317 "Cannot remap index %d to local indices in solution distribution. \n ", *dofIter );
318 unsigned indLoc = pos -> second;
321 *valIter++ =
sol_[ indLoc ];
void insertToDiagonalWeights(const int &index, const double &value)
std::vector< double > sol_
distributed solution vector
~BddcmlWrapper()
Destructor frees the BDDCML structures.
ublas::matrix< double > SubMat_
std::vector< double > fixv_
values of fixed boundary conditions at places of ifix_ - values outside fixed dofs are ignored
bool isDiagAssembled_
true if diagonal is assembled
void destroyRhs()
Destroy RHS.
void insertToRhs(const SubVec_ &eForce, const VecUint_ &dofIndices)
insert subvector to system rhs vector
const int numDofs_
number of total dofs
std::map< unsigned, unsigned > Global2LocalMap_
std::vector< double > rhsVec_
vector with RHS values restricted to subdomain, i.e. values are repeated at shared nodes
static constexpr bool value
@ SYMMETRICGENERAL
general symmetric ( e.g. saddle point ),
int getLocalNumber(DOFHOLDER *np, MAPTYPE &map)
void finishAssembly()
Compatibility call which does absolutely nothing.
int numNodesSub_
number of nodes in subdomain
void clearMatrix()
Fill matrix with zeros.
std::vector< double > element_data_
array with data on elements, here used for permeability for each element
double normRhs()
Get norm of right-hand side.
std::vector< int > isvgvn_
Indices of Subdomain Variables in Global Variable Numbering ( i.e. dof mapping )
std::ostream & write(std::ostream &out)
debug-output
std::vector< int > ifix_
indices of fixed boundary conditions - ( 0 for free variable, 1 for constrained dof )
double normSol_
norm of the global solution
void applyConstraints(ConstraintVec_ &constraints, const double factor, const double scalar)
void clearBC()
Blank arrays for boundary conditions.
void destroySol()
Destroy solution.
int numElem_
total number of elements
bool isMatAssembled_
true if matrix is assembled
std::vector< int > isngn_
Indices of Subdomain Nodes in Global Numbering.
Multilevel BDDC based linear system solver.
IndexType nnz() const
Return number of non-zeros.
double giveCondNumber()
Give estimate of condition number.
std::vector< int > isegn_
Indices of Subdomain Elements in Global Numbering.
enum matrixTypeEnum MatrixType
void fixDOF(const unsigned index, const double scalar=1.)
void prepareMatAssembly(unsigned numElements, unsigned elMatSize)
Prepare assembly of matrix - reserve space in underlying coordinate matrix object.
@ SPD_VIA_SYMMETRICGENERAL
const int numDofsSub_
number of subdomain dofs
int numIter_
required number of iterations
void clearSol()
Fill solution with zeros.
const MatrixType matrixType_
type of matrix
void finishDiagAssembly()
Finalize assembly of diagonal.
std::vector< double > xyz_
@ GENERAL
general (default),
void clear()
destroy all contents
void solveSystem(double tol=1.e-7, int numLevels=2, std::vector< int > *numSubAtLevels=NULL, int verboseLevel=0, int maxIt=1000, int ndecrMax=30, bool use_adaptive=false)
Solve the system.
void finishMatAssembly()
Finalize assembly of matrix.
void clearRhs()
Fill RHS with zeros.
std::vector< std::pair< unsigned, double > > ConstraintVec_
int rank_
ID of processors in communicator.
std::vector< unsigned > VecUint_
void destroyMatrix()
Destroy matrix.
void prepareAssembly(const IndexType length)
Global macros to enhance readability and debugging, general constants.
BddcmlWrapper(const unsigned numDofs, const unsigned numDofsSub, const MatrixType matrixType=GENERAL, const MPI_Comm comm=MPI_COMM_WORLD, int numSubLoc=1)
void destroyBC()
Destroy boundary conditions.
la::MatrixCoo< int, double > diagWeightsCoo_
diagonal of subdomain matrix in sparse format and global numbers
int nProc_
number of processors in communicator
void loadRawMesh(const int nDim, const int numNodes, 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_data, const int meshDim=0)
Load raw data about mesh.
int giveNumIterations()
Give number of iteration.
int numSubLoc_
number of subdomains on process
void writeMatrix(std::ostream &out)
Outputs.
la::MatrixCoo< int, double > coo_
matrix in coordinate format (COO)
int numNodes_
total number of nodes
double normRhs_
norm of the global right-hand side
const MPI_Comm comm_
communicator
int meshDim_
mesh dimension, may differ from space dimension - e.g. 2 for shells in 3D
void insertToMatrix(const SubMat_ &eStiff, const VecUint_ &rowIndices, const VecUint_ &colIndices)
insert submatrix to system matrix - into coordinate matrix object
void giveSolution(const VEC1 &dofIndices, VEC2 &result) const
Give access to the solution vector.
int giveConvergedReason()
Give reason of convergence.
int numElemSub_
number of elements in subdomain
@ SPD
symmetric positive definite,
double normSol()
Get norm of solution.
std::vector< int > inet_
safety state variable to warn if solver is called without loading subdomain mesh
Global2LocalMap_ global2LocalDofMap_
type for storage of global to local map
ublas::vector< double > SubVec_