The APIs should be consistent enough that we can avoid copying data everywhere. One such problematic mismatch is between the point evaluation routines and the SetDOFData routines.
See here:
|
PCMS_FUNCTION_TIMER; |
|
const LO num_points = num_points_; |
|
const int n_comp = n_comp_; |
|
Kokkos::View<T**, DeviceMemorySpace> output("interp_output", num_points, |
|
n_comp); |
|
auto output_view = MakeRank2View(output); |
|
evaluator_->Evaluate(source, output_view); |
|
Kokkos::View<T*, DeviceMemorySpace> flat( |
|
"interp_flat", static_cast<size_t>(num_points) * n_comp); |
|
Kokkos::parallel_for( |
|
Kokkos::RangePolicy<DeviceMemorySpace::execution_space>(0, num_points), |
|
KOKKOS_LAMBDA(LO i) { |
|
for (int c = 0; c < n_comp; ++c) { |
|
flat(i * n_comp + c) = output(i, c); |
|
} |
|
}); |
|
target.GetData().SetDOFHolderData(make_const_array_view(flat)); |
In the short-term with scalar fields, we can just create a 1D view that aliases the 2D view. However, longer term, the SetDOFData API needs to be updated to follow the cannonical data format we have been using in this project.
i.e., data is always Rank 2 where the shape is [# npoints][# components]
The APIs should be consistent enough that we can avoid copying data everywhere. One such problematic mismatch is between the point evaluation routines and the SetDOFData routines.
See here:
pcms/src/pcms/transfer/interpolator.h
Lines 53 to 69 in 5697725
In the short-term with scalar fields, we can just create a 1D view that aliases the 2D view. However, longer term, the SetDOFData API needs to be updated to follow the cannonical data format we have been using in this project.
i.e., data is always Rank 2 where the shape is [# npoints][# components]