https://mooseframework.inl.gov
TestTHMUtils.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "gtest/gtest.h"
11 #include "libmesh/vector_value.h"
12 #include "MooseUtils.h"
13 #include "THMUtils.h"
14 #include "THMTestUtils.h"
15 
16 TEST(NumericsTest, computeOrthogonalDirections_x_aligned)
17 {
18  const RealVectorValue n(-2, 0, 0);
19  RealVectorValue t1, t2;
21 
22  EXPECT_TRUE(MooseUtils::absoluteFuzzyEqual(t1.norm(), 1));
23  EXPECT_TRUE(MooseUtils::absoluteFuzzyEqual(t2.norm(), 1));
24  EXPECT_TRUE(MooseUtils::absoluteFuzzyEqual(t1 * n, 0));
25  EXPECT_TRUE(MooseUtils::absoluteFuzzyEqual(t2 * n, 0));
26  EXPECT_TRUE(MooseUtils::absoluteFuzzyEqual(t1 * t2, 0));
27 }
28 
29 TEST(NumericsTest, computeOrthogonalDirections_skew)
30 {
31  const RealVectorValue n(1, 2, 3);
32  RealVectorValue t1, t2;
34 
35  EXPECT_TRUE(MooseUtils::absoluteFuzzyEqual(t1.norm(), 1));
36  EXPECT_TRUE(MooseUtils::absoluteFuzzyEqual(t2.norm(), 1));
37  EXPECT_TRUE(MooseUtils::absoluteFuzzyEqual(t1 * n, 0));
38  EXPECT_TRUE(MooseUtils::absoluteFuzzyEqual(t2 * n, 0));
39  EXPECT_TRUE(MooseUtils::absoluteFuzzyEqual(t1 * t2, 0));
40 }
auto norm() const -> decltype(std::norm(Real()))
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
TEST(NumericsTest, computeOrthogonalDirections_x_aligned)
Definition: TestTHMUtils.C:16
void computeOrthogonalDirections(const RealVectorValue &n_unnormalized, RealVectorValue &t1, RealVectorValue &t2)
Computes two unit vectors orthogonal to the given vector.
Definition: THMUtils.C:22