1 // Copyright (c) 2010-2021, Lawrence Livermore National Security, LLC. Produced 2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files 3 // LICENSE and NOTICE for details. LLNL-CODE-806117. 4 // 5 // This file is part of the MFEM library. For more information and source code 6 // availability visit https://mfem.org. 7 // 8 // MFEM is free software; you can redistribute it and/or modify it under the 9 // terms of the BSD-3 license. We welcome feedback and contributions, see file 10 // CONTRIBUTING.md for details. 11 12 #include "mfem.hpp" 13 #include "unit_tests.hpp" 14 15 using namespace mfem; 16 17 namespace tet_reorder 18 { 19 20 TEST_CASE("Tetrahedron Reordering") 21 { 22 typedef Geometry::Constants<Geometry::TETRAHEDRON> g_const; 23 24 int p = 7; 25 double tol = 1e-6; 26 to_string(p)27 SECTION("Geometry order " + std::to_string(p)) 28 { 29 for (int nd=0; nd<=1; nd++) 30 SECTION("Discontinuous flag set to " + std::to_string(nd)) 31 { 32 for (int no=0; no<=1; no++) 33 SECTION("VDim ordering type set to " + std::to_string(no)) 34 { 35 for (int o=0; o<g_const::NumOrient; o++) 36 SECTION("Initial orientation set to " + std::to_string(o)) 37 { 38 Mesh mesh(3, 4, 1); 39 40 double c[3]; 41 c[0] = 0.0; c[1] = 0.0; c[2] = 3.0; 42 mesh.AddVertex(c); 43 c[0] = 0.0; c[1] = 2.0; c[2] = 0.0; 44 mesh.AddVertex(c); 45 c[0] = 1.0; c[1] = 0.0; c[2] = 0.0; 46 mesh.AddVertex(c); 47 c[0] = 0.0; c[1] = 0.0; c[2] = 0.0; 48 mesh.AddVertex(c); 49 50 const int * vo = g_const::Orient[o]; 51 mesh.AddTet(vo); 52 mesh.FinalizeMesh(0, false); 53 54 mesh.SetCurvature(p, nd, 3, no); 55 double vol0 = mesh.GetElementVolume(0); 56 REQUIRE(fabs(vol0 - 1.0 + 2.0 * (o % 2)) < tol); 57 58 mesh.Finalize(true, true); 59 double vol1 = mesh.GetElementVolume(0); 60 REQUIRE(fabs(vol1 - 1.0) < tol); 61 } 62 } 63 } 64 } 65 } 66 67 } // namespace tet_reorder 68