This software refines a basic domain using given image data.
This software refines a basic domain using given image data.As a result, the resulting VTK file showcases the message 'Hello World' through the mesh.
#ifndef P4_TO_P8
#else
#endif
#include "hw32.h"
#define P4EST_STEP1_PATTERN_LEVEL 5
#define P4EST_STEP1_PATTERN_LENGTH (1 << P4EST_STEP1_PATTERN_LEVEL)
static const int plv = P4EST_STEP1_PATTERN_LEVEL;
static const int ple = P4EST_STEP1_PATTERN_LENGTH;
#ifdef P4_TO_P8
#endif
static int
{
int tilelen;
int offsi, offsj;
int i, j;
const char *d;
unsigned char p[3];
P4EST_ASSERT (which_tree == 0);
if (quadrant->
level > plv) {
return 0;
}
#ifdef P4_TO_P8
if (quadrant->
level >= 3 &&
(quadrant->z < 3 * eighth || quadrant->z >= 5 * eighth)) {
return 0;
}
#endif
tilelen = 1 << (plv - quadrant->
level);
P4EST_ASSERT (offsi >= 0 && offsj >= 0);
for (j = 0; j < tilelen; ++j) {
P4EST_ASSERT (offsj + j < ple);
for (i = 0; i < tilelen; ++i) {
const int allind = 4 * (ple * (ple - 1 - (offsj + j)) + (offsi + i));
P4EST_ASSERT (offsi + i < ple);
#if 0
d =
hw32_header_data + 4 * (ple * (ple - 1 - (offsj + j)) + (offsi + i));
#else
P4EST_ASSERT (0 <= allind && allind < 4096);
d = hw32_header_data[allind >> 10] + (allind & ((1 << 10) - 1));
#endif
HW32_HEADER_PIXEL (d, p);
P4EST_ASSERT (p[0] == p[1] && p[1] == p[2]);
if (p[0] < 128) {
return 1;
}
}
}
return 0;
}
int
main (int argc, char **argv)
{
int mpiret;
int recursive, partforcoarsen, balance;
sc_MPI_Comm mpicomm;
mpiret = sc_MPI_Init (&argc, &argv);
SC_CHECK_MPI (mpiret);
mpicomm = sc_MPI_COMM_WORLD;
sc_init (mpicomm, 1, 1, NULL, SC_LP_ESSENTIAL);
P4EST_GLOBAL_PRODUCTIONF
("This is the p4est %dD demo example/steps/%s_step1\n",
#ifndef P4_TO_P8
#else
#endif
P4EST_ASSERT (P4EST_STEP1_PATTERN_LENGTH == width);
P4EST_ASSERT (P4EST_STEP1_PATTERN_LENGTH == height);
recursive = 1;
partforcoarsen = 0;
balance = 1;
if (balance) {
}
sc_finalize ();
mpiret = sc_MPI_Finalize ();
SC_CHECK_MPI (mpiret);
return 0;
}
void p4est_refine(p4est_t *p4est, int refine_recursive, p4est_refine_t refine_fn, p4est_init_t init_fn)
Refine a forest.
void p4est_destroy(p4est_t *p4est)
Destroy a p4est.
p4est_t * p4est_new(sc_MPI_Comm mpicomm, p4est_connectivity_t *connectivity, size_t data_size, p4est_init_t init_fn, void *user_pointer)
Create a new forest with an initial coarse mesh.
void p4est_partition(p4est_t *p4est, int allow_for_coarsening, p4est_weight_t weight_fn)
Equally partition the forest.
void p4est_balance(p4est_t *p4est, p4est_connect_type_t btype, p4est_init_t init_fn)
2:1 balance the size differences of neighboring elements in a forest.
#define P4EST_QUADRANT_LEN(l)
The length of a quadrant of level l.
Definition: p4est.h:61
int32_t p4est_qcoord_t
Typedef for quadrant coordinates.
Definition: p4est_base.h:81
int32_t p4est_topidx_t
Typedef for counting topological entities (trees, tree vertices).
Definition: p4est_base.h:93
void p4est_init(sc_log_handler_t log_handler, int log_threshold)
Registers p4est with the SC Library and sets the logging behavior.
void p4est_connectivity_destroy(p4est_connectivity_t *connectivity)
Destroy a connectivity structure.
#define P4EST_DIM
The spatial dimension.
Definition: p4est_connectivity.h:71
p4est_connectivity_t * p4est_connectivity_new_unitsquare(void)
Create a connectivity structure for the unit square.
#define P4EST_STRING
p4est identification string
Definition: p4est_connectivity.h:94
@ P4EST_CONNECT_FACE
Balance across faces only.
Definition: p4est_connectivity.h:116
Routines for printing a forest and associated fields to VTK format.
void p4est_vtk_write_file(p4est_t *p4est, p4est_geometry_t *geom, const char *filename)
Write the p4est in VTK format.
p8est_connectivity_t * p8est_connectivity_new_unitcube(void)
Create a connectivity structure for the unit cube.
Routines for printing a forest and associated fields to VTK format.
This structure holds the 2D inter-tree connectivity information.
Definition: p4est_connectivity.h:190
The 2D quadrant datatype.
Definition: p4est.h:72
int8_t level
level of refinement
Definition: p4est.h:76
p4est_qcoord_t y
coordinates
Definition: p4est.h:74
The p4est forest datatype.
Definition: p4est.h:136