p4est  1.0
Defines | Functions | Variables
example/steps/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"
Include dependency graph for p4est_step1.c:
This graph shows which files directly or indirectly include this file:

Defines

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

Functions

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

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.


Define Documentation

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.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines