12#ifndef ARCANE_UTILS_ARCANEGLOBAL_H
13#define ARCANE_UTILS_ARCANEGLOBAL_H
21#include "arcane_core_config.h"
23#ifdef ARCCORE_OS_LINUX
24#define ARCANE_OS_LINUX
28#ifdef ARCCORE_OS_WIN32
29#define ARCANE_OS_WIN32
32#ifdef ARCCORE_OS_MACOS
33#define ARCANE_OS_MACOS
36#define ARCANE_EXPORT ARCCORE_EXPORT
37#define ARCANE_IMPORT ARCCORE_IMPORT
38#define ARCANE_TEMPLATE_EXPORT ARCCORE_TEMPLATE_EXPORT
39#define ARCANE_RESTRICT ARCCORE_RESTRICT
45#define ARCANE_UNUSED(var) ARCCORE_UNUSED(var)
53#ifndef ARCANE_NO_USING_FOR_STREAM
58using std::istringstream;
61using std::ostringstream;
68typedef ARCANE_TYPE_INT16 Int16;
69typedef ARCANE_TYPE_INT32 Int32;
70typedef ARCANE_TYPE_INT64 Int64;
73#define ARCANE_BEGIN_NAMESPACE \
76#define ARCANE_END_NAMESPACE }
77#define NUMERICS_BEGIN_NAMESPACE \
80#define NUMERICS_END_NAMESPACE }
85#ifdef ARCANE_COMPONENT_FULL
86#define ARCANE_COMPONENT_arcane_utils
87#define ARCANE_COMPONENT_arcane
88#define ARCANE_COMPONENT_arcane_mesh
89#define ARCANE_COMPONENT_arcane_std
90#define ARCANE_COMPONENT_arcane_impl
91#define ARCANE_COMPONENT_arcane_script
94#if defined(ARCANE_COMPONENT_arcane) || defined(ARCANE_COMPONENT_arcane_core)
95#define ARCANE_CORE_EXPORT ARCANE_EXPORT
96#define ARCANE_EXPR_EXPORT ARCANE_EXPORT
97#define ARCANE_DATATYPE_EXPORT ARCANE_EXPORT
98#define ARCANE_CORE_EXTERN_TPL
100#define ARCANE_CORE_EXPORT ARCANE_IMPORT
101#define ARCANE_EXPR_EXPORT ARCANE_IMPORT
102#define ARCANE_DATATYPE_EXPORT ARCANE_IMPORT
103#define ARCANE_CORE_EXTERN_TPL extern
106#ifdef ARCANE_COMPONENT_arcane_utils
107#define ARCANE_UTILS_EXPORT ARCANE_EXPORT
108#define ARCANE_UTILS_EXTERN_TPL
110#define ARCANE_UTILS_EXPORT ARCANE_IMPORT
111#define ARCANE_UTILS_EXTERN_TPL extern
114#ifdef ARCANE_COMPONENT_arcane_impl
115#define ARCANE_IMPL_EXPORT ARCANE_EXPORT
117#define ARCANE_IMPL_EXPORT ARCANE_IMPORT
120#ifdef ARCANE_COMPONENT_arcane_mesh
121#define ARCANE_MESH_EXPORT ARCANE_EXPORT
123#define ARCANE_MESH_EXPORT ARCANE_IMPORT
126#ifdef ARCANE_COMPONENT_arcane_std
127#define ARCANE_STD_EXPORT ARCANE_EXPORT
129#define ARCANE_STD_EXPORT ARCANE_IMPORT
132#ifdef ARCANE_COMPONENT_arcane_script
133#define ARCANE_SCRIPT_EXPORT ARCANE_EXPORT
135#define ARCANE_SCRIPT_EXPORT ARCANE_IMPORT
138#ifdef ARCANE_COMPONENT_arcane_solvers
139#define ARCANE_SOLVERS_EXPORT ARCANE_EXPORT
141#define ARCANE_SOLVERS_EXPORT ARCANE_IMPORT
144#ifdef ARCANE_COMPONENT_arcane_geometry
145#define ARCANE_GEOMETRY_EXPORT ARCANE_EXPORT
147#define ARCANE_GEOMETRY_EXPORT ARCANE_IMPORT
150#ifdef ARCANE_COMPONENT_arcane_thread
151#define ARCANE_THREAD_EXPORT ARCANE_EXPORT
153#define ARCANE_THREAD_EXPORT ARCANE_IMPORT
156#ifdef ARCANE_COMPONENT_arcane_mpi
157#define ARCANE_MPI_EXPORT ARCANE_EXPORT
159#define ARCANE_MPI_EXPORT ARCANE_IMPORT
162#ifdef ARCANE_COMPONENT_arcane_hyoda
163#define ARCANE_HYODA_EXPORT ARCANE_EXPORT
165#define ARCANE_HYODA_EXPORT ARCANE_IMPORT
168#ifdef ARCANE_REAL_USE_APFLOAT
181#define ARCANE_HAS_LONG_LONG
186const double cgrEPSILON_DELTA = 1.0e-2;
187const double cgrPI = 3.14159265358979323846;
192#define ARCANE_REAL(val) ARCCORE_REAL(val)
194#ifdef ARCCORE_REAL_NOT_BUILTIN
195#define ARCANE_REAL_NOT_BUILTIN
198#ifdef ARCCORE_REAL_LONG
199#define ARCANE_REAL_LONG
202#ifdef ARCCORE_REAL_IS_DOUBLE
203#define ARCANE_REAL_IS_DOUBLE
253extern "C++" ARCANE_UTILS_EXPORT
void
269extern "C++" ARCANE_UTILS_EXPORT
void
275extern "C++" ARCANE_UTILS_EXPORT
void
276_internalArcaneMathError(
long double arg_value,
const char* func_name);
278extern "C++" ARCANE_UTILS_EXPORT
void
279_internalArcaneMathError(
long double arg_value1,
long double arg_value2,
const char* func_name);
291ARCCORE_HOST_DEVICE
inline void
294#ifndef ARCCORE_DEVICE_CODE
295 _internalArcaneMathError(arg_value, func_name);
297 ARCANE_UNUSED(arg_value);
298 ARCANE_UNUSED(func_name);
311ARCCORE_HOST_DEVICE
inline void
314#ifndef ARCCORE_DEVICE_CODE
315 _internalArcaneMathError(arg_value1, arg_value2, func_name);
317 ARCANE_UNUSED(arg_value1);
318 ARCANE_UNUSED(arg_value2);
319 ARCANE_UNUSED(func_name);
336extern "C++" ARCANE_UTILS_EXPORT
void
343extern "C++" ARCANE_UTILS_EXPORT
void
358extern "C++" ARCANE_UTILS_EXPORT
void
370extern "C++" ARCANE_UTILS_EXPORT
void
379extern "C++" ARCANE_UTILS_EXPORT
Integer
388extern "C++" ARCANE_UTILS_EXPORT
Integer
397extern "C++" ARCANE_UTILS_EXPORT
Integer
406extern "C++" ARCANE_UTILS_EXPORT
Integer
415extern "C++" ARCANE_UTILS_EXPORT
Integer
424extern "C++" ARCANE_UTILS_EXPORT
Integer
431extern "C++" ARCANE_UTILS_EXPORT
void
476extern "C++" ARCANE_UTILS_EXPORT
484extern "C++" ARCANE_UTILS_EXPORT
bool _checkDebug(
size_t);
485#define ARCANE_DEBUGP(a, b) \
486 if (_checkDebug(a)) { \
490#define ARCANE_DEBUGP(a, b)
497#define ARCANE_NOT_YET_IMPLEMENTED(a) \
499 arcaneNotYetImplemented(__FILE__, __PRETTY_FUNCTION__, __LINE__, (a)); \
502#define ARCANE_NOT_YET_IMPLEMENTED(a) \
504 arcaneNotYetImplemented(__FILE__, "(NoInfo)", __LINE__, (a)); \
508#define ARCANE_DEPRECATED ARCCORE_DEPRECATED
510#define ARCANE_DEPRECATED_112 ARCANE_DEPRECATED
511#define ARCANE_DEPRECATED_114 ARCANE_DEPRECATED
512#define ARCANE_DEPRECATED_116 ARCANE_DEPRECATED
513#define ARCANE_DEPRECATED_118 ARCANE_DEPRECATED
514#define ARCANE_DEPRECATED_120 ARCANE_DEPRECATED
515#define ARCANE_DEPRECATED_122 ARCANE_DEPRECATED
516#define ARCANE_DEPRECATED_200 ARCANE_DEPRECATED
517#define ARCANE_DEPRECATED_220 ARCANE_DEPRECATED
518#define ARCANE_DEPRECATED_240 ARCANE_DEPRECATED
519#define ARCANE_DEPRECATED_260 ARCANE_DEPRECATED
520#define ARCANE_DEPRECATED_280 ARCANE_DEPRECATED
521#define ARCANE_DEPRECATED_2018 ARCANE_DEPRECATED
522#define ARCANE_DEPRECATED_2018_R(reason) [[deprecated(reason)]]
524#define ARCANE_DEPRECATED_REASON(reason) [[deprecated(reason)]]
526#ifdef ARCANE_NO_DEPRECATED_LONG_TERM
527#define ARCANE_DEPRECATED_LONG_TERM(reason)
536#define ARCANE_DEPRECATED_LONG_TERM(reason) [[deprecated(reason)]]
541#define ARCANE_NO_DEPRECATED
545#ifdef ARCANE_NO_NOTIFY_DEPRECATED_ARRAY
546#define ARCANE_DEPRECATED_ARRAY
548#define ARCANE_DEPRECATED_ARRAY ARCANE_DEPRECATED
559#define ARCANE_JOIN_HELPER2(a, b) a##b
560#define ARCANE_JOIN_HELPER(a, b) ARCANE_JOIN_HELPER2(a, b)
561#define ARCANE_JOIN_WITH_LINE(a) ARCANE_JOIN_HELPER(a, __LINE__)
567#define ARCANE_NORETURN ARCCORE_NORETURN
570#define ARCANE_CONSTEXPR ARCCORE_CONSTEXPR
577#define ARCANE_NOEXCEPT ARCCORE_NOEXCEPT
578#define ARCANE_NOEXCEPT_FALSE ARCCORE_NOEXCEPT_FALSE
593#define ARCANE_ALIGNAS(value) __declspec(align(value))
595#define ARCANE_ALIGNAS_PACKED(value) __declspec(align(value))
598#define ARCANE_ALIGNAS_PACKED(value) __attribute__((aligned(value), packed))
600#define ARCANE_ALIGNAS(value) __attribute__((aligned(value)))
607#ifdef ARCANE_DEPRECATED
608#undef ARCANE_DEPRECATED
615#if defined(ARCANE_CHECK) || defined(ARCANE_DEBUG)
616#ifndef ARCANE_DEBUG_ASSERT
617#define ARCANE_DEBUG_ASSERT
630extern "C++" ARCANE_UTILS_EXPORT
void
646extern "C++" ARCANE_UTILS_EXPORT
void
655arcaneCheckNull(
const void* ptr)
671extern "C++" ARCANE_UTILS_EXPORT
Integer
680#ifdef ARCANE_DEBUG_ASSERT
681extern "C++" ARCANE_UTILS_EXPORT
void _doAssert(
const char*,
const char*,
const char*,
size_t);
682template <
typename T>
inline T*
683_checkPointer(T* t,
const char* file,
const char* func,
size_t line)
686 _doAssert(
"ARCANE_ASSERT", file, func, line);
692#define ARCANE_D_WHERE(a) Arcane::_doAssert(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
693#define ARCANE_DCHECK_POINTER(a) Arcane::_checkPointer((a), __FILE__, __PRETTY_FUNCTION__, __LINE__);
695#define ARCANE_D_WHERE(a) Arcane::_doAssert(a, __FILE__, "(NoInfo)", __LINE__)
696#define ARCANE_DCHECK_POINTER(a) Arcane::_checkPointer((a),__FILE__,"(NoInfo"),__LINE__);
698#define ARCANE_CHECK_PTR(a) \
701 Arcane::arcanePrintf("Null value"); \
702 ARCANE_D_WHERE("ARCANE_ASSERT"); \
706#define ARCANE_ASSERT(a, b) \
709 Arcane::arcanePrintf("Assertion '%s' fails:", #a); \
710 Arcane::arcanePrintf b; \
711 ARCANE_D_WHERE("ARCANE_ASSERT"); \
714#define ARCANE_WARNING(a) \
716 Arcane::arcanePrintf a; \
717 ARCANE_D_WHERE("ARCANE_WARNING"); \
720#define ARCANE_CHECK_PTR(a)
721#define ARCANE_ASSERT(a, b)
722#define ARCANE_WARNING(a)
723#define ARCANE_DCHECK_POINTER(a) (a);
735#define ARCANE_THROW(exception_class, ...) \
736 ARCCORE_THROW(exception_class, __VA_ARGS__)
747#define ARCANE_THROW_IF(const, exception_class, ...) \
748 ARCCORE_THROW_IF(const, exception_class, __VA_ARGS__)
758#define ARCANE_FATAL(...) \
759 ARCCORE_FATAL(__VA_ARGS__)
769#define ARCANE_FATAL_IF(const, ...) \
770 ARCCORE_FATAL_IF(const, __VA_ARGS__)
781arcaneThrowIfNull(
void* ptr,
const char* ptr_name,
const char* text)
796static inline const void*
797arcaneThrowIfNull(
const void* ptr,
const char* ptr_name,
const char* text)
812template <
typename T>
inline T*
813arcaneThrowIfNull(T* ptr,
const char* ptr_name,
const char* text)
828#define ARCANE_CHECK_POINTER(ptr) \
829 arcaneThrowIfNull(ptr, #ptr, nullptr)
837#define ARCANE_CHECK_POINTER2(ptr, text) \
838 arcaneThrowIfNull(ptr, #ptr, text)
851extern "C++" ARCANE_UTILS_EXPORT
void
852arcaneRangeError [[noreturn]] (Int64 i, Int64 max_size);
857static inline constexpr ARCCORE_HOST_DEVICE
void
858arcaneCheckAt(Int64 i, Int64 max_size)
860#ifndef ARCCORE_DEVICE_CODE
861 if (i < 0 || i >= max_size)
862 arcaneRangeError(i, max_size);
865 ARCANE_UNUSED(max_size);
869#if defined(ARCANE_CHECK) || defined(ARCANE_DEBUG)
870#define ARCANE_CHECK_AT(a, b) ::Arcane::arcaneCheckAt((a), (b))
872#define ARCANE_CHECK_AT(a, b)
Définitions et globaux de Arccore.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
void arcaneNoReferenceErrorCallTerminate(const void *ptr)
Utilisation d'un objet non référencé.
Int64 arcaneCurrentThread()
Retourne l'identifiant du thread courant.
Integer arcaneCheckArraySize(unsigned long long size)
Vérifie que size peut être converti dans un 'Integer' pour servir de taille à un tableau....
bool arcaneIsCheck()
Vrai si on est en mode vérification.
bool arcaneHasThread()
Vrai si arcane est compilé avec le support des threads ET qu'ils sont actifs.
Int64 UniqueIdType
Type des entiers utilisés pour stocker les identifiants uniques (globaux) des entités.
std::int64_t Int64
Type entier signé sur 64 bits.
void arcaneSetHasThread(bool v)
Active ou désactive le support des threads.
void arcaneNullPointerError()
Signalue l'utilisation d'un pointeur nul.
Int32 Integer
Type représentant un entier.
void arcanePrintf(const char *,...)
Encapsulation de la fonction C printf.
void arcaneNotYetImplemented(const char *file, const char *func, unsigned long line, const char *text)
Signale une fonction non implémentée.
Integer arcaneSizeWithPadding(Integer size)
Retourne la taille avec padding pour une taille size.
void arcaneDeprecated(const char *file, const char *func, unsigned long line, const char *text)
Signale l'utilisation d'une fonction obsolète.
bool arcaneIsDebug()
Vrai si la macro ARCANE_DEBUG est définie.
void arcaneSetCheck(bool v)
Active ou désactive le mode vérification.
void arcaneNoReferenceError(const void *ptr)
Utilisation d'un objet non référencé.
bool _checkDebug(unsigned int val)
__host__ __device__ void arcaneMathError(long double arg_value, const char *func_name)
Signale un argument invalide d'une fonction mathématique.
void _doAssert(const char *text, const char *file, const char *func, size_t line)
void arcaneDebugPause(const char *msg)
Passe en mode pause ou lance une erreur fatale.
void arcaneCheckAlignment(const void *ptr, Integer alignment)
Vérifie que ptr est aligné sur alignment octets. Si ce n'est pas le cas, Sinon, lance une exception d...
std::int32_t Int32
Type entier signé sur 32 bits.
void arcaneThrowNullPointerError(const char *ptr_name, const char *text)
Signalee l'utilisation d'un pointeur nul en envoyant une exception.