<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Tatiana,<br>
      <br>
      I am guessing for your first error, but would say that it is
      simply not allowed to call "factory.createGrid()" twice.
      Concerning the second error: as the message says, it is not
      possible to have two UGGrids at once. You should be able to
      circummvent that by putting the two stages in separate blocks<br>
      <br>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        {<br>
            <span style="color: #bb2ca2">typedef</span>
        UGGrid<dim> GridType;</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            GridType grid;</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            GridFactory<GridType> factory(&grid);</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            GmshReader<GridType>::read(factory,<span style="color:
          #d12f1b">"fine.msh"</span>);</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            factory.createGrid();<br>
      </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; min-height: 13px;">
            </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            std::cout << <span style="color: #d12f1b">" Fine mesh
          has been read "</span> << std::endl;<br>
        }<br>
        {<br>
      </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; min-height: 13px;">
      </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            <span style="color: #bb2ca2">typedef</span>
        UGGrid<dim> GridType1;</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            GridType1 grid1;</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            GridFactory<GridType1> factory1(&grid1);</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            GmshReader<GridType1>::read(factory1,<span
          style="color: #d12f1b">"cube2.msh"</span>);</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            factory1.createGrid();</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            <span style="color: #bb2ca2">typedef</span>
        GridType1::LeafGridView GridView;</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; min-height: 13px;">
            </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; min-height: 13px;">
        <br>
      </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            std::cout << <span style="color: #d12f1b">" Coarse
          mesh has been read "</span> << std::endl;<br>
        }<br>
      </p>
      <span style="color: rgb(0, 132, 0); font-family: Menlo; font-size:
        11px; background-color: rgb(255, 255, 255);"></span><br>
      The question is if that is useful for you. If you need both grids
      to be present at the same time in order to compare your results,
      you should either use another grid manager or have both the fine
      and the coarse grid within one UGGrid multigrid structure.<br>
      <br>
      Kind regards<br>
      Bernd<br>
      <br>
      On 06/15/2015 12:45 PM, Tatiana Kim wrote:<br>
    </div>
    <blockquote cite="mid:1434365130519.18732@bath.ac.uk" type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
      <p>Hello,<br>
      </p>
      <p><br>
      </p>
      <p>I would like to read in several meshes from Gmesh into UGGrid.
        Below is a simple example where I have two meshes: fine and
        coarse. I first read in the fine mesh and then I read in
        the coarse mesh. The idea is that I solve the problem on fine
        mesh first and on the coarse mesh second and then compare the
        results. <br>
      </p>
      <p><br>
      </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; color: rgb(0, 132, 0);">
//*******************************************************************<br>
      </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; min-height: 13px;">
            </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; min-height: 13px;">
            </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            <span style="color: #bb2ca2">typedef</span>
        UGGrid<dim> GridType;</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            GridType grid;</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            GridFactory<GridType> factory(&grid);</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            GmshReader<GridType>::read(factory,<span style="color:
          #d12f1b">"fine.msh"</span>);</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            factory.createGrid();<br>
      </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; min-height: 13px;">
            </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            std::cout << <span style="color: #d12f1b">" Fine mesh
          has been read "</span> << std::endl;</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; min-height: 13px;">
            </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; min-height: 13px;">
            </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; color: rgb(0, 132, 0);">
//************************************************************************</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; min-height: 13px;">
        <br>
      </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; min-height: 13px;">
        <br>
      </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            GmshReader<GridType>::read(factory,<span style="color:
          #d12f1b">"coarse.msh"</span>);</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            factory.createGrid();<br>
      </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; min-height: 13px;">
            </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo; min-height: 13px;">
        <br>
      </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
            std::cout << <span style="color: #d12f1b">" Coarse
          mesh has been read "</span> << std::endl;<br>
      </p>
      <p><span style="color: rgb(0, 132, 0); font-family: Menlo;
          font-size: 11px; background-color: rgb(255, 255, 255);">//*********************************************************************</span><span
          style="color: rgb(0, 132, 0); font-family: Menlo; font-size:
          11px;">***</span><span style="font-size: 12pt;">​</span></p>
      <p><br>
      </p>
      <p><br>
      </p>
      <p>It compiles fine, but when I run it, I get the following error
        (when creating cube2.msh grid):</p>
      <p><br>
      </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        Reading 3d Gmsh grid...</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        version 2.2 Gmsh file detected</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        file contains 6580 nodes</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        file contains 37673 elements</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        number of real vertices = 6580</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        number of boundary elements = 6266</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        number of elements = 31407<br>
      </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
         Fine mesh has been read </p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        Reading 3d Gmsh grid...</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        version 2.2 Gmsh file detected</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        file contains 1115 nodes</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        file contains 5961 elements</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        number of real vertices = 1115</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        number of boundary elements = 1476</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        number of elements = 4485</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        [138-38-185-242:14754] *** Process received signal ***</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        [138-38-185-242:14754] Signal: Segmentation fault: 11 (11)</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        [138-38-185-242:14754] Signal code: Address not mapped (1)</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        [138-38-185-242:14754] Failing at address: 0xe8</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        [138-38-185-242:14754] [ 0] 0   libsystem_platform.dylib       
            0x00007fff8647b5aa _sigtramp + 26</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        [138-38-185-242:14754] [ 1] 0   libsystem_c.dylib              
            0x00007fff723d12a0 usual + 0</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        [138-38-185-242:14754] [ 2] 0   testproject                    
            0x00000001063ab5fa
        _ZN4Dune10GmshReaderINS_6UGGridILi3EEEE4readERNS_11GridFactoryIS2_EERKSsbb
        + 2426</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        [138-38-185-242:14754] [ 3] 0   testproject                    
            0x000000010642ce72 main + 226</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        [138-38-185-242:14754] [ 4] 0   libmpi.1.dylib                 
            0x0000000106d7df20 ompi_mpi_comm_world + 0</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        [138-38-185-242:14754] *** End of error message ***</p>
      <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
        font-family: Menlo;">
        Segmentation fault: 11</p>
      <div><br>
        <br>
      </div>
      <div>If, for the second part of the code, I write:<br>
      </div>
      <div>
        <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
          font-family: Menlo; min-height: 13px;">
              </p>
        <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
          font-family: Menlo; color: rgb(0, 132, 0);">
//************************************************************************</p>
        <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
          font-family: Menlo; min-height: 13px;">
          <br>
        </p>
        <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
          font-family: Menlo;">
              <span style="color: #bb2ca2">typedef</span>
          UGGrid<dim> GridType1;</p>
        <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
          font-family: Menlo;">
              GridType1 grid1;</p>
        <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
          font-family: Menlo;">
              GridFactory<GridType1> factory1(&grid1);</p>
        <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
          font-family: Menlo;">
              GmshReader<GridType1>::read(factory1,<span
            style="color: #d12f1b">"cube2.msh"</span>);</p>
        <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
          font-family: Menlo;">
              factory1.createGrid();</p>
        <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
          font-family: Menlo;">
              <span style="color: #bb2ca2">typedef</span>
          GridType1::LeafGridView GridView;</p>
        <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
          font-family: Menlo; min-height: 13px;">
              </p>
        <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
          font-family: Menlo; min-height: 13px;">
          <br>
        </p>
        <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
          font-family: Menlo;">
              std::cout << <span style="color: #d12f1b">" Coarse
            mesh has been read "</span> << std::endl;<br>
        </p>
        <p style="margin-right: 0px; margin-left: 0px; font-size: 11px;
          font-family: Menlo;">
          <span style="color: rgb(0, 132, 0); font-family: Menlo;
            font-size: 11px; background-color: rgb(255, 255, 255);">//************************************************************************</span><br>
        </p>
        <br>
      </div>
      <div>then I get this error instead of the segmentation fault:<br>
      </div>
      <div><br>
      </div>
      <p>"ERROR in InitCurrMG: opening more than one MG is not allowed
        in parallel"<br>
      </p>
      <p><br>
      </p>
      <p><br>
      </p>
      <p>Could you please help me figure out what I am doing wrong?<br>
      </p>
      <p><br>
      </p>
      <p>Thanks!<br>
      </p>
      <p>Tatiana.<br>
      </p>
      <p><br>
      </p>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
dune-pdelab mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dune-pdelab@dune-project.org">dune-pdelab@dune-project.org</a>
<a class="moz-txt-link-freetext" href="http://lists.dune-project.org/mailman/listinfo/dune-pdelab">http://lists.dune-project.org/mailman/listinfo/dune-pdelab</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
_______________________________________________________________

Bernd Flemisch                         phone: +49 711 685 69162
IWS, Universität Stuttgart             fax:   +49 711 685 60430
Pfaffenwaldring 61            email: <a class="moz-txt-link-abbreviated" href="mailto:bernd@iws.uni-stuttgart.de">bernd@iws.uni-stuttgart.de</a>
D-70569 Stuttgart            url: <a class="moz-txt-link-abbreviated" href="http://www.hydrosys.uni-stuttgart.de">www.hydrosys.uni-stuttgart.de</a>
_______________________________________________________________
</pre>
  </body>
</html>