t8  1.2.0
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
Macros | Typedefs | Enumerations | Functions
t8.h File Reference

This is the administrative header file for t8code. More...

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

Go to the source code of this file.

Macros

#define t8_const   _sc_const
 Portable way to use the const keyword determined by configure.
 
#define t8_restrict   _sc_restrict
 Portable way to use the const keyword determined by configure.
 
#define T8_ASSERT(c)   SC_NOOP ()
 Widely used assertion. More...
 
#define T8_ALLOC(t, n)
 Allocate a t-array with n elements. More...
 
#define T8_ALLOC_ZERO(t, n)
 Allocate a t-array with n elements and init to zero. More...
 
#define T8_FREE(p)   sc_free (t8_get_package_id(), (p))
 Deallocate a t-array.
 
#define T8_REALLOC(p, t, n)
 Reallocate the t-array p with n elements. More...
 
#define T8_MPI_LOCIDX   sc_MPI_INT
 The MPI Datatype of t8_locidx_t.
 
#define T8_LOCIDX_ABS(x)   ((t8_locidx_t) labs ((long) (x)))
 Macro to get the absolute value of a t8_locidx_t.
 
#define T8_LOCIDX_MAX   INT32_MAX
 Maximum possible value of a t8_locidx_t.
 
#define t8_compare_locidx(v, w)   sc_int32_compare(v,w)
 Comparison function for t8_locidx_t.
 
#define T8_MPI_GLOIDX   sc_MPI_LONG_LONG_INT
 The MPI Datatype of t8_gloidx_t.
 
#define T8_GLOIDX_ABS(x)   ((t8_gloidx_t) llabs ((long long) (x)))
 Macro to get the absolute value of a t8_gloidx_t.
 
#define t8_compare_gloidx(v, w)   sc_int64_compare(v,w)
 Comparison function for t8_gloidx_t.
 
#define T8_MPI_LINEARIDX   sc_MPI_UNSIGNED_LONG_LONG
 The MPI datatype of t8_linearidx_t.
 
#define T8_PADDING_SIZE   (sizeof (void*))
 
#define T8_ADD_PADDING(_x)    ((T8_PADDING_SIZE - ((_x) % T8_PADDING_SIZE)) % T8_PADDING_SIZE)
 Compute the number of bytes that have to be added to a given byte_count such that it is a multiple of the padding size.
 
#define T8_PRECISION_EPS   SC_EPS
 Define precisions for computations.
 

Typedefs

typedef int32_t t8_locidx_t
 A type for processor-local indexing.
 
typedef int64_t t8_gloidx_t
 A type for global indexing that holds really big numbers.
 
typedef uint64_t t8_linearidx_t
 A type for storing SFC indices.
 

Enumerations

enum  t8_MPI_tag_t {
  T8_MPI_TAG_FIRST = SC_TAG_FIRST ,
  T8_MPI_PARTITION_CMESH = SC_TAG_LAST ,
  T8_MPI_PARTITION_FOREST ,
  T8_MPI_GHOST_FOREST ,
  T8_MPI_GHOST_EXC_FOREST ,
  T8_MPI_TAG_LAST
}
 Communication tags used internal to t8code. More...
 

Functions

int t8_get_package_id (void)
 Query the package identity as registered in libsc. More...
 
void t8_logv (int category, int priority, const char *fmt, va_list ap)
 Logging function parametrized by local/global category and priority. More...
 
void t8_logf (int category, int priority, const char *fmt,...)
 Logging function parametrized by local/global category and priority. More...
 
void t8_log_indent_push (void)
 Add one space to the start of t8's default log format.
 
void t8_log_indent_pop (void)
 Remove one space from the start of a t8's default log format.
 
void t8_global_errorf (const char *fmt,...)
 Log a message on the root rank with priority SC_LP_ERROR. More...
 
void t8_global_essentialf (const char *fmt,...)
 Log a message on the root rank with priority SC_LP_ESSENTIAL. More...
 
void t8_global_productionf (const char *fmt,...)
 Log a message on the root rank with priority SC_LP_PRODUCTION. More...
 
void t8_global_infof (const char *fmt,...)
 Log a message on the root rank with priority SC_LP_INFO. More...
 
void t8_infof (const char *fmt,...)
 Log a message, no matter what rank, with priority SC_LP_INFO. More...
 
void t8_productionf (const char *fmt,...)
 Log a message, no matter what rank, with priority SC_LP_PRODUCTION. More...
 
void t8_debugf (const char *fmt,...)
 Log a message, no matter what rank, with priority SC_LP_DEBUG. More...
 
void t8_errorf (const char *fmt,...)
 Log a message, no matter what rank, with priority SC_LP_ERROR. More...
 
void t8_init (int log_threshold)
 Register t8code with libsc and print version and variable information. More...
 
void * t8_sc_array_index_locidx (sc_array_t *array, t8_locidx_t it)
 Return a pointer to an array element indexed by a t8_locidx_t. More...
 

Detailed Description

This is the administrative header file for t8code.

