34#if defined(HAVE_CONFIG_H)
35# include "cs_config.h"
53#if defined(ENABLE_NLS) && defined(HAVE_GETTEXT)
56# define _(String) dgettext(PACKAGE, String)
58# define N_(String) gettext_noop(String)
60# define N_(String) String
70# define _(String) (String)
71# define N_(String) String
72# define textdomain(String) (String)
73# define gettext(String) (String)
74# define dgettext(Domain,String) (String)
75# define dcgettext(Domain,String,Type) (String)
76# define bindtextdomain(Domain, Directory) (Domain)
88#if defined(HAVE_MPI) && !defined(CS_IGNORE_MPI)
92# if !defined(MPI_VERSION)
98# define MPI_INFO_NULL 0
103#if defined(HAVE_OPENMP)
108#undef HAVE_OPENMP_SIMD
109#define HAVE_OPENMP_SIMD 1
116#if defined(HAVE_CUDA)
118#elif defined(HAVE_SYCL)
120#elif defined(HAVE_OPENMP_TARGET)
132#if !defined(__STDC_VERSION__)
133# define __STDC_VERSION__ 1989
141#if (__STDC_VERSION__ < 199901L)
143# if defined(__GNUC__)
144# define inline __inline__
145# define restrict __restrict__
155# if defined(__GNUC__) || defined(__clang__) || defined (__NVCC__)
156# define restrict __restrict__
157# elif defined(_MSC_VER)
158# define restrict __restrict
160# ifndef HAVE_RESTRICT
169#if defined(__GNUC__) || defined(__clang__)
170# define DEPRECATED __attribute__((deprecated))
171#elif defined(_MSC_VER)
172# define DEPRECATED __declspec(deprecated)
201# include <inttypes.h>
208#if defined(HAVE_SYS_TYPES_H)
209#include <sys/types.h>
219# define _Bool signed char;
227# define __bool_true_false_are_defined 1
231#if defined(__cplusplus)
238#if !defined(HAVE_INT32_T)
239# if (SIZEOF_INT == 4)
241# elif (SIZEOF_SHORT == 4)
242typedef short int32_t;
250#if !defined(HAVE_INT64_T)
251# if (SIZEOF_INT == 8)
253# elif (SIZEOF_LONG == 8)
255# elif (HAVE_LONG_LONG == 8)
256typedef long long int64_t;
264#if !defined(HAVE_UINT32_T)
265# if (SIZEOF_INT == 4)
266typedef unsigned uint32_t;
267# elif (SIZEOF_SHORT == 4)
268typedef unsigned short uint32_t;
276#if !defined(HAVE_UINT64_T)
277# if (SIZEOF_INT == 8)
278typedef unsigned uint64_t;
279# elif (SIZEOF_LONG == 8)
280typedef unsigned long uint64_t;
281# elif (HAVE_LONG_LONG)
282typedef unsigned long long uint64_t;
327#if defined(HAVE_LONG_GNUM)
335#if defined(HAVE_LONG_LNUM)
413#if defined(HAVE_MPI) && !defined(CS_IGNORE_MPI)
415# define CS_MPI_REAL MPI_DOUBLE
419# if defined(HAVE_LONG_GNUM)
420# if (SIZEOF_LONG == 8)
421# define CS_MPI_GNUM MPI_UNSIGNED_LONG
422# elif (SIZEOF_LONG_LONG == 8)
423# if defined(MPI_UNSIGNED_LONG_LONG)
424# define CS_MPI_GNUM MPI_UNSIGNED_LONG_LONG
425# elif defined(MPI_LONG_LONG)
426# define CS_MPI_GNUM MPI_LONG_LONG
429# if !defined(CS_MPI_GNUM)
433# define CS_MPI_GNUM MPI_UNSIGNED
438# if defined(HAVE_LONG_LNUM)
439# define CS_MPI_LNUM MPI_LONG
441# define CS_MPI_LNUM MPI_INT
444# define CS_MPI_EFLAG MPI_UNSIGNED
445# define CS_MPI_FLAG MPI_UNSIGNED_SHORT
446# define CS_MPI_COORD MPI_DOUBLE
453#if defined(HAVE_LONG_GNUM)
454# define CS_GNUM_TYPE CS_UINT64
455#elif (SIZEOF_INT == 8)
456# define CS_GNUM_TYPE CS_UINT64
458# define CS_GNUM_TYPE CS_UINT32
461#if defined(HAVE_LONG_LNUM)
462# if (SIZEOF_LONG == 8)
463# define CS_LNUM_TYPE CS_INT64
465# define CS_LNUM_TYPE CS_INT32
468# if (SIZEOF_INT == 8)
469# define CS_LNUM_TYPE CS_INT64
471# define CS_LNUM_TYPE CS_INT32
476# define CS_INT_TYPE CS_INT64
478# define CS_INT_TYPE CS_INT32
482# define CS_UINT_TYPE CS_UINT64
484# define CS_UINT_TYPE CS_UINT32
487#define CS_FLAG_TYPE CS_UINT16
488#define CS_EFLAG_TYPE CS_UINT_TYPE
489#define CS_REAL_TYPE CS_DOUBLE
490#define CS_COORD_TYPE CS_DOUBLE
496#define CS_THR_MIN 128
507#define CS_ABS(a) ((a) < 0 ? -(a) : (a))
508#define CS_MIN(a,b) ((a) < (b) ? (a) : (b))
509#define CS_MAX(a,b) ((a) > (b) ? (a) : (b))
531#define CS_UNUSED(x) (void)(x)
532#define CS_NO_WARN_IF_UNUSED(x) (void)(x)
541#if defined(__cplusplus)
542# define BEGIN_C_DECLS extern "C" {
543# define END_C_DECLS }
545# define BEGIN_C_DECLS
555#define CS_F_HOST __host__
556#define CS_F_DEVICE __device__
557#define CS_F_HOST_DEVICE __host__ __device__
558#define CS_V_CONSTANT __constant__
564#define CS_F_HOST_DEVICE
565#define CS_V_CONSTANT static const
579#define CS_PROCF(x, y) x##_
581#define CS_PROCF(x, y) x
599#if defined(HAVE_MPI) && !defined(CS_IGNORE_MPI)
616#if defined(HAVE_MPI) && !defined(CS_IGNORE_MPI)
658 return ((i > 0) ? ((i-1)/m+1)*m : 0);
673#if defined(HAVE_OPENMP)
674 return omp_get_thread_num();
701struct dependent_false : std::false_type {};
705cs_datatype_from_type()
707 static_assert(dependent_false<T>::value,
"Unknown datatype");
717cs_datatype_from_type<char>()
726cs_datatype_from_type<float>()
735cs_datatype_from_type<double>()
744cs_datatype_from_type<uint16_t>()
753cs_datatype_from_type<uint32_t>()
762cs_datatype_from_type<uint64_t>()
771cs_datatype_from_type<int32_t>()
780cs_datatype_from_type<int64_t>()
int cs_glob_n_ranks
Definition: cs_defs.cpp:175
cs_datatype_t
Definition: cs_defs.h:300
@ CS_FLOAT
Definition: cs_defs.h:304
@ CS_CHAR
Definition: cs_defs.h:303
@ CS_UINT16
Definition: cs_defs.h:306
@ CS_INT64
Definition: cs_defs.h:308
@ CS_UINT64
Definition: cs_defs.h:310
@ CS_DOUBLE
Definition: cs_defs.h:305
@ CS_UINT32
Definition: cs_defs.h:309
@ CS_INT32
Definition: cs_defs.h:307
@ CS_DATATYPE_NULL
Definition: cs_defs.h:302
cs_lnum_t cs_lnum_3_t[3]
Definition: cs_defs.h:353
const char * cs_datatype_name[]
Definition: cs_defs.cpp:143
char cs_byte_t
Definition: cs_defs.h:343
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
void *() cs_destructor_t(void *s)
Destroy a given structure.
Definition: cs_defs.h:634
cs_rreal_t cs_rreal_3_t[3]
Definition: cs_defs.h:388
const size_t cs_datatype_size[]
Definition: cs_defs.cpp:133
cs_real_33_t cs_real_332_t[2]
vector of 2 3x3 matrices of floating-point values
Definition: cs_defs.h:380
int cs_glob_node_rank_id
Definition: cs_defs.cpp:177
cs_real_t cs_real_69_t[6][9]
Definition: cs_defs.h:378
cs_nreal_t cs_nreal_3_t[3]
Definition: cs_defs.h:385
const char cs_empty_string[]
Definition: cs_defs.cpp:129
int cs_glob_n_threads
Definition: cs_defs.cpp:172
cs_lnum_t cs_lnum_2_t[2]
vector of 2 local mesh-entity ids
Definition: cs_defs.h:352
static int cs_get_thread_id(void)
Retrieve the associated thread id (0 if no OpenMP or if outside an OpenMP region)
Definition: cs_defs.h:668
int cs_glob_node_n_ranks
Definition: cs_defs.cpp:178
cs_real_t cs_real_4_t[4]
vector of 4 floating-point values
Definition: cs_defs.h:360
MPI_Datatype cs_datatype_to_mpi[]
Definition: cs_defs.cpp:157
double cs_dreal_t
Definition: cs_defs.h:347
cs_real_t cs_real_10_t[10]
Definition: cs_defs.h:364
cs_real_t cs_real_99_t[9][9]
Definition: cs_defs.h:370
double cs_coord_t
Definition: cs_defs.h:340
cs_real_t cs_real_34_t[3][4]
Definition: cs_defs.h:374
cs_real_t cs_real_66_t[6][6]
6x6 matrix of floating-point values
Definition: cs_defs.h:369
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:359
cs_coord_t cs_coord_3_t[3]
Definition: cs_defs.h:355
cs_real_66_t cs_real_662_t[2]
Definition: cs_defs.h:382
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:358
uint64_t cs_gnum_t
global mesh entity number
Definition: cs_defs.h:325
cs_interlace_t
Definition: cs_defs.h:514
@ CS_INTERLACE
Definition: cs_defs.h:516
@ CS_NO_INTERLACE
Definition: cs_defs.h:517
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:361
static cs_lnum_t cs_align(cs_lnum_t i, cs_lnum_t m)
Given a base index i, return the next index aligned with a size m.
Definition: cs_defs.h:652
cs_dreal_t cs_dreal_3_t[3]
Definition: cs_defs.h:387
cs_real_t cs_real_333_t[3][3][3]
Definition: cs_defs.h:372
double cs_rreal_t
Definition: cs_defs.h:348
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:368
MPI_Comm cs_glob_mpi_comm
Definition: cs_defs.cpp:183
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
cs_real_t cs_real_63_t[6][3]
Definition: cs_defs.h:376
double cs_nreal_t
Definition: cs_defs.h:346
cs_real_t cs_real_9_t[9]
Definition: cs_defs.h:363
cs_real_t cs_real_23_t[2][3]
Definition: cs_defs.h:366
unsigned short int cs_flag_t
Definition: cs_defs.h:344
int cs_glob_rank_id
Definition: cs_defs.cpp:174
Definition: cs_defs.h:390
Definition: cs_defs.h:400