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/Affine/Isotropic.H"
17 : #include "Model/Solid/Affine/Cubic.H"
18 : #include "Model/Solid/Finite/NeoHookean.H"
19 : #include "Model/Solid/Finite/NeoHookeanPredeformed.H"
20 : #include "Model/Solid/Finite/PseudoLinear/Cubic.H"
21 : #include "Model/Solid/Finite/PseudoAffine/Cubic.H"
22 : #include "Model/Solid/Linear/Hexagonal.H"
23 : #include "Model/Solid/Affine/Hexagonal.H"
24 :
25 2 : int main (int argc, char* argv[])
26 : {
27 2 : Util::Initialize(argc, argv);
28 :
29 2 : int failed = 0;
30 :
31 : #define MODELTEST(TYPE) \
32 : Util::Test::Message(#TYPE); \
33 : { \
34 : int subfailed = 0; \
35 : subfailed += Util::Test::SubMessage("ArithmeticTest", TYPE::ArithmeticTest<TYPE>(true)); \
36 : subfailed += Util::Test::SubMessage("DerivativeTest1", TYPE::DerivativeTest1<TYPE>(true)); \
37 : subfailed += Util::Test::SubMessage("DerivativeTest2", TYPE::DerivativeTest2<TYPE>(true)); \
38 : if (TYPE::kinvar == Model::Solid::KinematicVariable::F) \
39 : { \
40 : subfailed += Util::Test::SubMessage("MaterialFrameIndifference", TYPE::MaterialFrameIndifference<TYPE>(true)); \
41 : } \
42 : failed += Util::Test::SubFinalMessage(subfailed); \
43 : }
44 2 : MODELTEST(Model::Solid::Linear::Isotropic);
45 2 : MODELTEST(Model::Solid::Linear::Cubic);
46 2 : MODELTEST(Model::Solid::Linear::Laplacian);
47 2 : MODELTEST(Model::Solid::Affine::Isotropic);
48 2 : MODELTEST(Model::Solid::Affine::Cubic);
49 2 : MODELTEST(Model::Solid::Linear::Hexagonal);
50 2 : MODELTEST(Model::Solid::Affine::Hexagonal);
51 2 : MODELTEST(Model::Solid::Finite::NeoHookean);
52 2 : MODELTEST(Model::Solid::Finite::PseudoLinear::Cubic);
53 2 : MODELTEST(Model::Solid::Finite::NeoHookeanPredeformed);
54 2 : MODELTEST(Model::Solid::Finite::PseudoAffine::Cubic);
55 :
56 :
57 2 : Util::Test::Message("Set::Matrix4");
58 : {
59 2 : int subfailed = 0;
60 : Test::Set::Matrix4<2,Set::Sym::Full> test_2d_full;
61 2 : subfailed += Util::Test::SubMessage("2D - Full", test_2d_full.SymmetryTest(0));
62 : Test::Set::Matrix4<3,Set::Sym::Full> test_3d_full;
63 2 : subfailed += Util::Test::SubMessage("3D - Full", test_3d_full.SymmetryTest(0));
64 : Test::Set::Matrix4<3,Set::Sym::MajorMinor> test_3d_majorminor;
65 2 : subfailed += Util::Test::SubMessage("3D - MajorMinor", test_3d_majorminor.SymmetryTest(0));
66 2 : failed += Util::Test::SubFinalMessage(subfailed);
67 : }
68 :
69 2 : Util::Test::Message("Numeric::Interpolator<Linear>");
70 : {
71 2 : int subfailed = 0;
72 : Numeric::Interpolator::Test<Numeric::Interpolator::Linear<Set::Scalar> > test;
73 2 : subfailed += Util::Test::SubMessage("Match",test.Match(0));
74 2 : failed += Util::Test::SubFinalMessage(subfailed);
75 : }
76 :
77 2 : Util::Test::Message("Numeric::Stencil test");
78 : {
79 2 : int subfailed = 0;
80 2 : Test::Numeric::Stencil test;
81 2 : test.Define(32);
82 : // first order
83 2 : subfailed += Util::Test::SubMessage("1-0-0",test.Derivative<1,0,0>(0));
84 2 : subfailed += Util::Test::SubMessage("0-1-0",test.Derivative<0,1,0>(0));
85 : // second order
86 2 : subfailed += Util::Test::SubMessage("2-0-0",test.Derivative<2,0,0>(0));
87 2 : subfailed += Util::Test::SubMessage("0-2-0",test.Derivative<0,2,0>(0));
88 2 : subfailed += Util::Test::SubMessage("0-0-1",test.Derivative<0,2,0>(0));
89 2 : subfailed += Util::Test::SubMessage("1-1-0",test.Derivative<1,1,0>(0));
90 : // fourth order
91 2 : subfailed += Util::Test::SubMessage("3-1-0",test.Derivative<3,1,0>(0));
92 2 : subfailed += Util::Test::SubMessage("1-3-0",test.Derivative<1,3,0>(0));
93 2 : subfailed += Util::Test::SubMessage("2-2-0",test.Derivative<2,2,0>(0));
94 2 : subfailed += Util::Test::SubMessage("4-0-0",test.Derivative<4,0,0>(0));
95 2 : subfailed += Util::Test::SubMessage("0-4-0",test.Derivative<0,4,0>(0));
96 : #if AMREX_SPACEDIM>2
97 : // first order
98 1 : subfailed += Util::Test::SubMessage("0-0-1",test.Derivative<0,0,1>(0));
99 : // second order
100 1 : subfailed += Util::Test::SubMessage("0-0-2",test.Derivative<0,0,2>(0));
101 1 : subfailed += Util::Test::SubMessage("1-0-1",test.Derivative<1,0,1>(0));
102 1 : subfailed += Util::Test::SubMessage("0-1-1",test.Derivative<0,1,1>(0));
103 : // fourth order
104 1 : subfailed += Util::Test::SubMessage("0-0-4",test.Derivative<0,0,4>(0));
105 1 : subfailed += Util::Test::SubMessage("0-1-3",test.Derivative<0,1,3>(0));
106 1 : subfailed += Util::Test::SubMessage("0-3-1",test.Derivative<0,3,1>(0));
107 1 : subfailed += Util::Test::SubMessage("3-0-1",test.Derivative<3,0,1>(0));
108 1 : subfailed += Util::Test::SubMessage("1-0-3",test.Derivative<1,0,3>(0));
109 1 : subfailed += Util::Test::SubMessage("0-2-2",test.Derivative<0,2,2>(0));
110 1 : subfailed += Util::Test::SubMessage("2-0-2",test.Derivative<2,0,2>(0));
111 1 : subfailed += Util::Test::SubMessage("2-1-1",test.Derivative<2,1,1>(0));
112 1 : subfailed += Util::Test::SubMessage("1-2-1",test.Derivative<1,2,1>(0));
113 1 : subfailed += Util::Test::SubMessage("1-1-2",test.Derivative<1,1,2>(0));
114 : #endif
115 2 : failed += Util::Test::SubFinalMessage(subfailed);
116 : }
117 :
118 2 : Util::Message(INFO,failed," tests failed");
119 :
120 2 : Util::Finalize();
121 2 : return failed;
122 : }
|