Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef VALUE_FACTORY_HH
#define VALUE_FACTORY_HH
#include <vector>
#include <dune/gfe/unitvector.hh>
/** \brief A class that creates sets of values of various types, to be used in unit tests
*
* This is the generic dummy. The actual work is done in specializations.
*/
template <class T>
class ValueFactory
{
public:
static void get(std::vector<T>& values);
};
/** \brief A class that creates sets of values of various types, to be used in unit tests
*
* This is the specialization for UnitVector<2>
*/
template <>
class ValueFactory<UnitVector<2> >
{
public:
static void get(std::vector<UnitVector<2> >& values) {
int nTestPoints = 10;
double testPoints[10][2] = {{1,0}, {0.5,0.5}, {0,1}, {-0.5,0.5}, {-1,0}, {-0.5,-0.5}, {0,-1}, {0.5,-0.5}, {0.1,1}, {1,.1}};
values.resize(nTestPoints);
// Set up elements of S^1
for (int i=0; i<nTestPoints; i++) {
Dune::array<double,2> w = {{testPoints[i][0], testPoints[i][1]}};
values[i] = UnitVector<2>(w);
}
}
};
/** \brief A class that creates sets of values of various types, to be used in unit tests
*
* This is the specialization for UnitVector<3>
*/
template <>
class ValueFactory<UnitVector<3> >
{
public:
static void get(std::vector<UnitVector<3> >& values) {
int nTestPoints = 10;
double testPoints[10][3] = {{1,0,0}, {0,1,0}, {-0.838114,0.356751,-0.412667},
{-0.490946,-0.306456,0.81551},{-0.944506,0.123687,-0.304319},
{-0.6,0.1,-0.2},{0.45,0.12,0.517},
{-0.1,0.3,-0.1},{-0.444506,0.123687,0.104319},{-0.7,-0.123687,-0.304319}};
values.resize(nTestPoints);
// Set up elements of S^1
for (int i=0; i<nTestPoints; i++) {
Dune::array<double,3> w = {{testPoints[i][0], testPoints[i][1], testPoints[i][2]}};
values[i] = UnitVector<3>(w);
}
}
};
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/** \brief A class that creates sets of values of various types, to be used in unit tests
*
* This is the specialization for Rotation<3>
*/
template <>
class ValueFactory<Rotation<3,double> >
{
public:
static void get(std::vector<Rotation<3,double> >& values) {
int nTestPoints = 10;
double testPoints[10][4] = {{1,0,0,0}, {0,1,0,0}, {-0.838114,0.356751,-0.412667,0.5},
{-0.490946,-0.306456,0.81551,0.23},{-0.944506,0.123687,-0.304319,-0.7},
{-0.6,0.1,-0.2,0.8},{0.45,0.12,0.517,0},
{-0.1,0.3,-0.1,0.73},{-0.444506,0.123687,0.104319,-0.23},{-0.7,-0.123687,-0.304319,0.72}};
values.resize(nTestPoints);
// Set up elements of S^1
for (int i=0; i<nTestPoints; i++) {
Dune::array<double,4> w = {{testPoints[i][0], testPoints[i][1], testPoints[i][2], testPoints[i][3]}};
values[i] = Rotation<3,double>(w);
}
}
};