p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
p4est_step1.c File Reference

This 2D example program refines a domain based on given image data. More...

#include <p4est_vtk.h>
#include "hw32.h"

Macros

#define P4EST_STEP1_PATTERN_LEVEL   5
 The resolution of the image data in powers of two. More...
 
#define P4EST_STEP1_PATTERN_LENGTH   (1 << P4EST_STEP1_PATTERN_LEVEL)
 The dimension of the image data. More...
 

Functions

static int refine_fn (p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
 Callback function to decide on refinement. More...
 
int main (int argc, char **argv)
 The main function of the step1 example program. More...
 

Variables

static const int plv = P4EST_STEP1_PATTERN_LEVEL
 Shortcut.
 
static const int ple = P4EST_STEP1_PATTERN_LENGTH
 Shortcut.
 

Detailed Description

This 2D example program refines a domain based on given image data.

The image file hw32.h has been created with the GIMP and is compiled in.

Macro Definition Documentation

#define P4EST_STEP1_PATTERN_LENGTH   (1 << P4EST_STEP1_PATTERN_LEVEL)

The dimension of the image data.

#define P4EST_STEP1_PATTERN_LEVEL   5

The resolution of the image data in powers of two.

Function Documentation

int main ( int  argc,
char **  argv 
)

The main function of the step1 example program.

It creates a connectivity and forest, refines it, and writes a VTK file.

static int refine_fn ( p4est_t p4est,
p4est_topidx_t  which_tree,
p4est_quadrant_t quadrant 
)
static

Callback function to decide on refinement.

Refinement and coarsening is controlled by callback functions. This function is called for every processor-local quadrant in order; its return value is understood as a boolean refinement flag. In this example we use the image file hw32.h to determine the refinement.