https://mooseframework.inl.gov
RankTwoScalarToolsTest.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 
12 #include "RankTwoTensor.h"
13 #include "RankTwoScalarTools.h"
14 
15 TEST(RankTwoScalarToolsTest, ErrorComputingEV)
16 {
17  // generate tensor that does not allow computation of eigenvectors
18  // and fails because of nan entries
19 
21  a(0, 0) = a(0, 1) = a(0, 2) = std::numeric_limits<double>::quiet_NaN();
22  a(1, 0) = a(1, 1) = a(1, 2) = a(0, 0);
23  a(2, 0) = a(2, 1) = a(2, 2) = a(0, 0);
24 
25  try
26  {
27  Point p(1, 0, 0);
29  FAIL();
30  }
31  catch (const std::exception & err)
32  {
33  std::size_t pos = std::string(err.what()).find("In computing the eigenvalues and eigenvectors");
34  ASSERT_TRUE(pos != std::string::npos);
35  }
36 }
OStreamProxy err
TEST(RankTwoScalarToolsTest, ErrorComputingEV)
T calcEigenValuesEigenVectors(const RankTwoTensorTempl< T > &r2tensor, unsigned int index, Point &eigenvec)