Skip to content

Commit

Permalink
Merge pull request #289 from tim-griesbach/feature-domain-p4est
Browse files Browse the repository at this point in the history
Add domain constructor for given p4est
  • Loading branch information
scottaiton authored Dec 18, 2023
2 parents 517010f + d8312e7 commit af00694
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 4 deletions.
2 changes: 1 addition & 1 deletion p4est
Submodule p4est updated 125 files
2 changes: 1 addition & 1 deletion sc
Submodule sc updated 62 files
+42 −36 .github/workflows/ci_cmake.yml
+4 −0 .gitignore
+21 −13 CMakeLists.txt
+12 −4 CMakePresets.json
+9 −1 Makefile.am
+2 −0 README
+4 −2 cmake/FindSC.cmake
+47 −0 cmake/check_mpiio.cmake
+38 −8 cmake/config.cmake
+19 −0 cmake/config.cmake.in
+10 −0 cmake/init_build_type.cmake
+11 −11 cmake/install.cmake
+42 −0 cmake/jansson.cmake
+7 −2 cmake/options.cmake
+23 −1 cmake/pkgconf.cmake
+5 −0 cmake/pkgconf.pc.in
+7 −1 cmake/sc_config.h.in
+36 −0 cmake/utils.cmake
+75 −0 cmake/zlib.cmake
+5 −0 config/sc_autotools.pc.in
+1 −0 config/sc_include.m4
+24 −27 config/sc_mpi.m4
+31 −4 config/sc_package.m4
+2 −1 configure.ac
+0 −1 doc/Doxyfile.in
+0 −0 doc/attic/puff.h
+1 −0 doc/author_brandt.txt
+1 −0 doc/author_markert.txt
+1 −0 doc/author_rudi.txt
+1 −0 doc/author_schlottke-lakemper.txt
+31 −0 doc/mainpage.dox
+38 −0 doc/release_notes.txt
+13 −44 example/CMakeLists.txt
+0 −0 example/linksc/AUTHORS
+502 −0 example/linksc/COPYING
+0 −0 example/linksc/ChangeLog
+0 −0 example/linksc/INSTALL
+45 −0 example/linksc/Makefile.am
+0 −0 example/linksc/NEWS
+2 −0 example/linksc/README
+7 −0 example/linksc/bootstrap
+123 −0 example/linksc/configure.ac
+44 −0 example/linksc/liblinksc.c
+36 −0 example/linksc/liblinksc.h
+44 −0 example/linksc/linksc.c
+5 −4 src/CMakeLists.txt
+12 −10 src/Makefile.am
+30 −4 src/sc.c
+27 −3 src/sc.h
+0 −0 src/sc_builtin/sc_getopt.h
+40 −57 src/sc_io.c
+103 −68 src/sc_io.h
+1 −1 src/sc_mpi.c
+17 −2 src/sc_mpi.h
+3 −2 src/sc_options.c
+24 −0 src/sc_scda.c
+1,022 −0 src/sc_scda.h
+1 −4 test/CMakeLists.txt
+5 −2 test/Makefile.am
+1 −1 test/test_builtin.c
+22 −1 test/test_helpers.c
+69 −0 test/test_scda.c
17 changes: 17 additions & 0 deletions src/fclaw2d_convenience.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,23 @@ fclaw2d_domain_new (p4est_wrap_t * wrap, sc_keyvalue_t * attributes)
return domain;
}

fclaw2d_domain_t *
fclaw2d_domain_new_p4est (p4est_t *p4est)
{
FCLAW_ASSERT (p4est != NULL);
FCLAW_ASSERT (p4est->user_pointer == NULL);

p4est_wrap_t *wrap;

/* create p4est_wrap from the given p4est */
wrap = p4est_wrap_new_p4est (p4est, 0, P4EST_CONNECT_FULL, NULL, NULL);

FCLAW_ASSERT (wrap->p4est->data_size == 0);

/* attributes of the created domain is initialized by sc_keyvalue_new */
return fclaw2d_domain_new (wrap, NULL);
}

static void
fclaw2d_check_initial_level (sc_MPI_Comm mpicomm, int initial_level)
{
Expand Down
17 changes: 16 additions & 1 deletion src/fclaw2d_convenience.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define FCLAW2D_CONVENIENCE_H

#include <forestclaw2d.h>
#include <p4est_connectivity.h>
#include <p4est.h>

#ifdef __cplusplus
extern "C"
Expand All @@ -37,6 +37,21 @@ extern "C"
#endif
#endif

/** Construct a domain from a given p4est.
*
* This function takes ownership of the passed p4est and its connectivity.
*
* \param [in,out] p4est The p4est that is used to create the domain.
* p4est->user_pointer must be NULL and will be
* changed to pointing to a p4est_wrap created using
* the given p4est. The data size of the p4est will
* be set to 0 and its quadrant data will be freed.
* \return A domain that is constructed based on the given
* p4est and in particular with a pp based on the
* given p4est.
*/
fclaw2d_domain_t *fclaw2d_domain_new_p4est (p4est_t *p4est);

fclaw2d_domain_t *fclaw2d_domain_new_unitsquare (sc_MPI_Comm mpicomm,
int initial_level);

Expand Down
1 change: 1 addition & 0 deletions src/fclaw2d_to_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define fclaw2d_domain_new_unitsquare fclaw3d_domain_new_unitcube
#define fclaw2d_domain_new_brick fclaw3d_domain_new_brick
#define fclaw2d_domain_new_conn fclaw3d_domain_new_conn
#define fclaw2d_domain_new_p4est fclaw3d_domain_new_p8est
#define fclaw2d_domain_num_faces fclaw3d_domain_num_faces
#define fclaw2d_domain_num_corners fclaw3d_domain_num_corners
#define fclaw2d_domain_num_face_corners fclaw3d_domain_num_face_corners
Expand Down
17 changes: 16 additions & 1 deletion src/fclaw3d_convenience.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define FCLAW3D_CONVENIENCE_H

#include <forestclaw3d.h>
#include <p8est_connectivity.h>
#include <p8est.h>

#ifdef __cplusplus
extern "C"
Expand All @@ -37,6 +37,21 @@ extern "C"
#endif
#endif

/** Construct a domain from a given p8est.
*
* This function takes ownership of the passed p8est and its connectivity.
*
* \param [in,out] p8est The p8est that is used to create the domain.
* p8est->user_pointer must be NULL and will be
* changed to pointing to a p8est_wrap created using
* the given p8est. The data size of the p8est will
* be set to 0 and its quadrant data will be freed.
* \return A domain that is constructed based on the given
* p8est and in particular with a pp based on the
* given p8est.
*/
fclaw3d_domain_t *fclaw3d_domain_new_p8est (p8est_t *p8est);

fclaw3d_domain_t *fclaw3d_domain_new_unitcube (sc_MPI_Comm mpicomm,
int initial_level);

Expand Down

0 comments on commit af00694

Please sign in to comment.