5#ifndef IPPL_BARE_FIELD_H
6#define IPPL_BARE_FIELD_H
8#include <Kokkos_Core.hpp>
13#include "Types/IpplTypes.h"
15#include "Utility/IpplInfo.h"
16#include "Utility/PAssert.h"
17#include "Utility/ViewUtils.h"
22#include "FieldLayout/FieldLayout.h"
39 template <
typename T,
unsigned Dim,
class... ViewArgs>
41 BareField<T, Dim, ViewArgs...>,
42 sizeof(typename detail::ViewType<T, Dim, ViewArgs...>::view_type)> {
51 typedef typename view_type::memory_space memory_space;
52 typedef typename view_type::execution_space execution_space;
53 using host_mirror_type =
typename view_type::host_mirror_type;
54 template <
class... PolicyArgs>
55 using policy_type =
typename RangePolicy<Dim, PolicyArgs...>::policy_type;
60 constexpr static unsigned dim = Dim;
91 template <
typename... Args>
104 void updateLayout(
Layout_t&,
int nghost = 1);
111 detail::size_type
size(
unsigned d)
const {
return owned_m[d].length(); }
125 int getNghost()
const {
return nghost_m; }
128 void accumulateHalo();
129 void accumulateHalo_noghost(
int nghost = 1);
131 auto& getCommunicator()
const {
return getLayout().comm; }
134 Layout_t& getLayout()
const {
135 PAssert(layout_m != 0);
139 const Index& getIndex(
unsigned d)
const {
return getLayout().getDomain()[d]; }
140 const NDIndex<Dim>& getDomain()
const {
return getLayout().getDomain(); }
142 halo_type& getHalo() {
return halo_m; }
154 template <
typename E,
size_t N>
164 template <
typename... Args>
166 return dview_m(args...);
171 const view_type& getView()
const {
return dview_m; }
173 host_mirror_type getHostMirror()
const {
return Kokkos::create_mirror(dview_m); }
182 template <
class... PolicyArgs>
184 const int nghost = 0)
const {
185 PAssert_LE(nghost, nghost_m);
186 const size_t shift = nghost_m - nghost;
194 void write(std::ostream& out = std::cout)
const;
223 T sum(
int nghost = 0)
const;
224 T max(
int nghost = 0)
const;
225 T min(
int nghost = 0)
const;
226 T prod(
int nghost = 0)
const;
246 Layout_t* layout_m =
nullptr;
251#include "Field/BareField.hpp"
252#include "Field/BareFieldOperations.hpp"
Definition BareField.h:42
friend std::ostream & operator<<(std::ostream &out, const BareField< T, Dim, ViewArgs... > &field)
Definition BareField.h:217
const Domain_t getAllocated() const
Definition BareField.h:123
typename detail::ViewType< T, Dim, ViewArgs... >::view_type view_type
View type storing the data.
Definition BareField.h:50
policy_type< execution_space, PolicyArgs... > getFieldRangePolicy(const int nghost=0) const
Definition BareField.h:183
void initialize(Layout_t &l, int nghost=1)
Definition BareField.hpp:113
BareField & operator=(const detail::Expression< E, N > &expr)
void write(std::ostream &out=std::cout) const
Definition BareField.hpp:197
BareField deepCopy() const
Definition BareField.hpp:98
BareField()
Definition BareField.hpp:93
detail::size_type size(unsigned d) const
Definition BareField.h:111
KOKKOS_INLINE_FUNCTION T operator()(Args... args) const
Definition BareField.h:165
void resize(Args... args)
Definition BareField.hpp:142
const Domain_t & getOwned() const
Definition BareField.h:117
void write_as_list(std::ostream &out=std::cout) const
Definition BareField.hpp:208
NDIndex< Dim > Domain_t
Domain type specifying the index region.
Definition BareField.h:47
Definition FieldLayout.h:166
KOKKOS_INLINE_FUNCTION NDIndex< Dim > grow(int ncells) const
Definition NDIndex.hpp:68
RangePolicy< View::rank, typenameView::execution_space, PolicyArgs... >::policy_type getRangePolicy(const View &view, int shift=0)
Definition ParallelDispatch.h:56
Definition ParallelDispatch.h:24
Definition IpplExpressions.h:26
Definition ViewTypes.h:44