28 #if defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
29 #define KRATOS_COMPILED_IN_LINUX
30 #elif defined(__APPLE__) && defined(__MACH__)
31 #define KRATOS_COMPILED_IN_OS
32 #elif defined(_WIN32) || defined(_WIN64)
33 #define KRATOS_COMPILED_IN_WINDOWS
38 #if defined(_WIN32) || defined(_WIN64)
40 #define KRATOS_ENV64BIT
42 #define KRATOS_ENV32BIT
43 #error 32 bit system are not supported anymore. Please consider a 64 bits system
46 #if defined(__x86_64__) || defined(__ppc64__) || defined(__aarch64__)
47 #define KRATOS_ENV64BIT
49 #define KRATOS_ENV32BIT
50 #error 32 bit system are not supported anymore. Please consider a 64 bits system
61 # pragma warning(disable: 4244 4267)
70 #define KRATOS_CATCH_AND_THROW(ExceptionType, MoreInfo, Block) \
71 catch(ExceptionType& e) \
74 KRATOS_ERROR << e.what(); \
77 #define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo) \
79 KRATOS_ERROR << ErrorMessage << MoreInfo << std::endl; \
82 #define KRATOS_CATCH_WITH_BLOCK(MoreInfo,Block) \
84 KRATOS_CATCH_AND_THROW(std::overflow_error,MoreInfo,Block) \
85 KRATOS_CATCH_AND_THROW(std::underflow_error,MoreInfo,Block) \
86 KRATOS_CATCH_AND_THROW(std::range_error,MoreInfo,Block) \
87 KRATOS_CATCH_AND_THROW(std::out_of_range,MoreInfo,Block) \
88 KRATOS_CATCH_AND_THROW(std::length_error,MoreInfo,Block) \
89 KRATOS_CATCH_AND_THROW(std::invalid_argument,MoreInfo,Block) \
90 KRATOS_CATCH_AND_THROW(std::domain_error,MoreInfo,Block) \
91 KRATOS_CATCH_AND_THROW(std::logic_error,MoreInfo,Block) \
92 KRATOS_CATCH_AND_THROW(std::runtime_error,MoreInfo,Block) \
93 catch(Exception& e) { Block throw Exception(e) << KRATOS_CODE_LOCATION << MoreInfo << std::endl; } \
94 catch(std::exception& e) { Block KRATOS_THROW_ERROR(std::runtime_error, e.what(), MoreInfo) } \
95 catch(...) { Block KRATOS_THROW_ERROR(std::runtime_error, "Unknown error", MoreInfo) }
97 #define KRATOS_CATCH_BLOCK_BEGIN class ExceptionBlock{public: void operator()(void){
98 #define KRATOS_CATCH_BLOCK_END }} exception_block; exception_block();
100 #ifndef KRATOS_NO_TRY_CATCH
101 #define KRATOS_TRY_IMPL try {
102 #define KRATOS_CATCH_IMPL(MoreInfo) KRATOS_CATCH_WITH_BLOCK(MoreInfo,{})
104 #define KRATOS_TRY_IMPL {};
105 #define KRATOS_CATCH_IMPL(MoreInfo) {};
109 #define KRATOS_TRY KRATOS_TRY_IMPL
110 #define KRATOS_CATCH(MoreInfo) KRATOS_CATCH_IMPL(MoreInfo)
112 #define KRATOS_TRY {};
113 #define KRATOS_CATCH(MoreInfo) {};
122 #define KRATOS_EXPORT_MACRO KRATOS_NO_EXPORT
124 #ifdef KRATOS_DEFINE_VARIABLE_IMPLEMENTATION
125 #undef KRATOS_DEFINE_VARIABLE_IMPLEMENTATION
127 #define KRATOS_DEFINE_VARIABLE_IMPLEMENTATION(module, type, name) \
128 KRATOS_EXPORT_MACRO(module) extern Variable<type > name;
130 #ifdef KRATOS_DEFINE_VARIABLE
131 #undef KRATOS_DEFINE_VARIABLE
133 #define KRATOS_DEFINE_VARIABLE(type, name) \
134 KRATOS_DEFINE_VARIABLE_IMPLEMENTATION(KRATOS_CORE, type, name)
136 #ifdef KRATOS_DEFINE_APPLICATION_VARIABLE
137 #undef KRATOS_DEFINE_APPLICATION_VARIABLE
139 #define KRATOS_DEFINE_APPLICATION_VARIABLE(application, type, name) \
140 KRATOS_API(application) extern Variable<type > name;
142 #ifdef KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS
143 #undef KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS
145 #define KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS_IMPLEMENTATION(module, name) \
146 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<Kratos::array_1d<double, 3> > name; \
147 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_X;\
148 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_Y;\
149 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_Z;
151 #ifdef KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS
152 #undef KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS
154 #define KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS(name) \
155 KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS_IMPLEMENTATION(KRATOS_CORE, name)
157 #ifdef KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS
158 #undef KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS
160 #define KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS(application, name) \
161 KRATOS_API(application) extern Kratos::Variable<Kratos::array_1d<double, 3> > name; \
162 KRATOS_API(application) extern Kratos::Variable<double> name##_X;\
163 KRATOS_API(application) extern Kratos::Variable<double> name##_Y;\
164 KRATOS_API(application) extern Kratos::Variable<double> name##_Z;
166 #ifdef KRATOS_DEFINE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS
167 #undef KRATOS_DEFINE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS
169 #define KRATOS_DEFINE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS_IMPLEMENTATION(module, name) \
170 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<Kratos::array_1d<double, 3> > name; \
171 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_XX;\
172 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_YY;\
173 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_XY;
175 #ifdef KRATOS_DEFINE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS
176 #undef KRATOS_DEFINE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS
178 #define KRATOS_DEFINE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS(name) \
179 KRATOS_DEFINE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS_IMPLEMENTATION(KRATOS_CORE, name)
181 #ifdef KRATOS_DEFINE_SYMMETRIC_2D_TENSOR_APPLICATION_VARIABLE_WITH_COMPONENTS
182 #undef KRATOS_DEFINE_SYMMETRIC_2D_TENSOR_APPLICATION_VARIABLE_WITH_COMPONENTS
184 #define KRATOS_DEFINE_SYMMETRIC_2D_TENSOR_APPLICATION_VARIABLE_WITH_COMPONENTS(application, name) \
185 KRATOS_API(application) extern Kratos::Variable<Kratos::array_1d<double, 3> > name; \
186 KRATOS_API(application) extern Kratos::Variable<double> name##_XX;\
187 KRATOS_API(application) extern Kratos::Variable<double> name##_YY;\
188 KRATOS_API(application) extern Kratos::Variable<double> name##_XY;
190 #ifdef KRATOS_DEFINE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS
191 #undef KRATOS_DEFINE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS
193 #define KRATOS_DEFINE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS_IMPLEMENTATION(module, name) \
194 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<Kratos::array_1d<double, 6> > name; \
195 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_XX;\
196 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_YY;\
197 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_ZZ;\
198 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_XY;\
199 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_YZ;\
200 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_XZ;
202 #ifdef KRATOS_DEFINE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS
203 #undef KRATOS_DEFINE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS
205 #define KRATOS_DEFINE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS(name) \
206 KRATOS_DEFINE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS_IMPLEMENTATION(KRATOS_CORE, name)
208 #ifdef KRATOS_DEFINE_SYMMETRIC_3D_TENSOR_APPLICATION_VARIABLE_WITH_COMPONENTS
209 #undef KRATOS_DEFINE_SYMMETRIC_3D_TENSOR_APPLICATION_VARIABLE_WITH_COMPONENTS
211 #define KRATOS_DEFINE_SYMMETRIC_3D_TENSOR_APPLICATION_VARIABLE_WITH_COMPONENTS(application, name) \
212 KRATOS_API(application) extern Kratos::Variable<Kratos::array_1d<double, 6> > name; \
213 KRATOS_API(application) extern Kratos::Variable<double> name##_XX;\
214 KRATOS_API(application) extern Kratos::Variable<double> name##_YY;\
215 KRATOS_API(application) extern Kratos::Variable<double> name##_ZZ;\
216 KRATOS_API(application) extern Kratos::Variable<double> name##_XY;\
217 KRATOS_API(application) extern Kratos::Variable<double> name##_YZ;\
218 KRATOS_API(application) extern Kratos::Variable<double> name##_XZ;
220 #ifdef KRATOS_DEFINE_2D_TENSOR_VARIABLE_WITH_COMPONENTS
221 #undef KRATOS_DEFINE_2D_TENSOR_VARIABLE_WITH_COMPONENTS
223 #define KRATOS_DEFINE_2D_TENSOR_VARIABLE_WITH_COMPONENTS_IMPLEMENTATION(module, name) \
224 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<Kratos::array_1d<double, 4> > name; \
225 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_XX;\
226 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_XY;\
227 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_YX;\
228 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_YY;
230 #ifdef KRATOS_DEFINE_2D_TENSOR_VARIABLE_WITH_COMPONENTS
231 #undef KRATOS_DEFINE_2D_TENSOR_VARIABLE_WITH_COMPONENTS
233 #define KRATOS_DEFINE_2D_TENSOR_VARIABLE_WITH_COMPONENTS(name) \
234 KRATOS_DEFINE_2D_TENSOR_VARIABLE_WITH_COMPONENTS_IMPLEMENTATION(KRATOS_CORE, name)
236 #ifdef KRATOS_DEFINE_2D_TENSOR_APPLICATION_VARIABLE_WITH_COMPONENTS
237 #undef KRATOS_DEFINE_2D_TENSOR_APPLICATION_VARIABLE_WITH_COMPONENTS
239 #define KRATOS_DEFINE_2D_TENSOR_APPLICATION_VARIABLE_WITH_COMPONENTS(application, name) \
240 KRATOS_API(application) extern Kratos::Variable<Kratos::array_1d<double, 4> > name; \
241 KRATOS_API(application) extern Kratos::Variable<double> name##_XX;\
242 KRATOS_API(application) extern Kratos::Variable<double> name##_XY;\
243 KRATOS_API(application) extern Kratos::Variable<double> name##_YX;\
244 KRATOS_API(application) extern Kratos::Variable<double> name##_YY;
246 #ifdef KRATOS_DEFINE_3D_TENSOR_VARIABLE_WITH_COMPONENTS
247 #undef KRATOS_DEFINE_3D_TENSOR_VARIABLE_WITH_COMPONENTS
249 #define KRATOS_DEFINE_3D_TENSOR_VARIABLE_WITH_COMPONENTS_IMPLEMENTATION(module, name) \
250 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<Kratos::array_1d<double, 9> > name; \
251 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_XX;\
252 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_XY;\
253 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_XZ;\
254 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_YX;\
255 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_YY;\
256 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_YZ;\
257 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_ZX;\
258 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_ZY;\
259 KRATOS_EXPORT_MACRO(module) extern Kratos::Variable<double> name##_ZZ;
261 #ifdef KRATOS_DEFINE_3D_TENSOR_VARIABLE_WITH_COMPONENTS
262 #undef KRATOS_DEFINE_3D_TENSOR_VARIABLE_WITH_COMPONENTS
264 #define KRATOS_DEFINE_3D_TENSOR_VARIABLE_WITH_COMPONENTS(name) \
265 KRATOS_DEFINE_3D_TENSOR_VARIABLE_WITH_COMPONENTS_IMPLEMENTATION(KRATOS_CORE, name)
267 #ifdef KRATOS_DEFINE_3D_TENSOR_APPLICATION_VARIABLE_WITH_COMPONENTS
268 #undef KRATOS_DEFINE_3D_TENSOR_APPLICATION_VARIABLE_WITH_COMPONENTS
270 #define KRATOS_DEFINE_3D_TENSOR_APPLICATION_VARIABLE_WITH_COMPONENTS(application, name) \
271 KRATOS_API(application) extern Kratos::Variable<Kratos::array_1d<double, 9> > name; \
272 KRATOS_API(application) extern Kratos::Variable<double> name##_XX;\
273 KRATOS_API(application) extern Kratos::Variable<double> name##_XY;\
274 KRATOS_API(application) extern Kratos::Variable<double> name##_XZ;\
275 KRATOS_API(application) extern Kratos::Variable<double> name##_YX;\
276 KRATOS_API(application) extern Kratos::Variable<double> name##_YY;\
277 KRATOS_API(application) extern Kratos::Variable<double> name##_YZ;\
278 KRATOS_API(application) extern Kratos::Variable<double> name##_ZX;\
279 KRATOS_API(application) extern Kratos::Variable<double> name##_ZY;\
280 KRATOS_API(application) extern Kratos::Variable<double> name##_ZZ;
282 #ifdef KRATOS_CREATE_VARIABLE
283 #undef KRATOS_CREATE_VARIABLE
285 #define KRATOS_CREATE_VARIABLE(type, name) \
286 Kratos::Variable<type > name(#name);
288 #ifdef KRATOS_CREATE_VARIABLE_WITH_ZERO
289 #undef KRATOS_CREATE_VARIABLE_WITH_ZERO
291 #define KRATOS_CREATE_VARIABLE_WITH_ZERO(type, name, zero) \
292 Kratos::Variable<type> name(#name, zero);
294 #ifdef KRATOS_CREATE_3D_VARIABLE_WITH_THIS_COMPONENTS
295 #undef KRATOS_CREATE_3D_VARIABLE_WITH_THIS_COMPONENTS
297 #define KRATOS_CREATE_3D_VARIABLE_WITH_THIS_COMPONENTS(name, component1, component2, component3) \
298 Kratos::Variable<Kratos::array_1d<double, 3> > name(#name, Kratos::array_1d<double, 3>(Kratos::ZeroVector(3))); \
300 Kratos::Variable<double> \
301 component1(#component1, &name, 0); \
303 Kratos::Variable<double> \
304 component2(#component2, &name, 1); \
306 Kratos::Variable<double> \
307 component3(#component3, &name, 2);
309 #ifdef KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS
310 #undef KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS
312 #define KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(name) \
313 KRATOS_CREATE_3D_VARIABLE_WITH_THIS_COMPONENTS(name, name##_X, name##_Y, name##_Z)
315 #ifdef KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS
316 #undef KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS
318 #define KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS(name, component1, component2, component3) \
319 Kratos::Variable<Kratos::array_1d<double, 3> > name(#name, Kratos::zero_vector<double>(3)); \
321 Kratos::Variable<double> \
322 component1(#component1, &name, 0); \
324 Kratos::Variable<double> \
325 component2(#component2, &name, 1); \
327 Kratos::Variable<double> \
328 component3(#component3, &name, 2);
330 #ifdef KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS
331 #undef KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS
333 #define KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS(name) \
334 KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS(name, name##_XX, name##_YY, name##_XY)
336 #ifdef KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS
337 #undef KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS
339 #define KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS(name, component1, component2, component3, component4, component5, component6) \
340 Kratos::Variable<Kratos::array_1d<double, 6> > name(#name, Kratos::zero_vector<double>(6)); \
342 Kratos::Variable<double> \
343 component1(#component1, &name, 0); \
345 Kratos::Variable<double> \
346 component2(#component2, &name, 1); \
348 Kratos::Variable<double> \
349 component3(#component3, &name, 2); \
351 Kratos::Variable<double> \
352 component4(#component4, &name, 3); \
354 Kratos::Variable<double> \
355 component5(#component5, &name, 4); \
357 Kratos::Variable<double> \
358 component6(#component6, &name, 5);
360 #ifdef KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS
361 #undef KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS
363 #define KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS(name) \
364 KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS(name, name##_XX, name##_YY, name##_ZZ, name##_XY, name##_YZ, name##_XZ)
366 #ifdef KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS
367 #undef KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS
369 #define KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS(name, component1, component2, component3, component4) \
370 Kratos::Variable<Kratos::array_1d<double, 4> > name(#name, Kratos::zero_vector<double>(4)); \
372 Kratos::Variable<double> \
373 component1(#component1, &name, 0); \
375 Kratos::Variable<double> \
376 component2(#component2, &name, 1); \
378 Kratos::Variable<double> \
379 component3(#component3, &name, 2); \
381 Kratos::Variable<double> \
382 component4(#component4, &name, 3);
384 #ifdef KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_COMPONENTS
385 #undef KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_COMPONENTS
387 #define KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_COMPONENTS(name) \
388 KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS(name, name##_XX, name##_XY, name##_YX, name##_YY)
390 #ifdef KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS
391 #undef KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS
393 #define KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS(name, component1, component2, component3, component4, component5, component6, component7, component8, component9) \
394 Kratos::Variable<Kratos::array_1d<double, 9> > name(#name, Kratos::zero_vector<double>(9)); \
396 Kratos::Variable<double> \
397 component1(#component1, &name, 0); \
399 Kratos::Variable<double> \
400 component2(#component2, &name, 1); \
402 Kratos::Variable<double> \
403 component3(#component3, &name, 2); \
405 Kratos::Variable<double> \
406 component4(#component4, &name, 3); \
408 Kratos::Variable<double> \
409 component5(#component5, &name, 4); \
411 Kratos::Variable<double> \
412 component6(#component6, &name, 5); \
414 Kratos::Variable<double> \
415 component7(#component7, &name, 6); \
417 Kratos::Variable<double> \
418 component8(#component8, &name, 7); \
420 Kratos::Variable<double> \
421 component9(#component9, &name, 8);
423 #ifdef KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_COMPONENTS
424 #undef KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_COMPONENTS
426 #define KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_COMPONENTS(name) \
427 KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS(name, name##_XX, name##_XY, name##_XZ, name##_YX, name##_YY, name##_YZ, name##_ZX, name##_ZY, name##_ZZ)
429 #ifdef KRATOS_REGISTER_VARIABLE
430 #undef KRATOS_REGISTER_VARIABLE
432 #define KRATOS_REGISTER_VARIABLE(name) \
433 AddKratosComponent(name.Name(), name); \
434 KratosComponents<VariableData>::Add(name.Name(), name);
436 #ifdef KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS
437 #undef KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS
439 #define KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(name) \
440 KRATOS_REGISTER_VARIABLE(name) \
441 KRATOS_REGISTER_VARIABLE(name##_X) \
442 KRATOS_REGISTER_VARIABLE(name##_Y) \
443 KRATOS_REGISTER_VARIABLE(name##_Z)
445 #ifdef KRATOS_REGISTER_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS
446 #undef KRATOS_REGISTER_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS
448 #define KRATOS_REGISTER_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS(name) \
449 KRATOS_REGISTER_VARIABLE(name) \
450 KRATOS_REGISTER_VARIABLE(name##_XX) \
451 KRATOS_REGISTER_VARIABLE(name##_YY) \
452 KRATOS_REGISTER_VARIABLE(name##_XY)
454 #ifdef KRATOS_REGISTER_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS
455 #undef KRATOS_REGISTER_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS
457 #define KRATOS_REGISTER_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS(name) \
458 KRATOS_REGISTER_VARIABLE(name) \
459 KRATOS_REGISTER_VARIABLE(name##_XX) \
460 KRATOS_REGISTER_VARIABLE(name##_YY) \
461 KRATOS_REGISTER_VARIABLE(name##_ZZ) \
462 KRATOS_REGISTER_VARIABLE(name##_XY) \
463 KRATOS_REGISTER_VARIABLE(name##_YZ) \
464 KRATOS_REGISTER_VARIABLE(name##_XZ)
466 #ifdef KRATOS_REGISTER_2D_TENSOR_VARIABLE_WITH_COMPONENTS
467 #undef KRATOS_REGISTER_2D_TENSOR_VARIABLE_WITH_COMPONENTS
469 #define KRATOS_REGISTER_2D_TENSOR_VARIABLE_WITH_COMPONENTS(name) \
470 KRATOS_REGISTER_VARIABLE(name) \
471 KRATOS_REGISTER_VARIABLE(name##_XX) \
472 KRATOS_REGISTER_VARIABLE(name##_XY) \
473 KRATOS_REGISTER_VARIABLE(name##_YX) \
474 KRATOS_REGISTER_VARIABLE(name##_YY)
476 #ifdef KRATOS_REGISTER_3D_TENSOR_VARIABLE_WITH_COMPONENTS
477 #undef KRATOS_REGISTER_3D_TENSOR_VARIABLE_WITH_COMPONENTS
479 #define KRATOS_REGISTER_3D_TENSOR_VARIABLE_WITH_COMPONENTS(name) \
480 KRATOS_REGISTER_VARIABLE(name) \
481 KRATOS_REGISTER_VARIABLE(name##_XX) \
482 KRATOS_REGISTER_VARIABLE(name##_XY) \
483 KRATOS_REGISTER_VARIABLE(name##_XZ) \
484 KRATOS_REGISTER_VARIABLE(name##_YX) \
485 KRATOS_REGISTER_VARIABLE(name##_YY) \
486 KRATOS_REGISTER_VARIABLE(name##_YZ) \
487 KRATOS_REGISTER_VARIABLE(name##_ZX) \
488 KRATOS_REGISTER_VARIABLE(name##_ZY) \
489 KRATOS_REGISTER_VARIABLE(name##_ZZ)
497 #ifdef KRATOS_CREATE_VARIABLE_WITH_TIME_DERIVATIVE
498 #undef KRATOS_CREATE_VARIABLE_WITH_TIME_DERIVATIVE
500 #define KRATOS_CREATE_VARIABLE_WITH_TIME_DERIVATIVE(type, name, variable_derivative) \
501 Kratos::Variable<type > name(#name, &variable_derivative);
503 #ifdef KRATOS_CREATE_3D_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE
504 #undef KRATOS_CREATE_3D_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE
506 #define KRATOS_CREATE_3D_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE(name, component1, component2, component3, variable_derivative) \
507 Kratos::Variable<Kratos::array_1d<double, 3> > name(#name, Kratos::array_1d<double, 3>(Kratos::ZeroVector(3)), &variable_derivative); \
509 Kratos::Variable<double> \
510 component1(#component1, &name, 0, &variable_derivative##_X); \
512 Kratos::Variable<double> \
513 component2(#component2, &name, 1, &variable_derivative##_Y); \
515 Kratos::Variable<double> \
516 component3(#component3, &name, 2, &variable_derivative##_Z);
518 #ifdef KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE
519 #undef KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE
521 #define KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE(name, variable_derivative) \
522 KRATOS_CREATE_3D_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE(name, name##_X, name##_Y, name##_Z, variable_derivative)
524 #ifdef KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE
525 #undef KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE
527 #define KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE(name, component1, component2, component3, variable_derivative) \
528 Kratos::Variable<Kratos::array_1d<double, 3> > name(#name, Kratos::zero_vector<double>(3), &variable_derivative); \
530 Kratos::Variable<double> \
531 component1(#component1, &name, 0, &variable_derivative##_XX); \
533 Kratos::Variable<double> \
534 component2(#component2, &name, 1, &variable_derivative##_YY); \
536 Kratos::Variable<double> \
537 component3(#component3, &name, 2, &variable_derivative##_XY);
539 #ifdef KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE
540 #undef KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE
542 #define KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE(name, variable_derivative) \
543 KRATOS_CREATE_SYMMETRIC_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE(name, name##_XX, name##_YY, name##_XY, variable_derivative)
545 #ifdef KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE
546 #undef KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE
548 #define KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE(name, component1, component2, component3, component4, component5, component6, variable_derivative) \
549 Kratos::Variable<Kratos::array_1d<double, 6> > name(#name, Kratos::zero_vector<double>(6), &variable_derivative); \
551 Kratos::Variable<double> \
552 component1(#component1, &name, 0, &variable_derivative##_XX); \
554 Kratos::Variable<double> \
555 component2(#component2, &name, 1, &variable_derivative##_YY); \
557 Kratos::Variable<double> \
558 component3(#component3, &name, 2, &variable_derivative##_ZZ); \
560 Kratos::Variable<double> \
561 component4(#component4, &name, 3, &variable_derivative##_XY); \
563 Kratos::Variable<double> \
564 component5(#component5, &name, 4, &variable_derivative##_YZ); \
566 Kratos::Variable<double> \
567 component6(#component6, &name, 5, &variable_derivative##_XZ);
569 #ifdef KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE
570 #undef KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE
572 #define KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE(name, variable_derivative) \
573 KRATOS_CREATE_SYMMETRIC_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE(name, name##_XX, name##_YY, name##_ZZ, name##_XY, name##_YZ, name##_XZ, variable_derivative)
575 #ifdef KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE
576 #undef KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE
578 #define KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE(name, component1, component2, component3, component4, variable_derivative) \
579 Kratos::Variable<Kratos::array_1d<double, 4> > name(#name, Kratos::zero_vector<double>(4), &variable_derivative); \
581 Kratos::Variable<double> \
582 component1(#component1, &name, 0, &variable_derivative##_XX); \
584 Kratos::Variable<double> \
585 component2(#component2, &name, 1, &variable_derivative##_XY); \
587 Kratos::Variable<double> \
588 component3(#component3, &name, 2, &variable_derivative##_YX); \
590 Kratos::Variable<double> \
591 component4(#component4, &name, 3, &variable_derivative##_YY);
593 #ifdef KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE
594 #undef KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE
596 #define KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE(name, variable_derivative) \
597 KRATOS_CREATE_2D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE(name, name##_XX, name##_XY, name##_YX, name##_YY, variable_derivative)
599 #ifdef KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE
600 #undef KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE
602 #define KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE(name, component1, component2, component3, component4, component5, component6, component7, component8, component9, variable_derivative) \
603 Kratos::Variable<Kratos::array_1d<double, 9> > name(#name, Kratos::zero_vector<double>(9), &variable_derivative); \
605 Kratos::Variable<double> \
606 component1(#component1, &name, 0, &variable_derivative##_XX); \
608 Kratos::Variable<double> \
609 component2(#component2, &name, 1, &variable_derivative##_XY); \
611 Kratos::Variable<double> \
612 component3(#component3, &name, 2, &variable_derivative##_XZ); \
614 Kratos::Variable<double> \
615 component4(#component4, &name, 3, &variable_derivative##_YX); \
617 Kratos::Variable<double> \
618 component5(#component5, &name, 4, &variable_derivative##_YY); \
620 Kratos::Variable<double> \
621 component6(#component6, &name, 5, &variable_derivative##_YZ); \
623 Kratos::Variable<double> \
624 component7(#component7, &name, 6, &variable_derivative##_ZX); \
626 Kratos::Variable<double> \
627 component8(#component8, &name, 7, &variable_derivative##_ZY); \
629 Kratos::Variable<double> \
630 component9(#component9, &name, 8, &variable_derivative##_ZZ);
632 #ifdef KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE
633 #undef KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE
635 #define KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_COMPONENTS_WITH_TIME_DERIVATIVE(name, variable_derivative) \
636 KRATOS_CREATE_3D_TENSOR_VARIABLE_WITH_THIS_COMPONENTS_WITH_TIME_DERIVATIVE(name, name##_XX, name##_XY, name##_XZ, name##_YX, name##_YY, name##_YZ, name##_ZX, name##_ZY, name##_ZZ, variable_derivative)
644 #ifdef KRATOS_DEFINE_FLAG
645 #undef KRATOS_DEFINE_FLAG
647 #define KRATOS_DEFINE_FLAG(name) \
648 extern const Kratos::Flags name;
650 #ifdef KRATOS_ADD_FLAG_TO_KRATOS_COMPONENTS
651 #undef KRATOS_ADD_FLAG_TO_KRATOS_COMPONENTS
653 #define KRATOS_ADD_FLAG_TO_KRATOS_COMPONENTS(name) \
654 Kratos::KratosComponents<Kratos::Flags>::Add(#name, name)
656 #ifdef KRATOS_CREATE_FLAG
657 #undef KRATOS_CREATE_FLAG
659 #define KRATOS_CREATE_FLAG(name, position) \
660 const Kratos::Flags name(Kratos::Flags::Create(position));
662 #ifdef KRATOS_REGISTER_FLAG
663 #undef KRATOS_REGISTER_FLAG
665 #define KRATOS_REGISTER_FLAG(name) \
666 KRATOS_ADD_FLAG_TO_KRATOS_COMPONENTS(name);
670 #ifdef KRATOS_DEFINE_LOCAL_FLAG
671 #undef KRATOS_DEFINE_LOCAL_FLAG
673 #define KRATOS_DEFINE_LOCAL_FLAG(name) \
674 static const Kratos::Flags name;
676 #ifdef KRATOS_DEFINE_LOCAL_APPLICATION_FLAG
677 #undef KRATOS_DEFINE_LOCAL_APPLICATION_FLAG
679 #define KRATOS_DEFINE_LOCAL_APPLICATION_FLAG(application, name) \
680 static KRATOS_API(application) const Kratos::Flags name;
682 #ifdef KRATOS_CREATE_LOCAL_FLAG
683 #undef KRATOS_CREATE_LOCAL_FLAG
685 #define KRATOS_CREATE_LOCAL_FLAG(class_name, name, position) \
686 const Kratos::Flags class_name::name(Kratos::Flags::Create(position));
696 #ifdef KRATOS_REGISTER_GEOMETRY
697 #undef KRATOS_REGISTER_GEOMETRY
699 #define KRATOS_REGISTER_GEOMETRY(name, reference) \
700 KratosComponents<Geometry<Node>>::Add(name, reference); \
701 Serializer::Register(name, reference);
703 #ifdef KRATOS_REGISTER_ELEMENT
704 #undef KRATOS_REGISTER_ELEMENT
706 #define KRATOS_REGISTER_ELEMENT(name, reference) \
707 KratosComponents<Element >::Add(name, reference); \
708 Serializer::Register(name, reference);
710 #ifdef KRATOS_REGISTER_CONDITION
711 #undef KRATOS_REGISTER_CONDITION
713 #define KRATOS_REGISTER_CONDITION(name, reference) \
714 KratosComponents<Condition >::Add(name, reference); \
715 Serializer::Register(name, reference);
717 #ifdef KRATOS_REGISTER_CONSTRAINT
718 #undef KRATOS_REGISTER_CONSTRAINT
720 #define KRATOS_REGISTER_CONSTRAINT(name, reference) \
721 KratosComponents<MasterSlaveConstraint >::Add(name, reference); \
722 Serializer::Register(name, reference);
724 #ifdef KRATOS_REGISTER_MODELER
725 #undef KRATOS_REGISTER_MODELER
727 #define KRATOS_REGISTER_MODELER(name, reference) \
728 KratosComponents<Modeler>::Add(name, reference); \
729 Serializer::Register(name, reference);
731 #ifdef KRATOS_REGISTER_CONSTITUTIVE_LAW
732 #undef KRATOS_REGISTER_CONSTITUTIVE_LAW
734 #define KRATOS_REGISTER_CONSTITUTIVE_LAW(name, reference) \
735 KratosComponents<ConstitutiveLaw >::Add(name, reference); \
736 Serializer::Register(name, reference);
738 #define KRATOS_DEPRECATED [[deprecated]]
739 #define KRATOS_DEPRECATED_MESSAGE(deprecated_message) [[deprecated(deprecated_message)]]
746 #if defined(__clang__)
747 #define KRATOS_PRAGMA_INSIDE_MACRO_DEFINITION(x) _Pragma(#x)
748 #define KRATOS_START_IGNORING_DEPRECATED_FUNCTION_WARNING \
749 KRATOS_PRAGMA_INSIDE_MACRO_DEFINITION(clang diagnostic push) \
750 KRATOS_PRAGMA_INSIDE_MACRO_DEFINITION(clang diagnostic ignored "-Wdeprecated-declarations")
751 #elif defined(__GNUG__) && !defined(__INTEL_COMPILER)
752 #define KRATOS_PRAGMA_INSIDE_MACRO_DEFINITION(x) _Pragma(#x)
753 #define KRATOS_START_IGNORING_DEPRECATED_FUNCTION_WARNING \
754 KRATOS_PRAGMA_INSIDE_MACRO_DEFINITION(GCC diagnostic push) \
755 KRATOS_PRAGMA_INSIDE_MACRO_DEFINITION(GCC diagnostic ignored "-Wdeprecated-declarations")
756 #elif defined(_MSC_VER)
757 #define KRATOS_START_IGNORING_DEPRECATED_FUNCTION_WARNING \
758 __pragma(warning(push))\
759 __pragma(warning(disable: 4996))
761 #define KRATOS_START_IGNORING_DEPRECATED_FUNCTION_WARNING
766 #if defined(__clang__)
767 #define KRATOS_STOP_IGNORING_DEPRECATED_FUNCTION_WARNING \
768 _Pragma("clang diagnostic pop")
769 #elif defined(__GNUG__) && !defined(__INTEL_COMPILER)
770 #define KRATOS_STOP_IGNORING_DEPRECATED_FUNCTION_WARNING \
771 _Pragma("GCC diagnostic pop")
772 #elif defined(_MSC_VER)
773 #define KRATOS_STOP_IGNORING_DEPRECATED_FUNCTION_WARNING \
774 __pragma(warning(pop))
776 #define KRATOS_STOP_IGNORING_DEPRECATED_FUNCTION_WARNING
785 #if defined(_MSC_VER)
786 #pragma warning (disable: 4355)
787 #pragma warning (disable: 4503)
788 #pragma warning (disable: 4786)
792 #define KRATOS_TYPE_NAME_OF(name) name##Type
793 #define KRATOS_NOT_EXCLUDED(filename) !defined(KRATOS_##filename##_EXCLUDED)
795 #define KRATOS_DECLEAR_TYPE namespace KratosComponents{ typedef
796 #define KRATOS_FOR_COMPONENT_NAMED(name) KRATOS_TYPE_NAME_OF(name);}
806 #define KRATOS_WATCH(variable) std::cout << #variable << " : " << variable << std::endl;
807 #define KRATOS_WATCH_CERR(variable) std::cerr << #variable << " : " << variable << std::endl;
808 #define KRATOS_WATCH_MPI(variable, mpi_data_comm) std::cout << "RANK " << mpi_data_comm.Rank() << "/" << mpi_data_comm.Size() << " "; KRATOS_WATCH(variable);
812 #define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType) \
813 Serializer.save_base("BaseClass",*static_cast<const BaseType *>(this));
815 #define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType) \
816 Serializer.load_base("BaseClass",*static_cast<BaseType *>(this));
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21