IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
Field.h
Go to the documentation of this file.
1//
2// Class Field
3// BareField with a mesh and configurable boundary conditions
4//
5#ifndef IPPL_FIELD_H
6#define IPPL_FIELD_H
7
8#include "Utility/TypeUtils.h"
9
10#include "Field/BareField.h"
11#include "Field/BConds.h"
12
14
15namespace ippl {
16
17 template <typename T, unsigned Dim, class Mesh, class Centering, class... ViewArgs>
18 class Field : public BareField<T, Dim, ViewArgs...> {
19 template <typename... Props>
20 using base_type = Field<T, Dim, Mesh, Centering, Props...>;
21
22 public:
23 using Mesh_t = Mesh;
26 using BareField_t = BareField<T, Dim, ViewArgs...>;
28 using BConds_t = BConds<Field<T, Dim, Mesh, Centering, ViewArgs...>, Dim>;
29
32
33 // A default constructor, which should be used only if the user calls the
34 // 'initialize' function before doing anything else. There are no special
35 // checks in the rest of the Field methods to check that the Field has
36 // been properly initialized.
38
39 Field(const Field&) = default;
40
45 Field deepCopy() const;
46
47 virtual ~Field() = default;
48
49 // Constructors including a Mesh object as argument:
50 Field(Mesh_t&, Layout_t&, int nghost = 1);
51
52 // Initialize the Field, also specifying a mesh
53 void initialize(Mesh_t&, Layout_t&, int nghost = 1);
54
55 // ML
56 void updateLayout(Layout_t&, int nghost = 1);
57
58 void setFieldBC(BConds_t& bc) {
59 bc_m = bc;
60 bc_m.findBCNeighbors(*this);
61 }
62
63 // Access to the mesh
64 KOKKOS_INLINE_FUNCTION Mesh_t& get_mesh() const { return *mesh_m; }
65
71
77
78 BConds_t& getFieldBC() { return bc_m; }
79 // Assignment from constants and other arrays.
80 using BareField<T, Dim, ViewArgs...>::operator=;
81
82 private:
83 // The Mesh object, and a flag indicating if we constructed it
85
86 // The boundary conditions.
88 };
89} // namespace ippl
90
91#include "Field/Field.hpp"
93
94#endif
95
96// vi: set et ts=4 sw=4 sts=4:
97// Local Variables:
98// mode:c
99// c-basic-offset: 4
100// indent-tabs-mode: nil
101// require-final-newline: nil
102// End:
constexpr unsigned Dim
Definition Archive.h:20
typename detail::ViewType< T, Dim, ViewArgs... >::view_type view_type
Definition BareField.h:50
void initialize(Mesh_t &, Layout_t &, int nghost=1)
Definition Field.hpp:49
void updateLayout(Layout_t &, int nghost=1)
Definition Field.hpp:71
typename detail::CreateUniformType< base_type, typename view_type::uniform_type >::type uniform_type
Definition Field.h:30
T getVolumeAverage() const
Definition Field.hpp:66
Field(const Field &)=default
BConds< Field< T, Dim, Mesh, Centering, ViewArgs... >, Dim > BConds_t
Definition Field.h:28
Field deepCopy() const
Definition Field.hpp:26
T getVolumeIntegral() const
Definition Field.hpp:60
virtual ~Field()=default
BareField< T, Dim, ViewArgs... > BareField_t
Definition Field.h:26
Field(Mesh_t &, Layout_t &, int nghost=1)
Definition Field.hpp:37
KOKKOS_INLINE_FUNCTION Mesh_t & get_mesh() const
Definition Field.h:64
BConds_t & getFieldBC()
Definition Field.h:78
typename BareField_t::view_type view_type
Definition Field.h:27
void setFieldBC(BConds_t &bc)
Definition Field.h:58
Field< T, Dim, Mesh, Centering, Props... > base_type
Definition Field.h:20
typename Forward< Type, view_type >::type type
Definition TypeUtils.h:205