Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ArcaneGlobal.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ArcaneGlobal.cc (C) 2000-2024 */
9/* */
10/* Déclarations générales de Arcane. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/IndexOutOfRangeException.h"
15#include "arcane/utils/ArithmeticException.h"
16#include "arcane/utils/ArgumentException.h"
17#include "arcane/utils/TraceInfo.h"
18#include "arcane/utils/FatalErrorException.h"
19#include "arcane/utils/BadAlignmentException.h"
20#include "arcane/utils/NotImplementedException.h"
21#include "arcane/utils/ArraySimdPadder.h"
22
23#include "arcane/utils/Iostream.h"
24#include "arcane/utils/IMemoryInfo.h"
25
26// Ces includes ne sont pas utilisés par ce fichier
27// mais il faut au moins les lire une fois sous Windows
28// pour que les symboles externes soient créés
29#include "arcane/utils/IFunctor.h"
30#include "arcane/utils/IFunctorWithAddress.h"
31#include "arcane/utils/IRangeFunctor.h"
32#include "arcane/utils/SpinLock.h"
33#include "arcane/utils/IDynamicLibraryLoader.h"
34#include "arcane/utils/IPerformanceCounterService.h"
35#include "arcane/utils/IProfilingService.h"
36#include "arcane/utils/DataTypeContainer.h"
37#include "arcane/utils/ITraceMngPolicy.h"
38#include "arcane/utils/IThreadImplementationService.h"
39#include "arcane/utils/IMessagePassingProfilingService.h"
40#include "arcane/utils/ISymbolizerService.h"
41#include "arcane/utils/IDataCompressor.h"
42
43/*---------------------------------------------------------------------------*/
44/*---------------------------------------------------------------------------*/
58/*---------------------------------------------------------------------------*/
59/*---------------------------------------------------------------------------*/
60
61namespace Arcane
62{
63
64/*---------------------------------------------------------------------------*/
65/*---------------------------------------------------------------------------*/
66
67extern "C++" ARCANE_UTILS_EXPORT void
68arcaneRangeError(Int32 i,Int32 max_size)
69{
70 arcaneDebugPause("arcaneRangeError");
71 throw IndexOutOfRangeException(A_FUNCINFO,String(),i,0,max_size);
72}
73
74/*---------------------------------------------------------------------------*/
75/*---------------------------------------------------------------------------*/
76
77extern "C++" ARCANE_UTILS_EXPORT void
78arcaneRangeError(Int64 i,Int64 max_size)
79{
80 arcaneDebugPause("arcaneRangeError");
81 throw IndexOutOfRangeException(A_FUNCINFO,String(),i,0,max_size);
82}
83
84/*---------------------------------------------------------------------------*/
85/*---------------------------------------------------------------------------*/
86
87extern "C++" ARCANE_UTILS_EXPORT void
88_internalArcaneMathError(long double value,const char* funcname)
89{
90 cerr << "** FATAL: Argument error for a mathematical operation:\n";
91 cerr << "** FATAL: Argument: " << value << '\n';
92 if (funcname)
93 cerr << "** FATAL: Operation: " << funcname << '\n';
94 arcaneDebugPause("arcaneMathError");
95 throw ArithmeticException(A_FUNCINFO);
96}
97
98/*---------------------------------------------------------------------------*/
99/*---------------------------------------------------------------------------*/
100
101extern "C++" ARCANE_UTILS_EXPORT void
102_internalArcaneMathError(long double value1,long double value2,const char* funcname)
103{
104 cerr << "** FATAL: Argument error for a mathematical operation:\n";
105 cerr << "** FATAL: Argument1: " << value1 << '\n';
106 cerr << "** FATAL: Argument2: " << value2 << '\n';
107 if (funcname)
108 cerr << "** FATAL: Operation: " << funcname << '\n';
109 arcaneDebugPause("arcaneMathError");
110 throw ArithmeticException(A_FUNCINFO);
111}
112
113/*---------------------------------------------------------------------------*/
114/*---------------------------------------------------------------------------*/
115
116extern "C++" ARCANE_UTILS_EXPORT void
117arcaneNotYetImplemented(const char* file,const char* func,
118 unsigned long line,const char* text)
119{
120 cerr << file << ':' << func << ':' << line << '\n';
121 cerr << "sorry, functionality not yet implemented";
122 if (text)
123 cerr << ": " << text;
124 cerr << '\n';
125}
126
127/*---------------------------------------------------------------------------*/
128/*---------------------------------------------------------------------------*/
129
130extern "C++" ARCANE_UTILS_EXPORT void
132{
133 cerr << "** FATAL: null pointer.\n";
134 cerr << "** FATAL: Trying to dereference a null pointer.\n";
135 arcaneDebugPause("arcaneNullPointerPtr");
136 throw FatalErrorException(A_FUNCINFO,"null pointer");
137}
138
139/*---------------------------------------------------------------------------*/
140/*---------------------------------------------------------------------------*/
141
142extern "C++" ARCANE_UTILS_EXPORT void
144{
145 throw FatalErrorException(A_FUNCINFO,text ? text : ptr_name);
146}
147
148/*---------------------------------------------------------------------------*/
149/*---------------------------------------------------------------------------*/
150
151extern "C++" ARCANE_UTILS_EXPORT Integer
152arcaneCheckArraySize(unsigned long long size)
153{
154 if (size>=ARCANE_INTEGER_MAX)
155 ARCANE_THROW(ArgumentException,"value '{0}' too big for Array size",size);
156 return (Integer)size;
157}
158
159extern "C++" ARCANE_UTILS_EXPORT Integer
160arcaneCheckArraySize(long long size)
161{
162 if (size>=ARCANE_INTEGER_MAX)
163 ARCANE_THROW(ArgumentException,"value '{0}' too big for Array size",size);
164 if (size<0)
165 ARCANE_THROW(ArgumentException,"invalid negative value '{0}' for Array size",size);
166 return (Integer)size;
167}
168
169extern "C++" ARCANE_UTILS_EXPORT Integer
170arcaneCheckArraySize(unsigned long size)
171{
172 if (size>=ARCANE_INTEGER_MAX)
173 ARCANE_THROW(ArgumentException,"value '{0}' too big for Array size",size);
174 return (Integer)size;
175}
176
177extern "C++" ARCANE_UTILS_EXPORT Integer
179{
180 if (size>=ARCANE_INTEGER_MAX)
181 ARCANE_THROW(ArgumentException,"value '{0}' too big for Array size",size);
182 if (size<0)
183 ARCANE_THROW(ArgumentException,"invalid negative value '{0}' for Array size",size);
184 return (Integer)size;
185}
186
187extern "C++" ARCANE_UTILS_EXPORT Integer
188arcaneCheckArraySize(unsigned int size)
189{
190 if (size>=ARCANE_INTEGER_MAX)
191 ARCANE_THROW(ArgumentException,"value '{0}' too big for Array size",size);
192 return (Integer)size;
193}
194
195extern "C++" ARCANE_UTILS_EXPORT Integer
197{
198 if (size>=ARCANE_INTEGER_MAX)
199 ARCANE_THROW(ArgumentException,"value '{0}' too big for Array size",size);
200 if (size<0)
201 ARCANE_THROW(ArgumentException,"invalid negative value '{0}' for Array size",size);
202 return (Integer)size;
203}
204
205/*---------------------------------------------------------------------------*/
206/*---------------------------------------------------------------------------*/
207
208extern "C++" ARCANE_UTILS_EXPORT void
209arcaneCheckAlignment(const void* ptr,Integer alignment)
210{
211 if (alignment<=0)
212 return;
213 Int64 iptr = (intptr_t)ptr;
214 Int64 modulo = iptr % alignment;
215 if (modulo!=0)
216 throw BadAlignmentException(A_FUNCINFO,ptr,alignment);
217}
218
219/*---------------------------------------------------------------------------*/
220/*---------------------------------------------------------------------------*/
221
222extern "C++" ARCANE_UTILS_EXPORT Integer
224{
226}
227
228/*---------------------------------------------------------------------------*/
229/*---------------------------------------------------------------------------*/
230
301/*---------------------------------------------------------------------------*/
302/*---------------------------------------------------------------------------*/
303
304}
305
306/*---------------------------------------------------------------------------*/
307/*---------------------------------------------------------------------------*/
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
static ARCCORE_HOST_DEVICE SizeType getSizeWithPadding(SizeType size)
Calcule la taille nécessaire pour être un multiple de SIMD_PADDING_SIZE.
Exception lorsqu'une adresse n'est pas correctement alignée.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Exception lorsqu'un argument est invalide.
Exception lorsqu'une erreur fatale est survenue.
Exception lorsqu'une valeur n'est pas dans un intervalle donné.
Chaîne de caractères unicode.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Integer arcaneCheckArraySize(unsigned long long size)
Vérifie que size peut être converti dans un 'Integer' pour servir de taille à un tableau....
void arcaneNullPointerError()
Signalue l'utilisation d'un pointeur nul.
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 arcaneDebugPause(const char *msg)
Passe en mode pause ou lance une erreur fatale.
Definition Misc.cc:220
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.