33 #ifndef T8_CMAKE_BUILD
34 #include <t8_config.h>
36 #include <sc_config.h>
37 #if (defined(T8_ENABLE_MPI) && !defined(SC_ENABLE_MPI)) || (!defined(T8_ENABLE_MPI) && defined(SC_ENABLE_MPI))
38 #error "MPI configured differently in t8code and libsc"
40 #if (defined(T8_ENABLE_MPIIO) && !defined(SC_ENABLE_MPIIO)) || (!defined(T8_ENABLE_MPIIO) && defined(SC_ENABLE_MPIIO))
41 #error "MPI I/O configured differently in t8code and libsc"
45 #include <sc_containers.h>
49 #define T8_EXTERN_C_BEGIN() SC_EXTERN_C_BEGIN
53 #define T8_EXTERN_C_END() SC_EXTERN_C_END
59 #define t8_const _sc_const
62 #define t8_restrict _sc_restrict
70 #ifdef T8_ENABLE_DEBUG
71 #define T8_ASSERT(c) SC_CHECK_ABORT ((c), "Assertion '" #c "'")
73 #define T8_ASSERT(c) SC_NOOP ()
77 #define T8_ALLOC(t, n) (t *) sc_malloc (t8_get_package_id (), (n) * sizeof (t))
80 #define T8_ALLOC_ZERO(t, n) (t *) sc_calloc (t8_get_package_id (), (size_t) (n), sizeof (t))
83 #define T8_FREE(p) sc_free (t8_get_package_id (), (p))
86 #define T8_REALLOC(p, t, n) (t *) sc_realloc (t8_get_package_id (), (p), (n) * sizeof (t))
91 #define T8_MPI_LOCIDX sc_MPI_INT
93 #define T8_LOCIDX_ABS(x) ((t8_locidx_t) labs ((long) (x)))
95 #define T8_LOCIDX_MAX INT32_MAX
97 #define t8_compare_locidx(v, w) sc_int32_compare (v, w)
102 #define T8_MPI_GLOIDX sc_MPI_LONG_LONG_INT
104 #define T8_GLOIDX_ABS(x) ((t8_gloidx_t) llabs ((long long) (x)))
106 #define t8_compare_gloidx(v, w) sc_int64_compare (v, w)
111 #define T8_MPI_LINEARIDX sc_MPI_UNSIGNED_LONG_LONG
113 #define T8_PADDING_SIZE (sizeof (void *))
116 #define T8_ADD_PADDING(_x) ((T8_PADDING_SIZE - ((_x) % T8_PADDING_SIZE)) % T8_PADDING_SIZE)
119 #define T8_PRECISION_EPS SC_EPS
120 #define T8_PRECISION_SQRT_EPS sqrt (T8_PRECISION_EPS)
123 #define T8_1D_TO_1D(nx, i) (i)
124 #define T8_2D_TO_1D(nx, ny, i, j) ((i) * (ny) + (j))
125 #define T8_3D_TO_1D(nx, ny, nz, i, j, k) (((i) * (ny) + (j)) * (nz) + (k))
126 #define T8_4D_TO_1D(nx, ny, nz, nl, i, j, k, l) ((((i) * (ny) + (j)) * (nz) + (k)) * (nl) + (l))
130 T8_MPI_TAG_FIRST = SC_TAG_FIRST,
154 t8_logv (
int category,
int priority,
const char *fmt, va_list ap);
163 t8_logf (
int category,
int priority,
const char *fmt, ...)
165 __attribute__ ((format (printf, 3, 4)))
183 __attribute__ ((format (printf, 1, 2)))
193 __attribute__ ((format (printf, 1, 2)))
203 __attribute__ ((format (printf, 1, 2)))
213 __attribute__ ((format (printf, 1, 2)))
223 __attribute__ ((format (printf, 1, 2)))
233 __attribute__ ((format (printf, 1, 2)))
245 __attribute__ ((format (printf, 1, 2)))
255 __attribute__ ((format (printf, 1, 2)))
int64_t t8_gloidx_t
A type for global indexing that holds really big numbers.
Definition: t8.h:100
void t8_errorf(const char *fmt,...)
Log a message, no matter what rank, with priority SC_LP_ERROR.
Definition: t8.c:135
void t8_infof(const char *fmt,...)
Log a message, no matter what rank, with priority SC_LP_INFO.
Definition: t8.c:103
void t8_global_productionf(const char *fmt,...)
Log a message on the root rank with priority SC_LP_PRODUCTION.
Definition: t8.c:83
void t8_global_errorf(const char *fmt,...)
Log a message on the root rank with priority SC_LP_ERROR.
Definition: t8.c:63
void t8_logf(int category, int priority, const char *fmt,...)
Logging function parametrized by local/global category and priority.
Definition: t8.c:41
void t8_global_essentialf(const char *fmt,...)
Log a message on the root rank with priority SC_LP_ESSENTIAL.
Definition: t8.c:73
void t8_global_infof(const char *fmt,...)
Log a message on the root rank with priority SC_LP_INFO.
Definition: t8.c:93
int t8_get_package_id(void)
Query the package identity as registered in libsc.
Definition: t8.c:29
void t8_debugf(const char *fmt,...)
Log a message, no matter what rank, with priority SC_LP_DEBUG.
Definition: t8.c:123
void t8_log_indent_push(void)
Add one space to the start of t8's default log format.
Definition: t8.c:51
t8_MPI_tag_t
Communication tags used internal to t8code.
Definition: t8.h:129
@ T8_MPI_PARTITION_CMESH
Used for coarse mesh partitioning.
Definition: t8.h:131
@ T8_MPI_GHOST_FOREST
Used for for ghost layer creation.
Definition: t8.h:133
@ T8_MPI_PARTITION_FOREST
Used for forest partitioning.
Definition: t8.h:132
@ T8_MPI_TEST_ELEMENT_PACK_TAG
Used for testing mpi pack and unpack functionality.
Definition: t8.h:135
@ T8_MPI_GHOST_EXC_FOREST
Used for ghost data exchange.
Definition: t8.h:134
void t8_init(int log_threshold)
Register t8code with libsc and print version and variable information.
Definition: t8.c:145
void t8_log_indent_pop(void)
Remove one space from the start of a t8's default log format.
Definition: t8.c:57
void * t8_sc_array_index_locidx(const sc_array_t *array, const t8_locidx_t it)
Return a pointer to an array element indexed by a t8_locidx_t.
Definition: t8.c:162
uint64_t t8_linearidx_t
A type for storing SFC indices.
Definition: t8.h:109
int32_t t8_locidx_t
A type for processor-local indexing.
Definition: t8.h:89
void t8_logv(int category, int priority, const char *fmt, va_list ap)
Logging function parametrized by local/global category and priority.
Definition: t8.c:35
void t8_productionf(const char *fmt,...)
Log a message, no matter what rank, with priority SC_LP_PRODUCTION.
Definition: t8.c:113