FreePOOMA
2.4.1
|
PAssert macro, PInsist macro, CTAssert struct, SameType struct. More...
#include "Pooma/Configuration.h"
Classes | |
class | Pooma::Assertion |
assertion: exception notification class for assertions. More... | |
struct | PoomaCTAssert< B > |
struct | PoomaCTAssert< true > |
struct | SameType< T1, T2 > |
SameType: SameType can be used to check types at compile time. More... | |
struct | SameType< T1, T1 > |
Namespaces | |
namespace | Pooma |
Defines | |
#define | CTAssert(c) PoomaCTAssert<(c)>::test() |
CTAssert: CTAssert is a compile-time assert. | |
#define | PAssert(c) if (c) {} else Pooma::toss_cookies(#c, __FILE__, __LINE__) |
PAssert: Run-time assertion. | |
#define | PInsist(c, m) if (c) {} else Pooma::toss_cookies(m, __FILE__, __LINE__) |
The PInsist macros are like the PAssert macro, but they provide the opportunity to specify an instructive message. | |
#define | PInsist1(c, m, a1) if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1) |
#define | PInsist2(c, m, a1, a2) if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2) |
#define | PInsist3(c, m, a1, a2, a3) if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3) |
#define | PInsist4(c, m, a1, a2, a3, a4) if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4) |
#define | PInsist5(c, m, a1, a2, a3, a4, a5) if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4,a5) |
#define | PInsist6(c, m, a1, a2, a3, a4, a5, a6) if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4,a5,a6) |
#define | PInsist7(c, m, a1, a2, a3, a4, a5, a6, a7) if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7) |
#define | PError(m) Pooma::toss_cookies(m, __FILE__, __LINE__) |
This macro is used when executing some code always results in an error. | |
#define | PError1(m, a1) Pooma::toss_cookies(m,__FILE__,__LINE__,a1) |
#define | PError2(m, a1, a2) Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2) |
#define | PError3(m, a1, a2, a3) Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3) |
#define | PError4(m, a1, a2, a3, a4) Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4) |
#define | PError5(m, a1, a2, a3, a4, a5) Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4,a5) |
#define | PError6(m, a1, a2, a3, a4, a5, a6) Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4,a5,a6) |
#define | PError7(m, a1, a2, a3, a4, a5, a6, a7) Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7) |
#define | PBoundInsist(cond, msg) |
These macros are used for bounds checking and are controlled by the POOMA_BOUNDS_CHECK define. | |
#define | PBoundInsist1(cond, msg, a1) |
#define | PBoundInsist2(cond, msg, a1, a2) |
#define | PBoundInsist3(cond, msg, a1, a2, a3) |
#define | PBoundInsist4(cond, msg, a1, a2, a3, a4) |
#define | PBoundInsist5(cond, msg, a1, a2, a3, a4, a5) |
#define | PBoundInsist6(cond, msg, a1, a2, a3, a4, a5, a6) |
#define | PBoundInsist7(cond, msg, a1, a2, a3, a4, a5, a6, a7) |
#define | PBoundAssert(cond) |
Functions | |
void | Pooma::toss_cookies (const char *msg, const char *file, int line...) POOMA_ATTRIBUTE_NORETURN |
This is the function called in the assert/insist macros. |
PAssert macro, PInsist macro, CTAssert struct, SameType struct.
NOTE: We provide a way to eliminate assertions, but not insistings. The idea is that PAssert is used to perform sanity checks during program development, which you might want to eliminate during production runs for performance sake. PInsist is used for things which really really must be true, such as "the file must've been opened", etc. So, use PAssert for things which you want taken out of production codes (like, the check might inhibit inlining or something like that), but use PInsist for those things you want checked even in a production code.
#define CTAssert | ( | c | ) | PoomaCTAssert<(c)>::test() |
CTAssert: CTAssert is a compile-time assert.
That is, it tests the condition at compile time and if it is false you get a compile error that it can't find CTAssert<false>::test(). If NOCTAssert is defined, CTAssert will revert to the equivalent of PAssert. To turn off the test completely, define NOPAssert as well.
#define PAssert | ( | c | ) | if (c) {} else Pooma::toss_cookies(#c, __FILE__, __LINE__) |
PAssert: Run-time assertion.
Now we define a run time assertion mechanism. We will call it "PAssert", to reflect the idea that this is for use in POOMA per se, recognizing that there are numerous other assertion facilities in use in client codes.
The PAssert macro is intended to be used for validating preconditions which must be true in order for following code to be correct, etc. For example, PAssert( x > 0. ); y = sqrt(x); If the assertion fails, the code should just bomb. Philosophically, it should be used to feret out bugs in preceding code, making sure that prior results are within reasonable bounds before proceeding to use those results in further computation, etc.
If exceptions are completely turned off (by setting POOMA_NO_EXCEPTIONS) or NOPAssert is defined, PAssert will just be an empty macro.
#define PInsist | ( | c, | |
m | |||
) | if (c) {} else Pooma::toss_cookies(m, __FILE__, __LINE__) |
The PInsist macros are like the PAssert macro, but they provide the opportunity to specify an instructive message.
The idea here is that you should use Insist for checking things which are more or less under user control. If the user makes a poor choice, we "insist" that it be corrected, providing a corrective hint.
#define PInsist1 | ( | c, | |
m, | |||
a1 | |||
) | if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1) |
#define PInsist2 | ( | c, | |
m, | |||
a1, | |||
a2 | |||
) | if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2) |
#define PInsist3 | ( | c, | |
m, | |||
a1, | |||
a2, | |||
a3 | |||
) | if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3) |
#define PInsist4 | ( | c, | |
m, | |||
a1, | |||
a2, | |||
a3, | |||
a4 | |||
) | if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4) |
#define PInsist5 | ( | c, | |
m, | |||
a1, | |||
a2, | |||
a3, | |||
a4, | |||
a5 | |||
) | if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4,a5) |
#define PInsist6 | ( | c, | |
m, | |||
a1, | |||
a2, | |||
a3, | |||
a4, | |||
a5, | |||
a6 | |||
) | if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4,a5,a6) |
#define PInsist7 | ( | c, | |
m, | |||
a1, | |||
a2, | |||
a3, | |||
a4, | |||
a5, | |||
a6, | |||
a7 | |||
) | if (c) {} else Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7) |
#define PError | ( | m | ) | Pooma::toss_cookies(m, __FILE__, __LINE__) |
This macro is used when executing some code always results in an error.
This cannot be removed, so is like PInsist.
#define PError1 | ( | m, | |
a1 | |||
) | Pooma::toss_cookies(m,__FILE__,__LINE__,a1) |
#define PError2 | ( | m, | |
a1, | |||
a2 | |||
) | Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2) |
#define PError3 | ( | m, | |
a1, | |||
a2, | |||
a3 | |||
) | Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3) |
#define PError4 | ( | m, | |
a1, | |||
a2, | |||
a3, | |||
a4 | |||
) | Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4) |
#define PError5 | ( | m, | |
a1, | |||
a2, | |||
a3, | |||
a4, | |||
a5 | |||
) | Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4,a5) |
#define PError6 | ( | m, | |
a1, | |||
a2, | |||
a3, | |||
a4, | |||
a5, | |||
a6 | |||
) | Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4,a5,a6) |
#define PError7 | ( | m, | |
a1, | |||
a2, | |||
a3, | |||
a4, | |||
a5, | |||
a6, | |||
a7 | |||
) | Pooma::toss_cookies(m,__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7) |
#define PBoundInsist | ( | cond, | |
msg | |||
) |
These macros are used for bounds checking and are controlled by the POOMA_BOUNDS_CHECK define.
Referenced by SubFieldView< Field< Mesh, T, EngineTag > >::make(), SubFieldView< Field< Mesh, T, ExpressionTag< Expr > > >::make(), View1Implementation< Field< Mesh, T, EngineTag >, Domain, true >::make(), View1Implementation< Field< Mesh, T, EngineTag >, Domain, false >::make(), View1< Field< Mesh, T, EngineTag >, int >::make(), View1< Field< Mesh, T, EngineTag >, Loc< Mesh::dimensions > >::make(), View2< Field< Mesh, T, EngineTag >, int, int >::make(), View2< Field< Mesh, T, EngineTag >, FieldOffset< Dim >, Loc< Dim > >::make(), View1< Array< Dim, T, EngineTag >, Loc< Dim > >::make(), View3< Field< Mesh, T, EngineTag >, int, int, int >::make(), View1Implementation< Field< Mesh, T, EngineTag >, Domain, true >::makeRead(), View1< Field< Mesh, T, EngineTag >, int >::makeRead(), View1< Field< Mesh, T, EngineTag >, Loc< Mesh::dimensions > >::makeRead(), View2< Field< Mesh, T, EngineTag >, int, int >::makeRead(), View2< Field< Mesh, T, EngineTag >, FieldOffset< Dim >, Loc< Dim > >::makeRead(), View1< Array< Dim, T, EngineTag >, Loc< Dim > >::makeRead(), and View3< Field< Mesh, T, EngineTag >, int, int, int >::makeRead().
#define PBoundInsist1 | ( | cond, | |
msg, | |||
a1 | |||
) |
#define PBoundInsist2 | ( | cond, | |
msg, | |||
a1, | |||
a2 | |||
) |
#define PBoundInsist3 | ( | cond, | |
msg, | |||
a1, | |||
a2, | |||
a3 | |||
) |
#define PBoundInsist4 | ( | cond, | |
msg, | |||
a1, | |||
a2, | |||
a3, | |||
a4 | |||
) |
#define PBoundInsist5 | ( | cond, | |
msg, | |||
a1, | |||
a2, | |||
a3, | |||
a4, | |||
a5 | |||
) |
#define PBoundInsist6 | ( | cond, | |
msg, | |||
a1, | |||
a2, | |||
a3, | |||
a4, | |||
a5, | |||
a6 | |||
) |
#define PBoundInsist7 | ( | cond, | |
msg, | |||
a1, | |||
a2, | |||
a3, | |||
a4, | |||
a5, | |||
a6, | |||
a7 | |||
) |
#define PBoundAssert | ( | cond | ) |
Referenced by VectorEngine< D, T, Full >::operator()(), TinyMatrixEngine< D1, D2, T, Full >::operator()(), TensorEngine< D, T, Full >::operator()(), TensorEngine< D, T, Antisymmetric >::operator()(), TensorEngine< D, T, Symmetric >::operator()(), TensorEngine< D, T, Diagonal >::operator()(), and Pooma::BrickViewBase< Dim >::sliceInit().