[petsc-dev] reading gmsh into DMPlex

Stefano Zampini stefano.zampini at gmail.com
Thu May 16 02:37:46 CDT 2019

Can you try with this PR https://bitbucket.org/petsc/petsc/pull-requests/1660/binary-i-o-and-gmsh-dmplex-reader/diff <https://bitbucket.org/petsc/petsc/pull-requests/1660/binary-i-o-and-gmsh-dmplex-reader/diff>?

> On May 16, 2019, at 5:59 AM, Adrian Croucher via petsc-dev <petsc-dev at mcs.anl.gov> wrote:
> hi
> A couple of years ago (see below) I was having problems reading in GMSH files using DMPlexCreateFromFile(), if the MSH file didn't have a newline on the end.
> It was fixed at the time, but the problem seems to be happening again with PETSc 3.11.1.
> I've attached an example mesh which no longer works (unless you add a newline on the end of it). The error message is below.
> - Adrian
> [0]PETSC ERROR: Invalid argument
> [0]PETSC ERROR: File is not a valid Gmsh file, expecting $EndElements
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html <http://www.mcs.anl.gov/petsc/documentation/faq.html> for trouble shooting.
> [0]PETSC ERROR: Petsc Development GIT revision: v3.11.1-701-g5065da2f63  GIT Date: 2019-05-13 01:43:35 -0
> 500                                                                                                     
> [0]PETSC ERROR: ./plexview on a linux-gnu-c-opt named en-354401 by acro018 Thu May 16 14:54:13 2019
> [0]PETSC ERROR: Configure options --with-x --download-hdf5 --download-zlib --download-pnetcdf --download-
> netcdf --download-exodusii --download-triangle --download-ptscotch --download-chaco --download-hypre --wi
> th-debugging=0 COPTFLAGS="-O3 -march=native -mtune=native" CXXOPTFLAGS="-O3 -march=native -mtune=native" 
> FOPTFLAGS="-O3 -march=native -mtune=native"                                                             
> [0]PETSC ERROR: #1 GmshExpect() line 80 in /home/acro018/software/PETSc/code/src/dm/impls/plex/plexgmsh.c
> [0]PETSC ERROR: #2 GmshReadEndSection() line 108 in /home/acro018/software/PETSc/code/src/dm/impls/plex/p
> lexgmsh.c                                                                                               
> [0]PETSC ERROR: #3 DMPlexCreateGmsh() line 1107 in /home/acro018/software/PETSc/code/src/dm/impls/plex/pl
> exgmsh.c                                                                                                
> [0]PETSC ERROR: #4 DMPlexCreateGmshFromFile() line 989 in /home/acro018/software/PETSc/code/src/dm/impls/
> plex/plexgmsh.c                                                                                         
> [0]PETSC ERROR: #5 DMPlexCreateFromFile() line 3268 in /home/acro018/software/PETSc/code/src/dm/impls/ple
> x/plexcreate.c                                                                                          
> [0]PETSC ERROR: #6 User provided function() line 0 in User file
> On 17/01/17 4:32 PM, Matthew Knepley wrote:
>> On Mon, Jan 16, 2017 at 9:15 PM, Adrian Croucher <a.croucher at auckland.ac.nz <mailto:a.croucher at auckland.ac.nz>> wrote:
>> hi Matt
>> On 17/01/17 15:52, Matthew Knepley wrote:
>>> Its a DOS file and has no newline at the end. Thus, when I read $EndElements, it has no termination and you
>>> can something weird. I put a newline on that line and its fine.
>> I don't think it is a DOS file- it was created on a Linux machine, emacs doesn't identify it as DOS, and I tried running dos2unix on it to make sure, but that made no difference.
>> What does make a difference is manually adding a newline on the end. However, that isn't super convenient when these files are being created automatically via scripts.
>> Would it be possible to make DMPlexCreateGmsh() a bit more robust about the line ending at the end of the file? Gmsh itself isn't bothered by it.
>> Yes, that was lazy. The fix is in next.
>>  Thanks,
>>     Matt
> -- 
> Dr Adrian Croucher
> Senior Research Fellow
> Department of Engineering Science
> University of Auckland, New Zealand
> email: a.croucher at auckland.ac.nz <mailto:a.croucher at auckland.ac.nz>
> tel: +64 (0)9 923 4611
> <testmesh3.msh>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20190516/0550939d/attachment.html>

More information about the petsc-dev mailing list