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

General support types and functions. More...

#include <p4est_config.h>
#include <sc_config.h>
#include <sc_containers.h>

Go to the source code of this file.

Macros

#define _p4est_const   _sc_const
 
#define p4est_qcoord_compare   sc_int32_compare
 
#define P4EST_MPI_QCOORD   sc_MPI_INT
 
#define P4EST_VTK_QCOORD   "Int32"
 
#define P4EST_F90_QCOORD   INTEGER(KIND=C_INT32_T)
 
#define P4EST_QCOORD_MIN   INT32_MIN
 
#define P4EST_QCOORD_MAX   INT32_MAX
 
#define P4EST_QCOORD_1   ((p4est_qcoord_t) 1)
 
#define p4est_topidx_compare   sc_int32_compare
 
#define P4EST_MPI_TOPIDX   sc_MPI_INT
 
#define P4EST_VTK_TOPIDX   "Int32"
 
#define P4EST_F90_TOPIDX   INTEGER(KIND=C_INT32_T)
 
#define P4EST_TOPIDX_MIN   INT32_MIN
 
#define P4EST_TOPIDX_MAX   INT32_MAX
 
#define P4EST_TOPIDX_FITS_32   1
 
#define P4EST_TOPIDX_1   ((p4est_topidx_t) 1)
 
#define p4est_locidx_compare   sc_int32_compare
 
#define P4EST_MPI_LOCIDX   sc_MPI_INT
 
#define P4EST_VTK_LOCIDX   "Int32"
 
#define P4EST_F90_LOCIDX   INTEGER(KIND=C_INT32_T)
 
#define P4EST_LOCIDX_MIN   INT32_MIN
 
#define P4EST_LOCIDX_MAX   INT32_MAX
 
#define P4EST_LOCIDX_1   ((p4est_locidx_t) 1)
 
#define p4est_gloidx_compare   sc_int64_compare
 
#define P4EST_MPI_GLOIDX   sc_MPI_LONG_LONG_INT
 
#define P4EST_VTK_GLOIDX   "Int64"
 
#define P4EST_F90_GLOIDX   INTEGER(KIND=C_INT64_T)
 
#define P4EST_GLOIDX_MIN   INT64_MIN
 
#define P4EST_GLOIDX_MAX   INT64_MAX
 
#define P4EST_GLOIDX_1   ((p4est_gloidx_t) 1)
 
#define P4EST_ASSERT(c)   SC_NOOP ()
 
#define P4EST_EXECUTE_ASSERT_FALSE(expression)   do { (void) (expression); } while (0)
 
#define P4EST_EXECUTE_ASSERT_TRUE(expression)   do { (void) (expression); } while (0)
 
#define P4EST_ALLOC(t, n)
 allocate a t-array with n elements More...
 
#define P4EST_ALLOC_ZERO(t, n)
 allocate a t-array with n elements and zero More...
 
#define P4EST_REALLOC(p, t, n)
 reallocate the t-array p with n elements More...
 
#define P4EST_STRDUP(s)   sc_strdup (p4est_package_id, (s))
 duplicate a string
 
#define P4EST_FREE(p)   sc_free (p4est_package_id, (p))
 free an allocated array
 
#define P4EST_GLOBAL_LOG(p, s)   SC_GEN_LOG (p4est_package_id, SC_LC_GLOBAL, (p), (s))
 
#define P4EST_LOG(p, s)   SC_GEN_LOG (p4est_package_id, SC_LC_NORMAL, (p), (s))
 
#define P4EST_GLOBAL_LOGF(p, f,...)   SC_GEN_LOGF (p4est_package_id, SC_LC_GLOBAL, (p), (f), __VA_ARGS__)
 
#define P4EST_LOGF(p, f,...)   SC_GEN_LOGF (p4est_package_id, SC_LC_NORMAL, (p), (f), __VA_ARGS__)
 
#define P4EST_GLOBAL_TRACE(s)   P4EST_GLOBAL_LOG (SC_LP_TRACE, (s))
 
#define P4EST_GLOBAL_LDEBUG(s)   P4EST_GLOBAL_LOG (SC_LP_DEBUG, (s))
 
#define P4EST_GLOBAL_VERBOSE(s)   P4EST_GLOBAL_LOG (SC_LP_VERBOSE, (s))
 
#define P4EST_GLOBAL_INFO(s)   P4EST_GLOBAL_LOG (SC_LP_INFO, (s))
 
#define P4EST_GLOBAL_STATISTICS(s)   P4EST_GLOBAL_LOG (SC_LP_STATISTICS, (s))
 
#define P4EST_GLOBAL_PRODUCTION(s)   P4EST_GLOBAL_LOG (SC_LP_PRODUCTION, (s))
 
#define P4EST_GLOBAL_ESSENTIAL(s)   P4EST_GLOBAL_LOG (SC_LP_ESSENTIAL, (s))
 
#define P4EST_GLOBAL_LERROR(s)   P4EST_GLOBAL_LOG (SC_LP_ERROR, (s))
 
