1#ifndef _COMPADRE_POINTCONNECTIONS_HPP_
2#define _COMPADRE_POINTCONNECTIONS_HPP_
5#include <Kokkos_Core.hpp>
12template <
typename view_type_1,
typename view_type_2,
typename nla_type,
typename memory_space = device_memory_space>
16 typedef decltype(Kokkos::create_mirror_view<memory_space>(
17 memory_space(), view_type_1()))
21 typedef decltype(Kokkos::create_mirror_view<memory_space>(
22 memory_space(), view_type_2()))
35 view_type_2 source_coordinates,
36 nla_type nla) :
_nla(nla) {
39 memory_space(), target_coordinates);
41 memory_space(), source_coordinates);
50 template <
typename other_type_1,
typename other_type_2,
typename other_type_3>
62 KOKKOS_INLINE_FUNCTION
67 val += global_coord.
x * V(dim, 0);
68 if (V.extent_int(1)>1) val += global_coord.
y * V(dim, 1);
69 if (V.extent_int(1)>2) val += global_coord.
z * V(dim, 2);
74 KOKKOS_INLINE_FUNCTION
77 if (dim == 0 && V.extent_int(0)==1) {
78 val = local_coord.
x * V(0, dim);
80 val = local_coord.
x * V(0, dim) + local_coord.
y * V(1, dim);
86 KOKKOS_INLINE_FUNCTION
88 double inside_val = delta_vector.
x*delta_vector.
x;
91 inside_val += delta_vector.
z*delta_vector.
z;
94 inside_val += delta_vector.
y*delta_vector.
y;
99 return std::sqrt(inside_val);
113 memory_space(), target_coordinates);
120 memory_space(), source_coordinates);
138 KOKKOS_INLINE_FUNCTION
153 KOKKOS_INLINE_FUNCTION
171 KOKKOS_INLINE_FUNCTION
173 XYZ coordinate_delta;
179 return coordinate_delta;
184 KOKKOS_INLINE_FUNCTION
186 return _nla.getNeighborDevice(target_index, neighbor_list_num);
#define compadre_kernel_assert_debug(condition)
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...
PointConnections(const PointConnections< other_type_1, other_type_2, other_type_3 > &other)
static KOKKOS_INLINE_FUNCTION double EuclideanVectorLength(const XYZ &delta_vector, const int dimension)
Returns Euclidean norm of a vector.
decltype(Kokkos::create_mirror_view< memory_space >(memory_space(), view_type_1())) device_mirror_target_view_type
source site coordinates on device
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...
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...
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.
void setSourceCoordinates(view_type_2 source_coordinates)
Update only source coordinates.
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_2())) device_mirror_source_view_type
target site coordinates on device
void setTargetCoordinates(view_type_1 target_coordinates)
Update only target coordinates.
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.
device_mirror_source_view_type _source_coordinates
device_mirror_target_view_type _target_coordinates
PointConnections(view_type_1 target_coordinates, view_type_2 source_coordinates, nla_type nla)
Constructor for PointConnections.
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...