From 76d7de4a1a7082bf2c60f1dfc90cf9d4ccfe13d7 Mon Sep 17 00:00:00 2001 From: ljcarlin Date: Fri, 3 Nov 2023 13:21:25 +0100 Subject: [PATCH 1/3] Fixed typo, misleading documentation --- src/p4est_geometry.c | 2 +- src/p4est_geometry.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/p4est_geometry.c b/src/p4est_geometry.c index 7cb5aaf70..8690934cf 100644 --- a/src/p4est_geometry.c +++ b/src/p4est_geometry.c @@ -623,7 +623,7 @@ p4est_geometry_new_sphere2d (p4est_connectivity_t * conn, double R) builtin = P4EST_ALLOC_ZERO (p4est_geometry_builtin_t, 1); sphere2d = &builtin->p.sphere2d; - sphere2d->type = P4EST_GEOMETRY_BUILTIN_DISK2D; + sphere2d->type = P4EST_GEOMETRY_BUILTIN_SPHERE2D; sphere2d->R = R; builtin->geom.name = "p4est_sphere2d"; diff --git a/src/p4est_geometry.h b/src/p4est_geometry.h index 62e037d97..582eb7717 100644 --- a/src/p4est_geometry.h +++ b/src/p4est_geometry.h @@ -74,9 +74,10 @@ typedef void (*p4est_geometry_destroy_t) (p4est_geometry_t * geom); /** Encapsulates a custom transformation from tree-local coordinates to * user defined physical space. * - * \warning Used in \ref p4est_vtk.h to write global-coordinate meshes. - * In this case *user is assumed to point to a \ref p4est_connectivity. - * In general it can be used however the user likes. + * Used in \ref p4est_vtk.h to write global-coordinate meshes. + * + * Some internal p4est functions assume that *user points to a + * \ref p4est_connectivity. However, in general it can be used as the user wishes. * * This structure can be filled or allocated by the user. * p4est will never change its contents. From b98d83af8db3ede780f94106661f2a888e8392bc Mon Sep 17 00:00:00 2001 From: ljcarlin Date: Sat, 4 Nov 2023 10:04:24 +0100 Subject: [PATCH 2/3] Fixed typo --- src/p8est_connectivity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p8est_connectivity.h b/src/p8est_connectivity.h index 1cb130b20..bec806082 100644 --- a/src/p8est_connectivity.h +++ b/src/p8est_connectivity.h @@ -47,7 +47,7 @@ * Please see the documentation of \ref p8est_connectivity_t for the exact * encoding convention. * - * We provide various predefined connectivitys by dedicated constructors, + * We provide various predefined connectivities by dedicated constructors, * such as * * * \ref p8est_connectivity_new_unitcube for the unit square, From ecca31e1b85933d2a6dd20933e1f506702246c0b Mon Sep 17 00:00:00 2001 From: ljcarlin Date: Wed, 22 Nov 2023 12:30:56 +0100 Subject: [PATCH 3/3] Made geometry_X non-static --- src/p4est_geometry.c | 20 +------------------- src/p4est_geometry.h | 21 +++++++++++++++++++++ src/p4est_to_p8est.h | 1 + src/p8est_geometry.c | 6 +++--- src/p8est_geometry.h | 20 ++++++++++++++++++++ 5 files changed, 46 insertions(+), 22 deletions(-) diff --git a/src/p4est_geometry.c b/src/p4est_geometry.c index 8690934cf..fd47a467c 100644 --- a/src/p4est_geometry.c +++ b/src/p4est_geometry.c @@ -107,25 +107,7 @@ p4est_geometry_destroy (p4est_geometry_t * geom) } } -/** - * Geometric coordinate transformation for geometry created with - * \ref p4est_geometry_new_connectivity. This is defined by - * tri/binlinear interpolation from vertex coordinates. - * - * May also be used as a building block in custom geometric coordinate transforms. - * See for example \ref p4est_geometry_sphere2d_X or \ref p4est_geometry_disk2d_X. - * - * \param[in] geom associated geometry - * \param[in] which_tree tree id inside forest - * \param[in] abc tree-local reference coordinates : [0,1]^d. - * Note: abc[2] is only accessed by the P4_TO_P8 version - * \param[out] xyz Cartesian coordinates in physical space after geometry - * - * \warning The associated geometry is assumed to have a connectivity - * as its *user field, and this connectivity is assumed to have vertex - * information in its *tree_to_vertex field. - */ -static void +void p4est_geometry_connectivity_X (p4est_geometry_t * geom, p4est_topidx_t which_tree, const double abc[3], double xyz[3]) diff --git a/src/p4est_geometry.h b/src/p4est_geometry.h index 582eb7717..c92da6d7a 100644 --- a/src/p4est_geometry.h +++ b/src/p4est_geometry.h @@ -107,6 +107,27 @@ void p4est_geometry_destroy (p4est_geometry_t * geom); p4est_geometry_t *p4est_geometry_new_connectivity (p4est_connectivity_t * conn); +/** Geometric coordinate transformation for geometry created with + * \ref p4est_geometry_new_connectivity. This is defined by + * tri/binlinear interpolation from vertex coordinates. + * + * May also be used as a building block in custom geometric coordinate transforms. + * See for example \ref p4est_geometry_sphere2d_X or \ref p4est_geometry_disk2d_X. + * + * \param[in] geom associated geometry + * \param[in] which_tree tree id inside forest + * \param[in] abc tree-local reference coordinates : [0,1]^3. + * Note: abc[2] is only accessed by the P4_TO_P8 version + * \param[out] xyz Cartesian coordinates in physical space after geometry + * + * \warning The associated geometry is assumed to have a connectivity + * as its *user field, and this connectivity is assumed to have vertex + * information in its *tree_to_vertex field. + */ +void p4est_geometry_connectivity_X (p4est_geometry_t * geom, + p4est_topidx_t which_tree, + const double abc[3], double xyz[3]); + /** Create a geometry for mapping the sphere using 2d connectivity icosahedron. * * \param[in] conn The result of \ref p4est_connectivity_new_icosahedron. diff --git a/src/p4est_to_p8est.h b/src/p4est_to_p8est.h index 9b6998b2b..2771e42ca 100644 --- a/src/p4est_to_p8est.h +++ b/src/p4est_to_p8est.h @@ -508,6 +508,7 @@ /* functions in p4est_geometry */ #define p4est_geometry_destroy p8est_geometry_destroy #define p4est_geometry_new_connectivity p8est_geometry_new_connectivity +#define p4est_geometry_connectivity_X p8est_geometry_connectivity_X /* functions in p4est_vtk */ #define p4est_vtk_context_new p8est_vtk_context_new diff --git a/src/p8est_geometry.c b/src/p8est_geometry.c index c8336a0b7..a600c4cdb 100644 --- a/src/p8est_geometry.c +++ b/src/p8est_geometry.c @@ -96,7 +96,7 @@ p8est_geometry_shell_X (p8est_geometry_t * geom, double abc[3]; /* transform from the reference cube into vertex space */ - p4est_geometry_connectivity_X (geom, which_tree, rst, abc); + p8est_geometry_connectivity_X (geom, which_tree, rst, abc); /* assert that input points are in the expected range */ P4EST_ASSERT (shell->type == P8EST_GEOMETRY_BUILTIN_SHELL); @@ -184,7 +184,7 @@ p8est_geometry_sphere_X (p8est_geometry_t * geom, double abc[3]; /* transform from the reference cube into vertex space */ - p4est_geometry_connectivity_X (geom, which_tree, rst, abc); + p8est_geometry_connectivity_X (geom, which_tree, rst, abc); /* assert that input points are in the expected range */ P4EST_ASSERT (sphere->type == P8EST_GEOMETRY_BUILTIN_SPHERE); @@ -341,7 +341,7 @@ p8est_geometry_torus_X (p8est_geometry_t * geom, /* transform from the reference cube [0,1]^3 into logical vertex space using bi/trilinear transformation */ - p4est_geometry_connectivity_X (geom, which_tree, rst, abc); + p8est_geometry_connectivity_X (geom, which_tree, rst, abc); /* * assert that input points are in the expected range diff --git a/src/p8est_geometry.h b/src/p8est_geometry.h index 10e8dc8a2..d2828899c 100644 --- a/src/p8est_geometry.h +++ b/src/p8est_geometry.h @@ -87,6 +87,26 @@ void p8est_geometry_destroy (p8est_geometry_t * geom); p8est_geometry_t *p8est_geometry_new_connectivity (p8est_connectivity_t * conn); +/** Geometric coordinate transformation for geometry created with + * \ref p8est_geometry_new_connectivity. This is defined by + * tri/binlinear interpolation from vertex coordinates. + * + * May also be used as a building block in custom geometric coordinate transforms. + * See for example \ref p8est_geometry_shell_X or \ref p8est_geometry_sphere_X. + * + * \param[in] geom associated geometry + * \param[in] which_tree tree id inside forest + * \param[in] abc tree-local reference coordinates : [0,1]^3. + * \param[out] xyz Cartesian coordinates in physical space after geometry + * + * \warning The associated geometry is assumed to have a connectivity + * as its *user field, and this connectivity is assumed to have vertex + * information in its *tree_to_vertex field. + */ +void p8est_geometry_connectivity_X (p8est_geometry_t * geom, + p4est_topidx_t which_tree, + const double abc[3], double xyz[3]); + /** Create a geometry structure for the spherical shell of 24 trees. * \param [in] conn Result of p8est_connectivity_new_shell or equivalent. * We do NOT take ownership and expect it to stay alive.