#define P4EST_GLOBAL_TRACEF(f,...)   P4EST_GLOBAL_LOGF (SC_LP_TRACE, (f), __VA_ARGS__)
 
#define P4EST_GLOBAL_LDEBUGF(f,...)   P4EST_GLOBAL_LOGF (SC_LP_DEBUG, (f), __VA_ARGS__)
 
#define P4EST_GLOBAL_VERBOSEF(f,...)   P4EST_GLOBAL_LOGF (SC_LP_VERBOSE, (f), __VA_ARGS__)
 
#define P4EST_GLOBAL_INFOF(f,...)   P4EST_GLOBAL_LOGF (SC_LP_INFO, (f), __VA_ARGS__)
 
#define P4EST_GLOBAL_STATISTICSF(f,...)   P4EST_GLOBAL_LOGF (SC_LP_STATISTICS, (f), __VA_ARGS__)
 
#define P4EST_GLOBAL_PRODUCTIONF(f,...)   P4EST_GLOBAL_LOGF (SC_LP_PRODUCTION, (f), __VA_ARGS__)
 
#define P4EST_GLOBAL_ESSENTIALF(f,...)   P4EST_GLOBAL_LOGF (SC_LP_ESSENTIAL, (f), __VA_ARGS__)
 
#define P4EST_GLOBAL_LERRORF(f,...)   P4EST_GLOBAL_LOGF (SC_LP_ERROR, (f), __VA_ARGS__)
 
#define P4EST_GLOBAL_NOTICE   P4EST_GLOBAL_STATISTICS
 
#define P4EST_GLOBAL_NOTICEF   P4EST_GLOBAL_STATISTICSF
 
#define P4EST_TRACE(s)   P4EST_LOG (SC_LP_TRACE, (s))
 
#define P4EST_LDEBUG(s)   P4EST_LOG (SC_LP_DEBUG, (s))
 
#define P4EST_VERBOSE(s)   P4EST_LOG (SC_LP_VERBOSE, (s))
 
#define P4EST_INFO(s)   P4EST_LOG (SC_LP_INFO, (s))
 
#define P4EST_STATISTICS(s)   P4EST_LOG (SC_LP_STATISTICS, (s))
 
#define P4EST_PRODUCTION(s)   P4EST_LOG (SC_LP_PRODUCTION, (s))
 
#define P4EST_ESSENTIAL(s)   P4EST_LOG (SC_LP_ESSENTIAL, (s))
 
#define P4EST_LERROR(s)   P4EST_LOG (SC_LP_ERROR, (s))
 
#define P4EST_TRACEF(f,...)   P4EST_LOGF (SC_LP_TRACE, (f), __VA_ARGS__)
 
#define P4EST_LDEBUGF(f,...)   P4EST_LOGF (SC_LP_DEBUG, (f), __VA_ARGS__)
 
#define P4EST_VERBOSEF(f,...)   P4EST_LOGF (SC_LP_VERBOSE, (f), __VA_ARGS__)
 
#define P4EST_INFOF(f,...)   P4EST_LOGF (SC_LP_INFO, (f), __VA_ARGS__)
 
#define P4EST_STATISTICSF(f,...)   P4EST_LOGF (SC_LP_STATISTICS, (f), __VA_ARGS__)
 
#define P4EST_PRODUCTIONF(f,...)   P4EST_LOGF (SC_LP_PRODUCTION, (f), __VA_ARGS__)
 
#define P4EST_ESSENTIALF(f,...)   P4EST_LOGF (SC_LP_ESSENTIAL, (f), __VA_ARGS__)
 
#define P4EST_LERRORF(f,...)   P4EST_LOGF (SC_LP_ERROR, (f), __VA_ARGS__)
 
#define P4EST_NOTICE   P4EST_STATISTICS
 
#define P4EST_NOTICEF   P4EST_STATISTICSF
 

Typedefs

typedef int32_t p4est_qcoord_t
 Typedef for quadrant coordinates. More...
 
typedef int32_t p4est_topidx_t
 Typedef for counting topological entities (trees, tree vertices). More...
 
typedef int32_t p4est_locidx_t
 Typedef for processor-local indexing of quadrants and nodes. More...
 
typedef int64_t p4est_gloidx_t
 Typedef for globally unique indexing of quadrants. More...
 

Functions

