Skip to content

Commit aaa3bdf

Browse files
committed
Copy to host where necessary and fix copy_to_host
1 parent cf6263f commit aaa3bdf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

source/ThermalPhysics.templates.hh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ evaluate_thermal_physics_impl(
120120

121121
// Compute the source term.
122122
// TODO do this on the GPU
123-
heat_sources.update_time(t);
123+
auto host_heat_sources = heat_sources.copy_to_host();
124+
host_heat_sources.update_time(t);
124125
dealii::LA::distributed::Vector<double, dealii::MemorySpace::Host> source(
125126
y.get_partitioner());
126127
source = 0.;
@@ -165,7 +166,7 @@ evaluate_thermal_physics_impl(
165166
double const inv_rho_cp = thermal_operator_dev->get_inv_rho_cp(cell, q);
166167
double quad_pt_source = 0.;
167168
dealii::Point<dim> const &q_point = fe_values.quadrature_point(q);
168-
quad_pt_source += heat_sources.value(q_point, current_source_height);
169+
quad_pt_source += host_heat_sources.value(q_point, current_source_height);
169170

170171
cell_source[i] += inv_rho_cp * quad_pt_source *
171172
fe_values.shape_value(i, q) * fe_values.JxW(q);
@@ -464,7 +465,8 @@ ThermalPhysics<dim, p_order, fe_degree, MaterialStates, MemorySpaceType,
464465
cell->set_active_fe_index(1);
465466
}
466467

467-
_current_source_height = _heat_sources.get_current_height(0.0);
468+
auto host_heat_sources = _heat_sources.copy_to_host();
469+
_current_source_height = host_heat_sources.get_current_height(0.0);
468470
}
469471

470472
template <int dim, int p_order, int fe_degree, typename MaterialStates,
@@ -818,7 +820,7 @@ double ThermalPhysics<dim, p_order, fe_degree, MaterialStates, MemorySpaceType,
818820
dealii::LA::distributed::Vector<double, MemorySpaceType> &solution,
819821
std::vector<Timer> &timers)
820822
{
821-
_current_source_height = _heat_sources.get_current_height(t);
823+
_current_source_height = _heat_sources.copy_to_host().get_current_height(t);
822824

823825
auto eval = [&](double const t, LA_Vector const &y)
824826
{ return evaluate_thermal_physics(t, y, timers); };

0 commit comments

Comments
 (0)