<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Aug 7, 2014 at 7:01 PM, Adrian Croucher <span dir="ltr"><<a href="mailto:a.croucher@auckland.ac.nz" target="_blank">a.croucher@auckland.ac.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">hi<br>
<br>
I'm getting a compile-time error when calling DMPlexCreateSection() from fortran. The error is:<br>
<br>
num_bc, pbc_field, pbc_pointIS, section, ierr); if (ierr .ne. 0) call MP<br>
1<br>
Error: Type mismatch in argument 'section' at (1); passed INTEGER(4) to INTEGER(8)<br>
<br>
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.<br>
<br>
Is my code wrong or could it be a bug? I'm using the 'next' branch of PETSc.<br></blockquote><div><br></div><div>In 'next' I have changed the signature:</div><div><br></div><div> <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMPlexCreateSection.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMPlexCreateSection.html</a></div>
<div><br></div><div>You can just put in a PETSC_NULL_OBJECT for it, as in DMPlex test ex1f90.</div><div><br></div><div>I am starting to move away from calling this directly, as in ex12.</div><div><br></div><div> Thanks,</div>
<div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Cheers, Adrian<br>
<br>
------------------------------<u></u>------------------------<br>
<br>
subroutine setup_dm_section(dm)<br>
<br>
! Sets up section on dm.<br>
<br>
implicit none<br>
<br>
#include <finclude/petsc.h90><br>
<br>
DM, intent(in out) :: dm<br>
! Locals:<br>
PetscInt, parameter :: dim = 3, num_fields = 1<br>
PetscInt, target :: num_comp(1) = [1], num_dof(3) = [0,0,1]<br>
PetscInt, pointer :: pnum_comp(:), pnum_dof(:)<br>
PetscInt, parameter :: num_bc = 0<br>
PetscInt, target :: bc_field(1) = [0]<br>
PetscInt, pointer :: pbc_field(:)<br>
IS, target :: bc_pointIS(1)<br>
IS, pointer :: pbc_pointIS(:)<br>
PetscSection :: section<br>
PetscErrorCode :: ierr<br>
<br>
pnum_comp => num_comp; pnum_dof => num_dof<br>
pbc_field => bc_field; pbc_pointIS => bc_pointIS<br>
<br>
call DMPlexCreateSection(dm, dim, num_fields, pnum_comp, pnum_dof, &<br>
num_bc, pbc_field, pbc_pointIS, section, ierr); CHKERRQ(ierr)<br>
call PetscSectionSetFieldName(<u></u>section, 0, "y", ierr); CHKERRQ(ierr)<br>
call PetscSectionSetUp(section, ierr); CHKERRQ(ierr)<br>
call DMSetDefaultSection(dm, section); CHKERRQ(ierr)<br>
call PetscSectionDestroy(section, ierr); CHKERRQ(ierr)<br>
<br>
end subroutine setup_dm_section<span class=""><font color="#888888"><br>
<br>
-- <br>
Dr Adrian Croucher<br>
Senior Research Fellow<br>
Department of Engineering Science<br>
University of Auckland, New Zealand<br>
email: <a href="mailto:a.croucher@auckland.ac.nz" target="_blank">a.croucher@auckland.ac.nz</a><br>
tel: <a href="tel:%2B64%20%280%299%20923%204611" value="+6499234611" target="_blank">+64 (0)9 923 4611</a><br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>