Skip to content
Snippets Groups Projects
Commit 85a4bb90 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

ifdef HAVE_MPI to remove warnings

parent 45fb0c09
Branches
Tags
No related merge requests found
#ifdef HAVE_PETSC
#if defined(HAVE_PETSC)
#include <petsc.h>
#include <petscksp.h>
#include "linearSystemPETSc.h"
static void _try(int ierr)
{
CHKERRABORT(PETSC_COMM_WORLD, ierr);
......@@ -79,6 +79,7 @@ linearSystemPETSc<scalar>::~linearSystemPETSc()
template <class scalar>
void linearSystemPETSc<scalar>::_assembleMatrixIfNeeded()
{
#if defined(HAVE_MPI)
if (_comm == PETSC_COMM_WORLD){
if (Msg::GetCommSize() > 1){
int value = _valuesNotAssembled ? 1 : 0;
......@@ -89,7 +90,7 @@ void linearSystemPETSc<scalar>::_assembleMatrixIfNeeded()
}
}
}
#endif
if (_valuesNotAssembled) {
_try(MatAssemblyBegin(_a, MAT_FINAL_ASSEMBLY));
_try(MatAssemblyEnd(_a, MAT_FINAL_ASSEMBLY));
......@@ -179,7 +180,7 @@ void linearSystemPETSc<scalar>::allocate(int nbRows)
_try(MatSetFromOptions(_a));
//since PETSc 3.3 GetOwnershipRange and MatGetSize cannot be called before MatXXXSetPreallocation
_localSize = nbRows;
#ifdef HAVE_MPI
#if defined(HAVE_MPI)
if (commSize > 1){
_localRowStart = 0;
if (Msg::GetCommRank() != 0) {
......@@ -327,6 +328,7 @@ void linearSystemPETSc<scalar>::getFromSolution(int row, scalar &val) const
template <class scalar>
void linearSystemPETSc<scalar>::zeroMatrix()
{
#if defined(HAVE_MPI)
if (_comm == PETSC_COMM_WORLD){
if (Msg::GetCommSize() > 1){
int value = _entriesPreAllocated ? 1 : 0;
......@@ -337,6 +339,7 @@ void linearSystemPETSc<scalar>::zeroMatrix()
}
}
}
#endif
if (_isAllocated && _entriesPreAllocated) {
_assembleMatrixIfNeeded();
_try(MatZeroEntries(_a));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment