@@ -38,10 +38,18 @@ public:
38
38
Kokkos::View<CubeHeatSource<dim> *, typename MemorySpace::kokkos_space>
39
39
cube_heat_sources,
40
40
Kokkos::View<GoldakHeatSource<dim> *, typename MemorySpace::kokkos_space>
41
- goldak_heat_sources)
41
+ goldak_heat_sources,
42
+ Kokkos::View<ScanPath *, typename MemorySpace::kokkos_space>
43
+ electron_beam_scan_paths,
44
+ Kokkos::View<ScanPath *, typename MemorySpace::kokkos_space>
45
+ cube_scan_paths,
46
+ Kokkos::View<ScanPath *, typename MemorySpace::kokkos_space>
47
+ goldak_scan_paths)
42
48
: _electron_beam_heat_sources(electron_beam_heat_sources),
43
49
_cube_heat_sources (cube_heat_sources),
44
- _goldak_heat_sources(goldak_heat_sources)
50
+ _goldak_heat_sources(goldak_heat_sources),
51
+ _electron_beam_scan_paths(electron_beam_scan_paths),
52
+ _cube_scan_paths(cube_scan_paths), _goldak_scan_paths(goldak_scan_paths)
45
53
{
46
54
}
47
55
@@ -52,7 +60,13 @@ public:
52
60
Kokkos::create_mirror_view_and_copy (Kokkos::HostSpace{},
53
61
_cube_heat_sources),
54
62
Kokkos::create_mirror_view_and_copy (Kokkos::HostSpace{},
55
- _goldak_heat_sources)};
63
+ _goldak_heat_sources),
64
+ Kokkos::create_mirror_view_and_copy (Kokkos::HostSpace{},
65
+ _electron_beam_scan_paths),
66
+ Kokkos::create_mirror_view_and_copy (Kokkos::HostSpace{},
67
+ _cube_scan_paths),
68
+ Kokkos::create_mirror_view_and_copy (Kokkos::HostSpace{},
69
+ _goldak_scan_paths)};
56
70
}
57
71
58
72
/* *
@@ -100,6 +114,11 @@ private:
100
114
_cube_heat_sources;
101
115
Kokkos::View<GoldakHeatSource<dim> *, typename MemorySpace::kokkos_space>
102
116
_goldak_heat_sources;
117
+ Kokkos::View<ScanPath *, typename MemorySpace::kokkos_space>
118
+ _electron_beam_scan_paths;
119
+ Kokkos::View<ScanPath *, typename MemorySpace::kokkos_space> _cube_scan_paths;
120
+ Kokkos::View<ScanPath *, typename MemorySpace::kokkos_space>
121
+ _goldak_scan_paths;
103
122
};
104
123
105
124
template <typename MemorySpace, int dim>
@@ -108,23 +127,31 @@ HeatSources<MemorySpace, dim>::HeatSources(
108
127
{
109
128
unsigned int const n_beams = source_database.get <unsigned int >(" n_beams" );
110
129
std::vector<ElectronBeamHeatSource<dim>> electron_beam_heat_sources;
130
+ std::vector<ScanPath> electron_beam_scan_paths;
111
131
std::vector<CubeHeatSource<dim>> cube_heat_sources;
132
+ std::vector<ScanPath> cube_scan_paths;
112
133
std::vector<GoldakHeatSource<dim>> goldak_heat_sources;
134
+ std::vector<ScanPath> goldak_scan_paths;
113
135
for (unsigned int i = 0 ; i < n_beams; ++i)
114
136
{
115
137
boost::property_tree::ptree const &beam_database =
116
138
source_database.get_child (" beam_" + std::to_string (i));
117
139
std::string type = beam_database.get <std::string>(" type" );
140
+ ScanPath scan_path (beam_database.get <std::string>(" scan_path_file" ),
141
+ beam_database.get <std::string>(" scan_path_file_format" ));
118
142
if (type == " goldak" )
119
143
{
144
+ goldak_scan_paths.push_back (std::move (scan_path));
120
145
goldak_heat_sources.emplace_back (beam_database);
121
146
}
122
147
else if (type == " electron_beam" )
123
148
{
149
+ electron_beam_scan_paths.push_back (std::move (scan_path));
124
150
electron_beam_heat_sources.emplace_back (beam_database);
125
151
}
126
152
else if (type == " cube" )
127
153
{
154
+ cube_scan_paths.push_back (std::move (scan_path));
128
155
cube_heat_sources.emplace_back (beam_database);
129
156
}
130
157
else
@@ -156,17 +183,39 @@ HeatSources<MemorySpace, dim>::HeatSources(
156
183
Kokkos::deep_copy (_cube_heat_sources,
157
184
Kokkos::View<CubeHeatSource<dim> *, Kokkos::HostSpace>(
158
185
cube_heat_sources.data (), cube_heat_sources.size ()));
186
+
187
+ _goldak_scan_paths = decltype (_goldak_scan_paths)(
188
+ Kokkos::view_alloc (Kokkos::WithoutInitializing, " goldak_scan_paths" ),
189
+ goldak_scan_paths.size ());
190
+ _electron_beam_scan_paths = decltype (_electron_beam_scan_paths)(
191
+ Kokkos::view_alloc (Kokkos::WithoutInitializing,
192
+ " electron_beam_scan_paths" ),
193
+ electron_beam_scan_paths.size ());
194
+ _cube_scan_paths = decltype (_cube_scan_paths)(
195
+ Kokkos::view_alloc (Kokkos::WithoutInitializing, " cube_scan_paths" ),
196
+ cube_scan_paths.size ());
197
+ Kokkos::deep_copy (_goldak_scan_paths,
198
+ Kokkos::View<ScanPath *, Kokkos::HostSpace>(
199
+ goldak_scan_paths.data (), goldak_scan_paths.size ()));
200
+ Kokkos::deep_copy (
201
+ _electron_beam_scan_paths,
202
+ Kokkos::View<ScanPath *, Kokkos::HostSpace>(
203
+ electron_beam_scan_paths.data (), electron_beam_scan_paths.size ()));
204
+ Kokkos::deep_copy (_cube_scan_paths,
205
+ Kokkos::View<ScanPath *, Kokkos::HostSpace>(
206
+ cube_scan_paths.data (), cube_scan_paths.size ()));
159
207
}
160
208
161
209
template <typename MemorySpace, int dim>
162
210
KOKKOS_FUNCTION void HeatSources<MemorySpace, dim>::update_time(double time)
163
211
{
164
212
for (unsigned int i = 0 ; i < _electron_beam_heat_sources.size (); ++i)
165
- _electron_beam_heat_sources (i).update_time (time);
213
+ _electron_beam_heat_sources (i).update_time (time,
214
+ _electron_beam_scan_paths (i));
166
215
for (unsigned int i = 0 ; i < _cube_heat_sources.size (); ++i)
167
- _cube_heat_sources (i).update_time (time);
216
+ _cube_heat_sources (i).update_time (time, _cube_scan_paths (i) );
168
217
for (unsigned int i = 0 ; i < _goldak_heat_sources.size (); ++i)
169
- _goldak_heat_sources (i).update_time (time);
218
+ _goldak_heat_sources (i).update_time (time, _goldak_scan_paths (i) );
170
219
}
171
220
172
221
template <typename MemorySpace, int dim>
@@ -204,12 +253,12 @@ template <typename MemorySpace, int dim>
204
253
std::vector<ScanPath> HeatSources<MemorySpace, dim>::get_scan_paths() const
205
254
{
206
255
std::vector<ScanPath> scan_paths;
207
- for (unsigned int i = 0 ; i < _electron_beam_heat_sources .size (); ++i)
208
- scan_paths.push_back (_electron_beam_heat_sources (i). get_scan_path ( ));
209
- for (unsigned int i = 0 ; i < _cube_heat_sources .size (); ++i)
210
- scan_paths.push_back (_cube_heat_sources (i). get_scan_path ( ));
211
- for (unsigned int i = 0 ; i < _goldak_heat_sources .size (); ++i)
212
- scan_paths.push_back (_goldak_heat_sources (i). get_scan_path ( ));
256
+ for (unsigned int i = 0 ; i < _electron_beam_scan_paths .size (); ++i)
257
+ scan_paths.push_back (_electron_beam_scan_paths (i ));
258
+ for (unsigned int i = 0 ; i < _cube_scan_paths .size (); ++i)
259
+ scan_paths.push_back (_cube_scan_paths (i ));
260
+ for (unsigned int i = 0 ; i < _goldak_scan_paths .size (); ++i)
261
+ scan_paths.push_back (_goldak_scan_paths (i ));
213
262
return scan_paths;
214
263
}
215
264
@@ -220,14 +269,17 @@ double HeatSources<MemorySpace, dim>::get_current_height(double time) const
220
269
// unexpected behavior for different sources with different heights.
221
270
double temp_height = std::numeric_limits<double >::lowest ();
222
271
for (unsigned int i = 0 ; i < _electron_beam_heat_sources.size (); ++i)
223
- temp_height = std::max (
224
- temp_height, _electron_beam_heat_sources (i).get_current_height (time));
225
- for (unsigned int i = 0 ; i < _cube_heat_sources.size (); ++i)
226
272
temp_height =
227
- std::max (temp_height, _cube_heat_sources (i).get_current_height (time));
273
+ std::max (temp_height, _electron_beam_heat_sources (i).get_current_height (
274
+ time, _electron_beam_scan_paths (i)));
275
+ for (unsigned int i = 0 ; i < _cube_heat_sources.size (); ++i)
276
+ temp_height = std::max (
277
+ temp_height,
278
+ _cube_heat_sources (i).get_current_height (time, _cube_scan_paths (i)));
228
279
for (unsigned int i = 0 ; i < _goldak_heat_sources.size (); ++i)
229
280
temp_height =
230
- std::max (temp_height, _goldak_heat_sources (i).get_current_height (time));
281
+ std::max (temp_height, _goldak_heat_sources (i).get_current_height (
282
+ time, _goldak_scan_paths (i)));
231
283
return temp_height;
232
284
}
233
285
0 commit comments