@@ -38,10 +38,18 @@ public:
3838 Kokkos::View<CubeHeatSource<dim> *, typename MemorySpace::kokkos_space>
3939 cube_heat_sources,
4040 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)
4248 : _electron_beam_heat_sources(electron_beam_heat_sources),
4349 _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)
4553 {
4654 }
4755
@@ -52,7 +60,13 @@ public:
5260 Kokkos::create_mirror_view_and_copy (Kokkos::HostSpace{},
5361 _cube_heat_sources),
5462 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)};
5670 }
5771
5872 /* *
@@ -100,6 +114,11 @@ private:
100114 _cube_heat_sources;
101115 Kokkos::View<GoldakHeatSource<dim> *, typename MemorySpace::kokkos_space>
102116 _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;
103122};
104123
105124template <typename MemorySpace, int dim>
@@ -108,23 +127,31 @@ HeatSources<MemorySpace, dim>::HeatSources(
108127{
109128 unsigned int const n_beams = source_database.get <unsigned int >(" n_beams" );
110129 std::vector<ElectronBeamHeatSource<dim>> electron_beam_heat_sources;
130+ std::vector<ScanPath> electron_beam_scan_paths;
111131 std::vector<CubeHeatSource<dim>> cube_heat_sources;
132+ std::vector<ScanPath> cube_scan_paths;
112133 std::vector<GoldakHeatSource<dim>> goldak_heat_sources;
134+ std::vector<ScanPath> goldak_scan_paths;
113135 for (unsigned int i = 0 ; i < n_beams; ++i)
114136 {
115137 boost::property_tree::ptree const &beam_database =
116138 source_database.get_child (" beam_" + std::to_string (i));
117139 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" ));
118142 if (type == " goldak" )
119143 {
144+ goldak_scan_paths.push_back (std::move (scan_path));
120145 goldak_heat_sources.emplace_back (beam_database);
121146 }
122147 else if (type == " electron_beam" )
123148 {
149+ electron_beam_scan_paths.push_back (std::move (scan_path));
124150 electron_beam_heat_sources.emplace_back (beam_database);
125151 }
126152 else if (type == " cube" )
127153 {
154+ cube_scan_paths.push_back (std::move (scan_path));
128155 cube_heat_sources.emplace_back (beam_database);
129156 }
130157 else
@@ -156,17 +183,39 @@ HeatSources<MemorySpace, dim>::HeatSources(
156183 Kokkos::deep_copy (_cube_heat_sources,
157184 Kokkos::View<CubeHeatSource<dim> *, Kokkos::HostSpace>(
158185 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 ()));
159207}
160208
161209template <typename MemorySpace, int dim>
162210KOKKOS_FUNCTION void HeatSources<MemorySpace, dim>::update_time(double time)
163211{
164212 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));
166215 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) );
168217 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) );
170219}
171220
172221template <typename MemorySpace, int dim>
@@ -204,12 +253,12 @@ template <typename MemorySpace, int dim>
204253std::vector<ScanPath> HeatSources<MemorySpace, dim>::get_scan_paths() const
205254{
206255 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 ));
213262 return scan_paths;
214263}
215264
@@ -220,14 +269,17 @@ double HeatSources<MemorySpace, dim>::get_current_height(double time) const
220269 // unexpected behavior for different sources with different heights.
221270 double temp_height = std::numeric_limits<double >::lowest ();
222271 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)
226272 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)));
228279 for (unsigned int i = 0 ; i < _goldak_heat_sources.size (); ++i)
229280 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)));
231283 return temp_height;
232284}
233285
0 commit comments