In early versions of OpenFOAM the scalar limits were simple macro replacements and the
names were capitalized to indicate this. The scalar limits are now static
constants which is a huge improvement on the use of macros and for consistency
the names have been changed to camel-case to indicate this and improve
readability of the code:
GREAT -> great
ROOTGREAT -> rootGreat
VGREAT -> vGreat
ROOTVGREAT -> rootVGreat
SMALL -> small
ROOTSMALL -> rootSmall
VSMALL -> vSmall
ROOTVSMALL -> rootVSmall
The original capitalized are still currently supported but their use is
deprecated.
72 lines
1.3 KiB
C++
72 lines
1.3 KiB
C++
#include "vector.H"
|
|
#include "IOstreams.H"
|
|
#include "vectorTools.H"
|
|
#include "unitConversion.H"
|
|
|
|
using namespace Foam;
|
|
|
|
|
|
void test(const vector& a, const vector& b, const scalar tolerance)
|
|
{
|
|
Info<< "Vectors " << a << " and " << b
|
|
<< " are (to tolerance of " << tolerance << "): ";
|
|
|
|
if (vectorTools::areParallel(a, b, tolerance))
|
|
Info<< " parallel ";
|
|
|
|
if (vectorTools::areOrthogonal(a, b, tolerance))
|
|
Info<< " orthogonal ";
|
|
|
|
if (vectorTools::areAcute(a, b))
|
|
Info<< " acute ";
|
|
|
|
if (vectorTools::areObtuse(a, b))
|
|
Info<< " obtuse ";
|
|
|
|
Info<< ", angle = " << vectorTools::degAngleBetween(a, b);
|
|
|
|
Info<< endl;
|
|
}
|
|
|
|
|
|
int main()
|
|
{
|
|
vector a(1.0, 1.0, 1.0);
|
|
vector b(2.0, 2.0, 2.0);
|
|
|
|
test(a, b, 0.0);
|
|
test(a, b, vSmall);
|
|
test(a, b, small);
|
|
test(a, b, 1e-3);
|
|
test(a, b, 1e-1);
|
|
|
|
a = vector(1,0,0);
|
|
b = vector(0,2,0);
|
|
|
|
test(a, b, 0.0);
|
|
test(a, b, vSmall);
|
|
test(a, b, small);
|
|
test(a, b, 1e-3);
|
|
test(a, b, 1e-1);
|
|
|
|
a = vector(1,0,0);
|
|
b = vector(-1,0,0);
|
|
|
|
test(a, b, 0.0);
|
|
test(a, b, vSmall);
|
|
test(a, b, small);
|
|
test(a, b, 1e-3);
|
|
test(a, b, 1e-1);
|
|
|
|
a = vector(1,0,0);
|
|
b = vector(-1,2,0);
|
|
|
|
test(a, b, 0.0);
|
|
test(a, b, vSmall);
|
|
test(a, b, small);
|
|
test(a, b, 1e-3);
|
|
test(a, b, 1e-1);
|
|
|
|
return 0;
|
|
}
|