[petsc-dev] DMPlexCreateSection from fortran
Matthew Knepley
knepley at gmail.com
Fri Aug 8 13:43:42 CDT 2014
On Thu, Aug 7, 2014 at 7:01 PM, Adrian Croucher <a.croucher at auckland.ac.nz>
wrote:
> hi
>
> I'm getting a compile-time error when calling DMPlexCreateSection() from
> fortran. The error is:
>
> num_bc, pbc_field, pbc_pointIS, section, ierr); if (ierr .ne. 0)
> call MP
> 1
> Error: Type mismatch in argument 'section' at (1); passed INTEGER(4) to
> INTEGER(8)
>
> The code is below. (I'm not sure if there is a simpler way to do this that
> doesn't require all those extra pointer variables.) I based it on the C
> code in SNES ex12.
>
> Is my code wrong or could it be a bug? I'm using the 'next' branch of
> PETSc.
>
In 'next' I have changed the signature:
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMPlexCreateSection.html
You can just put in a PETSC_NULL_OBJECT for it, as in DMPlex test ex1f90.
I am starting to move away from calling this directly, as in ex12.
Thanks,
Matt
> Cheers, Adrian
>
> ------------------------------------------------------
>
> subroutine setup_dm_section(dm)
>
> ! Sets up section on dm.
>
> implicit none
>
> #include <finclude/petsc.h90>
>
> DM, intent(in out) :: dm
> ! Locals:
> PetscInt, parameter :: dim = 3, num_fields = 1
> PetscInt, target :: num_comp(1) = [1], num_dof(3) = [0,0,1]
> PetscInt, pointer :: pnum_comp(:), pnum_dof(:)
> PetscInt, parameter :: num_bc = 0
> PetscInt, target :: bc_field(1) = [0]
> PetscInt, pointer :: pbc_field(:)
> IS, target :: bc_pointIS(1)
> IS, pointer :: pbc_pointIS(:)
> PetscSection :: section
> PetscErrorCode :: ierr
>
> pnum_comp => num_comp; pnum_dof => num_dof
> pbc_field => bc_field; pbc_pointIS => bc_pointIS
>
> call DMPlexCreateSection(dm, dim, num_fields, pnum_comp, pnum_dof, &
> num_bc, pbc_field, pbc_pointIS, section, ierr); CHKERRQ(ierr)
> call PetscSectionSetFieldName(section, 0, "y", ierr); CHKERRQ(ierr)
> call PetscSectionSetUp(section, ierr); CHKERRQ(ierr)
> call DMSetDefaultSection(dm, section); CHKERRQ(ierr)
> call PetscSectionDestroy(section, ierr); CHKERRQ(ierr)
>
> end subroutine setup_dm_section
>
> --
> Dr Adrian Croucher
> Senior Research Fellow
> Department of Engineering Science
> University of Auckland, New Zealand
> email: a.croucher at auckland.ac.nz
> tel: +64 (0)9 923 4611
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20140808/8333e960/attachment.html>
More information about the petsc-dev
mailing list