Skip to content

Commit

Permalink
fix: new map type in aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
yoctoyotta1024 committed Apr 30, 2024
1 parent 6289a61 commit 905b898
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
12 changes: 6 additions & 6 deletions libs/cartesiandomain/cartesianmaps.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* Copyright (c) 2023 MPI-M, Clara Bayley
/*
* Copyright (c) 2024 MPI-M, Clara Bayley
*
*
* ----- CLEO -----
* File: cartesianmaps.cpp
Expand All @@ -7,7 +9,7 @@
* Author: Clara Bayley (CB)
* Additional Contributors:
* -----
* Last Modified: Thursday 9th November 2023
* Last Modified: Wednesday 1st May 2024
* Modified By: CB
* -----
* License: BSD 3-Clause "New" or "Revised" License
Expand All @@ -31,10 +33,8 @@ size_t CartesianMaps::maps_size() const {
to_coord2bounds.size() != sz || to_back_coord3nghbr.size() != sz ||
to_forward_coord3nghbr.size() != sz || to_back_coord1nghbr.size() != sz ||
to_forward_coord1nghbr.size() != sz || to_back_coord2nghbr.size() != sz ||
to_forward_coord2nghbr.size() != sz) {
throw std::invalid_argument(
"gridbox maps are not"
" all the same size");
to_forward_coord2nghbr.size() != sz || to_area.size() != sz || to_volume.size() != sz) {
throw std::invalid_argument("gridbox maps are not all the same size");
}

return sz;
Expand Down
13 changes: 6 additions & 7 deletions libs/cartesiandomain/cartesianmaps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* File Description:
*/


/* Copyright (c) 2023 MPI-M, Clara Bayley
*
* ----- CLEO -----
Expand Down Expand Up @@ -225,18 +224,18 @@ struct CartesianMaps {
KOKKOS_INLINE_FUNCTION
size_t get_ndim(const unsigned int d) const { return ndims(d); }

/* returns horizontal (x-y planar) area of gridbox with index 'gbxindex' on device */
/* returns horizontal (x-y planar) area of gridbox with index 'gbxidx' on device */
KOKKOS_INLINE_FUNCTION
double get_gbxarea(const unsigned int gbxindex) const {
const auto i(to_area.find(gbxindex)); // index in map of key 'gbxindex'
double get_gbxarea(const unsigned int gbxidx) const {
const auto i(to_area.find(gbxidx)); // index in map of key 'gbxindex'

return to_area.value_at(i); // value returned by map at index i
}

/* returns volume of gridbox with index 'gbxindex' on device */
/* returns volume of gridbox with index 'gbxidx' on device */
KOKKOS_INLINE_FUNCTION
double get_gbxvolume(const unsigned int gbxindex) const {
const auto i(to_volume.find(gbxindex)); // index in map of key 'gbxindex'
double get_gbxvolume(const unsigned int gbxidx) const {
const auto i(to_volume.find(gbxidx)); // index in map of key 'gbxindex'

return to_volume.value_at(i); // value returned by map at index i
}
Expand Down
12 changes: 6 additions & 6 deletions libs/kokkosaliases.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* Copyright (c) 2023 MPI-M, Clara Bayley
/*
* Copyright (c) 2024 MPI-M, Clara Bayley
*
*
* ----- CLEO -----
* File: kokkosaliases.hpp
Expand All @@ -7,7 +9,7 @@
* Author: Clara Bayley (CB)
* Additional Contributors:
* -----
* Last Modified: Thursday 2nd November 2023
* Last Modified: Wednesday 1st May 2024
* Modified By: CB
* -----
* License: BSD 3-Clause "New" or "Revised" License
Expand All @@ -20,8 +22,6 @@
#ifndef LIBS_KOKKOSALIASES_HPP_
#define LIBS_KOKKOSALIASES_HPP_

#include <memory>

#include <Kokkos_Core.hpp>
#include <Kokkos_DualView.hpp>
#include <Kokkos_Pair.hpp>
Expand All @@ -43,9 +43,9 @@ using viewd_gbx = dualview_gbx::t_dev; // view in device memory of gr
using viewd_constgbx = dualview_constgbx::t_dev; // view in device memory of const gridboxes

/* Gridbox Maps */
using viewd_ndims =
Kokkos::View<size_t[3]>; // view in device memory for number of gridboxes in CartesianMaps
using viewd_ndims = Kokkos::View<size_t[3]>;
using kokkos_pairmap = Kokkos::UnorderedMap<unsigned int, Kokkos::pair<double, double>, ExecSpace>;
using kokkos_dblmap = Kokkos::UnorderedMap<unsigned int, double, ExecSpace>;
using kokkos_uintmap = Kokkos::UnorderedMap<unsigned int, unsigned int, ExecSpace>;

#endif // LIBS_KOKKOSALIASES_HPP_

0 comments on commit 905b898

Please sign in to comment.