12#ifndef ARCANE_UTILS_ARCANEGLOBAL_H
13#define ARCANE_UTILS_ARCANEGLOBAL_H
17#include "arccore/base/ArccoreGlobal.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#define ARCANE_EXPORT ARCCORE_EXPORT
33#define ARCANE_IMPORT ARCCORE_IMPORT
34#define ARCANE_TEMPLATE_EXPORT ARCCORE_TEMPLATE_EXPORT
35#define ARCANE_RESTRICT ARCCORE_RESTRICT
41#define ARCANE_UNUSED(var) ARCCORE_UNUSED(var)
46#if defined(ARCANE_HAS_CUDA) && defined(__CUDACC__)
51#define ARCANE_COMPILING_CUDA
53#if defined(ARCANE_HAS_HIP) && defined(__HIP__)
58#define ARCANE_COMPILING_HIP
61#if defined(ARCANE_HAS_SYCL)
62# if defined(SYCL_LANGUAGE_VERSION) || defined(__ADAPTIVECPP__)
67# define ARCANE_COMPILING_SYCL
76#ifndef ARCANE_NO_USING_FOR_STREAM
83using std::ostringstream;
84using std::istringstream;
91typedef ARCANE_TYPE_INT16
Int16;
92typedef ARCANE_TYPE_INT32
Int32;
93typedef ARCANE_TYPE_INT64
Int64;
96#define ARCANE_BEGIN_NAMESPACE namespace Arcane {
97#define ARCANE_END_NAMESPACE }
98#define NUMERICS_BEGIN_NAMESPACE namespace Numerics {
99#define NUMERICS_END_NAMESPACE }
104#ifdef ARCANE_COMPONENT_FULL
105#define ARCANE_COMPONENT_arcane_utils
106#define ARCANE_COMPONENT_arcane
107#define ARCANE_COMPONENT_arcane_mesh
108#define ARCANE_COMPONENT_arcane_std
109#define ARCANE_COMPONENT_arcane_impl
110#define ARCANE_COMPONENT_arcane_script
113#if defined(ARCANE_COMPONENT_arcane) || defined(ARCANE_COMPONENT_arcane_core)
114#define ARCANE_CORE_EXPORT ARCANE_EXPORT
115#define ARCANE_EXPR_EXPORT ARCANE_EXPORT
116#define ARCANE_DATATYPE_EXPORT ARCANE_EXPORT
117#define ARCANE_CORE_EXTERN_TPL
119#define ARCANE_CORE_EXPORT ARCANE_IMPORT
120#define ARCANE_EXPR_EXPORT ARCANE_IMPORT
121#define ARCANE_DATATYPE_EXPORT ARCANE_IMPORT
122#define ARCANE_CORE_EXTERN_TPL extern
125#ifdef ARCANE_COMPONENT_arcane_utils
126#define ARCANE_UTILS_EXPORT ARCANE_EXPORT
127#define ARCANE_UTILS_EXTERN_TPL
129#define ARCANE_UTILS_EXPORT ARCANE_IMPORT
130#define ARCANE_UTILS_EXTERN_TPL extern
133#ifdef ARCANE_COMPONENT_arcane_impl
134#define ARCANE_IMPL_EXPORT ARCANE_EXPORT
136#define ARCANE_IMPL_EXPORT ARCANE_IMPORT
139#ifdef ARCANE_COMPONENT_arcane_mesh
140#define ARCANE_MESH_EXPORT ARCANE_EXPORT
142#define ARCANE_MESH_EXPORT ARCANE_IMPORT
145#ifdef ARCANE_COMPONENT_arcane_std
146#define ARCANE_STD_EXPORT ARCANE_EXPORT
148#define ARCANE_STD_EXPORT ARCANE_IMPORT
151#ifdef ARCANE_COMPONENT_arcane_script
152#define ARCANE_SCRIPT_EXPORT ARCANE_EXPORT
154#define ARCANE_SCRIPT_EXPORT ARCANE_IMPORT
157#ifdef ARCANE_COMPONENT_arcane_solvers
158#define ARCANE_SOLVERS_EXPORT ARCANE_EXPORT
160#define ARCANE_SOLVERS_EXPORT ARCANE_IMPORT
163#ifdef ARCANE_COMPONENT_arcane_geometry
164#define ARCANE_GEOMETRY_EXPORT ARCANE_EXPORT
166#define ARCANE_GEOMETRY_EXPORT ARCANE_IMPORT
169#ifdef ARCANE_COMPONENT_arcane_thread
170#define ARCANE_THREAD_EXPORT ARCANE_EXPORT
172#define ARCANE_THREAD_EXPORT ARCANE_IMPORT
175#ifdef ARCANE_COMPONENT_arcane_mpi
176#define ARCANE_MPI_EXPORT ARCANE_EXPORT
178#define ARCANE_MPI_EXPORT ARCANE_IMPORT
181#ifdef ARCANE_COMPONENT_arcane_hyoda
182#define ARCANE_HYODA_EXPORT ARCANE_EXPORT
184#define ARCANE_HYODA_EXPORT ARCANE_IMPORT
187#ifdef ARCANE_REAL_USE_APFLOAT
200#define ARCANE_HAS_LONG_LONG
205const double cgrEPSILON_DELTA = 1.0e-2;
206const double cgrPI = 3.14159265358979323846;
211#define ARCANE_REAL(val) ARCCORE_REAL(val)
213#ifdef ARCCORE_REAL_NOT_BUILTIN
214# define ARCANE_REAL_NOT_BUILTIN
217#ifdef ARCCORE_REAL_LONG
218# define ARCANE_REAL_LONG
221#ifdef ARCCORE_REAL_IS_DOUBLE
222# define ARCANE_REAL_IS_DOUBLE
272extern "C++" ARCANE_UTILS_EXPORT
void
288extern "C++" ARCANE_UTILS_EXPORT
void
294extern "C++" ARCANE_UTILS_EXPORT
void
295_internalArcaneMathError(
long double arg_value,
const char* func_name);
297extern "C++" ARCANE_UTILS_EXPORT
void
310ARCCORE_HOST_DEVICE
inline void
313#ifndef ARCCORE_DEVICE_CODE
314 _internalArcaneMathError(
arg_value,func_name);
317 ARCANE_UNUSED(func_name);
330ARCCORE_HOST_DEVICE
inline void
333#ifndef ARCCORE_DEVICE_CODE
338 ARCANE_UNUSED(func_name);
354extern "C++" ARCANE_UTILS_EXPORT
void
361extern "C++" ARCANE_UTILS_EXPORT
void
376extern "C++" ARCANE_UTILS_EXPORT
void
388extern "C++" ARCANE_UTILS_EXPORT
void
397extern "C++" ARCANE_UTILS_EXPORT Integer
406extern "C++" ARCANE_UTILS_EXPORT Integer
415extern "C++" ARCANE_UTILS_EXPORT Integer
424extern "C++" ARCANE_UTILS_EXPORT Integer
433extern "C++" ARCANE_UTILS_EXPORT Integer
442extern "C++" ARCANE_UTILS_EXPORT Integer
449extern "C++" ARCANE_UTILS_EXPORT
void
458extern "C++" ARCANE_UTILS_EXPORT
468extern "C++" ARCANE_UTILS_EXPORT
474extern "C++" ARCANE_UTILS_EXPORT
480extern "C++" ARCANE_UTILS_EXPORT
492extern "C++" ARCANE_UTILS_EXPORT
500extern "C++" ARCANE_UTILS_EXPORT
521extern "C++" ARCANE_UTILS_EXPORT
bool _checkDebug(
size_t);
522#define ARCANE_DEBUGP(a,b) if (_checkDebug(a)) { arcanePrintf b; }
524#define ARCANE_DEBUGP(a,b)
531# define ARCANE_NOT_YET_IMPLEMENTED(a) \
532{ arcaneNotYetImplemented(__FILE__,__PRETTY_FUNCTION__,__LINE__,(a)); }
534# define ARCANE_NOT_YET_IMPLEMENTED(a) \
535{ arcaneNotYetImplemented(__FILE__,"(NoInfo)",__LINE__,(a)); }
538#define ARCANE_DEPRECATED ARCCORE_DEPRECATED
540#define ARCANE_DEPRECATED_112 ARCANE_DEPRECATED
541#define ARCANE_DEPRECATED_114 ARCANE_DEPRECATED
542#define ARCANE_DEPRECATED_116 ARCANE_DEPRECATED
543#define ARCANE_DEPRECATED_118 ARCANE_DEPRECATED
544#define ARCANE_DEPRECATED_120 ARCANE_DEPRECATED
545#define ARCANE_DEPRECATED_122 ARCANE_DEPRECATED
546#define ARCANE_DEPRECATED_200 ARCANE_DEPRECATED
547#define ARCANE_DEPRECATED_220 ARCANE_DEPRECATED
548#define ARCANE_DEPRECATED_240 ARCANE_DEPRECATED
549#define ARCANE_DEPRECATED_260 ARCANE_DEPRECATED
550#define ARCANE_DEPRECATED_280 ARCANE_DEPRECATED
551#define ARCANE_DEPRECATED_2018 ARCANE_DEPRECATED
552#define ARCANE_DEPRECATED_2018_R(reason) [[deprecated(reason)]]
554#ifndef ARCCORE_DEPRECATED_2021
555#define ARCCORE_DEPRECATED_2021(reason) [[deprecated(reason)]]
558#define ARCANE_DEPRECATED_REASON(reason) [[deprecated(reason)]]
560#ifdef ARCANE_NO_DEPRECATED_LONG_TERM
561#define ARCANE_DEPRECATED_LONG_TERM(reason)
570#define ARCANE_DEPRECATED_LONG_TERM(reason) [[deprecated(reason)]]
575#define ARCANE_NO_DEPRECATED
579#ifdef ARCANE_NO_NOTIFY_DEPRECATED_ARRAY
580#define ARCANE_DEPRECATED_ARRAY
582#define ARCANE_DEPRECATED_ARRAY ARCANE_DEPRECATED
593#define ARCANE_JOIN_HELPER2(a,b) a ## b
594#define ARCANE_JOIN_HELPER(a,b) ARCANE_JOIN_HELPER2(a,b)
595#define ARCANE_JOIN_WITH_LINE(a) ARCANE_JOIN_HELPER(a,__LINE__)
601#define ARCANE_NORETURN ARCCORE_NORETURN
604#define ARCANE_CONSTEXPR ARCCORE_CONSTEXPR
611#define ARCANE_NOEXCEPT ARCCORE_NOEXCEPT
612#define ARCANE_NOEXCEPT_FALSE ARCCORE_NOEXCEPT_FALSE
627# define ARCANE_ALIGNAS(value) __declspec(align(value))
629# define ARCANE_ALIGNAS_PACKED(value) __declspec(align(value))
632# define ARCANE_ALIGNAS_PACKED(value) __attribute__ ((aligned (value),packed))
634# define ARCANE_ALIGNAS(value) __attribute__ ((aligned (value)))
641#ifdef ARCANE_DEPRECATED
642#undef ARCANE_DEPRECATED
649#if defined(ARCANE_CHECK) || defined(ARCANE_DEBUG)
650#ifndef ARCANE_DEBUG_ASSERT
651#define ARCANE_DEBUG_ASSERT
664extern "C++" ARCANE_UTILS_EXPORT
void
680extern "C++" ARCANE_UTILS_EXPORT
void
689arcaneCheckNull(
const void* ptr)
705static const Integer SIMD_PADDING_SIZE = 8;
717extern "C++" ARCANE_UTILS_EXPORT
Integer
726#ifdef ARCANE_DEBUG_ASSERT
727extern "C++" ARCANE_UTILS_EXPORT
void _doAssert(
const char*,
const char*,
const char*,
size_t);
728template<
typename T>
inline T*
729_checkPointer(T* t,
const char* file,
const char* func,
size_t line)
732 _doAssert(
"ARCANE_ASSERT",file,func,line);
738# define ARCANE_D_WHERE(a) Arcane::_doAssert(a,__FILE__,__PRETTY_FUNCTION__,__LINE__)
739# define ARCANE_DCHECK_POINTER(a) Arcane::_checkPointer((a),__FILE__,__PRETTY_FUNCTION__,__LINE__);
741# define ARCANE_D_WHERE(a) Arcane::_doAssert(a,__FILE__,"(NoInfo)",__LINE__)
742# define ARCANE_DCHECK_POINTER(a) Arcane::_checkPointer((a),__FILE__,"(NoInfo"),__LINE__);
744# define ARCANE_CHECK_PTR(a) \
745 {if (!(a)){Arcane::arcanePrintf("Null value");ARCANE_D_WHERE("ARCANE_ASSERT");}}
747# define ARCANE_ASSERT(a,b) \
748 {if (!(a)){ Arcane::arcanePrintf("Assertion '%s' fails:",#a); Arcane::arcanePrintf b; ARCANE_D_WHERE("ARCANE_ASSERT");}}
749# define ARCANE_WARNING(a) \
750 { Arcane::arcanePrintf a; ARCANE_D_WHERE("ARCANE_WARNING"); }
752# define ARCANE_CHECK_PTR(a)
753# define ARCANE_ASSERT(a,b)
754# define ARCANE_WARNING(a)
755# define ARCANE_DCHECK_POINTER(a) (a);
767#define ARCANE_THROW(exception_class,...) \
768 throw exception_class (A_FUNCINFO,Arcane::String::format(__VA_ARGS__))
778#define ARCANE_FATAL(...)\
779 throw Arcane::FatalErrorException(A_FUNCINFO,Arcane::String::format(__VA_ARGS__))
790arcaneThrowIfNull(
void* ptr,
const char* ptr_name,
const char* text)
805static inline const void*
806arcaneThrowIfNull(
const void* ptr,
const char* ptr_name,
const char* text)
821template<
typename T>
inline T*
837#define ARCANE_CHECK_POINTER(ptr) \
838 arcaneThrowIfNull(ptr,#ptr,nullptr)
846#define ARCANE_CHECK_POINTER2(ptr,text)\
847 arcaneThrowIfNull(ptr,#ptr,text)
860extern "C++" ARCANE_UTILS_EXPORT
void
861arcaneRangeError [[noreturn]] (
Int64 i,
Int64 max_size);
866static inline constexpr ARCCORE_HOST_DEVICE
void
869#ifndef ARCCORE_DEVICE_CODE
870 if (i<0 || i>=max_size)
871 arcaneRangeError(i,max_size);
874 ARCANE_UNUSED(max_size);
878#if defined(ARCANE_CHECK) || defined(ARCANE_DEBUG)
879#define ARCANE_CHECK_AT(a,b) ::Arcane::arcaneCheckAt((a),(b))
881#define ARCANE_CHECK_AT(a,b)
Lecteur des fichiers de maillage via la bibliothèque LIMA.
-*- 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.
void arcaneSetHasThread(bool v)
Active ou désactive le support des threads.
void arcaneNullPointerError()
Signalue l'utilisation d'un pointeur nul.
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.
ARCCORE_HOST_DEVICE void arcaneMathError(long double arg_value, const char *func_name)
Signale un argument invalide d'une fonction mathématique.
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)
Int32 LocalIdType
Type des entiers utilisés pour stocker les identifiants locaux des entités.
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.
Int64 UniqueIdType
Type des entiers utilisés pour stocker les identifiants uniques (globaux) des entités.
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...
void arcaneThrowNullPointerError(const char *ptr_name, const char *text)
Signalee l'utilisation d'un pointeur nul en envoyant une exception.
Int32 Integer
Type représentant un entier.
Structure équivalente à la valeur booléenne vrai.
Structure équivalente à la valeur booléenne vrai.