It includes standard C headers via subpackages. It also provides application-level convenience code such as logging functions.

Macro Definition Documentation

◆ T8_ALLOC

#define T8_ALLOC (   t,
 
)
Value:
(t *) sc_malloc (t8_get_package_id(), \
(n) * sizeof(t))
int t8_get_package_id(void)
Query the package identity as registered in libsc.
Definition: t8.c:29

Allocate a t-array with n elements.

◆ T8_ALLOC_ZERO

#define T8_ALLOC_ZERO (   t,
 
)
Value:
(t *) sc_calloc (t8_get_package_id(), \
(size_t) (n), sizeof(t))

Allocate a t-array with n elements and init to zero.

◆ T8_ASSERT

#define T8_ASSERT (   c)    SC_NOOP ()

Widely used assertion.

Only active in debug-mode.

◆ T8_REALLOC

#define T8_REALLOC (   p,
  t,
 
)
Value:
(t *) sc_realloc (t8_get_package_id(), \
(p), (n) * sizeof(t))

Reallocate the t-array p with n elements.

Enumeration Type Documentation

◆ t8_MPI_tag_t

Communication tags used internal to t8code.

Enumerator
T8_MPI_PARTITION_CMESH 

Used for coarse mesh partitioning.

T8_MPI_PARTITION_FOREST 

Used for forest partitioning.

T8_MPI_GHOST_FOREST 

Used for for ghost layer creation.

T8_MPI_GHOST_EXC_FOREST 

Used for ghost data exchange.

Function Documentation

◆ t8_debugf()

void t8_debugf ( const char *  fmt,
  ... 
)

Log a message, no matter what rank, with priority SC_LP_DEBUG.

Parameters
[in]fmtPrintf-style format string.
Note
This function does not print anything unless t8code was compiled in debug mode (–enable-debug, T8_ENABLE_DEBUG was defined).

◆ t8_errorf()

void t8_errorf ( const char *  fmt,
  ... 
)

Log a message, no matter what rank, with priority SC_LP_ERROR.

Parameters
[in]fmtPrintf-style format string.

◆ t8_get_package_id()

int t8_get_package_id ( void  )

Query the package identity as registered in libsc.

Returns
This is -1 before t8_init has been called and a proper package identifier afterwards.

◆ t8_global_errorf()

void t8_global_errorf ( const char *  fmt,
  ... 
)

Log a message on the root rank with priority SC_LP_ERROR.

Parameters
[in]fmtPrintf-style format string.

◆ t8_global_essentialf()

void t8_global_essentialf ( const char *  fmt,
  ... 
)

Log a message on the root rank with priority SC_LP_ESSENTIAL.

Parameters
[in]fmtPrintf-style format string.

◆ t8_global_infof()

void t8_global_infof ( const char *  fmt,
  ... 
)

Log a message on the root rank with priority SC_LP_INFO.

Parameters
[in]fmtPrintf-style format string.

◆ t8_global_productionf()

void t8_global_productionf ( const char *  fmt,
  ... 
)

Log a message on the root rank with priority SC_LP_PRODUCTION.

Parameters
[in]fmtPrintf-style format string.

◆ t8_infof()

void t8_infof ( const char *  fmt,
  ... 
)

Log a message, no matter what rank, with priority SC_LP_INFO.

Parameters
[in]fmtPrintf-style format string.

◆ t8_init()

void t8_init ( int  log_threshold)

Register t8code with libsc and print version and variable information.

Parameters
[in]log_thresholdDeclared in sc.h. SC_LP_DEFAULT is fine. You can also choose from log levels SC_LP_*.

◆ t8_logf()

void t8_logf ( int  category,
int  priority,
const char *  fmt,
  ... 
)

Logging function parametrized by local/global category and priority.

Parameters
[in]categoryEither SC_LC_NORMAL for outputting on every rank or SC_LC_GLOBAL for outputting on the root rank.
[in]priorityPlease see sc.h for legal log priorities.
[in]fmtPrintf-style format string.

◆ t8_logv()

void t8_logv ( int  category,
int  priority,
const char *  fmt,
va_list  ap 
)

Logging function parametrized by local/global category and priority.

Parameters
[in]categoryEither SC_LC_NORMAL for outputting on every rank or SC_LC_GLOBAL for outputting on the root rank.
[in]priorityPlease see sc.h for legal log priorities.
[in]fmtPrintf-style format string.
[in]apArgument list; see stdarg.h.

◆ t8_productionf()

void t8_productionf ( const char *  fmt,
  ... 
)

Log a message, no matter what rank, with priority SC_LP_PRODUCTION.

Parameters
[in]fmtPrintf-style format string.

◆ t8_sc_array_index_locidx()

void* t8_sc_array_index_locidx ( sc_array_t *  array,
t8_locidx_t  it 
)

Return a pointer to an array element indexed by a t8_locidx_t.

Parameters
[in]indexneeds to be in [0]..[elem_count-1].
Returns
A void * pointing to entry it in array.