#ifndef P4_TO_P8
static const char *p4est_userdata_usage =
"<configuration> is the first optional argument.\n"
" The following values are legal (default is \"unit\"):\n"
" o unit Refinement on the unit square.\n"
" o periodic Unit square with all-periodic boundary conditions.\n"
" o brick Refinement on a 2x3 rectangle of quadtrees.\n"
" o disk Refinement on a spherical disk of five trees.\n"
" o corner Refinement on a non-planar hexagon made of three trees.\n"
" o moebius Refinement on a 5-tree Moebius band embedded in 3D.\n"
" o icosahedron Refinement on the icosahedron sphere with geometry.\n"
"<level> is the second optional argument (default is 4).\n"
" It is clamped into the range of [0, P4EST_QMAXLEVEL].\n"
" This argument takes precedence over the option of the same name.\n"
"No more than two non-option arguments may be specified.\n";
#endif
#include "userdata_global.h"
static int
p4est_userdata_process (p4est_userdata_global_t *g)
{
P4EST_ASSERT (g != NULL && g->options != NULL);
P4EST_ASSERT (g->configuration != NULL);
P4EST_ASSERT (g->conn == NULL);
P4EST_ASSERT (g->geom == NULL);
if (!strcmp (g->configuration, "unit")) {
#ifndef P4_TO_P8
#else
#endif
}
#ifndef P4_TO_P8
else if (!strcmp (g->configuration, "periodic")) {
}
else if (!strcmp (g->configuration, "brick")) {
}
else if (!strcmp (g->configuration, "disk")) {
}
else if (!strcmp (g->configuration, "corner")) {
}
else if (!strcmp (g->configuration, "moebius")) {
}
else if (!strcmp (g->configuration, "icosahedron")) {
}
#else
else if (!strcmp (g->configuration, "periodic")) {
}
else if (!strcmp (g->configuration, "brick")) {
}
else if (!strcmp (g->configuration, "rotcubes")) {
}
else if (!strcmp (g->configuration, "sphere")) {
}
else if (!strcmp (g->configuration, "shell")) {
}
else if (!strcmp (g->configuration, "torus")) {
}
#endif
if (g->maxlevel < 0) {
g->maxlevel = 0;
}
}
if (g->conn == NULL) {
P4EST_GLOBAL_LERROR ("ERROR: Invalid configuration argument\n");
return -1;
}
if (g->geom == NULL) {
}
return 0;
}
static int
p4est_userdata_options (int argc, char **argv, p4est_userdata_global_t *g)
{
int erres;
int firstarg;
sc_options_t *o;
P4EST_ASSERT (argc >= 1);
P4EST_ASSERT (argv != NULL);
P4EST_ASSERT (g != NULL);
P4EST_ASSERT (g->options == NULL);
o = g->options = sc_options_new (argv[0]);
sc_options_add_switch (o, 'h', "help", &g->help,
"Print help message and exit cleanly");
sc_options_add_int (o, 'L', "maxlevel", &g->maxlevel, 4,
"Maximum refinement level");
sc_options_add_switch (o, 'N', "no-vtk", &g->novtk,
"Do not write VTK graphics files");
sc_options_add_switch (o, 'I', "no-int", &g->noint,
"Skip the part with internal user data");
sc_options_add_switch (o, 'E', "no-ext", &g->noext,
"Skip the part with external user data");
g->configuration = "unit";
erres = 0;
if (!erres && (erres = ((firstarg = sc_options_parse
o, argc, argv)) < 0))) {
P4EST_GLOBAL_LERROR ("ERROR: processing options\n");
}
P4EST_ASSERT (erres || (1 <= firstarg && firstarg <= argc));
if (!erres && firstarg < argc) {
g->configuration = argv[firstarg++];
}
if (!erres && firstarg < argc) {
g->maxlevel = atoi (argv[firstarg++]);
}
if (!erres && (erres = (firstarg < argc))) {
P4EST_GLOBAL_LERROR ("ERROR: no more than two arguments are allowed\n");
}
if (!erres && (erres = p4est_userdata_process (g))) {
P4EST_GLOBAL_LERROR ("ERROR: processing the command line\n");
}
if (g->help || erres) {
p4est_userdata_usage);
}
else {
}
return erres;
}
static void
p4est_userdata_cleanup (p4est_userdata_global_t *g)
{
P4EST_ASSERT (g != NULL);
P4EST_ASSERT (g->options != NULL);
if (g->geom != NULL) {
P4EST_ASSERT (g->conn != NULL);
}
if (g->conn != NULL) {
}
sc_options_destroy (g->options);
}
int
main (int argc, char **argv)
{
int erres;
int mpiret;
p4est_userdata_global_t sglobal, *global = &sglobal;
mpiret = sc_MPI_Init (&argc, &argv);
SC_CHECK_MPI (mpiret);
memset (global, 0, sizeof (*global));
global->mpicomm = sc_MPI_COMM_WORLD;
sc_init (global->mpicomm, 1, 1, NULL, SC_LP_APPLICATION);
erres = 0;
if (!erres && (erres = p4est_userdata_options (argc, argv, global)))
{
P4EST_GLOBAL_LERROR ("ERROR: Usage/options\n");
}
if (!erres && !global->help && (erres = p4est_userdata_run (global)))
{
P4EST_GLOBAL_LERROR ("ERROR: running the program\n");
}
p4est_userdata_cleanup (global);
sc_finalize ();
mpiret = sc_MPI_Finalize ();
SC_CHECK_MPI (mpiret);
return erres ? EXIT_FAILURE : EXIT_SUCCESS;
}
#define P4EST_QMAXLEVEL
The finest level of the quadtree for representing quadrant corners.
Definition: p4est.h:59
int p4est_get_package_id(void)
Query the package identity as registered in libsc.
void p4est_init(sc_log_handler_t log_handler, int log_threshold)
Registers p4est with the SC Library and sets the logging behavior.
p4est_connectivity_t * p4est_connectivity_new_moebius(void)
Create a connectivity structure for a five-tree moebius band.
void p4est_connectivity_destroy(p4est_connectivity_t *connectivity)
Destroy a connectivity structure.
p4est_connectivity_t * p4est_connectivity_new_icosahedron(void)
Create a connectivity for mapping the sphere using an icosahedron.
p4est_connectivity_t * p4est_connectivity_new_brick(int mi, int ni, int periodic_a, int periodic_b)
A rectangular m by n array of trees with configurable periodicity.
p4est_connectivity_t * p4est_connectivity_new_unitsquare(void)
Create a connectivity structure for the unit square.
p4est_connectivity_t * p4est_connectivity_new_disk_nonperiodic(void)
Create a connectivity structure for a five-tree flat spherical disk.
p4est_connectivity_t * p4est_connectivity_new_corner(void)
Create a connectivity structure for a three-tree mesh around a corner.
p4est_connectivity_t * p4est_connectivity_new_periodic(void)
Create a connectivity structure for an all-periodic unit square.
p4est_geometry_t * p4est_geometry_new_disk2d(p4est_connectivity_t *conn, double R0, double R1)
Create disk2d geometry associated to disk2d connectivity.
void p4est_geometry_destroy(p4est_geometry_t *geom)
Can be used to conveniently destroy a geometry structure.
p4est_geometry_t * p4est_geometry_new_icosahedron(p4est_connectivity_t *conn, double R)
Create a geometry for mapping the sphere using 2d connectivity icosahedron.
p4est_geometry_t * p4est_geometry_new_connectivity(p4est_connectivity_t *conn)
Create a geometry structure based on the vertices in a connectivity.
p8est_connectivity_t * p8est_connectivity_new_periodic(void)
Create a connectivity structure for an all-periodic unit cube.
p8est_connectivity_t * p8est_connectivity_new_unitcube(void)
Create a connectivity structure for the unit cube.
p8est_connectivity_t * p8est_connectivity_new_shell(void)
Create a connectivity structure that builds a spherical shell.
p8est_connectivity_t * p8est_connectivity_new_torus(int nSegments)
Create a connectivity structure that builds a revolution torus.
p8est_connectivity_t * p8est_connectivity_new_rotcubes(void)
Create a connectivity structure that contains a few cubes.
p8est_connectivity_t * p8est_connectivity_new_brick(int m, int n, int p, int periodic_a, int periodic_b, int periodic_c)
An m by n by p array with periodicity in x, y, and z if periodic_a, periodic_b, and periodic_c are tr...
p8est_connectivity_t * p8est_connectivity_new_sphere(void)
Create a connectivity structure that builds a solid sphere.
p8est_geometry_t * p8est_geometry_new_torus(p8est_connectivity_t *conn, double R0, double R1, double R2)
Create a geometry structure for the torus.
p8est_geometry_t * p8est_geometry_new_sphere(p8est_connectivity_t *conn, double R2, double R1, double R0)
Create a geometry structure for the solid sphere of 13 trees.
p8est_geometry_t * p8est_geometry_new_shell(p8est_connectivity_t *conn, double R2, double R1)
Create a geometry structure for the spherical shell of 24 trees.