I can't get a a simple code to work for DMPlexGetCone.
I have tried different ways of handling the array/pointer which is the
third argument of DMPlexGetCone,
but neither of them worked for me.

The last version that I got compiling is this one, which is very much based
on the
following example:

    PetscInt, target, dimension(6) :: icone
    PetscInt, pointer :: pIcone(:)

    call DMPlexCreateFromCellList(PETSC_COMM_WORLD,
     &                              ndim,numel,numnp,nen,PETSC_TRUE,
     &                              ielement,ndim,xnodes,dm,ierr)
      call DMPlexGetCone(dm,0,pIcone,ierr)
      write(*,*) icone(1),icone(2),icone(3),icone(4),icone(5),icone(6)
      call DMPlexRestoreCone(dm,0,pIcone,ierr)

I always get a segmentation fault.

I've created a simple cuboid mesh with 2x2x2 hexaedral elements.
Many other routines are working and give reasonable results.

Output of DMView

DM Object: 1 MPI processes
  type: plex
DM_0x84000000_0 in 3 dimensions:
  0-cells: 27
  1-cells: 66
  2-cells: 44
  3-cells: 8
  depth: 4 strata of sizes (27, 66, 44, 8)

On Thu, Apr 5, 2018 at 10:57 PM, Bernardo Rocha <
bernardomartinsro...@gmail.com> wrote:

> OK, thanks a lot.
> I had to rename the files and add -ffixed-form as argument to the compiler.
> Best regards,
> Bernardo
> On Thu, Apr 5, 2018 at 8:21 PM, Matthew Knepley <knep...@gmail.com> wrote:
>> On Thu, Apr 5, 2018 at 7:16 PM, Bernardo Rocha <
>> bernardomartinsro...@gmail.com> wrote:
>>> Hello everyone,
>>> I've been trying to use DMPlex in a Fortran 77 application
>>> (unfortunately this is legacy code and I can't move to F90).
>>> Is there a way to use DMPlexGetCone on it?
>>> Although the documentation online says it is only available for F90,
>>> I'm wondering if there is a trick like the ones in the users manual for
>>> routines
>>> that return an array. I tried, but I'm not sure it it is right.
>> We have standardized our array handling with F90, and I don't think we
>> will go back
>> to supporting new things for F77-style arrays.
>> That being said, I think all you have to do is compile that source with
>> an F90 compiler. You
>> should not have to change anything. If you want the F90 array to look
>> like an F77 array,
>> just pass it as a function argument (I think this works).
>>   Thanks,
>>      Matt
>>> Best regards,
>>> Bernardo M. Rocha
>> --
>> 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
>> https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>

Reply via email to