Skip to content

Commit

Permalink
Rename Base to base_type
Browse files Browse the repository at this point in the history
  • Loading branch information
icui committed Feb 26, 2025
1 parent c09796f commit 558545b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ struct properties_container<specfem::element::medium_tag::acoustic,
: public impl::impl_properties_container<
specfem::element::medium_tag::acoustic,
specfem::element::property_tag::isotropic, 2> {
using Base =
using base_type =
impl::impl_properties_container<specfem::element::medium_tag::acoustic,
specfem::element::property_tag::isotropic,
2>;
using Base::Base;
using base_type::base_type;
constexpr static int _counter = __COUNTER__;

DEFINE_CONTAINER(rho_inverse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ struct properties_container<specfem::element::medium_tag::elastic,
: public impl::impl_properties_container<
specfem::element::medium_tag::elastic,
specfem::element::property_tag::anisotropic, 10> {
using Base = impl::impl_properties_container<
using base_type = impl::impl_properties_container<
specfem::element::medium_tag::elastic,
specfem::element::property_tag::anisotropic, 10>;
using Base::Base;
using base_type::base_type;
constexpr static int _counter = __COUNTER__;

DEFINE_CONTAINER(c11)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ struct properties_container<specfem::element::medium_tag::elastic,
: public impl::impl_properties_container<
specfem::element::medium_tag::elastic,
specfem::element::property_tag::isotropic, 3> {
using Base =
using base_type =
impl::impl_properties_container<specfem::element::medium_tag::elastic,
specfem::element::property_tag::isotropic,
3>;
using Base::Base;
using base_type::base_type;
constexpr static int _counter = __COUNTER__;

DEFINE_CONTAINER(lambdaplus2mu)
Expand Down
4 changes: 2 additions & 2 deletions include/medium/properties_container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
constexpr static int i_##prop = __COUNTER__ - _counter - 1; \
KOKKOS_INLINE_FUNCTION type_real &prop(const int &ispec, const int &iz, \
const int &ix) const { \
return Base::data(ispec, iz, ix, i_##prop); \
return base_type::data(ispec, iz, ix, i_##prop); \
} \
KOKKOS_INLINE_FUNCTION type_real &h_##prop(const int &ispec, const int &iz, \
const int &ix) const { \
return Base::h_data(ispec, iz, ix, i_##prop); \
return base_type::h_data(ispec, iz, ix, i_##prop); \
}

namespace specfem {
Expand Down
16 changes: 8 additions & 8 deletions include/point/properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#define DEFINE_PROP(prop) \
constexpr static int i_##prop = __COUNTER__ - _counter - 1; \
KOKKOS_INLINE_FUNCTION constexpr value_type prop() const { \
return Base::data[i_##prop]; \
return base_type::data[i_##prop]; \
} \
KOKKOS_INLINE_FUNCTION constexpr void prop(value_type &val) { \
Base::data[i_##prop] = val; \
base_type::data[i_##prop] = val; \
}

namespace specfem {
Expand Down Expand Up @@ -109,8 +109,8 @@ struct properties<specfem::dimension::type::dim2,
using value_type = typename simd::datatype;
constexpr static int _counter = __COUNTER__;
///@}
using Base = impl::impl_properties<3, UseSIMD>;
using Base::Base;
using base_type = impl::impl_properties<3, UseSIMD>;
using base_type::base_type;

DEFINE_PROP(lambdaplus2mu) ///< Lame's parameter @f$ \lambda + 2\mu @f$
DEFINE_PROP(mu) ///< shear modulus @f$ \mu @f$
Expand Down Expand Up @@ -151,8 +151,8 @@ struct properties<specfem::dimension::type::dim2,
using value_type = typename simd::datatype;
constexpr static int _counter = __COUNTER__;
///@}
using Base = impl::impl_properties<10, UseSIMD>;
using Base::Base;
using base_type = impl::impl_properties<10, UseSIMD>;
using base_type::base_type;

/**
* @name Elastic constants
Expand Down Expand Up @@ -204,8 +204,8 @@ struct properties<specfem::dimension::type::dim2,
using value_type = typename simd::datatype;
constexpr static int _counter = __COUNTER__;
///@}
using Base = impl::impl_properties<2, UseSIMD>;
using Base::Base;
using base_type = impl::impl_properties<2, UseSIMD>;
using base_type::base_type;

DEFINE_PROP(rho_inverse) ///< @f$ \frac{1}{\rho} @f$
DEFINE_PROP(kappa) ///< Bulk modulus @f$ \kappa @f$
Expand Down
34 changes: 17 additions & 17 deletions include/policies/chunk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ struct chunk_index_type<false, DimensionType> {
template <bool UseSIMD, specfem::dimension::type DimensionType>
struct mapped_chunk_index_type
: public chunk_index_type<UseSIMD, DimensionType> {
using Base = chunk_index_type<UseSIMD, DimensionType>;
using base_type = chunk_index_type<UseSIMD, DimensionType>;
int imap; ///< Index of the mapped element

KOKKOS_INLINE_FUNCTION
mapped_chunk_index_type(const int ielement,
const specfem::point::index<DimensionType> index,
const int imap)
: Base(ielement, index), imap(imap) {}
: base_type(ielement, index), imap(imap) {}
};

} // namespace impl
Expand Down Expand Up @@ -252,20 +252,20 @@ class mapped_chunk;
template <typename ViewType, typename SIMD>
class mapped_chunk<ViewType, specfem::dimension::type::dim2, SIMD>
: public chunk<ViewType, specfem::dimension::type::dim2, SIMD> {
using Base = chunk<ViewType, specfem::dimension::type::dim2, SIMD>;
using base_type = chunk<ViewType, specfem::dimension::type::dim2, SIMD>;
using mapped_index_type =
typename impl::mapped_chunk_index_type<Base::using_simd,
Base::dimension>; ///< Index
typename impl::mapped_chunk_index_type<base_type::using_simd,
base_type::dimension>; ///< Index

public:
KOKKOS_INLINE_FUNCTION
mapped_chunk(const ViewType &indices, const ViewType &mapping,
const int ngllz, const int ngllx)
: Base(indices, ngllz, ngllx), mapping(mapping) {}
: base_type(indices, ngllz, ngllx), mapping(mapping) {}

KOKKOS_INLINE_FUNCTION
mapped_index_type operator()(const int i) const {
const auto base_index = Base::operator()(i);
const auto base_index = base_type::operator()(i);
return mapped_index_type(base_index.ielement, base_index.index,
mapping(base_index.ielement));
}
Expand Down Expand Up @@ -405,30 +405,30 @@ struct element_chunk
template <typename ParallelConfig>
struct mapped_element_chunk : public element_chunk<ParallelConfig> {
using simd = typename ParallelConfig::simd;
using Base = element_chunk<ParallelConfig>;
using IndexViewType = typename Base::IndexViewType;
using base_type = element_chunk<ParallelConfig>;
using IndexViewType = typename base_type::IndexViewType;

using mapped_iterator_type =
specfem::iterator::mapped_chunk<IndexViewType, ParallelConfig::dimension,
simd>; ///< Iterator

mapped_element_chunk(const IndexViewType &view, const IndexViewType &mapping,
int ngllz, int ngllx)
: Base(view, ngllz, ngllx), mapping(mapping) {}
: base_type(view, ngllz, ngllx), mapping(mapping) {}

KOKKOS_INLINE_FUNCTION
mapped_iterator_type mapped_league_iterator(const int start_index) const {
const int start = start_index;
const int end =
(start + Base::chunk_size * Base::simd_size > Base::elements.extent(0))
? Base::elements.extent(0)
: start + Base::chunk_size * Base::simd_size;
const int end = (start + base_type::chunk_size * base_type::simd_size >
base_type::elements.extent(0))
? base_type::elements.extent(0)
: start + base_type::chunk_size * base_type::simd_size;
const auto elem_indices =
Kokkos::subview(Base::elements, Kokkos::make_pair(start, end));
Kokkos::subview(base_type::elements, Kokkos::make_pair(start, end));
const auto map_indices =
Kokkos::subview(mapping, Kokkos::make_pair(start, end));
return mapped_iterator_type(elem_indices, map_indices, Base::ngllz,
Base::ngllx);
return mapped_iterator_type(elem_indices, map_indices, base_type::ngllz,
base_type::ngllx);
}

protected:
Expand Down

0 comments on commit 558545b

Please sign in to comment.