test/tension_function.cpp
Go to the documentation of this file.
1 
9 /*****************************************************************************
10 ** Includes
11 *****************************************************************************/
12 
13 #include <iostream>
14 #include <string>
15 #include <gtest/gtest.h>
18 #include "../../include/ecl/geometry/tension_function.hpp"
19 
20 /*****************************************************************************
21 ** Using
22 *****************************************************************************/
23 
24 using std::string;
25 using ecl::RightAlign;
26 using ecl::Format;
28 
29 /*****************************************************************************
30 ** Tests
31 *****************************************************************************/
32 
33 TEST(TensionFunction,allEggsInOneBasket) {
34  // Haven't got around to running this properly through gtests yet.
35  SUCCEED();
36 }
37 /*****************************************************************************
38 ** Main program
39 *****************************************************************************/
40 
41 int main(int argc, char **argv) {
42 
43  Format<string> string_format; string_format.width(8); string_format.align(RightAlign);
44  Format<double> format; format.width(8); format.precision(2); format.align(RightAlign);
45 
46  std::cout << std::endl;
47  std::cout << "***********************************************************" << std::endl;
48  std::cout << " Constructors" << std::endl;
49  std::cout << "***********************************************************" << std::endl;
50  std::cout << std::endl;
51 
52  TensionFunction function;
53  function = TensionFunction::Interpolation(2.0,1.0,2.0,3.0,2.0,3.0);
54 
55  std::cout << "f(tau,x) =" << std::endl;
56  std::cout << function << std::endl;
57 
58  std::cout << string_format("t=0.01");
59  std::cout << string_format("t=1");
60  std::cout << string_format("t=2");
61  std::cout << string_format("t=3");
62  std::cout << string_format("t=4");
63  std::cout << string_format("t=10") << std::endl;
64  for ( int i = 0; i <= 50; ++i ) {
65  std::cout << format(function(0.01,2.0 + 0.02*i));
66  for ( int j = 1; j < 5; j+=1 ) {
67  std::cout << format(function(1.0*j,2.0 + 0.02*i));
68  }
69  std::cout << format(function(10.0,2.0 + 0.02*i));
70  std::cout << std::endl;
71  }
72 
73  std::cout << std::endl;
74  std::cout << "***********************************************************" << std::endl;
75  std::cout << " Derivatives" << std::endl;
76  std::cout << "***********************************************************" << std::endl;
77  std::cout << std::endl;
78 
79  std::cout << string_format("t=0.01");
80  std::cout << string_format("t=1");
81  std::cout << string_format("t=2");
82  std::cout << string_format("t=3");
83  std::cout << string_format("t=4");
84  std::cout << string_format("t=10") << std::endl;
85  for ( int i = 0; i <= 50; ++i ) {
86  std::cout << format(function.derivative(0.01,2.0 + 0.02*i));
87  for ( int j = 1; j < 5; j+=1 ) {
88  std::cout << format(function.derivative(1.0*j,2.0 + 0.02*i));
89  }
90  std::cout << format(function.derivative(10.0,2.0 + 0.02*i));
91  std::cout << std::endl;
92  }
93 
94 
95  std::cout << std::endl;
96  std::cout << "***********************************************************" << std::endl;
97  std::cout << " 2nd Derivatives" << std::endl;
98  std::cout << "***********************************************************" << std::endl;
99  std::cout << std::endl;
100 
101  std::cout << string_format("t=0.01");
102  std::cout << string_format("t=1");
103  std::cout << string_format("t=2");
104  std::cout << string_format("t=3");
105  std::cout << string_format("t=4");
106  std::cout << string_format("t=10") << std::endl;
107  for ( int i = 0; i <= 50; ++i ) {
108  std::cout << format(function.dderivative(0.01,2.0 + 0.02*i));
109  for ( int j = 1; j < 5; j+=1 ) {
110  std::cout << format(function.dderivative(1.0*j,2.0 + 0.02*i));
111  }
112  std::cout << format(function.dderivative(10.0,2.0 + 0.02*i));
113  std::cout << std::endl;
114  }
115 
116 
117  std::cout << std::endl;
118  std::cout << "***********************************************************" << std::endl;
119  std::cout << " Passed" << std::endl;
120  std::cout << "***********************************************************" << std::endl;
121  std::cout << std::endl;
122 
123  testing::InitGoogleTest(&argc,argv);
124  return RUN_ALL_TESTS();
125 }
126 
127 
int main(int argc, char **argv)
TEST(TensionFunction, allEggsInOneBasket)
Representation of a tension function.
RightAlign


ecl_geometry
Author(s): Daniel Stonier
autogenerated on Mon Feb 28 2022 22:18:49