45 namespace it = Input::Type;
51 "Maximum number of iterations of the linear solver with non-decreasing residual.")
53 "Number of levels in the multilevel method (=2 for the standard BDDC).")
55 "Use adaptive selection of constraints in BDDCML.")
57 "Level of verbosity of the BDDCML library: 0 - no output, 1 - mild output, 2 - detailed output.");
63 const int matrixTypeInt,
65 const bool swap_sign )
77 switch ( matrixTypeInt ) {
91 ASSERT(
true,
"Unknown matrix type %d", matrixTypeInt );
105 PetscInt numDofsSubInt =
static_cast<PetscInt
>( numDofsSub );
106 ierr = VecCreateSeq( PETSC_COMM_SELF, numDofsSubInt, &
locSolVec_ );
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( ) );
142 ISLocalToGlobalMapping subdomainMapping;
143 ierr = ISLocalToGlobalMappingCreate(
comm_, numDofsSubInt, &(idx[0]), PETSC_COPY_VALUES, &subdomainMapping ); CHKERRV( ierr );
145 IS subdomainIndexSet;
147 ierr = ISCreateStride( PETSC_COMM_SELF, numDofsSubInt, 0, 1, &subdomainIndexSet );
148 ierr = ISLocalToGlobalMappingApplyIS( subdomainMapping, subdomainIndexSet, &from );
156 ierr = ISDestroy( &subdomainIndexSet ); CHKERRV( ierr );
157 ierr = ISDestroy( &from ); CHKERRV( ierr );
161 double * locSolVecArray;
162 ierr = VecGetArray(
locSolVec_, &locSolVecArray ); CHKERRV( ierr );
164 ierr = VecRestoreArray(
locSolVec_, &locSolVecArray ); CHKERRV( ierr );
169 #endif // HAVE_BDDCML
175 namespace ublas = boost::numeric::ublas;
179 ublas::matrix< double > mat( nrow, ncol );
181 std::copy( &(rows[0]), &(rows[nrow]), myRows.begin() );
182 std::copy( &(cols[0]), &(cols[ncol]), myCols.begin() );
184 for (
unsigned i = 0; i < nrow; i++ ) {
185 for (
unsigned j = 0; j < ncol; j++ ) {
186 mat( i, j ) = vals[i*ncol + j];
193 bddcml_ -> insertToMatrix( mat, myRows, myCols );
194 #endif // HAVE_BDDCML
200 namespace ublas = boost::numeric::ublas;
203 ublas::vector< double > vec( nrow );
205 std::copy( &(rows[0]), &(rows[nrow]), myRows.begin() );
207 for (
unsigned i = 0; i < nrow; i++ ) {
214 bddcml_ -> insertToRhs( vec, myRows );
215 #endif // HAVE_BDDCML
221 bddcml_ -> insertToDiagonalWeights( global_index, value );
222 #endif // HAVE_BDDCML
229 #endif // HAVE_BDDCML
236 #endif // HAVE_BDDCML
242 bddcml_ -> finishMatAssembly( );
243 #endif // HAVE_BDDCML
250 #endif // HAVE_BDDCML
260 DBGMSG(
"BDDCML converged reason: %d ( 0 means OK ) \n",
bddcml_ -> giveConvergedReason() );
261 DBGMSG(
"BDDCML converged in %d iterations. \n",
bddcml_ -> giveNumIterations() );
262 DBGMSG(
"BDDCML estimated condition number is %f \n",
bddcml_ -> giveCondNumber() );
268 double * locSolVecArray;
270 ierr = VecGetArray(
locSolVec_, &locSolVecArray );
272 ierr = VecRestoreArray(
locSolVec_, &locSolVecArray );
281 return bddcml_ -> giveConvergedReason();
284 #endif // HAVE_BDDCML
294 #endif // HAVE_BDDCML
301 std::copy( globalSolution.begin(), globalSolution.end(),
globalSolution_.begin() );
302 #endif // HAVE_BDDCML
325 ierr = VecDestroy( &
locSolVec_ ); CHKERRV( ierr );
330 #endif // HAVE_BDDCML
349 for (
int i = 0; i <
isngn_.size(); i++ ) {
353 for (
int iProc = 1; iProc < nProc; iProc++ ) {
364 locSolutionNeib.resize( length );
368 for (
int i = 0; i < length; i++ ) {
376 int length =
isngn_.size();
383 #endif // HAVE_BDDCML