<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>hi</p>
    <p>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>It was fixed at the time, but the problem seems to be happening
      again with PETSc 3.11.1.</p>
    <p>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>- Adrian<br>
    </p>
    <p>[0]PETSC ERROR: Invalid argument<br>
      [0]PETSC ERROR: File is not a valid Gmsh file, expecting
      $EndElements<br>
      [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>
      [0]PETSC ERROR: Petsc Development GIT revision:
      v3.11.1-701-g5065da2f63  GIT Date: 2019-05-13 01:43:35 -0<br>
500                                                                                                    
      <br>
      [0]PETSC ERROR: ./plexview on a linux-gnu-c-opt named en-354401 by
      acro018 Thu May 16 14:54:13 2019<br>
      [0]PETSC ERROR: Configure options --with-x --download-hdf5
      --download-zlib --download-pnetcdf --download-<br>
      netcdf --download-exodusii --download-triangle --download-ptscotch
      --download-chaco --download-hypre --wi<br>
      th-debugging=0 COPTFLAGS="-O3 -march=native -mtune=native"
      CXXOPTFLAGS="-O3 -march=native -mtune=native" <br>
      FOPTFLAGS="-O3 -march=native
-mtune=native"                                                            
      <br>
      [0]PETSC ERROR: #1 GmshExpect() line 80 in
      /home/acro018/software/PETSc/code/src/dm/impls/plex/plexgmsh.c<br>
      [0]PETSC ERROR: #2 GmshReadEndSection() line 108 in
      /home/acro018/software/PETSc/code/src/dm/impls/plex/p<br>
lexgmsh.c                                                                                              
      <br>
      [0]PETSC ERROR: #3 DMPlexCreateGmsh() line 1107 in
      /home/acro018/software/PETSc/code/src/dm/impls/plex/pl<br>
exgmsh.c                                                                                               
      <br>
      [0]PETSC ERROR: #4 DMPlexCreateGmshFromFile() line 989 in
      /home/acro018/software/PETSc/code/src/dm/impls/<br>
plex/plexgmsh.c                                                                                        
      <br>
      [0]PETSC ERROR: #5 DMPlexCreateFromFile() line 3268 in
      /home/acro018/software/PETSc/code/src/dm/impls/ple<br>
x/plexcreate.c                                                                                         
      <br>
      [0]PETSC ERROR: #6 User provided function() line 0 in User file<br>
      <br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 17/01/17 4:32 PM, Matthew Knepley
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMYG4Gnw7NKwVOZt72TOe8W4kk=JYhyfSYnDUdXhN_5_6OFv8Q@mail.gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On Mon, Jan 16, 2017 at 9:15 PM,
            Adrian Croucher <span dir="ltr"><<a
                href="mailto:a.croucher@auckland.ac.nz" target="_blank"
                moz-do-not-send="true">a.croucher@auckland.ac.nz</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000">
                <p>hi Matt<br>
                </p>
                <br>
                <div class="m_7251513791071221137moz-cite-prefix">On
                  17/01/17 15:52, Matthew Knepley wrote:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr">
                    <div class="gmail_extra">
                      <div class="gmail_quote"><br>
                        <div>Its a DOS file and has no newline at the
                          end. Thus, when I read $EndElements, it has no
                          termination and you</div>
                        <div>can something weird. I put a newline on
                          that line and its fine.</div>
                        <br>
                      </div>
                    </div>
                  </div>
                </blockquote>
                <br>
                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>
                <br>
                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>
                <br>
                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><br>
            </div>
            <div>Yes, that was lazy. The fix is in next.</div>
            <div><br>
            </div>
            <div> Thanks,</div>
            <div><br>
            </div>
            <div>    Matt</div>
            <div> </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>
  </body>
</html>