This source file includes following definitions.
- FEfun_set
- FEfun_set
- write
- read
- Tiny_FEfun_set
- compose_dgfName
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #ifndef GRID_FEFFUNSET_H
25 #define GRID_FEFFUNSET_H
26
27 #include "esfem_fwd.h"
28 #include "io_dgf.h"
29 #include "grid.h"
30
31 namespace Esfem{
32
33 namespace Grid{
34
35 struct r3fef{
36
37 Scal_FEfun x;
38
39 Scal_FEfun y;
40
41 Scal_FEfun z;
42
43 r3fef(const std::string& name, const Grid_and_time& gt)
44 :x {name, gt}, y {name, gt}, z {name, gt} {}
45 };
46 template<typename FEfun>
47 struct FEfun_set{
48 FEfun fun;
49 FEfun app;
50 FEfun exact;
51 FEfun rhs_les;
52 FEfun_set(const std::string& name, const Grid::Grid_and_time&);
53
54
55
56 FEfun_set(const FEfun_set&, const Grid::Grid_and_time&);
57
58
59
60
61
62 void write(const Esfem::Io::Dgf::Handler&,
63 const std::string& dir = "/tmp/");
64
65 void read(const Esfem::Io::Dgf::Handler&,
66 const std::string& dir = "/tmp/");
67
68 };
69
70
71
72 template<typename FEfun>
73 struct Tiny_FEfun_set{
74 FEfun fun;
75 FEfun rhs_les;
76
77 Tiny_FEfun_set(const FEfun_set<FEfun>&, const Grid::Grid_and_time&);
78
79
80
81
82
83
84 };
85
86
87
88
89 using Scal_FEfun_set = FEfun_set<Scal_FEfun>;
90
91 using Vec_FEfun_set = FEfun_set<Vec_FEfun>;
92
93 using Scal_tiny_FEfun_set = Tiny_FEfun_set<Scal_FEfun>;
94
95 using Vec_tiny_FEfun_set = Tiny_FEfun_set<Vec_FEfun>;
96
97
98 inline std::string compose_dgfName(const std::string& fun_name,
99 const std::string& dir = "./");
100
101
102
103
104
105
106
107
108
109
110
111
112
113 template<typename FEfun>
114 FEfun_set<FEfun>::
115 FEfun_set(const std::string& name,
116 const Esfem::Grid::Grid_and_time& gt)
117 : fun {name, gt}, app {name + "_app", gt},
118 exact {name + "_exact", gt}, rhs_les {name + "_rhs_les", gt}
119 {}
120 template<typename FEfun>
121 FEfun_set<FEfun>::
122 FEfun_set(const FEfun_set& other, const Esfem::Grid::Grid_and_time& gt)
123 : fun {other.fun, gt}, app {other.app, gt},
124 exact {other.exact, gt}, rhs_les {other.rhs_les, gt}
125 {}
126
127 template<typename FEfun>
128 void FEfun_set<FEfun>::
129 write(const Esfem::Io::Dgf::Handler& h,
130 const std::string& dir){
131 h.write(compose_dgfName(fun.name(), dir), fun);
132 h.write(compose_dgfName(app.name(), dir), app);
133 h.write(compose_dgfName(exact.name(), dir), exact);
134 h.write(compose_dgfName(rhs_les.name(), dir), rhs_les);
135 }
136 template<typename FEfun>
137 void FEfun_set<FEfun>::
138 read(const Esfem::Io::Dgf::Handler& h, const std::string& dir){
139 h.read(compose_dgfName(fun.name(), dir), fun);
140 h.read(compose_dgfName(app.name(), dir), app);
141 h.read(compose_dgfName(exact.name(), dir), exact);
142 h.read(compose_dgfName(rhs_les.name(), dir), rhs_les);
143 }
144
145 template<typename FEfun>
146 Tiny_FEfun_set<FEfun>::
147 Tiny_FEfun_set(const FEfun_set<FEfun>& fef, const Grid::Grid_and_time& gt)
148 : fun {fef.fun, gt},
149 rhs_les {fef.rhs_les, gt}
150 {}
151
152
153
154
155 inline std::string compose_dgfName(const std::string& fun_name,
156 const std::string& dir){
157 constexpr auto suffix= ".dgf";
158 return dir + fun_name + suffix;
159 }
160 }
161 }
162
163 #endif