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 = p4est_new (mpicomm, conn, 0, NULL, NULL);
P4EST_ASSERT (P4EST_STEP1_PATTERN_LENGTH == width);
P4EST_ASSERT (P4EST_STEP1_PATTERN_LENGTH == height);
recursive = 1;
p4est_refine (
p4est, recursive, refine_fn, NULL);
partforcoarsen = 0;
p4est_partition (
p4est, partforcoarsen, NULL);
balance = 1;
if (balance) {
p4est_balance (
p4est, P4EST_CONNECT_FACE, NULL);
p4est_partition (
p4est, partforcoarsen, NULL);
}
p4est_connectivity_destroy (conn);
sc_finalize ();
mpiret = sc_MPI_Finalize ();
SC_CHECK_MPI (mpiret);
return 0;
}
#define P4EST_QUADRANT_LEN(l)
The length of a quadrant of level l.
Definition p4est.h:65
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.
#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
Routines for printing a forest and associated fields to 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:76
int8_t level
level of refinement
Definition p4est.h:80
p4est_qcoord_t y
coordinates
Definition p4est.h:78
The p4est forest datatype.
Definition p4est.h:150