I tried to use ISColoringValue, but when I include
IScoloringValue colors
into my code, I get an error message from the compiler(gfortran):
ISColoringValue colors
1
error: unclassifiable statement at (1)
I'm including these header files, am I missing one?
#include <finclude/petscsys.h>
#include <finclude/petscvec.h>
#include <finclude/petscdmda.h>
#include <finclude/petscis.h>
#include <finclude/petscmat.h>
#include <finclude/petscksp.h>
#include <finclude/petscpc.h>
#include <finclude/petscsnes.h>
#include <finclude/petscvec.h90>
#include <finclude/petscdmda.h90>
Thank you for your fast responses!
Am 15.05.2014 19:16, schrieb Peter Brune:
You should be using an array of type ISColoringValue. ISColoringValue
is by default a short, not an int, so you're getting nonsense entries.
We should either maintain or remove ex5s if it does something like this.
- Peter
On Thu, May 15, 2014 at 11:56 AM, Jonas Mairhofer
<[email protected]
<mailto:[email protected]>> wrote:
If 'colors' can be a dynamically allocated array then I dont know
where
the mistake is in this code:
ISColoring iscoloring
Integer, allocatable :: colors(:)
PetscInt maxc
...
!calculate max. number of colors
maxc = 2*irc+1 !irc is the number of ghost nodes needed to
calculate the function I want to solve
allocate(colors(user%xm)) !where user%xm is the number of
locally
owned nodes of a global array
!Set colors
DO i=1,user%xm
colors(i) = mod(i,maxc)
END DO
call
ISColoringCreate(PETSC_COMM_WORLD,maxc,user%xm,colors,iscoloring,ierr)
...
deallocate(colors)
call ISColoringDestroy(iscoloring,ierr)
On execution I get the following error message (running the DO
Loop from
0 to user%xm-1 does not change anything):
[0]PETSC ERROR: --------------------- Error Message
------------------------------------
[0]PETSC ERROR: Arguments are incompatible!
[0]PETSC ERROR: Number of colors passed in 291 is less then the actual
number of colors in array 61665!
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Release Version 3.4.4, Mar, 13, 2014
[0]PETSC ERROR: See docs/changes/index.html for recent updates.
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[0]PETSC ERROR: See docs/index.html for manual pages.
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: ./DFT on a arch-linux2-c-debug named
aries.itt.uni-stuttgart.de <http://aries.itt.uni-stuttgart.de> by
mhofer Thu May 15 18:01:41 2014
[0]PETSC ERROR: Libraries linked from
/usr/ITT/mhofer/Documents/Diss/NumericalMethods/Libraries/Petsc/petsc-3.4.4/arch-linux2-c-debug/lib
[0]PETSC ERROR: Configure run at Wed Mar 19 11:00:35 2014
[0]PETSC ERROR: Configure options --with-cc=gcc --with-fc=gfortran
--download-f-blas-lapack --download-mpich
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: ISColoringCreate() line 276 in
/usr/ITT/mhofer/Documents/Diss/NumericalMethods/Libraries/Petsc/petsc-3.4.4/src/vec/is/is/utils/iscoloring.c
But when I print out colors, it only has entries from 0 to 218, so no
entry is larger then 291 as stated in the error message.
Am 15.05.2014 16:45, schrieb Jed Brown:
Jonas Mairhofer <[email protected]
<mailto:[email protected]>> writes:
Hi, I'm trying to set the coloring of a matrix using
ISColoringCreate.
Therefore I need an array 'colors' which in C can be
creates as (from
example ex5s.c)
int *colors
PetscMalloc(...,&colors)
There is no PetscMalloc in Fortran, due to language
"deficiencies".
colors(i) = ....
ISColoringCreate(...)
How do I have to define the array colors in Fortran?
I tried:
Integer, allocatable :: colors(:) and allocate()
instead of
PetscMalloc
and
Integer, pointer :: colors
but neither worked.
The ISColoringCreate Fortran binding copies from the array you
pass into
one allocated using PetscMalloc. You should pass a normal
Fortran array
(statically or dynamically allocated).