From bd3420edc0872d5fe2831ced4bd193918f4484e5 Mon Sep 17 00:00:00 2001 From: jfussbro Date: Fri, 5 Apr 2024 08:58:13 +0200 Subject: [PATCH 01/14] added numbering for pyramid element in t8_eclass.c --- src/t8_eclass.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/t8_eclass.c b/src/t8_eclass.c index 508a00f7bb..bf2dfb0cd0 100644 --- a/src/t8_eclass.c +++ b/src/t8_eclass.c @@ -48,7 +48,7 @@ const int t8_face_edge_to_tree_edge[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECL { { 8, 10, 4, 6 }, { 9, 11, 5, 7 }, { 8, 9, 0, 2 }, { 10, 11, 1, 3 }, { 4, 5, 0, 1 }, { 6, 7, 2, 3 } }, /* hex */ { { 3, 4, 5 }, { 1, 2, 5 }, { 0, 2, 4 }, { 0, 1, 3 } }, /* tet */ { { -1 } }, /* prism */ - { { -1 } }, /* pyramid */ + { { 0, 4, 7 }, { 1, 5, 6 }, { 2, 4, 5 }, { 3, 6, 7 }, { 0, 1, 2, 3 } } /* pyramid */ }; /* TODO: prism, pyramid */ @@ -60,7 +60,7 @@ const int t8_face_to_edge_neighbor[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLA { { 0, 1, 2, 3 }, { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 8, 9, 10, 11 } }, /* hex */ { { 0, 1, 2 }, { 0, 3, 4 }, { 1, 3, 5 }, { 2, 4, 5 } }, /* tet */ { { -1 } }, /* prism */ - { { -1 } }, /* pyramid */ + { { 2, 3, 5, 6 }, { 2, 3, 4, 7 }, { 0, 1, 6, 7 }, { 0, 1, 4, 5 }, { 4, 5, 6, 7 } } /* pyramid */ }; /* TODO: prism, pyramid */ @@ -80,10 +80,10 @@ const int t8_edge_vertex_to_tree_vertex[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2] { 0, 4 }, { 1, 5 }, { 2, 6 }, - { 3, 7 } }, /* hex */ - { { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 1, 3 }, { 2, 3 } }, /* tet */ - { { -1 } }, /* prism */ - { { -1 } }, /* pyramid */ + { 3, 7 } }, /* hex */ + { { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 1, 3 }, { 2, 3 } }, /* tet */ + { { -1 } }, /* prism */ + { { 0, 2 }, { 1, 3 }, { 0, 1 }, { 2, 3 }, { 0, 4 }, { 1, 4 }, { 2, 4 }, { 3, 4 } } /* pyramid */ }; /* TODO: prism, pyramid */ @@ -103,10 +103,10 @@ const int t8_edge_to_face[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2] = { { 0, 2 }, { 1, 2 }, { 0, 3 }, - { 1, 3 } }, /* hex */ - { { 2, 3 }, { 1, 3 }, { 1, 2 }, { 0, 3 }, { 0, 2 }, { 0, 1 } }, /* tet */ - { { -1 } }, /* prism */ - { { -1 } }, /* pyramid */ + { 1, 3 } }, /* hex */ + { { 2, 3 }, { 1, 3 }, { 1, 2 }, { 0, 3 }, { 0, 2 }, { 0, 1 } }, /* tet */ + { { -1 } }, /* prism */ + { { 0, 4 }, { 1, 4 }, { 2, 4 }, { 3, 4 }, { 0, 2 }, { 1, 2 }, { 1, 3 }, { 0, 3 } } /* pyramid */ }; const int t8_eclass_face_orientation[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES] = { From f40381a2c90a75545af0178944804e7b327b906f Mon Sep 17 00:00:00 2001 From: jfussbro Date: Fri, 5 Apr 2024 11:03:27 +0200 Subject: [PATCH 02/14] added cad pyramid test --- .../t8_gtest_geometry_cad.cxx | 240 +++++++++++++++++- 1 file changed, 237 insertions(+), 3 deletions(-) diff --git a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx index 880c895480..4c4383ebcf 100644 --- a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx +++ b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx @@ -103,12 +103,12 @@ t8_euler_rotation (double *pos_vec, double *rot_vec, double *res_vec, double *ro } } -/** Constructs a cad surface for testing purposes. Surface is build between vertex 0, 1, 4 and 5 of a unit hexahedron. +/** Constructs a cad surface for testing purposes. Surface is build on the x-z-plane in reference space. * Saves the surface in the shape. * \return The shape. */ TopoDS_Shape -t8_create_cad_surface_shape () +t8_create_cad_surface_shape_x_z () { Handle_Geom_Surface surface; TopoDS_Shape shape; @@ -131,6 +131,62 @@ t8_create_cad_surface_shape () return shape; } +/** Constructs a cad surface for testing purposes. Surface is build on the x-y-plane in reference space. + * Saves the surface in the shape. + * \return The shape. + */ +TopoDS_Shape +t8_create_cad_surface_shape_x_y () +{ + Handle_Geom_Surface surface; + TopoDS_Shape shape; + TColgp_Array2OfPnt point_array (1, 3, 1, 3); + + point_array (1, 1) = gp_Pnt (0, 0, 0); + point_array (2, 1) = gp_Pnt (-0.2, 0.5, 0.2); + point_array (3, 1) = gp_Pnt (0, 1, 0); + + point_array (1, 2) = gp_Pnt (0.5, -0.2, 0.2); + point_array (2, 2) = gp_Pnt (0.5, 0.5, 0); + point_array (3, 2) = gp_Pnt (0.5, 1.2, -0.2); + + point_array (1, 3) = gp_Pnt (1, 0, 0); + point_array (2, 3) = gp_Pnt (1.2, 0.5, -0.2); + point_array (3, 3) = gp_Pnt (1, 1, 0); + + surface = GeomAPI_PointsToBSplineSurface (point_array).Surface (); + shape = BRepBuilderAPI_MakeFace (surface, 1e-6).Face (); + return shape; +} + +/** Constructs a cad surface for testing purposes. Surface is build between vertex 0, 1, 4 and 5 of a unit hexahedron. + * Saves the surface in the shape. + * \return The shape. + */ +TopoDS_Shape +t8_create_cad_surface_shape_y_z () +{ + Handle_Geom_Surface surface; + TopoDS_Shape shape; + TColgp_Array2OfPnt point_array (1, 3, 1, 3); + + point_array (1, 1) = gp_Pnt (1, 0, 0); + point_array (2, 1) = gp_Pnt (0.8, 0.2, 0.5); + point_array (3, 1) = gp_Pnt (1, 0, 1); + + point_array (1, 2) = gp_Pnt (1.2, 0.5, -0.2); + point_array (2, 2) = gp_Pnt (1, 0.5, 0.5); + point_array (3, 2) = gp_Pnt (0.8, 0.5, 1.2); + + point_array (1, 3) = gp_Pnt (1, 1, 0); + point_array (2, 3) = gp_Pnt (1.2, 0.8, 0.5); + point_array (3, 3) = gp_Pnt (1, 1, 1); + + surface = GeomAPI_PointsToBSplineSurface (point_array).Surface (); + shape = BRepBuilderAPI_MakeFace (surface, 1e-6).Face (); + return shape; +} + /** Constructs a cad curve for testing purposes. Curve is build between vertex 0, 1, 4 and 5 of a unit hexahedron. * Saves the curve in the shape. * \return The cad shape. @@ -185,7 +241,7 @@ t8_create_cad_hypercube (double *rot_vec, int face, int edge, double *parameters T8_ASSERT (face < 0 || edge < 0); if (face >= 0) { faces[face] = 1; - t8_cmesh_register_geometry (cmesh, 3, t8_create_cad_surface_shape ()); + t8_cmesh_register_geometry (cmesh, 3, t8_create_cad_surface_shape_x_z ()); t8_cmesh_set_attribute (cmesh, 0, t8_get_package_id (), T8_CMESH_CAD_FACE_PARAMETERS_ATTRIBUTE_KEY + face, parameters, 8 * sizeof (double), 0); } @@ -720,3 +776,181 @@ INSTANTIATE_TEST_SUITE_P (t8_gtest_check_2d_element_curved_cad_surface, class_2d AllEclasses2D); #endif /* T8_WITH_OCC */ + +/** Constructs a cmesh with an cad geometry linked pyramid. + * \param [in] face The index of the face to link a surface to. -1 for no face. + * \param [in] edge The index of the edge to link a curve to. -1 for no edge. + * \param [in] parameters Parameters of the curve/surface. + * \return A valid cmesh, as if _init and _commit had been called. + */ +t8_cmesh_t +t8_create_cad_reference_pyramid (int face, int edge, double *parameters) +{ +#if T8_WITH_OCC + if (edge >= 0 && face >= 0) { + SC_ABORTF ("Please specify only an edge or a face."); + } + + const int num_vertices = t8_eclass_num_vertices[T8_ECLASS_PYRAMID]; + const int face_vertices = (face < 4 ? 3 : 4); /* The number of vertices of the pyramid face */ + + t8_cmesh_t cmesh; + t8_cmesh_init (&cmesh); + t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_PYRAMID); + + double vertices_face[75] = { 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, /* linked face: 0 */ + 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, /* linked face: 1 */ + 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, /* linked face: 2 */ + 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, /* linked face: 3 */ + 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1 }; /* linked face: 4 */ + + double vertices_edge[120] = { 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, /* linked edge: 0 */ + 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, /* linked edge: 1 */ + 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, /* linked edge: 2 */ + 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, /* linked edge: 3 */ + 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, /* linked edge: 4 */ + 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, /* linked edge: 5 */ + 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, /* linked edge: 6 */ + 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0 }; /* linked edge: 7 */ + + t8_cmesh_set_tree_vertices (cmesh, 0, (face >= 0 ? vertices_face + face * 15 : vertices_edge + edge * 15), + num_vertices); + + int faces[5] = { 0 }; + int edges[16] = { 0 }; + T8_ASSERT (face < 0 || edge < 0); + if (face >= 0) { + faces[face] = 1; + t8_cmesh_register_geometry ( + cmesh, 3, (face < 4 ? t8_create_cad_surface_shape_y_z () : t8_create_cad_surface_shape_x_y ())); + t8_cmesh_set_attribute (cmesh, 0, t8_get_package_id (), T8_CMESH_CAD_FACE_PARAMETERS_ATTRIBUTE_KEY + face, + parameters, 2 * face_vertices * sizeof (double), 0); + } + else if (edge >= 0) { + edges[edge] = 1; + t8_cmesh_register_geometry (cmesh, 3, t8_create_cad_curve_shape ()); + t8_cmesh_set_attribute (cmesh, 0, t8_get_package_id (), T8_CMESH_CAD_EDGE_PARAMETERS_ATTRIBUTE_KEY + edge, + parameters, 2 * sizeof (double), 0); + } + else { + /* Even if we do not want to link any geometry to the edges or faces, + * we have to create a geometry. Hence a cad geometry can only be created + * with an actual shape, we just create a geometry with a curve and do not + * link the curve to any edge. */ + t8_cmesh_register_geometry (cmesh, 3, t8_create_cad_curve_shape ()); + } + t8_cmesh_set_attribute (cmesh, 0, t8_get_package_id (), T8_CMESH_CAD_FACE_ATTRIBUTE_KEY, faces, 5 * sizeof (int), 0); + t8_cmesh_set_attribute (cmesh, 0, t8_get_package_id (), T8_CMESH_CAD_EDGE_ATTRIBUTE_KEY, edges, 16 * sizeof (int), 0); + t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD); + return cmesh; + +#else /* !T8_WITH_OCC */ + SC_ABORTF ("OCC not linked"); +#endif /* T8_WITH_OCC */ +} + +/** Tests the cad geometry functions for pyramids. + * \param [in] face The face to test. -1 for no face. + * \param [in] edge The edge to test. -1 for no edge. + * \param [in] parameters The parameters of the curve/surface. + * \param [in] test_ref_coords List of coordinates to test. + * \param [in] test_return_coords List of expected output coordinates. + * \param [in] comm The mpi communicator to use. + * \return Returns 1 if passed, 0 if failed. + */ +void +t8_test_geometry_cad_pyramid (int face, int edge, double *parameters, double *test_ref_coords, + double *test_return_coords) +{ +#if T8_WITH_OCC + double out_coords[3]; + double tol = T8_PRECISION_EPS > 1e-10 ? T8_PRECISION_EPS : 1e-10; + const int face_vertices = (face < 4 ? 3 : 4); + + t8_cmesh_t cmesh = t8_create_cad_reference_pyramid (face, edge, parameters); + + for (int i_coord = 0; i_coord < (face >= 0 ? face_vertices : 3); ++i_coord) { + t8_geometry_evaluate (cmesh, 0, test_ref_coords + i_coord * 3 + (face >= 0 ? face * 12 : edge * 9), 1, out_coords); + + EXPECT_VEC3_EQ (out_coords, test_return_coords + i_coord * 3, tol); + } + t8_cmesh_destroy (&cmesh); + +#else /* !T8_WITH_OCC */ + SC_ABORTF ("OCC not linked"); +#endif /* T8_WITH_OCC */ +} + +#if T8_WITH_OCC +TEST (t8_gtest_geometry_cad_pyramid, linked_faces) +{ + /* clang-format off */ + double test_ref_coords[60] + = { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, // face 0 + 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, // face 1 + 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, // face 2 + 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, // face 3 + 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0 }; // face 4 + /* The 2.0's at face 0-3 are placeholders, because these faces only have 3 vertices. */ + + double surface_test_return_coords_quad[12] + = { 0.0, 0.0, 0.0, // face vertex 0 + 1.0, 0.0, 0.0, // face vertex 1 + 0.0, 1.0, 0.0, // face vertex 2 + 1.0, 1.0, 0.0 }; // face vertex 3 + double surface_test_return_coords_tri[9] + = { 0.0, 0.0, 0.0, // face vertex 0 + 1.0, 0.0, 0.0, // face vertex 1 + 1.0, 0.0, 1.0 }; // face vertex 2 + + double surface_parameters[40] + = { 0, 1, 0, 0, 1, 1, 2, 2, // face 0 + 0, 0, 0, 1, 1, 1, 2, 2, // face 1 + 0, 0, 0, 1, 1, 1, 2, 2, // face 2 + 0, 1, 0, 0, 1, 1, 2, 2, // face 3 + 0, 0, 0, 1, 1, 0, 1, 1 }; // face 4 + /* The 2's of face 0-3 are placeholders, because these faces only have 3 vertices. */ + /* clang-format on */ + + for (int i_faces = 0; i_faces < 5; i_faces++) { + t8_test_geometry_cad_pyramid (i_faces, -1, surface_parameters + i_faces * 8, test_ref_coords, + (i_faces < 4 ? surface_test_return_coords_tri : surface_test_return_coords_quad)); + } +} + +TEST (t8_gtest_geometry_cad_pyramid, linked_edges) +{ + /* clang-format off */ + double test_ref_coords[72] + = { 0.0, 1.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, // edge 0 + 1.0, 0.0, 0.0, 1.0, 0.5, 0.0, 1.0, 1.0, 0.0, // edge 1 + 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, // edge 2 + 1.0, 1.0, 0.0, 0.5, 1.0, 0.0, 0.0, 1.0, 0.0, // edge 3 + 1.0, 1.0, 1.0, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, // edge 4 + 1.0, 1.0, 1.0, 1.0, 0.5, 0.5, 1.0, 0.0, 0.0, // edge 5 + 1.0, 1.0, 1.0, 1.0, 1.0, 0.5, 1.0, 1.0, 0.0, // edge 6 + 1.0, 1.0, 1.0, 0.5, 1.0, 0.5, 0.0, 1.0, 0.0 }; // edge 7 + double curve_test_return_coords[9] + = { 0.0, 0.0, 0.0, // edge vertex 0 + 0.5, 0.0, 0.0, // center of edge + 1.0, 0.0, 0.0 }; // edge vertex 1 + + /* TODO: Adjust coordinates of center of edge after implementation of pyramid mapping algorithms */ + + double curve_parameters[16] = { + 1, 0, // edge 0 + 1, 0, // edge 1 + 0, 1, // edge 2 + 1, 0, // edge 3 + 1, 0, // edge 4 + 1, 0, // edge 5 + 1, 0, // edge 6 + 1, 0 };// edge 7 + /* clang-format on */ + + for (int i_edges = 0; i_edges < 9; ++i_edges) { + t8_test_geometry_cad_pyramid (-1, i_edges, curve_parameters + i_edges * 2, test_ref_coords, + curve_test_return_coords); + } +} +#endif /* T8_WITH_OCC */ From 34f4664647a2751c634a148e3463af984a24e449 Mon Sep 17 00:00:00 2001 From: jfussbro Date: Fri, 5 Apr 2024 11:29:21 +0200 Subject: [PATCH 03/14] added comment with link to issue --- .../t8_gtest_geometry_cad.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx index 4c4383ebcf..f259057597 100644 --- a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx +++ b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx @@ -881,8 +881,12 @@ t8_test_geometry_cad_pyramid (int face, int edge, double *parameters, double *te #endif /* T8_WITH_OCC */ } +/* This test covers the functionality described in Issue: [https://github.com/DLR-AMR/t8code/issues/1012] + * Remove `DISABLED_` from the name of the Test(suite) or use `--gtest_also_run_disabled_tests` when you start working on the issue. + */ + #if T8_WITH_OCC -TEST (t8_gtest_geometry_cad_pyramid, linked_faces) +TEST (DISABLED_t8_gtest_geometry_cad_pyramid, linked_faces) { /* clang-format off */ double test_ref_coords[60] @@ -918,7 +922,11 @@ TEST (t8_gtest_geometry_cad_pyramid, linked_faces) } } -TEST (t8_gtest_geometry_cad_pyramid, linked_edges) +/* This test covers the functionality described in Issue: [https://github.com/DLR-AMR/t8code/issues/1012] + * Remove `DISABLED_` from the name of the Test(suite) or use `--gtest_also_run_disabled_tests` when you start working on the issue. + */ + +TEST (DISABLED_t8_gtest_geometry_cad_pyramid, linked_edges) { /* clang-format off */ double test_ref_coords[72] From 16ff7e1f5924149ce160936ecf6d024f11c91764 Mon Sep 17 00:00:00 2001 From: jfussbro Date: Mon, 15 Apr 2024 16:01:58 +0200 Subject: [PATCH 04/14] Corrected fault in lookup table --- src/t8_eclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_eclass.c b/src/t8_eclass.c index bf2dfb0cd0..c9f6ff5ca8 100644 --- a/src/t8_eclass.c +++ b/src/t8_eclass.c @@ -83,7 +83,7 @@ const int t8_edge_vertex_to_tree_vertex[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2] { 3, 7 } }, /* hex */ { { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 1, 3 }, { 2, 3 } }, /* tet */ { { -1 } }, /* prism */ - { { 0, 2 }, { 1, 3 }, { 0, 1 }, { 2, 3 }, { 0, 4 }, { 1, 4 }, { 2, 4 }, { 3, 4 } } /* pyramid */ + { { 0, 2 }, { 1, 3 }, { 0, 1 }, { 2, 3 }, { 0, 4 }, { 1, 4 }, { 3, 4 }, { 2, 4 } } /* pyramid */ }; /* TODO: prism, pyramid */ From 01cdd294a45b3e27a69d79da9eaa35b8bbec679e Mon Sep 17 00:00:00 2001 From: jfussbro Date: Mon, 15 Apr 2024 16:08:25 +0200 Subject: [PATCH 05/14] Added mapping algorithm for cad pyramids --- src/t8_geometry/t8_geometry_helpers.c | 70 ++++++ src/t8_geometry/t8_geometry_helpers.h | 20 ++ .../t8_geometry_cad.cxx | 233 ++++++++++++++++++ .../t8_geometry_cad.hxx | 12 + 4 files changed, 335 insertions(+) diff --git a/src/t8_geometry/t8_geometry_helpers.c b/src/t8_geometry/t8_geometry_helpers.c index 06e7926e61..93247a6a82 100644 --- a/src/t8_geometry/t8_geometry_helpers.c +++ b/src/t8_geometry/t8_geometry_helpers.c @@ -411,6 +411,76 @@ t8_geom_get_scaling_factor_of_edge_on_face_tet (const int edge, const int face, return (1.0 - (orthogonal_vector[edge][face] / max_orthogonal_vector[edge][face])); } +double +t8_geom_get_scaling_factor_of_edge_on_face_pyramid (const int edge, const int face, const double *ref_coords) +{ + /* Save the orthogonal direction and the maximum of that direction + * of an edge in reference space on one of the neighbouring faces. + * /| + * / | + * / | + * / | + * / |--edge + * / --|--face + * / | + * / <~~| orthogonal direction + * /<----o--| maximum othogonal direction + * /_________| + */ + const double orthogonal_direction[8][5] + = { { ref_coords[2], 0, 0, 0, ref_coords[0] }, + { 0, ref_coords[2], 0, 0, (1 - ref_coords[0]) }, + { 0, 0, ref_coords[2], 0, ref_coords[1] }, + { 0, 0, 0, ref_coords[2], (1 - ref_coords[1]) }, + { (ref_coords[1] - ref_coords[2]), 0, (ref_coords[0] - ref_coords[2]), 0, 0 }, + { 0, (ref_coords[1] - ref_coords[2]), (1 - ref_coords[0]), 0, 0 }, + { 0, (1 - ref_coords[1]), 0, (1 - ref_coords[0]), 0 }, + { (1 - ref_coords[1]), 0, 0, (ref_coords[0] - ref_coords[2]), 0 } }; + const double max_orthogonal_direction[8][5] = { { ref_coords[1], 0, 0, 0, 1 }, + { 0, ref_coords[1], 0, 0, 1 }, + { 0, 0, ref_coords[0], 0, 1 }, + { 0, 0, 0, ref_coords[0], 1 }, + { (1 - ref_coords[2]), 0, (1 - ref_coords[0]), 0, 0 }, + { 0, (1 - ref_coords[2]), (1 - ref_coords[2]), 0, 0 }, + { 0, (1 - ref_coords[2]), 0, (1 - ref_coords[2]), 0 }, + { (1 - ref_coords[2]), 0, 0, (1 - ref_coords[2]), 0 } }; + + /* Check that the combination of edge and face is valid */ + T8_ASSERT (face == t8_edge_to_face[T8_ECLASS_PYRAMID][edge][0] + || face == t8_edge_to_face[T8_ECLASS_PYRAMID][edge][1]); + + /* If the maximum orthogonal direction is 1, the reference coordinate lies on + * one of the edge nodes and the scaling factor is therefore 0, because the displacement + * at the nodes is always 0. + * In all other cases the scaling factor is determined with one minus the relation of the orthogonal direction + * to the maximum orthogonal direction. */ + if (max_orthogonal_direction[edge][face] == 0) { + return 0; + } + else { + return (1.0 - (orthogonal_direction[edge][face] / max_orthogonal_direction[edge][face])); + } +} + +double +t8_geom_get_scaling_factor_face_through_volume_pyramid (const int face, const double *ref_coords) +{ + /* The function computes the scaling factor of any displacement of a pyramid face, throughout the + * volume of the element. The scaling factor is calculated accordingly to + * t8_geom_get_scaling_factor_of_edge_on_face_pyramid with 1 - (orthogonal_direction / max_orthogonal_direction) */ + + const double orthogonal_direction[5] = { (ref_coords[0] - ref_coords[2]), (1 - ref_coords[0]), + (ref_coords[1] - ref_coords[2]), (1 - ref_coords[1]), ref_coords[2] }; + const double max_orthogonal_direction[5] + = { (1 - ref_coords[2]), (1 - ref_coords[2]), (1 - ref_coords[2]), (1 - ref_coords[2]), ref_coords[1] }; + + if (max_orthogonal_direction[face] == 0) { + return 0; + } + + return (1.0 - (orthogonal_direction[face] / max_orthogonal_direction[face])); +} + void t8_geom_get_tet_face_intersection (const int face, const double *ref_coords, double face_intersection[3]) { diff --git a/src/t8_geometry/t8_geometry_helpers.h b/src/t8_geometry/t8_geometry_helpers.h index fc08fb3cfe..20d6355c0f 100644 --- a/src/t8_geometry/t8_geometry_helpers.h +++ b/src/t8_geometry/t8_geometry_helpers.h @@ -152,6 +152,26 @@ t8_geom_get_scaling_factor_of_edge_on_face_tet (int edge_index, int face_index, */ void t8_geom_get_tet_face_intersection (const int face_index, const double *ref_coords, double face_intersection[3]); + +/** Calculates the scaling factor for the displacement of an edge over a face of a pyramid element. + * \param [in] edge_index Index of the edge, whose displacement should be scaled. + * \param [in] face_index Index of the face, the displacement should be scaled on. + * \param [in] ref_coords Array containing the coordinates of the reference point. + * \return The scaling factor of the edge displacement on the face + * at the point of the reference coordinates. + */ +double +t8_geom_get_scaling_factor_of_edge_on_face_pyramid (int edge_index, int face_index, const double *ref_coords); + +/** Calculates the scaling factor for the displacement of an face through the volume of a pyramid element. + * \param [in] face_index Index of the displaced face. + * \param [in] ref_coords Array containing the coordinates of the reference point. + * \return The scaling factor of the face displacement + * at the point of the reference coordinates inside the pyramid volume. + */ +double +t8_geom_get_scaling_factor_face_through_volume_pyramid (const int face, const double *ref_coords); + /** Check if a point lies inside a vertex * * \param[in] vertex_coords The coordinates of the vertex diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.cxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.cxx index 2ba9eb3c2f..cf2601d911 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.cxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.cxx @@ -108,6 +108,9 @@ t8_geometry_cad::t8_geom_evaluate (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const case T8_ECLASS_TET: t8_geometry_cad::t8_geom_evaluate_cad_tet (cmesh, gtreeid, ref_coords, num_coords, out_coords); break; + case T8_ECLASS_PYRAMID: + t8_geometry_cad::t8_geom_evaluate_cad_pyramid (cmesh, gtreeid, ref_coords, num_coords, out_coords); + break; default: SC_ABORTF ("Error: Curved cad geometry for element type %s not yet implemented. \n", t8_eclass_to_string[active_tree_class]); @@ -1171,6 +1174,236 @@ t8_geometry_cad::t8_geom_evaluate_cad_hex (t8_cmesh_t cmesh, t8_gloidx_t gtreeid T8_FREE (interpolated_coords); } +void +t8_geometry_cad::t8_geom_evaluate_cad_pyramid (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, + const size_t num_coords, double *out_coords) const +{ + T8_ASSERT (active_tree_class == T8_ECLASS_PYRAMID); + + /* The array contains the coordinate [x,y,z] to interpolate for each edge of a pyramid. + * For example: On edge 0 the interpolation coordinate is y. */ + const int t8_interpolation_coefficient_pyramid_edge[8] = { 1, 1, 0, 0, 2, 2, 2, 2 }; + /* The array contains the coordinates [x,y,z] to interpolate for each face of a pyramid. + * For example: On face 0 the interpolation coordinates are y and z. */ + const int t8_interpolation_coefficients_pyramid_face[5][2] = { { 1, 2 }, { 1, 2 }, { 0, 2 }, { 0, 2 }, { 0, 1 } }; + + /* Compute coordinates in global space from ref_coords in order to shift them afterwards */ + t8_geom_compute_linear_geometry (active_tree_class, active_tree_vertices, ref_coords, num_coords, out_coords); + + const t8_locidx_t ltreeid = t8_cmesh_get_local_id (cmesh, gtreeid); + double interpolated_curve_param, interpolated_surface_params[2], cur_delta[3]; + gp_Pnt pnt; + double interpolated_coords[3], interpolation_coeffs[3], temp_face_vertices[T8_ECLASS_MAX_CORNERS_2D * 3], + temp_edge_vertices[2 * 3]; + Handle_Geom_Curve curve; + Handle_Geom_Surface surface; + Standard_Real first, last; + + /* Check each edge for a geometry. */ + for (int i_edge = 0; i_edge < t8_eclass_num_edges[active_tree_class]; ++i_edge) { + /* We have to check for curves as well as surfaces. Linked curves are stored + * in the first half of the array, surfaces in the second. + * If a curve is connected to this edge we have to also check, + * if a surface is connected to at least one of the two adjacent faces. */ + if (edges[i_edge] > 0 || edges[i_edge + t8_eclass_num_edges[active_tree_class]] > 0) { + /* Check if only a surface or a curve is present. Abort if both is true. */ + T8_ASSERT (!(edges[i_edge] > 0) != !(edges[i_edge + t8_eclass_num_edges[active_tree_class]] > 0)); + /* + * z y + * | _- + * |_- + * 0----x 4 + * _- /\ + * _- / |\ + * _- / | \ + * E7 / E6 \ + * _- / | \ + * _- E4 | E5 + * _- / | \ + * 2 -___E3__ /______ 3 \ + * \ / -_ \ + * \ / E1 \ + * E0 / -_ \ + * \ / -_ \ + * 0 ___________E2__________ 1 + * + */ + + /* Save the edge vertices temporarily. */ + t8_geom_get_edge_vertices (active_tree_class, active_tree_vertices, i_edge, 3, temp_edge_vertices); + + /* Loop for batch processing of reference points */ + for (size_t i_coord = 0; i_coord < num_coords; ++i_coord) { + const int offset_3d = i_coord * 3; + /* Interpolate between the edge vertices */ + t8_geom_linear_interpolation (&ref_coords[t8_interpolation_coefficient_pyramid_edge[i_edge] + offset_3d], + temp_edge_vertices, 3, 1, interpolated_coords); + + /* Get the parameters of the curve/surface linked to the current edge */ + const double *parameters = (double *) t8_cmesh_get_attribute ( + cmesh, t8_get_package_id (), T8_CMESH_CAD_EDGE_PARAMETERS_ATTRIBUTE_KEY + i_edge, ltreeid); + T8_ASSERT (parameters != NULL); + + /* Curves have only one parameter u, surfaces have two, u and v. + * Therefore, we have to distinguish if the edge has a curve or surface linked to it. */ + if (edges[i_edge] > 0) { + /* Linear interpolation between parameters */ + t8_geom_linear_interpolation (&ref_coords[t8_interpolation_coefficient_pyramid_edge[i_edge] + offset_3d], + parameters, 1, 1, &interpolated_curve_param); + + T8_ASSERT (edges[i_edge] <= cad_shape_edge_map.Size ()); + curve = BRep_Tool::Curve (TopoDS::Edge (cad_shape_edge_map.FindKey (edges[i_edge])), first, last); + + /* Check if curve are valid */ + T8_ASSERT (!curve.IsNull ()); + + /* Compute point on curve with interpolated parameters. */ + curve->D0 (interpolated_curve_param, pnt); + } + else { + /* Linear interpolation between parameters */ + t8_geom_linear_interpolation (&ref_coords[t8_interpolation_coefficient_pyramid_edge[i_edge] + offset_3d], + parameters, 2, 1, interpolated_surface_params); + + T8_ASSERT (edges[i_edge + t8_eclass_num_edges[active_tree_class]] <= cad_shape_face_map.Size ()); + surface = BRep_Tool::Surface ( + TopoDS::Face (cad_shape_face_map.FindKey (edges[i_edge + t8_eclass_num_edges[active_tree_class]]))); + + /* Check if surface is valid */ + T8_ASSERT (!surface.IsNull ()); + + /* Compute point on surface with interpolated parameters */ + surface->D0 (interpolated_surface_params[0], interpolated_surface_params[1], pnt); + } + + /* Compute displacement between vertex interpolation and curve evaluation with interpolated parameters */ + cur_delta[0] = pnt.X () - interpolated_coords[0]; + cur_delta[1] = pnt.Y () - interpolated_coords[1]; + cur_delta[2] = pnt.Z () - interpolated_coords[2]; + + /* Save the scaling factor for both neighbouring faces of the current edge. + * The scaling factors scale the edge displacement orthogonal along the adjacent faces. */ + double scaling_factor_neigh_face_1 = t8_geom_get_scaling_factor_of_edge_on_face_pyramid ( + i_edge, t8_edge_to_face[active_tree_class][i_edge][0], ref_coords + offset_3d); + double scaling_factor_neigh_face_2 = t8_geom_get_scaling_factor_of_edge_on_face_pyramid ( + i_edge, t8_edge_to_face[active_tree_class][i_edge][1], ref_coords + offset_3d); + double scaling_factor = scaling_factor_neigh_face_1 * scaling_factor_neigh_face_2; + + /* Add edge displacements to out_coords */ + out_coords[offset_3d + 0] += cur_delta[0] * scaling_factor; + out_coords[offset_3d + 1] += cur_delta[1] * scaling_factor; + out_coords[offset_3d + 2] += cur_delta[2] * scaling_factor; + } + } + } + + /* Iterate over each face to calculate the displacements generated by each face */ + for (int i_faces = 0; i_faces < t8_eclass_num_faces[active_tree_class]; ++i_faces) { + /* Check if face has a linked surface */ + if (faces[i_faces] > 0) { + /* Save the face vertices for later usage */ + t8_geom_get_face_vertices (active_tree_class, active_tree_vertices, i_faces, 3, temp_face_vertices); + + /* Retrieve surface parameters of nodes */ + const double *surface_parameters = (double *) t8_cmesh_get_attribute ( + cmesh, t8_get_package_id (), T8_CMESH_CAD_FACE_PARAMETERS_ATTRIBUTE_KEY + i_faces, ltreeid); + T8_ASSERT (surface_parameters != NULL); + + /* Loop for batch processing of reference points */ + for (size_t coord = 0; coord < num_coords; ++coord) { + const int offset_3d = coord * 3; + + double face_displacement_from_edges[3] = { 0 }; + + /* Iterate over each edge of face */ + for (int i_face_edge = 0; i_face_edge < t8_eclass_num_edges[t8_eclass_face_types[active_tree_class][i_faces]]; + ++i_face_edge) { + + const int i_tree_edge = t8_face_edge_to_tree_edge[active_tree_class][i_faces][i_face_edge]; + const int interpolation_coeff = t8_interpolation_coefficient_pyramid_edge[i_tree_edge]; + + /* Check if curve is present */ + if (edges[i_tree_edge] > 0) { + /* Convert global tree id to local tree id, for receiving cmesh attributes. */ + t8_locidx_t ltreeid = t8_cmesh_get_local_id (cmesh, gtreeid); + /* Retrieve parameters of nodes of the curve */ + const double *curve_parameters = (double *) t8_cmesh_get_attribute ( + cmesh, t8_get_package_id (), T8_CMESH_CAD_EDGE_PARAMETERS_ATTRIBUTE_KEY + i_tree_edge, ltreeid); + T8_ASSERT (curve_parameters != NULL); + + /* Interpolate linearly between the parameters of the two nodes on the curve */ + t8_geom_linear_interpolation (&ref_coords[interpolation_coeff + offset_3d], curve_parameters, 1, 1, + &interpolated_curve_param); + + /* Do the same interpolation but this time between the coordinates of the same two nodes as above */ + double interpolated_edge_coordinates[3]; + double edge_vertices_on_face[6]; + t8_geom_get_edge_vertices (active_tree_class, active_tree_vertices, i_tree_edge, 3, edge_vertices_on_face); + t8_geom_linear_interpolation (&ref_coords[interpolation_coeff + offset_3d], edge_vertices_on_face, 3, 1, + interpolated_edge_coordinates); + + /* Retrieve the curve of the edge */ + T8_ASSERT (edges[i_tree_edge] <= cad_shape_edge_map.Size ()); + curve = BRep_Tool::Curve (TopoDS::Edge (cad_shape_edge_map.FindKey (edges[i_tree_edge])), first, last); + /* Check if curve is valid */ + T8_ASSERT (!curve.IsNull ()); + /* Calculate point on curve with interpolated parameters */ + curve->D0 (interpolated_curve_param, pnt); + + /* Compute the scaling_factor of the edge displacement on the current face */ + double scaling_factor = t8_geom_get_scaling_factor_of_edge_on_face_pyramid ( + t8_face_edge_to_tree_edge[active_tree_class][i_faces][i_face_edge], i_faces, ref_coords + offset_3d); + + /* Save the calculated and scaled displacement */ + for (int dim = 0; dim <= 2; ++dim) { + face_displacement_from_edges[dim] + += (pnt.Coord (dim + 1) - interpolated_edge_coordinates[dim]) * scaling_factor; + } + } + } + + interpolation_coeffs[0] = ref_coords[t8_interpolation_coefficients_pyramid_face[i_faces][0] + offset_3d]; + interpolation_coeffs[1] = ref_coords[t8_interpolation_coefficients_pyramid_face[i_faces][1] + offset_3d]; + + /* Do a bilinear interpolation between the nodes of the face and the parameters of the face */ + if (i_faces == 4) { + t8_geom_linear_interpolation (interpolation_coeffs, temp_face_vertices, 3, 2, interpolated_coords); + t8_geom_linear_interpolation (interpolation_coeffs, surface_parameters, 2, 2, interpolated_surface_params); + } + else { + t8_geom_triangular_interpolation (interpolation_coeffs, temp_face_vertices, 3, 2, interpolated_coords); + t8_geom_triangular_interpolation (interpolation_coeffs, surface_parameters, 2, 2, + interpolated_surface_params); + } + + for (int dim = 0; dim < T8_ECLASS_MAX_DIM; ++dim) { + /* Correct the interpolated coordinates with the displacement generated by the linked edges */ + interpolated_coords[dim] += face_displacement_from_edges[dim]; + } + + /* Retrieve the surface of the edge */ + T8_ASSERT (faces[i_faces] <= cad_shape_face_map.Size ()); + surface = BRep_Tool::Surface (TopoDS::Face (cad_shape_face_map.FindKey (faces[i_faces]))); + + /* Check if surface is valid */ + T8_ASSERT (!surface.IsNull ()); + + /* Compute point on surface with interpolated parameters */ + surface->D0 (interpolated_surface_params[0], interpolated_surface_params[1], pnt); + + /* Compute the displacement between surface and interpolated coords, scale them with the appropriate scaling_factor + * and add them to the out_coords. */ + double scaling_factor + = t8_geom_get_scaling_factor_face_through_volume_pyramid (i_faces, ref_coords + offset_3d); + + out_coords[offset_3d] += (pnt.X () - interpolated_coords[0]) * scaling_factor; + out_coords[offset_3d + 1] += (pnt.Y () - interpolated_coords[1]) * scaling_factor; + out_coords[offset_3d + 2] += (pnt.Z () - interpolated_coords[2]) * scaling_factor; + } + } + } +} + int t8_geometry_cad::t8_geom_is_line (const int curve_index) const { diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.hxx index d4981dac1c..82cb8b61f9 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.hxx @@ -344,6 +344,18 @@ struct t8_geometry_cad: public t8_geometry_with_vertices t8_geom_evaluate_cad_hex (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, double *out_coords) const; + /** + * Maps points in the reference space \f$ \f$ [0,1]^3 \f$ \f$ to \f$ \mathbb{R}^3 \f$. Only for pyramid trees. + * \param [in] cmesh The cmesh in which the point lies. + * \param [in] gtreeid The global tree (of the cmesh) in which the reference point is. + * \param [in] ref_coords Array of \a dimension x \a num_coords many entries, specifying points in \f$ [0,1]^\mathrm{dim} \f$. + * \param [in] num_coords Amount of points of /f$ \mathrm{dim} /f$ to map. + * \param [out] out_coords The mapped coordinates in physical space of \a ref_coords. The length is \a num_coords * 3. + */ + void + t8_geom_evaluate_cad_pyramid (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, + const size_t num_coords, double *out_coords) const; + const int *edges; /**< The linked edges of the currently active tree. */ const int *faces; /**< The linked faces of the currently active tree. */ TopoDS_Shape cad_shape; /**< cad geometry */ From aaa391104e901af3853b48d037c802dfef7f4562 Mon Sep 17 00:00:00 2001 From: jfussbro Date: Mon, 15 Apr 2024 16:09:04 +0200 Subject: [PATCH 06/14] Adapted test for cad pyramids to now existing mapping algorithm --- .../t8_gtest_geometry_cad.cxx | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx index f259057597..050eda6ba9 100644 --- a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx +++ b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx @@ -881,12 +881,8 @@ t8_test_geometry_cad_pyramid (int face, int edge, double *parameters, double *te #endif /* T8_WITH_OCC */ } -/* This test covers the functionality described in Issue: [https://github.com/DLR-AMR/t8code/issues/1012] - * Remove `DISABLED_` from the name of the Test(suite) or use `--gtest_also_run_disabled_tests` when you start working on the issue. - */ - #if T8_WITH_OCC -TEST (DISABLED_t8_gtest_geometry_cad_pyramid, linked_faces) +TEST (t8_gtest_geometry_cad_pyramid, linked_faces) { /* clang-format off */ double test_ref_coords[60] @@ -903,9 +899,9 @@ TEST (DISABLED_t8_gtest_geometry_cad_pyramid, linked_faces) 0.0, 1.0, 0.0, // face vertex 2 1.0, 1.0, 0.0 }; // face vertex 3 double surface_test_return_coords_tri[9] - = { 0.0, 0.0, 0.0, // face vertex 0 - 1.0, 0.0, 0.0, // face vertex 1 - 1.0, 0.0, 1.0 }; // face vertex 2 + = { 1.0, 0.0, 0.0, // face vertex 0 + 1.0, 1.0, 0.0, // face vertex 1 + 1.0, 1.0, 1.0 }; // face vertex 2 double surface_parameters[40] = { 0, 1, 0, 0, 1, 1, 2, 2, // face 0 @@ -922,11 +918,7 @@ TEST (DISABLED_t8_gtest_geometry_cad_pyramid, linked_faces) } } -/* This test covers the functionality described in Issue: [https://github.com/DLR-AMR/t8code/issues/1012] - * Remove `DISABLED_` from the name of the Test(suite) or use `--gtest_also_run_disabled_tests` when you start working on the issue. - */ - -TEST (DISABLED_t8_gtest_geometry_cad_pyramid, linked_edges) +TEST (t8_gtest_geometry_cad_pyramid, linked_edges) { /* clang-format off */ double test_ref_coords[72] @@ -940,14 +932,12 @@ TEST (DISABLED_t8_gtest_geometry_cad_pyramid, linked_edges) 1.0, 1.0, 1.0, 0.5, 1.0, 0.5, 0.0, 1.0, 0.0 }; // edge 7 double curve_test_return_coords[9] = { 0.0, 0.0, 0.0, // edge vertex 0 - 0.5, 0.0, 0.0, // center of edge + 0.4999500215, 0.0000523914, 0.4000007585, // center of edge 1.0, 0.0, 0.0 }; // edge vertex 1 - - /* TODO: Adjust coordinates of center of edge after implementation of pyramid mapping algorithms */ double curve_parameters[16] = { 1, 0, // edge 0 - 1, 0, // edge 1 + 0, 1, // edge 1 0, 1, // edge 2 1, 0, // edge 3 1, 0, // edge 4 @@ -956,7 +946,7 @@ TEST (DISABLED_t8_gtest_geometry_cad_pyramid, linked_edges) 1, 0 };// edge 7 /* clang-format on */ - for (int i_edges = 0; i_edges < 9; ++i_edges) { + for (int i_edges = 0; i_edges < 8; ++i_edges) { t8_test_geometry_cad_pyramid (-1, i_edges, curve_parameters + i_edges * 2, test_ref_coords, curve_test_return_coords); } From 5f71d4d15393e7fb651546ba48d73c2ddd4f8f2a Mon Sep 17 00:00:00 2001 From: jfussbro Date: Tue, 23 Apr 2024 10:55:03 +0200 Subject: [PATCH 07/14] enabled read-in of cad-linked pyramids --- src/t8_cmesh/t8_cmesh_readmshfile.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh_readmshfile.cxx b/src/t8_cmesh/t8_cmesh_readmshfile.cxx index 7b807d2b8a..d1d41ee20d 100644 --- a/src/t8_cmesh/t8_cmesh_readmshfile.cxx +++ b/src/t8_cmesh/t8_cmesh_readmshfile.cxx @@ -1017,9 +1017,10 @@ t8_cmesh_msh_file_4_read_eles (t8_cmesh_t cmesh, FILE *fp, sc_hash_t *vertices, const t8_geometry_cad_c *cad_geometry = dynamic_cast (cad_geometry_base); /* Check for right element class */ if (eclass != T8_ECLASS_TRIANGLE && eclass != T8_ECLASS_QUAD && eclass != T8_ECLASS_TET - && eclass != T8_ECLASS_HEX) { - t8_errorf ("%s element detected. The occ geometry currently only supports quad, tri, tet and hex elements.", - t8_eclass_to_string[eclass]); + && eclass != T8_ECLASS_HEX && eclass != T8_ECLASS_PYRAMID) { + t8_errorf ( + "%s element detected. The occ geometry currently only supports quad, tri, tet, hex and pyramid elements.", + t8_eclass_to_string[eclass]); goto die_ele; } int tree_is_linked = 0; From 0dae72ba86431aaa8b90d6572854bbeed6ac480a Mon Sep 17 00:00:00 2001 From: jfussbro Date: Wed, 24 Apr 2024 10:14:47 +0200 Subject: [PATCH 08/14] bug fix - wrong scaling factor of edges of pyramid face 4 --- src/t8_geometry/t8_geometry_helpers.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/t8_geometry/t8_geometry_helpers.c b/src/t8_geometry/t8_geometry_helpers.c index 93247a6a82..052486b6ac 100644 --- a/src/t8_geometry/t8_geometry_helpers.c +++ b/src/t8_geometry/t8_geometry_helpers.c @@ -472,10 +472,11 @@ t8_geom_get_scaling_factor_face_through_volume_pyramid (const int face, const do const double orthogonal_direction[5] = { (ref_coords[0] - ref_coords[2]), (1 - ref_coords[0]), (ref_coords[1] - ref_coords[2]), (1 - ref_coords[1]), ref_coords[2] }; const double max_orthogonal_direction[5] - = { (1 - ref_coords[2]), (1 - ref_coords[2]), (1 - ref_coords[2]), (1 - ref_coords[2]), ref_coords[1] }; + = { (1 - ref_coords[2]), (1 - ref_coords[2]), (1 - ref_coords[2]), (1 - ref_coords[2]), + (ref_coords[0] >= ref_coords[1] ? ref_coords[1] : ref_coords[0]) }; if (max_orthogonal_direction[face] == 0) { - return 0; + return 1.0; } return (1.0 - (orthogonal_direction[face] / max_orthogonal_direction[face])); From 156f53c1a695d031418e7ce8efa3ae73cca22cf5 Mon Sep 17 00:00:00 2001 From: jfussbro Date: Wed, 24 Apr 2024 10:37:58 +0200 Subject: [PATCH 09/14] added element centroid as testing point --- .../t8_gtest_geometry_cad.cxx | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx index 050eda6ba9..3df7527af1 100644 --- a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx +++ b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx @@ -869,8 +869,8 @@ t8_test_geometry_cad_pyramid (int face, int edge, double *parameters, double *te t8_cmesh_t cmesh = t8_create_cad_reference_pyramid (face, edge, parameters); - for (int i_coord = 0; i_coord < (face >= 0 ? face_vertices : 3); ++i_coord) { - t8_geometry_evaluate (cmesh, 0, test_ref_coords + i_coord * 3 + (face >= 0 ? face * 12 : edge * 9), 1, out_coords); + for (int i_coord = 0; i_coord < (face >= 0 ? face_vertices + 1 : 3); ++i_coord) { + t8_geometry_evaluate (cmesh, 0, test_ref_coords + i_coord * 3 + (face >= 0 ? face * 15 : edge * 9), 1, out_coords); EXPECT_VEC3_EQ (out_coords, test_return_coords + i_coord * 3, tol); } @@ -885,23 +885,26 @@ t8_test_geometry_cad_pyramid (int face, int edge, double *parameters, double *te TEST (t8_gtest_geometry_cad_pyramid, linked_faces) { /* clang-format off */ - double test_ref_coords[60] - = { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, // face 0 - 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, // face 1 - 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, // face 2 - 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, // face 3 - 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0 }; // face 4 + /* Reference coordinates of each face vertex and the centroid of the pyramid */ + double test_ref_coords[75] + = { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.6, 0.6, 0.2, 2.0, 2.0, 2.0, // face 0 + 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.6, 0.6, 0.2, 2.0, 2.0, 2.0, // face 1 + 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.6, 0.6, 0.2, 2.0, 2.0, 2.0, // face 2 + 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.6, 0.6, 0.2, 2.0, 2.0, 2.0, // face 3 + 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.6, 0.6, 0.2 }; // face 4 /* The 2.0's at face 0-3 are placeholders, because these faces only have 3 vertices. */ - double surface_test_return_coords_quad[12] + double surface_test_return_coords_quad[15] = { 0.0, 0.0, 0.0, // face vertex 0 1.0, 0.0, 0.0, // face vertex 1 0.0, 1.0, 0.0, // face vertex 2 - 1.0, 1.0, 0.0 }; // face vertex 3 - double surface_test_return_coords_tri[9] + 1.0, 1.0, 0.0, // face vertex 3 + 0.6357349585, 0.6357349585, 0.1438333846 }; // shifted centroid of the pyramid + double surface_test_return_coords_tri[12] = { 1.0, 0.0, 0.0, // face vertex 0 1.0, 1.0, 0.0, // face vertex 1 - 1.0, 1.0, 1.0 }; // face vertex 2 + 1.0, 1.0, 1.0, // face vertex 2 + 0.6737526363, 0.5930049972, 0.1275036282 }; // shifted centroid of the pyramid double surface_parameters[40] = { 0, 1, 0, 0, 1, 1, 2, 2, // face 0 From a95045fd122aa13ce8d0d14ea80e71e6df3132f2 Mon Sep 17 00:00:00 2001 From: jfussbro Date: Mon, 29 Apr 2024 14:39:04 +0200 Subject: [PATCH 10/14] bug fix --- .../t8_geometry_implementations/t8_gtest_geometry_cad.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx index e236318a72..1bc8ae9d05 100644 --- a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx +++ b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx @@ -451,7 +451,7 @@ t8_create_cad_reference_tet (int face, int edge, double *parameters) T8_ASSERT (face < 0 || edge < 0); if (face >= 0) { faces[face] = 1; - t8_cmesh_register_geometry (cmesh, 3, t8_create_cad_surface_shape ()); + t8_cmesh_register_geometry (cmesh, 3, t8_create_cad_surface_shape_x_z ()); t8_cmesh_set_attribute (cmesh, 0, t8_get_package_id (), T8_CMESH_CAD_FACE_PARAMETERS_ATTRIBUTE_KEY + face, parameters, 6 * sizeof (double), 0); } From 4b69d744ce6383f0f58f02aa027940c2d9d5b2cd Mon Sep 17 00:00:00 2001 From: jfussbro Date: Wed, 22 May 2024 14:10:15 +0200 Subject: [PATCH 11/14] indent --- src/t8_cmesh/t8_cmesh_readmshfile.cxx | 6 +++--- src/t8_eclass.c | 8 ++++---- .../t8_geometry_implementations/t8_geometry_cad.hxx | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh_readmshfile.cxx b/src/t8_cmesh/t8_cmesh_readmshfile.cxx index b17d256ddd..9d9079cb27 100644 --- a/src/t8_cmesh/t8_cmesh_readmshfile.cxx +++ b/src/t8_cmesh/t8_cmesh_readmshfile.cxx @@ -1018,9 +1018,9 @@ t8_cmesh_msh_file_4_read_eles (t8_cmesh_t cmesh, FILE *fp, sc_hash_t *vertices, /* Check for right element class */ if (eclass != T8_ECLASS_TRIANGLE && eclass != T8_ECLASS_QUAD && eclass != T8_ECLASS_TET && eclass != T8_ECLASS_HEX && eclass != T8_ECLASS_PRISM && eclass != T8_ECLASS_PYRAMID) { - t8_errorf ( - "%s element detected. The occ geometry currently only supports quad, tri, tet, hex, prism and pyramid elements.", - t8_eclass_to_string[eclass]); + t8_errorf ("%s element detected. The occ geometry currently only supports quad, tri, tet, hex, prism and " + "pyramid elements.", + t8_eclass_to_string[eclass]); goto die_ele; } int tree_is_linked = 0; diff --git a/src/t8_eclass.c b/src/t8_eclass.c index e79d39ad3c..02f42232d0 100644 --- a/src/t8_eclass.c +++ b/src/t8_eclass.c @@ -51,8 +51,8 @@ const int t8_face_edge_to_tree_edge[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECL { { -1 } }, /* prism */ { { 0, 4, 7 }, { 1, 5, 6 }, { 2, 4, 5 }, { 3, 6, 7 }, { 0, 1, 2, 3 } } /* pyramid */ ======= - { { 0, 7, 3, 6 }, { 1, 8, 4, 7 }, { 2, 6, 5, 8 }, { 0, 1, 2 }, { 3, 4, 5 } }, /* prism */ - { { -1 } }, /* pyramid */ + { { 0, 7, 3, 6 }, { 1, 8, 4, 7 }, { 2, 6, 5, 8 }, { 0, 1, 2 }, { 3, 4, 5 } }, /* prism */ + { { -1 } }, /* pyramid */ >>>>>>> origin/main }; @@ -68,8 +68,8 @@ const int t8_face_to_edge_neighbor[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLA { { -1 } }, /* prism */ { { 2, 3, 5, 6 }, { 2, 3, 4, 7 }, { 0, 1, 6, 7 }, { 0, 1, 4, 5 }, { 4, 5, 6, 7 } } /* pyramid */ ======= - { { 1, 2, 4, 5 }, { 0, 2, 3, 5 }, { 0, 1, 3, 4 }, { 6, 7, 8 }, { 6, 7, 8 } }, /* prism */ - { { -1 } }, /* pyramid */ + { { 1, 2, 4, 5 }, { 0, 2, 3, 5 }, { 0, 1, 3, 4 }, { 6, 7, 8 }, { 6, 7, 8 } }, /* prism */ + { { -1 } }, /* pyramid */ >>>>>>> origin/main }; diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.hxx index 1e710185f0..9588ddbc91 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.hxx @@ -343,7 +343,7 @@ struct t8_geometry_cad: public t8_geometry_with_vertices void t8_geom_evaluate_cad_hex (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, double *out_coords) const; - + /** * Maps points in the reference space \f$ \f$ [0,1]^3 \f$ \f$ to \f$ \mathbb{R}^3 \f$. Only for prism trees. * \param [in] cmesh The cmesh in which the point lies. From a10bae6d8675cb1adfe21b63f59f97837adafbfb Mon Sep 17 00:00:00 2001 From: jfussbro Date: Wed, 22 May 2024 14:16:53 +0200 Subject: [PATCH 12/14] removed old todo --- src/t8_eclass.c | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/src/t8_eclass.c b/src/t8_eclass.c index 02f42232d0..c6876471a6 100644 --- a/src/t8_eclass.c +++ b/src/t8_eclass.c @@ -39,7 +39,6 @@ const int t8_face_vertex_to_tree_vertex[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8 { { 0, 2, 4 }, { 1, 3, 4 }, { 0, 1, 4 }, { 2, 3, 4 }, { 0, 1, 2, 3 } } /* pyramid */ }; -/* TODO: tet, pyramid */ const int t8_face_edge_to_tree_edge[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLASS_MAX_EDGES_2D] = { { { -1 } }, /* vertex */ { { 0 } }, /* line */ @@ -47,16 +46,10 @@ const int t8_face_edge_to_tree_edge[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECL { { 0 }, { 1 }, { 2 } }, /* triangle */ { { 8, 10, 4, 6 }, { 9, 11, 5, 7 }, { 8, 9, 0, 2 }, { 10, 11, 1, 3 }, { 4, 5, 0, 1 }, { 6, 7, 2, 3 } }, /* hex */ { { 3, 4, 5 }, { 1, 2, 5 }, { 0, 2, 4 }, { 0, 1, 3 } }, /* tet */ -<<<<<<< HEAD - { { -1 } }, /* prism */ + { { 0, 7, 3, 6 }, { 1, 8, 4, 7 }, { 2, 6, 5, 8 }, { 0, 1, 2 }, { 3, 4, 5 } }, /* prism */ { { 0, 4, 7 }, { 1, 5, 6 }, { 2, 4, 5 }, { 3, 6, 7 }, { 0, 1, 2, 3 } } /* pyramid */ -======= - { { 0, 7, 3, 6 }, { 1, 8, 4, 7 }, { 2, 6, 5, 8 }, { 0, 1, 2 }, { 3, 4, 5 } }, /* prism */ - { { -1 } }, /* pyramid */ ->>>>>>> origin/main }; -/* TODO: tet, pyramid */ const int t8_face_to_edge_neighbor[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLASS_MAX_CORNERS_2D] = { { { -1 } }, /* vertex */ { { -1 } }, /* line */ @@ -64,16 +57,10 @@ const int t8_face_to_edge_neighbor[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLA { { 2, 1 }, { 2, 0 }, { 1, 0 } }, /* triangle */ { { 0, 1, 2, 3 }, { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 8, 9, 10, 11 } }, /* hex */ { { 0, 1, 2 }, { 0, 3, 4 }, { 1, 3, 5 }, { 2, 4, 5 } }, /* tet */ -<<<<<<< HEAD - { { -1 } }, /* prism */ + { { 1, 2, 4, 5 }, { 0, 2, 3, 5 }, { 0, 1, 3, 4 }, { 6, 7, 8 }, { 6, 7, 8 } }, /* prism */ /* prism */ { { 2, 3, 5, 6 }, { 2, 3, 4, 7 }, { 0, 1, 6, 7 }, { 0, 1, 4, 5 }, { 4, 5, 6, 7 } } /* pyramid */ -======= - { { 1, 2, 4, 5 }, { 0, 2, 3, 5 }, { 0, 1, 3, 4 }, { 6, 7, 8 }, { 6, 7, 8 } }, /* prism */ - { { -1 } }, /* pyramid */ ->>>>>>> origin/main }; -/* TODO: tet, pyramid */ const int t8_edge_vertex_to_tree_vertex[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2] = { { { -1 } }, /* vertex */ { { 0 }, { 1 } }, /* line */ @@ -90,20 +77,12 @@ const int t8_edge_vertex_to_tree_vertex[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2] { 0, 4 }, { 1, 5 }, { 2, 6 }, -<<<<<<< HEAD - { 3, 7 } }, /* hex */ - { { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 1, 3 }, { 2, 3 } }, /* tet */ - { { -1 } }, /* prism */ - { { 0, 2 }, { 1, 3 }, { 0, 1 }, { 2, 3 }, { 0, 4 }, { 1, 4 }, { 3, 4 }, { 2, 4 } } /* pyramid */ -======= { 3, 7 } }, /* hex */ { { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 1, 3 }, { 2, 3 } }, /* tet */ { { 1, 2 }, { 0, 2 }, { 0, 1 }, { 4, 5 }, { 3, 5 }, { 3, 4 }, { 1, 4 }, { 2, 5 }, { 0, 3 } }, /* prism */ - { { -1 } }, /* pyramid */ ->>>>>>> origin/main + { { 0, 2 }, { 1, 3 }, { 0, 1 }, { 2, 3 }, { 0, 4 }, { 1, 4 }, { 3, 4 }, { 2, 4 } } /* pyramid */ }; -/* TODO: tet, pyramid */ const int t8_edge_to_face[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2] = { { { -1 } }, /* vertex */ { { 0 } }, /* line */ @@ -120,17 +99,10 @@ const int t8_edge_to_face[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2] = { { 0, 2 }, { 1, 2 }, { 0, 3 }, -<<<<<<< HEAD - { 1, 3 } }, /* hex */ - { { 2, 3 }, { 1, 3 }, { 1, 2 }, { 0, 3 }, { 0, 2 }, { 0, 1 } }, /* tet */ - { { -1 } }, /* prism */ - { { 0, 4 }, { 1, 4 }, { 2, 4 }, { 3, 4 }, { 0, 2 }, { 1, 2 }, { 1, 3 }, { 0, 3 } } /* pyramid */ -======= { 1, 3 } }, /* hex */ { { 2, 3 }, { 1, 3 }, { 1, 2 }, { 0, 3 }, { 0, 2 }, { 0, 1 } }, /* tet */ { { 0, 3 }, { 1, 3 }, { 2, 3 }, { 0, 4 }, { 1, 4 }, { 2, 4 }, { 0, 2 }, { 0, 1 }, { 1, 2 } }, /* prism */ - { { -1 } }, /* pyramid */ ->>>>>>> origin/main + { { 0, 4 }, { 1, 4 }, { 2, 4 }, { 3, 4 }, { 0, 2 }, { 1, 2 }, { 1, 3 }, { 0, 3 } } /* pyramid */ }; const int t8_eclass_face_orientation[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES] = { From cbfd3f4dd98a327c9b1954748baf18859d41ca32 Mon Sep 17 00:00:00 2001 From: jfussbro Date: Wed, 22 May 2024 14:20:25 +0200 Subject: [PATCH 13/14] indent --- src/t8_eclass.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/t8_eclass.c b/src/t8_eclass.c index c6876471a6..6f6c155b48 100644 --- a/src/t8_eclass.c +++ b/src/t8_eclass.c @@ -57,8 +57,9 @@ const int t8_face_to_edge_neighbor[T8_ECLASS_COUNT][T8_ECLASS_MAX_FACES][T8_ECLA { { 2, 1 }, { 2, 0 }, { 1, 0 } }, /* triangle */ { { 0, 1, 2, 3 }, { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 8, 9, 10, 11 } }, /* hex */ { { 0, 1, 2 }, { 0, 3, 4 }, { 1, 3, 5 }, { 2, 4, 5 } }, /* tet */ - { { 1, 2, 4, 5 }, { 0, 2, 3, 5 }, { 0, 1, 3, 4 }, { 6, 7, 8 }, { 6, 7, 8 } }, /* prism */ /* prism */ - { { 2, 3, 5, 6 }, { 2, 3, 4, 7 }, { 0, 1, 6, 7 }, { 0, 1, 4, 5 }, { 4, 5, 6, 7 } } /* pyramid */ + { { 1, 2, 4, 5 }, { 0, 2, 3, 5 }, { 0, 1, 3, 4 }, { 6, 7, 8 }, { 6, 7, 8 } }, + /* prism */ /* prism */ + { { 2, 3, 5, 6 }, { 2, 3, 4, 7 }, { 0, 1, 6, 7 }, { 0, 1, 4, 5 }, { 4, 5, 6, 7 } } /* pyramid */ }; const int t8_edge_vertex_to_tree_vertex[T8_ECLASS_COUNT][T8_ECLASS_MAX_EDGES][2] = { From 1d645c9a81f3a6156fc52e39e492a09318bc3931 Mon Sep 17 00:00:00 2001 From: jfussbro Date: Fri, 24 May 2024 11:02:34 +0200 Subject: [PATCH 14/14] added suggestions from code review --- .../t8_gtest_geometry_cad.cxx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx index 1bc8ae9d05..3aa89ec74a 100644 --- a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx +++ b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx @@ -1033,7 +1033,7 @@ t8_test_geometry_cad_pyramid (int face, int edge, double *parameters, double *te { #if T8_WITH_OCC double out_coords[3]; - double tol = T8_PRECISION_EPS > 1e-10 ? T8_PRECISION_EPS : 1e-10; + double tol = T8_PRECISION_SQRT_EPS; const int face_vertices = (face < 4 ? 3 : 4); t8_cmesh_t cmesh = t8_create_cad_reference_pyramid (face, edge, parameters); @@ -1056,12 +1056,12 @@ TEST (t8_gtest_geometry_cad_pyramid, linked_faces) /* clang-format off */ /* Reference coordinates of each face vertex and the centroid of the pyramid */ double test_ref_coords[75] - = { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.6, 0.6, 0.2, 2.0, 2.0, 2.0, // face 0 - 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.6, 0.6, 0.2, 2.0, 2.0, 2.0, // face 1 - 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.6, 0.6, 0.2, 2.0, 2.0, 2.0, // face 2 - 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.6, 0.6, 0.2, 2.0, 2.0, 2.0, // face 3 + = { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.6, 0.6, 0.2, -1.0, -1.0, -1.0, // face 0 + 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.6, 0.6, 0.2, -1.0, -1.0, -1.0, // face 1 + 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.6, 0.6, 0.2, -1.0, -1.0, -1.0, // face 2 + 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.6, 0.6, 0.2, -1.0, -1.0, -1.0, // face 3 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.6, 0.6, 0.2 }; // face 4 - /* The 2.0's at face 0-3 are placeholders, because these faces only have 3 vertices. */ + /* The -1.0's at face 0-3 are placeholders, because these faces only have 3 vertices. */ double surface_test_return_coords_quad[15] = { 0.0, 0.0, 0.0, // face vertex 0 @@ -1076,12 +1076,12 @@ TEST (t8_gtest_geometry_cad_pyramid, linked_faces) 0.6737526363, 0.5930049972, 0.1275036282 }; // shifted centroid of the pyramid double surface_parameters[40] - = { 0, 1, 0, 0, 1, 1, 2, 2, // face 0 - 0, 0, 0, 1, 1, 1, 2, 2, // face 1 - 0, 0, 0, 1, 1, 1, 2, 2, // face 2 - 0, 1, 0, 0, 1, 1, 2, 2, // face 3 + = { 0, 1, 0, 0, 1, 1, -1, -1, // face 0 + 0, 0, 0, 1, 1, 1, -1, -1, // face 1 + 0, 0, 0, 1, 1, 1, -1, -1, // face 2 + 0, 1, 0, 0, 1, 1, -1, -1, // face 3 0, 0, 0, 1, 1, 0, 1, 1 }; // face 4 - /* The 2's of face 0-3 are placeholders, because these faces only have 3 vertices. */ + /* The -1's of face 0-3 are placeholders, because these faces only have 3 vertices. */ /* clang-format on */ for (int i_faces = 0; i_faces < 5; i_faces++) {