9 #ifndef _COMPADRE_POINTCONNECTIONS_HPP_
10 #define _COMPADRE_POINTCONNECTIONS_HPP_
13 #include <Kokkos_Core.hpp>
20 template <
typename view_type_1,
typename view_type_2,
typename nla_type,
typename memory_space = device_memory_space>
24 typedef decltype(Kokkos::create_mirror_view<memory_space>(
25 memory_space(), view_type_1()))
29 typedef
decltype(Kokkos::create_mirror_view<memory_space>(
30 memory_space(), view_type_2()))
43 view_type_2 source_coordinates,
44 nla_type nla) : _nla(nla) {
46 _target_coordinates = Kokkos::create_mirror_view<memory_space>(
47 memory_space(), target_coordinates);
48 _source_coordinates = Kokkos::create_mirror_view<memory_space>(
49 memory_space(), source_coordinates);
50 Kokkos::deep_copy(_target_coordinates, target_coordinates);
51 Kokkos::deep_copy(_source_coordinates, source_coordinates);
58 template <
typename other_type_1,
typename other_type_2,
typename other_type_3>
70 KOKKOS_INLINE_FUNCTION
75 val += global_coord.
x * V(dim, 0);
76 if (V.extent_int(1)>1) val += global_coord.
y * V(dim, 1);
77 if (V.extent_int(1)>2) val += global_coord.
z * V(dim, 2);
82 KOKKOS_INLINE_FUNCTION
85 if (dim == 0 && V.extent_int(0)==1) {
86 val = local_coord.
x * V(0, dim);
88 val = local_coord.
x * V(0, dim) + local_coord.
y * V(1, dim);
94 KOKKOS_INLINE_FUNCTION
96 double inside_val = delta_vector.
x*delta_vector.
x;
99 inside_val += delta_vector.
z*delta_vector.
z;
102 inside_val += delta_vector.
y*delta_vector.
y;
107 return std::sqrt(inside_val);
121 memory_space(), target_coordinates);
128 memory_space(), source_coordinates);
146 KOKKOS_INLINE_FUNCTION
161 KOKKOS_INLINE_FUNCTION
179 KOKKOS_INLINE_FUNCTION
181 XYZ coordinate_delta;
187 return coordinate_delta;
192 KOKKOS_INLINE_FUNCTION
194 return _nla.getNeighborDevice(target_index, neighbor_list_num);
PointConnections(const PointConnections< other_type_1, other_type_2, other_type_3 > &other)
KOKKOS_INLINE_FUNCTION double getNeighborCoordinate(const int target_index, const int neighbor_list_num, const int dim, const scratch_matrix_right_type *V=NULL) const
Returns one component of the neighbor coordinate for a particular target.
void setNeighborLists(nla_type nla)
Update only target coordinates.
decltype(Kokkos::create_mirror_view< memory_space >(memory_space(), view_type_1())) typedef device_mirror_target_view_type
source site coordinates on device
device_mirror_source_view_type _source_coordinates
static KOKKOS_INLINE_FUNCTION double convertLocalToGlobalCoordinate(const XYZ local_coord, const int dim, const scratch_matrix_right_type &V)
Returns a component of the global coordinate after transformation from local to global under the orth...
KOKKOS_INLINE_FUNCTION double getTargetCoordinate(const int target_index, const int dim, const scratch_matrix_right_type *V=NULL) const
Returns one component of the target coordinate for a particular target.
static KOKKOS_INLINE_FUNCTION double convertGlobalToLocalCoordinate(const XYZ global_coord, const int dim, const scratch_matrix_right_type &V)
Returns a component of the local coordinate after transformation from global to local under the ortho...
device_mirror_target_view_type _target_coordinates
static KOKKOS_INLINE_FUNCTION double EuclideanVectorLength(const XYZ &delta_vector, const int dimension)
Returns Euclidean norm of a vector.
KOKKOS_INLINE_FUNCTION XYZ getRelativeCoord(const int target_index, const int neighbor_list_num, const int dimension, const scratch_matrix_right_type *V=NULL) const
Returns the relative coordinate as a vector between the target site and the neighbor site...
Kokkos::View< double **, layout_right, Kokkos::MemoryTraits< Kokkos::Unmanaged > > scratch_matrix_right_type
Combines NeighborLists with the PointClouds from which it was derived Assumed that memory_space is th...
KOKKOS_INLINE_FUNCTION int getNeighborIndex(const int target_index, const int neighbor_list_num) const
Mapping from [0,number of neighbors for a target] to the row that contains the source coordinates for...
decltype(Kokkos::create_mirror_view< memory_space >(memory_space(), view_type_2())) typedef device_mirror_source_view_type
target site coordinates on device
void setTargetCoordinates(view_type_1 target_coordinates)
Update only target coordinates.
struct SubviewND< T, T2, enable_if_t<(T::rank< 2)> >{T _data_in;T2 _data_original_view;bool _scalar_as_vector_if_needed;SubviewND(T data_in, T2 data_original_view, bool scalar_as_vector_if_needed){_data_in=data_in;_data_original_view=data_original_view;_scalar_as_vector_if_needed=scalar_as_vector_if_needed;}auto get1DView(const int column_num) -> decltype(Kokkos::subview(_data_in, Kokkos::ALL))
Creates 1D subviews of data from a 1D view, generally constructed with CreateNDSliceOnDeviceView.
void setSourceCoordinates(view_type_2 source_coordinates)
Update only source coordinates.
#define compadre_kernel_assert_debug(condition)