44 namespace it = Input::Type;
50 "Maximum number of iterations of the linear solver with non-decreasing residual.")
52 "Number of levels in the multilevel method (=2 for the standard BDDC).")
54 "Use adaptive selection of constraints in BDDCML.")
56 "Level of verbosity of the BDDCML library: 0 - no output, 1 - mild output, 2 - detailed output.");
62 const int matrixTypeInt,
64 const bool swap_sign )
76 switch ( matrixTypeInt ) {
90 ASSERT(
true,
"Unknown matrix type %d", matrixTypeInt );
104 PetscInt numDofsSubInt =
static_cast<PetscInt
>( numDofsSub );
105 ierr = VecCreateSeq( PETSC_COMM_SELF, numDofsSubInt, &
locSolVec_ );
108 xprintf(
UsrErr,
"Compiled without support for BDDCML solver.\n");
109 #endif // HAVE_BDDCML
125 isngn_.resize(isngn.size());
126 std::copy( isngn.begin(), isngn.end(),
isngn_.begin() );
127 ASSERT( numDofs ==
size_,
"Global problem size mismatch!" );
129 bddcml_ -> loadRawMesh( nDim, numNodes, numDofs, inet, nnet, nndf, isegn, isngn, isvgvn, xyz, element_permeability, meshDim );
135 PetscInt numDofsSubInt =
static_cast<int>(
isngn_.size( ) );
141 ISLocalToGlobalMapping subdomainMapping;
142 ierr = ISLocalToGlobalMappingCreate(
comm_, numDofsSubInt, &(idx[0]), PETSC_COPY_VALUES, &subdomainMapping ); CHKERRV( ierr );
144 IS subdomainIndexSet;
146 ierr = ISCreateStride( PETSC_COMM_SELF, numDofsSubInt, 0, 1, &subdomainIndexSet );
147 ierr = ISLocalToGlobalMappingApplyIS( subdomainMapping, subdomainIndexSet, &from );
155 ierr = ISDestroy( &subdomainIndexSet ); CHKERRV( ierr );
156 ierr = ISDestroy( &from ); CHKERRV( ierr );
160 double * locSolVecArray;
161 ierr = VecGetArray(
locSolVec_, &locSolVecArray ); CHKERRV( ierr );
163 ierr = VecRestoreArray(
locSolVec_, &locSolVecArray ); CHKERRV( ierr );
168 #endif // HAVE_BDDCML
175 bddcml_ -> loadDiagonal( diag );
176 #endif // HAVE_BDDCML
182 namespace ublas = boost::numeric::ublas;
186 ublas::matrix< double > mat( nrow, ncol );
188 std::copy( &(rows[0]), &(rows[nrow]), myRows.begin() );
189 std::copy( &(cols[0]), &(cols[ncol]), myCols.begin() );
191 for (
unsigned i = 0; i < nrow; i++ ) {
192 for (
unsigned j = 0; j < ncol; j++ ) {
193 mat( i, j ) = vals[i*ncol + j];
200 bddcml_ -> insertToMatrix( mat, myRows, myCols );
201 #endif // HAVE_BDDCML
207 namespace ublas = boost::numeric::ublas;
210 ublas::vector< double > vec( nrow );
212 std::copy( &(rows[0]), &(rows[nrow]), myRows.begin() );
214 for (
unsigned i = 0; i < nrow; i++ ) {
221 bddcml_ -> insertToRhs( vec, myRows );
222 #endif // HAVE_BDDCML
228 bddcml_ -> finishMatAssembly( );
229 #endif // HAVE_BDDCML
236 #endif // HAVE_BDDCML
246 DBGMSG(
"BDDCML converged reason: %d ( 0 means OK ) \n",
bddcml_ -> giveConvergedReason() );
247 DBGMSG(
"BDDCML converged in %d iterations. \n",
bddcml_ -> giveNumIterations() );
248 DBGMSG(
"BDDCML estimated condition number is %f \n",
bddcml_ -> giveCondNumber() );
254 double * locSolVecArray;
256 ierr = VecGetArray(
locSolVec_, &locSolVecArray );
258 ierr = VecRestoreArray(
locSolVec_, &locSolVecArray );
267 return bddcml_ -> giveConvergedReason();
270 #endif // HAVE_BDDCML
280 #endif // HAVE_BDDCML
287 std::copy( globalSolution.begin(), globalSolution.end(),
globalSolution_.begin() );
288 #endif // HAVE_BDDCML
311 ierr = VecDestroy( &
locSolVec_ ); CHKERRV( ierr );
316 #endif // HAVE_BDDCML
335 for (
int i = 0; i <
isngn_.size(); i++ ) {
339 for (
int iProc = 1; iProc < nProc; iProc++ ) {
350 locSolutionNeib.resize( length );
354 for (
int i = 0; i < length; i++ ) {
362 int length =
isngn_.size();
369 #endif // HAVE_BDDCML