Line data Source code
1 : #include <stdlib.h>
2 :
3 : #include "Util/Util.H"
4 :
5 : #include "Test/Numeric/Stencil.H"
6 : #include "Test/Set/Matrix4.H"
7 :
8 : #include "Operator/Elastic.H"
9 :
10 : #include "Numeric/Interpolator/Test.H"
11 : #include "Numeric/Interpolator/Linear.H"
12 :
13 : #include "Model/Solid/Linear/Isotropic.H"
14 : #include "Model/Solid/Linear/Cubic.H"
15 : #include "Model/Solid/Linear/Laplacian.H"
16 : #include "Model/Solid/Linear/Transverse.H"
17 : #include "Model/Solid/Affine/Isotropic.H"
18 : #include "Model/Solid/Affine/Cubic.H"
19 : #include "Model/Solid/Finite/NeoHookean.H"
20 : #include "Model/Solid/Finite/NeoHookeanPredeformed.H"
21 : #include "Model/Solid/Finite/PseudoLinear/Cubic.H"
22 : #include "Model/Solid/Finite/PseudoAffine/Cubic.H"
23 : #include "Model/Solid/Linear/Hexagonal.H"
24 : #include "Model/Solid/Affine/Hexagonal.H"
25 :
26 : #include "Solver/Local/Riemann/Roe.H"
27 :
28 : #include "Unit/Test.H"
29 :
30 2 : int main (int argc, char* argv[])
31 : {
32 2 : Util::Initialize(argc, argv);
33 :
34 2 : int failed = 0;
35 :
36 2 : Util::globalprefix = " │ ";
37 :
38 :
39 : #define MODELTEST(TYPE) \
40 : Util::Test::Message(#TYPE); \
41 : { \
42 : int subfailed = 0; \
43 : subfailed += Util::Test::SubMessage("ArithmeticTest", TYPE::ArithmeticTest<TYPE>(true)); \
44 : subfailed += Util::Test::SubMessage("DerivativeTest1", TYPE::DerivativeTest1<TYPE>(true)); \
45 : subfailed += Util::Test::SubMessage("DerivativeTest2", TYPE::DerivativeTest2<TYPE>(true)); \
46 : if (TYPE::kinvar == Model::Solid::KinematicVariable::F) \
47 : { \
48 : subfailed += Util::Test::SubMessage("MaterialFrameIndifference", TYPE::MaterialFrameIndifference<TYPE>(true)); \
49 : } \
50 : failed += Util::Test::SubFinalMessage(subfailed); \
51 : }
52 16 : MODELTEST(Model::Solid::Linear::Isotropic);
53 16 : MODELTEST(Model::Solid::Linear::Cubic);
54 16 : MODELTEST(Model::Solid::Linear::Laplacian);
55 16 : MODELTEST(Model::Solid::Linear::Transverse);
56 16 : MODELTEST(Model::Solid::Affine::Isotropic);
57 16 : MODELTEST(Model::Solid::Affine::Cubic);
58 16 : MODELTEST(Model::Solid::Linear::Hexagonal);
59 16 : MODELTEST(Model::Solid::Affine::Hexagonal);
60 20 : MODELTEST(Model::Solid::Finite::NeoHookean);
61 20 : MODELTEST(Model::Solid::Finite::PseudoLinear::Cubic);
62 20 : MODELTEST(Model::Solid::Finite::NeoHookeanPredeformed);
63 20 : MODELTEST(Model::Solid::Finite::PseudoAffine::Cubic);
64 :
65 :
66 2 : Util::Test::Message("Set::Matrix4");
67 : {
68 2 : int subfailed = 0;
69 : Test::Set::Matrix4<2,Set::Sym::Full> test_2d_full;
70 4 : subfailed += Util::Test::SubMessage("2D - Full", test_2d_full.SymmetryTest(0));
71 : Test::Set::Matrix4<3,Set::Sym::Full> test_3d_full;
72 4 : subfailed += Util::Test::SubMessage("3D - Full", test_3d_full.SymmetryTest(0));
73 : Test::Set::Matrix4<3,Set::Sym::MajorMinor> test_3d_majorminor;
74 4 : subfailed += Util::Test::SubMessage("3D - MajorMinor", test_3d_majorminor.SymmetryTest(0));
75 2 : failed += Util::Test::SubFinalMessage(subfailed);
76 : }
77 :
78 2 : Util::Test::Message("Numeric::Interpolator<Linear>");
79 : {
80 2 : int subfailed = 0;
81 : Numeric::Interpolator::Test<Numeric::Interpolator::Linear<Set::Scalar> > test;
82 4 : subfailed += Util::Test::SubMessage("Match",test.Match(0));
83 2 : failed += Util::Test::SubFinalMessage(subfailed);
84 : }
85 :
86 2 : Util::Test::Message("Numeric::Stencil test");
87 : {
88 2 : int subfailed = 0;
89 2 : Test::Numeric::Stencil test;
90 2 : test.Define(32);
91 : // first order
92 8 : subfailed += Util::Test::SubMessage("1-0-0",test.Derivative<1,0,0>(0));
93 8 : subfailed += Util::Test::SubMessage("0-1-0",test.Derivative<0,1,0>(0));
94 : // second order
95 8 : subfailed += Util::Test::SubMessage("2-0-0",test.Derivative<2,0,0>(0));
96 8 : subfailed += Util::Test::SubMessage("0-2-0",test.Derivative<0,2,0>(0));
97 8 : subfailed += Util::Test::SubMessage("0-0-1",test.Derivative<0,2,0>(0));
98 8 : subfailed += Util::Test::SubMessage("1-1-0",test.Derivative<1,1,0>(0));
99 : // fourth order
100 8 : subfailed += Util::Test::SubMessage("3-1-0",test.Derivative<3,1,0>(0));
101 8 : subfailed += Util::Test::SubMessage("1-3-0",test.Derivative<1,3,0>(0));
102 8 : subfailed += Util::Test::SubMessage("2-2-0",test.Derivative<2,2,0>(0));
103 8 : subfailed += Util::Test::SubMessage("4-0-0",test.Derivative<4,0,0>(0));
104 7 : subfailed += Util::Test::SubMessage("0-4-0",test.Derivative<0,4,0>(0));
105 : #if AMREX_SPACEDIM>2
106 : // first order
107 4 : subfailed += Util::Test::SubMessage("0-0-1",test.Derivative<0,0,1>(0));
108 : // second order
109 4 : subfailed += Util::Test::SubMessage("0-0-2",test.Derivative<0,0,2>(0));
110 4 : subfailed += Util::Test::SubMessage("1-0-1",test.Derivative<1,0,1>(0));
111 4 : subfailed += Util::Test::SubMessage("0-1-1",test.Derivative<0,1,1>(0));
112 : // fourth order
113 4 : subfailed += Util::Test::SubMessage("0-0-4",test.Derivative<0,0,4>(0));
114 4 : subfailed += Util::Test::SubMessage("0-1-3",test.Derivative<0,1,3>(0));
115 4 : subfailed += Util::Test::SubMessage("0-3-1",test.Derivative<0,3,1>(0));
116 4 : subfailed += Util::Test::SubMessage("3-0-1",test.Derivative<3,0,1>(0));
117 4 : subfailed += Util::Test::SubMessage("1-0-3",test.Derivative<1,0,3>(0));
118 4 : subfailed += Util::Test::SubMessage("0-2-2",test.Derivative<0,2,2>(0));
119 4 : subfailed += Util::Test::SubMessage("2-0-2",test.Derivative<2,0,2>(0));
120 4 : subfailed += Util::Test::SubMessage("2-1-1",test.Derivative<2,1,1>(0));
121 4 : subfailed += Util::Test::SubMessage("1-2-1",test.Derivative<1,2,1>(0));
122 3 : subfailed += Util::Test::SubMessage("1-1-2",test.Derivative<1,1,2>(0));
123 : #endif
124 2 : failed += Util::Test::SubFinalMessage(subfailed);
125 2 : }
126 :
127 2 : Util::Test::Message("Solver::Nonlocal::Riemann::Roe test");
128 : {
129 2 : int subfailed = 0;
130 4 : subfailed += Util::Test::SubMessage("Test",Solver::Local::Riemann::Roe::Test());
131 2 : failed += Util::Test::SubFinalMessage(subfailed);
132 : }
133 :
134 2 : Util::Test::Message("Unit test");
135 : {
136 2 : int subfailed = 0;
137 4 : subfailed += Util::Test::SubMessage("Equivalence", UnitTest::Equivalence(1));
138 2 : failed += subfailed;
139 : }
140 :
141 :
142 2 : Util::globalprefix = "";
143 6 : Util::Message(INFO,failed," tests failed");
144 :
145 2 : Util::Finalize();
146 2 : return failed;
147 : }
|