Skip to content
Snippets Groups Projects
Commit f80012cd authored by Tuomas Karna's avatar Tuomas Karna
Browse files

linearSystemPETSc sequential fix

parent 59dc36d3
No related branches found
No related tags found
No related merge requests found
...@@ -91,13 +91,17 @@ void linearSystemPETSc<fullMatrix<PetscScalar> >::allocate(int nbRows) ...@@ -91,13 +91,17 @@ void linearSystemPETSc<fullMatrix<PetscScalar> >::allocate(int nbRows)
//_try(PetscOptionsInsertString("-ksp_monitor_true_residual -ksp_rtol 1e-10")); //_try(PetscOptionsInsertString("-ksp_monitor_true_residual -ksp_rtol 1e-10"));
_try(MatCreate(PETSC_COMM_WORLD, &_a)); _try(MatCreate(PETSC_COMM_WORLD, &_a));
_try(MatSetSizes(_a,nbRows * _blockSize, nbRows * _blockSize, PETSC_DETERMINE, PETSC_DETERMINE)); _try(MatSetSizes(_a,nbRows * _blockSize, nbRows * _blockSize, PETSC_DETERMINE, PETSC_DETERMINE));
//_try(MatSetType(_a, MATSEQBAIJ)); if (Msg::GetCommSize() > 1) {
_try(MatSetType(_a, MATMPIBAIJ)); _try(MatSetType(_a, MATMPIBAIJ));
_try(MatSetFromOptions(_a));
_try(MatMPIBAIJSetPreallocation(_a, _blockSize, 5, NULL, 0, NULL));
} else {
_try(MatSetType(_a, MATSEQBAIJ));
_try(MatSetFromOptions(_a));
_try(MatSeqBAIJSetPreallocation(_a, _blockSize, 5, NULL)); //todo preAllocate off-diagonal part
}
// override the default options with the ones from the option // override the default options with the ones from the option
// database (if any) // database (if any)
_try(MatSetFromOptions(_a));
_try(MatMPIBAIJSetPreallocation(_a, _blockSize, 5, NULL, 0, NULL));
//_try(MatMPIBAIJSetPreallocation(_a, _blockSize, 4, NULL, 0, NULL)); //todo preAllocate off-diagonal part
_try(VecCreate(PETSC_COMM_WORLD, &_x)); _try(VecCreate(PETSC_COMM_WORLD, &_x));
_try(VecSetSizes(_x, nbRows * _blockSize, PETSC_DETERMINE)); _try(VecSetSizes(_x, nbRows * _blockSize, PETSC_DETERMINE));
// override the default options with the ones from the option // override the default options with the ones from the option
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment