Skip to content

Commit

Permalink
PascalCase on internal types
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlag31 committed Dec 27, 2023
1 parent 612bb43 commit ad84b1e
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 77 deletions.
4 changes: 2 additions & 2 deletions src/interpolation/ArborX_InterpMovingLeastSquares.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class MovingLeastSquares
// original input
KOKKOS_ASSERT(_source_size == source_values.extent_int(0));

using value_t = typename ApproxValues::non_const_value_type;
using Value = typename ApproxValues::non_const_value_type;

int const num_targets = _values_indices.extent(0);
int const num_neighbors = _values_indices.extent(1);
Expand All @@ -247,7 +247,7 @@ class MovingLeastSquares
"ArborX::MovingLeastSquares::target_interpolation",
Kokkos::RangePolicy<ExecutionSpace>(space, 0, num_targets),
KOKKOS_CLASS_LAMBDA(int const i) {
value_t tmp = 0;
Value tmp = 0;
for (int j = 0; j < num_neighbors; j++)
tmp += _coeffs(i, j) * source_values(_values_indices(i, j));
approx_values(i) = tmp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ movingLeastSquaresCoefficients(ExecutionSpace const &space,
KokkosExt::is_accessible_from<typename SourcePoints::memory_space,
ExecutionSpace>::value,
"source points must be accessible from the execution space");
using src_point = typename SourcePoints::non_const_value_type;
GeometryTraits::check_valid_geometry_traits(src_point{});
static_assert(GeometryTraits::is_point<src_point>::value,
using SourcePoint = typename SourcePoints::non_const_value_type;
GeometryTraits::check_valid_geometry_traits(SourcePoint{});
static_assert(GeometryTraits::is_point<SourcePoint>::value,
"source points elements must be points");
static constexpr int dimension = GeometryTraits::dimension_v<src_point>;
static constexpr int dimension = GeometryTraits::dimension_v<SourcePoint>;

// TargetPoints is an access trait of points
ArborX::Details::check_valid_access_traits(PrimitivesTag{}, target_points);
Expand All @@ -77,7 +77,7 @@ movingLeastSquaresCoefficients(ExecutionSpace const &space,
// There must be a set of neighbors for each target
KOKKOS_ASSERT(num_targets == source_points.extent_int(0));

using point_t = ExperimentalHyperGeometry::Point<dimension, CoefficientsType>;
using Point = ExperimentalHyperGeometry::Point<dimension, CoefficientsType>;
static constexpr auto epsilon =
Kokkos::Experimental::epsilon_v<CoefficientsType>;
static constexpr int degree = PolynomialDegree::value;
Expand All @@ -96,7 +96,7 @@ movingLeastSquaresCoefficients(ExecutionSpace const &space,

// We first change the origin of the evaluation to be at the target point.
// This lets us use p(0) which is [1 0 ... 0].
Kokkos::View<point_t **, MemorySpace> source_ref_target(
Kokkos::View<Point **, MemorySpace> source_ref_target(
Kokkos::view_alloc(
space, Kokkos::WithoutInitializing,
"ArborX::MovingLeastSquaresCoefficients::source_ref_target"),
Expand All @@ -108,7 +108,7 @@ movingLeastSquaresCoefficients(ExecutionSpace const &space,
KOKKOS_LAMBDA(int const i, int const j) {
auto src = source_points(i, j);
auto tgt = target_access(i);
point_t t{};
Point t{};

for (int k = 0; k < dimension; k++)
t[k] = src[k] - tgt[k];
Expand All @@ -135,7 +135,7 @@ movingLeastSquaresCoefficients(ExecutionSpace const &space,
for (int j = 0; j < num_neighbors; j++)
{
CoefficientsType norm =
ArborX::Details::distance(source_ref_target(i, j), point_t{});
ArborX::Details::distance(source_ref_target(i, j), Point{});
radius = Kokkos::max(radius, norm);
}

Expand All @@ -158,7 +158,7 @@ movingLeastSquaresCoefficients(ExecutionSpace const &space,
space, {0, 0}, {num_targets, num_neighbors}),
KOKKOS_LAMBDA(int const i, int const j) {
CoefficientsType norm =
ArborX::Details::distance(source_ref_target(i, j), point_t{});
ArborX::Details::distance(source_ref_target(i, j), Point{});
phi(i, j) = CRBF::evaluate(norm / radii(i));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ KOKKOS_FUNCTION auto evaluatePolynomialBasis(Point const &p)
static_assert(GeometryTraits::is_point<Point>::value,
"point must be a point");
static constexpr std::size_t DIM = GeometryTraits::dimension_v<Point>;
using value_t = typename GeometryTraits::coordinate_type<Point>::type;
using Value = typename GeometryTraits::coordinate_type<Point>::type;
static_assert(DIM > 0, "Polynomial basis with no dimension is invalid");

Kokkos::Array<value_t, polynomialBasisSize<DIM, Degree>()> arr{};
arr[0] = value_t(1);
Kokkos::Array<Value, polynomialBasisSize<DIM, Degree>()> arr{};
arr[0] = Value(1);

if constexpr (Degree > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ template <typename Matrix>
KOKKOS_FUNCTION auto argmaxUpperTriangle(Matrix const &mat)
{
ensureIsSquareMatrix(mat);
using value_t = typename Matrix::non_const_value_type;
using Value = typename Matrix::non_const_value_type;

struct
{
value_t max = 0;
Value max = 0;
int row = 0;
int col = 0;
} result;
Expand All @@ -65,7 +65,7 @@ KOKKOS_FUNCTION auto argmaxUpperTriangle(Matrix const &mat)
for (int i = 0; i < size; i++)
for (int j = i + 1; j < size; j++)
{
value_t val = Kokkos::abs(mat(i, j));
Value val = Kokkos::abs(mat(i, j));
if (result.max < val)
{
result.max = val;
Expand Down Expand Up @@ -101,18 +101,18 @@ symmetricPseudoInverseSVDSerialKernel(AMatrix &A, ESMatrix &ES, UMatrix &U)
typename UMatrix::value_type>,
"All input matrices must have the same value type");
KOKKOS_ASSERT(A.extent(0) == ES.extent(0) && ES.extent(0) == U.extent(0));
using value_t = typename AMatrix::non_const_value_type;
using Value = typename AMatrix::non_const_value_type;
int const size = A.extent(0);

// We first initialize U as the identity matrix and copy A to ES
for (int i = 0; i < size; i++)
for (int j = 0; j < size; j++)
{
U(i, j) = value_t(i == j);
U(i, j) = Value(i == j);
ES(i, j) = A(i, j);
}

static constexpr value_t epsilon = Kokkos::Experimental::epsilon_v<float>;
static constexpr Value epsilon = Kokkos::Experimental::epsilon_v<float>;
while (true)
{
// We have a guarantee that p < q
Expand All @@ -138,13 +138,13 @@ symmetricPseudoInverseSVDSerialKernel(AMatrix &A, ESMatrix &ES, UMatrix &U)
// | b | c | | 0 | y |
// +---+---+ +---+---+

value_t cos_theta;
value_t sin_theta;
value_t x;
value_t y;
Value cos_theta;
Value sin_theta;
Value x;
Value y;
if (a == c)
{
cos_theta = Kokkos::sqrt(value_t(2)) / 2;
cos_theta = Kokkos::sqrt(Value(2)) / 2;
sin_theta = cos_theta;
x = a + b;
y = a - b;
Expand Down Expand Up @@ -212,7 +212,7 @@ symmetricPseudoInverseSVDSerialKernel(AMatrix &A, ESMatrix &ES, UMatrix &U)
for (int i = 0; i < size; i++)
for (int j = 0; j < size; j++)
{
value_t tmp = 0;
Value tmp = 0;
for (int k = 0; k < size; k++)
tmp += ES(k, k) * U(i, k) * U(j, k);
A(i, j) = tmp;
Expand Down
34 changes: 17 additions & 17 deletions test/tstInterpDetailsMLSCoefficients.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(mls_coefficients, DeviceType, ARBORX_DEVICE_TYPES)
// -------0--------------->
// SRC: 0 2 4 6
// TGT: 1 3 5
using point0 = ArborX::ExperimentalHyperGeometry::Point<1, double>;
Kokkos::View<point0 **, MemorySpace> srcp0("Testing::srcp0", 3, 2);
Kokkos::View<point0 *, MemorySpace> tgtp0("Testing::tgtp0", 3);
using Point0 = ArborX::ExperimentalHyperGeometry::Point<1, double>;
Kokkos::View<Point0 **, MemorySpace> srcp0("Testing::srcp0", 3, 2);
Kokkos::View<Point0 *, MemorySpace> tgtp0("Testing::tgtp0", 3);
Kokkos::View<double **, MemorySpace> srcv0("Testing::srcv0", 3, 2);
Kokkos::View<double *, MemorySpace> tgtv0("Testing::tgtv0", 3);
Kokkos::parallel_for(
Expand All @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(mls_coefficients, DeviceType, ARBORX_DEVICE_TYPES)
srcp0(i, 1) = {{2. * i + 2}};
tgtp0(i) = {{2. * i + 1}};

auto f = [](const point0 &) { return 3.; };
auto f = [](const Point0 &) { return 3.; };

srcv0(i, 0) = f(srcp0(i, 0));
srcv0(i, 1) = f(srcp0(i, 1));
Expand All @@ -86,9 +86,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(mls_coefficients, DeviceType, ARBORX_DEVICE_TYPES)
// T | T
// S S S
// |
using point1 = ArborX::ExperimentalHyperGeometry::Point<2, double>;
Kokkos::View<point1 **, MemorySpace> srcp1("Testing::srcp1", 4, 8);
Kokkos::View<point1 *, MemorySpace> tgtp1("Testing::tgtp1", 4);
using Point1 = ArborX::ExperimentalHyperGeometry::Point<2, double>;
Kokkos::View<Point1 **, MemorySpace> srcp1("Testing::srcp1", 4, 8);
Kokkos::View<Point1 *, MemorySpace> tgtp1("Testing::tgtp1", 4);
Kokkos::View<double **, MemorySpace> srcv1("Testing::srcv1", 4, 8);
Kokkos::View<double *, MemorySpace> tgtv1("Testing::tgtv1", 4);
Kokkos::parallel_for(
Expand All @@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(mls_coefficients, DeviceType, ARBORX_DEVICE_TYPES)
}
tgtp1(i) = {{double(u), double(v)}};

auto f = [](const point1 &p) { return p[0] * p[1] + 4 * p[0]; };
auto f = [](const Point1 &p) { return p[0] * p[1] + 4 * p[0]; };

for (int j = 0; j < 8; j++)
srcv1(i, j) = f(srcp1(i, j));
Expand All @@ -131,9 +131,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(mls_coefficients_edge_cases, DeviceType,
ExecutionSpace space{};

// Case 1: Same as previous case 1, but points are 2D and locked on y=0
using point0 = ArborX::ExperimentalHyperGeometry::Point<2, double>;
Kokkos::View<point0 **, MemorySpace> srcp0("Testing::srcp0", 3, 2);
Kokkos::View<point0 *, MemorySpace> tgtp0("Testing::tgtp0", 3);
using Point0 = ArborX::ExperimentalHyperGeometry::Point<2, double>;
Kokkos::View<Point0 **, MemorySpace> srcp0("Testing::srcp0", 3, 2);
Kokkos::View<Point0 *, MemorySpace> tgtp0("Testing::tgtp0", 3);
Kokkos::View<double **, MemorySpace> srcv0("Testing::srcv0", 3, 2);
Kokkos::View<double *, MemorySpace> tgtv0("Testing::tgtv0", 3);
Kokkos::parallel_for(
Expand All @@ -144,7 +144,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(mls_coefficients_edge_cases, DeviceType,
srcp0(i, 1) = {{2. * i + 2, 0.}};
tgtp0(i) = {{2. * i + 1, 0.}};

auto f = [](const point0 &) { return 3.; };
auto f = [](const Point0 &) { return 3.; };

srcv0(i, 0) = f(srcp0(i, 0));
srcv0(i, 1) = f(srcp0(i, 1));
Expand All @@ -158,9 +158,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(mls_coefficients_edge_cases, DeviceType,
ARBORX_MDVIEW_TEST_TOL(eval0, tgtv0, Kokkos::Experimental::epsilon_v<float>);

// Case 2: Same but corner source points are also targets
using point1 = ArborX::ExperimentalHyperGeometry::Point<2, double>;
Kokkos::View<point1 **, MemorySpace> srcp1("Testing::srcp1", 4, 8);
Kokkos::View<point1 *, MemorySpace> tgtp1("Testing::tgtp1", 4);
using Point1 = ArborX::ExperimentalHyperGeometry::Point<2, double>;
Kokkos::View<Point1 **, MemorySpace> srcp1("Testing::srcp1", 4, 8);
Kokkos::View<Point1 *, MemorySpace> tgtp1("Testing::tgtp1", 4);
Kokkos::View<double **, MemorySpace> srcv1("Testing::srcv1", 4, 8);
Kokkos::View<double *, MemorySpace> tgtv1("Testing::tgtv1", 4);
Kokkos::parallel_for(
Expand All @@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(mls_coefficients_edge_cases, DeviceType,
}
tgtp1(i) = {{u * 2., v * 2.}};

auto f = [](const point1 &p) { return p[0] * p[1] + 4 * p[0]; };
auto f = [](const Point1 &p) { return p[0] * p[1] + 4 * p[0]; };

for (int j = 0; j < 8; j++)
srcv1(i, j) = f(srcp1(i, j));
Expand All @@ -193,4 +193,4 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(mls_coefficients_edge_cases, DeviceType,
space, srcp1, tgtp1);
auto eval1 = interpolate(space, srcv1, coeffs1);
ARBORX_MDVIEW_TEST_TOL(eval1, tgtv1, Kokkos::Experimental::epsilon_v<float>);
}
}
22 changes: 11 additions & 11 deletions test/tstInterpDetailsPolyBasis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@

BOOST_AUTO_TEST_CASE(polynomial_basis_slice_lengths)
{
using view = Kokkos::View<std::size_t **, Kokkos::HostSpace>;
using View = Kokkos::View<std::size_t **, Kokkos::HostSpace>;

auto [arr0] =
ArborX::Interpolation::Details::polynomialBasisSliceLengths<5, 3>();
std::size_t ref0[3][5] = {
{1, 1, 1, 1, 1}, {1, 2, 3, 4, 5}, {1, 3, 6, 10, 15}};
view arr0_view(&arr0[0][0], 3, 5);
view ref0_view(&ref0[0][0], 3, 5);
View arr0_view(&arr0[0][0], 3, 5);
View ref0_view(&ref0[0][0], 3, 5);
ARBORX_MDVIEW_TEST(arr0_view, ref0_view);

auto [arr1] =
ArborX::Interpolation::Details::polynomialBasisSliceLengths<2, 3>();
std::size_t ref1[3][2] = {{1, 1}, {1, 2}, {1, 3}};
view arr1_view(&arr1[0][0], 3, 2);
view ref1_view(&ref1[0][0], 3, 2);
View arr1_view(&arr1[0][0], 3, 2);
View ref1_view(&ref1[0][0], 3, 2);
ARBORX_MDVIEW_TEST(arr1_view, ref1_view);
}

Expand All @@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE(polynomial_basis_size)

BOOST_AUTO_TEST_CASE(polynomial_basis)
{
using view = Kokkos::View<double *, Kokkos::HostSpace>;
using View = Kokkos::View<double *, Kokkos::HostSpace>;

ArborX::ExperimentalHyperGeometry::Point<5, double> point0 = {1, 2, 3, 4, 5};
auto arr0 =
Expand All @@ -56,15 +56,15 @@ BOOST_AUTO_TEST_CASE(polynomial_basis)
12, 16, 5, 10, 15, 20, 25, 1, 2, 4, 8, 3, 6, 12,
9, 18, 27, 4, 8, 16, 12, 24, 36, 16, 32, 48, 64, 5,
10, 20, 15, 30, 45, 20, 40, 60, 80, 25, 50, 75, 100, 125};
view arr0_view(arr0.data(), 56);
view ref0_view(&ref0[0], 56);
View arr0_view(arr0.data(), 56);
View ref0_view(&ref0[0], 56);
ARBORX_MDVIEW_TEST(arr0_view, ref0_view);

ArborX::ExperimentalHyperGeometry::Point<2, double> point1 = {-2, 0};
auto arr1 =
ArborX::Interpolation::Details::evaluatePolynomialBasis<3>(point1);
double ref1[10] = {1, -2, 0, 4, 0, 0, -8, 0, 0, 0};
view arr1_view(arr1.data(), 10);
view ref1_view(&ref1[0], 10);
View arr1_view(arr1.data(), 10);
View ref1_view(&ref1[0], 10);
ARBORX_MDVIEW_TEST(arr1_view, ref1_view);
}
}
12 changes: 6 additions & 6 deletions test/tstInterpDetailsSVD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ template <typename MS, typename ES, typename V, int M, int N>
void makeCase(ES const &es, V const (&src_arr)[M][N][N],
V const (&ref_arr)[M][N][N])
{
using device_view = Kokkos::View<V[M][N][N], MS>;
using host_view = typename device_view::HostMirror;
using DeviceView = Kokkos::View<V[M][N][N], MS>;
using HostView = typename DeviceView::HostMirror;

host_view src("Testing::src");
host_view ref("Testing::ref");
device_view inv("Testing::inv");
HostView src("Testing::src");
HostView ref("Testing::ref");
DeviceView inv("Testing::inv");

for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
Expand Down Expand Up @@ -125,4 +125,4 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(pseudo_inv_empty, DeviceType, ARBORX_DEVICE_TYPES)
Kokkos::View<double ***, MemorySpace> mat("mat", 0, 0, 0);
ArborX::Interpolation::Details::symmetricPseudoInverseSVD(space, mat);
BOOST_TEST(mat.size() == 0);
}
}
Loading

0 comments on commit ad84b1e

Please sign in to comment.