41
41
#ifdef HAVE_PETSC_MODULES
43
#if PETSC_VERSION_MINOR==0
53
45
#include "petscversion.h"
54
46
#ifdef HAVE_PETSC_MODULES
55
#if PETSC_VERSION_MINOR==0
56
#include "finclude/petscvecdef.h"
57
#include "finclude/petscmatdef.h"
58
#include "finclude/petsckspdef.h"
59
#include "finclude/petscpcdef.h"
60
#include "finclude/petscviewerdef.h"
61
#include "finclude/petscisdef.h"
63
47
#include "finclude/petscdef.h"
66
49
#include "finclude/petsc.h"
67
#if PETSC_VERSION_MINOR==0
68
#include "finclude/petscvec.h"
69
#include "finclude/petscmat.h"
70
#include "finclude/petscksp.h"
71
#include "finclude/petscpc.h"
72
#include "finclude/petscviewer.h"
73
#include "finclude/petscis.h"
77
52
PetscReal, parameter, private :: dummy_petsc_real = 0.0
1467
1448
PetscErrorCode :: ierr
1468
1449
call PetscInitialize(PETSC_NULL_CHARACTER, ierr); CHKERRQ(ierr);
1469
1450
end subroutine Initialize_Petsc
1452
! In petsc-3.3 the MatCreate[B]{Seq|MPI}() routines have changed to MatCreate[B]Aij
1453
! and MatSetup always needs to be called
1454
#if PETSC_VERSION_MINOR>=3
1455
subroutine MatCreateSeqAIJ(MPI_Comm, nrows, ncols, &
1457
integer, intent(in):: MPI_Comm
1458
PetscInt, intent(in):: nrows, ncols, nz
1459
PetscInt, dimension(:), intent(in):: nnz
1460
Mat, intent(out):: M
1461
PetscErrorCode, intent(out):: ierr
1463
call MatCreateAij(MPI_Comm, nrows, ncols, nrows, ncols, &
1464
nz, nnz, 0, PETSC_NULL_INTEGER, M, ierr)
1465
call MatSetup(M, ierr)
1467
end subroutine MatCreateSeqAIJ
1469
subroutine MatCreateMPIAIJ(MPI_Comm, nprows, npcols, &
1471
dnz, dnnz, onz, onnz, M, ierr)
1472
integer, intent(in):: MPI_Comm
1473
PetscInt, intent(in):: nprows, npcols,nrows, ncols, dnz, onz
1474
PetscInt, dimension(:), intent(in):: dnnz, onnz
1475
Mat, intent(out):: M
1476
PetscErrorCode, intent(out):: ierr
1478
call MatCreateAij(MPI_Comm, nprows, npcols, nrows, ncols, &
1479
dnz, dnnz, onz, onnz, M, ierr)
1480
call MatSetup(M, ierr)
1482
end subroutine MatCreateMPIAIJ
1484
subroutine MatCreateSeqBAIJ(MPI_Comm, bs, nrows, ncols, &
1486
integer, intent(in):: MPI_Comm
1487
PetscInt, intent(in):: bs, nrows, ncols, nz
1488
PetscInt, dimension(:), intent(in):: nnz
1489
Mat, intent(out):: M
1490
PetscErrorCode, intent(out):: ierr
1492
call MatCreateBAij(MPI_Comm, bs, nrows, ncols, nrows, ncols, &
1493
nz, nnz, 0, PETSC_NULL_INTEGER, M, ierr)
1494
call MatSetup(M, ierr)
1496
end subroutine MatCreateSeqBAIJ
1498
subroutine MatCreateMPIBAIJ(MPI_Comm, bs, nprows, npcols, &
1500
dnz, dnnz, onz, onnz, M, ierr)
1501
integer, intent(in):: MPI_Comm
1502
PetscInt, intent(in):: bs, nprows, npcols,nrows, ncols, dnz, onz
1503
PetscInt, dimension(:), intent(in):: dnnz, onnz
1504
Mat, intent(out):: M
1505
PetscErrorCode, intent(out):: ierr
1507
call MatCreateBAij(MPI_Comm, bs, nprows, npcols, nrows, ncols, &
1508
dnz, dnnz, onz, onnz, M, ierr)
1509
call MatSetup(M, ierr)
1511
end subroutine MatCreateMPIBAIJ
1471
1514
#include "Reference_count_petsc_numbering_type.F90"
1472
1515
end module Petsc_Tools