Commit 0f0e4a0c authored by Henry Weller's avatar Henry Weller
Browse files

zero: Added cast to float and double for consistent scalar and floatScalar...

zero: Added cast to float and double for consistent scalar and floatScalar initialization and assignment to 0
Zero: New global instance of zero for simple and efficient initialization and assigment of primitives to 0
parent e69aaae5
...@@ -36,6 +36,8 @@ SourceFiles ...@@ -36,6 +36,8 @@ SourceFiles
#ifndef zero_H #ifndef zero_H
#define zero_H #define zero_H
#include "label.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
...@@ -51,15 +53,38 @@ public: ...@@ -51,15 +53,38 @@ public:
zero() zero()
{} {}
//- Return 0 for label
inline operator label() const
{
return 0;
}
//- Return 0 for float
inline operator float() const
{
return 0;
}
//- Return 0 for double
inline operator double() const
{
return 0;
}
}; };
// Global zero
static const zero Zero;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "zeroI.H" #include "zeroI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment