<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Can you try with this PR <a href="https://bitbucket.org/petsc/petsc/pull-requests/1660/binary-i-o-and-gmsh-dmplex-reader/diff" class="">https://bitbucket.org/petsc/petsc/pull-requests/1660/binary-i-o-and-gmsh-dmplex-reader/diff</a>?<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On May 16, 2019, at 5:59 AM, Adrian Croucher via petsc-dev <<a href="mailto:petsc-dev@mcs.anl.gov" class="">petsc-dev@mcs.anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
  
  <div bgcolor="#FFFFFF" text="#000000" class=""><p class="">hi</p><p class="">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.</p><p class="">It was fixed at the time, but the problem seems to be happening
      again with PETSc 3.11.1.</p><p class="">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.</p><p class="">- Adrian<br class="">
    </p><p class="">[0]PETSC ERROR: Invalid argument<br class="">
      [0]PETSC ERROR: File is not a valid Gmsh file, expecting
      $EndElements<br class="">
      [0]PETSC ERROR: See
      <a class="moz-txt-link-freetext" href="http://www.mcs.anl.gov/petsc/documentation/faq.html">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble
      shooting.<br class="">
      [0]PETSC ERROR: Petsc Development GIT revision:
      v3.11.1-701-g5065da2f63  GIT Date: 2019-05-13 01:43:35 -0<br class="">
500                                                                                                    
      <br class="">
      [0]PETSC ERROR: ./plexview on a linux-gnu-c-opt named en-354401 by
      acro018 Thu May 16 14:54:13 2019<br class="">
      [0]PETSC ERROR: Configure options --with-x --download-hdf5
      --download-zlib --download-pnetcdf --download-<br class="">
      netcdf --download-exodusii --download-triangle --download-ptscotch
      --download-chaco --download-hypre --wi<br class="">
      th-debugging=0 COPTFLAGS="-O3 -march=native -mtune=native"
      CXXOPTFLAGS="-O3 -march=native -mtune=native" <br class="">
      FOPTFLAGS="-O3 -march=native
-mtune=native"                                                            
      <br class="">
      [0]PETSC ERROR: #1 GmshExpect() line 80 in
      /home/acro018/software/PETSc/code/src/dm/impls/plex/plexgmsh.c<br class="">
      [0]PETSC ERROR: #2 GmshReadEndSection() line 108 in
      /home/acro018/software/PETSc/code/src/dm/impls/plex/p<br class="">
lexgmsh.c                                                                                              
      <br class="">
      [0]PETSC ERROR: #3 DMPlexCreateGmsh() line 1107 in
      /home/acro018/software/PETSc/code/src/dm/impls/plex/pl<br class="">
exgmsh.c                                                                                               
      <br class="">
      [0]PETSC ERROR: #4 DMPlexCreateGmshFromFile() line 989 in
      /home/acro018/software/PETSc/code/src/dm/impls/<br class="">
plex/plexgmsh.c                                                                                        
      <br class="">
      [0]PETSC ERROR: #5 DMPlexCreateFromFile() line 3268 in
      /home/acro018/software/PETSc/code/src/dm/impls/ple<br class="">
x/plexcreate.c                                                                                         
      <br class="">
      [0]PETSC ERROR: #6 User provided function() line 0 in User file<br class="">
      <br class="">
    </p><p class=""><br class="">
    </p>
    <div class="moz-cite-prefix">On 17/01/17 4:32 PM, Matthew Knepley
      wrote:<br class="">
    </div>
    <blockquote type="cite" cite="mid:CAMYG4Gnw7NKwVOZt72TOe8W4kk=JYhyfSYnDUdXhN_5_6OFv8Q@mail.gmail.com" class="">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
      <div dir="ltr" class="">
        <div class="gmail_extra">
          <div class="gmail_quote">On Mon, Jan 16, 2017 at 9:15 PM,
            Adrian Croucher <span dir="ltr" class=""><<a href="mailto:a.croucher@auckland.ac.nz" target="_blank" moz-do-not-send="true" class="">a.croucher@auckland.ac.nz</a>></span>
            wrote:<br class="">
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000" class=""><p class="">hi Matt<br class="">
                </p>
                <br class="">
                <div class="m_7251513791071221137moz-cite-prefix">On
                  17/01/17 15:52, Matthew Knepley wrote:<br class="">
                </div>
                <blockquote type="cite" class="">
                  <div dir="ltr" class="">
                    <div class="gmail_extra">
                      <div class="gmail_quote"><br class="">
                        <div class="">Its a DOS file and has no newline at the
                          end. Thus, when I read $EndElements, it has no
                          termination and you</div>
                        <div class="">can something weird. I put a newline on
                          that line and its fine.</div>
                        <br class="">
                      </div>
                    </div>
                  </div>
                </blockquote>
                <br class="">
                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.<br class="">
                <br class="">
                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.<br class="">
                <br class="">
                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.</div>
            </blockquote>
            <div class=""><br class="">
            </div>
            <div class="">Yes, that was lazy. The fix is in next.</div>
            <div class=""><br class="">
            </div>
            <div class=""> Thanks,</div>
            <div class=""><br class="">
            </div>
            <div class="">    Matt</div>
            <div class=""> </div>
          </div>
        </div>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Dr Adrian Croucher
Senior Research Fellow
Department of Engineering Science
University of Auckland, New Zealand
email: <a class="moz-txt-link-abbreviated" href="mailto:a.croucher@auckland.ac.nz">a.croucher@auckland.ac.nz</a>
tel: +64 (0)9 923 4611
</pre>
  </div>

<span id="cid:D0877454-6F80-4FA2-A988-FDB2CA47500F@kaust.edu.sa"><testmesh3.msh></span></div></blockquote></div><br class=""></body></html>