void P4EST_GLOBAL_LOGF (int priority, const char *fmt,...) __attribute__((format(printf
 
void void P4EST_LOGF (int priority, const char *fmt,...) __attribute__((format(printf
 
void P4EST_GLOBAL_TRACEF (const char *fmt,...) __attribute__((format(printf
 
void void P4EST_GLOBAL_LDEBUGF (const char *fmt,...) __attribute__((format(printf
 
void void void P4EST_GLOBAL_VERBOSEF (const char *fmt,...) __attribute__((format(printf
 
void void void void P4EST_GLOBAL_INFOF (const char *fmt,...) __attribute__((format(printf
 
void void void void void P4EST_GLOBAL_STATISTICSF (const char *fmt,...) __attribute__((format(printf
 
void void void void void void P4EST_GLOBAL_PRODUCTIONF (const char *fmt,...) __attribute__((format(printf
 
void void void void void void void P4EST_GLOBAL_ESSENTIALF (const char *fmt,...) __attribute__((format(printf
 
void void void void void void
void void 
P4EST_GLOBAL_LERRORF (const char *fmt,...) __attribute__((format(printf
 
void P4EST_TRACEF (const char *fmt,...) __attribute__((format(printf
 
void void P4EST_LDEBUGF (const char *fmt,...) __attribute__((format(printf
 
void void void P4EST_VERBOSEF (const char *fmt,...) __attribute__((format(printf
 
void void void void P4EST_INFOF (const char *fmt,...) __attribute__((format(printf
 
void void void void void P4EST_STATISTICSF (const char *fmt,...) __attribute__((format(printf
 
void void void void void void P4EST_PRODUCTIONF (const char *fmt,...) __attribute__((format(printf
 
void void void void void void void P4EST_ESSENTIALF (const char *fmt,...) __attribute__((format(printf
 
void void void void void void
void void 
P4EST_LERRORF (const char *fmt,...) __attribute__((format(printf
 
static void p4est_log_indent_push ()
 
static void p4est_log_indent_pop ()
 
void p4est_init (sc_log_handler_t log_handler, int log_threshold)
 Registers p4est with the SC Library and sets the logging behavior. More...
 
static unsigned p4est_topidx_hash2 (const p4est_topidx_t *tt)
 Compute hash value for two p4est_topidx_t integers. More...
 
static unsigned p4est_topidx_hash3 (const p4est_topidx_t *tt)
 Compute hash value for three p4est_topidx_t integers. More...
 
static unsigned p4est_topidx_hash4 (const p4est_topidx_t *tt)
 Compute hash value for four p4est_topidx_t integers. More...
 
static int p4est_topidx_is_sorted (p4est_topidx_t *t, int length)
 
static void p4est_topidx_bsort (p4est_topidx_t *t, int length)
 
static uint64_t p4est_partition_cut_uint64 (uint64_t global_num, int p, int num_procs)
 
static p4est_gloidx_t p4est_partition_cut_gloidx (p4est_gloidx_t global_num, int p, int num_procs)
 

Variables

int p4est_package_id
 the libsc package id for p4est (set in p4est_init())
 

Detailed Description

General support types and functions.

Macro Definition Documentation

#define P4EST_ALLOC (   t,
 
)
Value:
(t *) sc_malloc (p4est_package_id, \
(n) * sizeof(t))
int p4est_package_id
the libsc package id for p4est (set in p4est_init())
Definition: p4est_base.c:26

allocate a t-array with n elements

#define P4EST_ALLOC_ZERO (   t,
 
)
Value:
(t *) sc_calloc (p4est_package_id, \
(size_t) (n), sizeof(t))
int p4est_package_id
the libsc package id for p4est (set in p4est_init())
Definition: p4est_base.c:26

allocate a t-array with n elements and zero

#define P4EST_REALLOC (   p,
  t,
 
)
Value:
(t *) sc_realloc (p4est_package_id, \
(p), (n) * sizeof(t))
int p4est_package_id
the libsc package id for p4est (set in p4est_init())
Definition: p4est_base.c:26

reallocate the t-array p with n elements

Typedef Documentation

typedef int64_t p4est_gloidx_t

Typedef for globally unique indexing of quadrants.

typedef int32_t p4est_locidx_t

Typedef for processor-local indexing of quadrants and nodes.

typedef int32_t p4est_qcoord_t

Typedef for quadrant coordinates.

typedef int32_t p4est_topidx_t

Typedef for counting topological entities (trees, tree vertices).

Function Documentation

void p4est_init ( sc_log_handler_t  log_handler,
int  log_threshold 
)

Registers p4est with the SC Library and sets the logging behavior.

This function is optional. This function must only be called before additional threads are created. If this function is not called or called with log_handler == NULL, the default SC log handler will be used. If this function is not called or called with log_threshold == SC_LP_DEFAULT, the default SC log threshold will be used. The default SC log settings can be changed with sc_set_log_defaults ().

static unsigned p4est_topidx_hash2 ( const p4est_topidx_t tt)
inlinestatic

Compute hash value for two p4est_topidx_t integers.

Parameters
[in]ttArray of (at least) two values.
Returns
An unsigned hash value.
static unsigned p4est_topidx_hash3 ( const p4est_topidx_t tt)
inlinestatic

Compute hash value for three p4est_topidx_t integers.

Parameters
[in]ttArray of (at least) three values.
Returns
An unsigned hash value.
static unsigned p4est_topidx_hash4 ( const p4est_topidx_t tt)
inlinestatic

Compute hash value for four p4est_topidx_t integers.

Parameters
[in]ttArray of (at least) four values.
Returns
An unsigned hash value.