Mfem: Error in UniformRefinement() for quad and hex meshes

Created on 20 Jun 2018  路  3Comments  路  Source: mfem/mfem

Hi,

Since a long time I was struggling to get the following code running

#include "mfem.hpp"
#include <iostream>

using namespace mfem;

int main(int argc, char *argv[])
{
//    Mesh *mesh = new Mesh("../data/inline-tri.mesh", 1, 1);
//    Mesh *mesh = new Mesh("../data/inline-quad.mesh", 1, 1);
//    Mesh *mesh = new Mesh("../data/inline-tet.mesh", 1, 1);
   Mesh *mesh = new Mesh("../data/inline-hex.mesh", 1, 1);
   int dim = mesh->Dimension();

   for (int ref_levels = 0; ref_levels < 2; ref_levels++)
   {
      mesh->UniformRefinement();

      Array<int> edges, orientation;

      if (dim == 3)
         for(int i = 0; i<mesh->GetNFaces(); i++)
            mesh->GetFaceEdges(i, edges, orientation);
      else
         for(int i = 0; i<mesh->GetNEdges(); i++)
            mesh->GetEdgeVertices(i, edges);
   }

   delete mesh;

   return 0;
}

It gave an error for all 4 meshes using previous versions of MFEM. Using MFEM 3.4 triangular and tetrahedral meshes are working, due to the call of DeleteLazyTables(); in LocalRefinement. However, it is not called inside QuadUniformRefinement() or HexUniformRefinement(). I added it to the very beginning of those functions for myself, and it seems to be working. I am not entirely sure if that is the best place to delete the old tables. Do you have any suggestions?

Is there any reason behind the absence of DeleteLazyTables(); inside those two functions?

Regards,
Tamas

bug mesh

Most helpful comment

Yes, I think that is okay. Feel free to make a PR to fix this issue.

All 3 comments

Yes, this is a recent fix - see #492. I guess I simply forgot to add the call to DeleteLazyTables() in the quad/hex refinement methods.

Thanks for reporting the issue.

Do you think it is okay to call DeleteLazyTables() at the very beginning of the quad/hex refinement?

Yes, I think that is okay. Feel free to make a PR to fix this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anjirom picture anjirom  路  3Comments

tbarani picture tbarani  路  3Comments

sshiraiwa picture sshiraiwa  路  4Comments

kolotinsky1998 picture kolotinsky1998  路  4Comments

samanseifi picture samanseifi  路  4Comments