IPPL API Reference
Independent Parallel Particle Layer C++ API
Loading...
Searching...
No Matches
Field.h
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
13#include "Meshes/UniformCartesian.h"
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;
24 using Centering_t = Cell;
26 using BareField_t = BareField<T, Dim, ViewArgs...>;
27 using view_type = typename BareField_t::view_type;
28 using BConds_t = BConds<Field<T, Dim, Mesh, Centering, ViewArgs...>, Dim>;
29
30 using uniform_type =
31 typename detail::CreateUniformType<base_type, typename view_type::uniform_type>::type;
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.
37 Field();
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
70 T getVolumeIntegral() const;
71
76 T getVolumeAverage() const;
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
84 Mesh_t* mesh_m;
85
86 // The boundary conditions.
87 BConds_t bc_m;
88 };
89} // namespace ippl
90
91#include "Field/Field.hpp"
92#include "Field/FieldOperations.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:
Definition Centering.h:30
Definition Centering.h:25
Definition BareField.h:42
typename detail::ViewType< T, Dim, ViewArgs... >::view_type view_type
View type storing the data.
Definition BareField.h:50
Definition FieldLayout.h:166
Definition Field.h:18
T getVolumeAverage() const
Definition Field.hpp:66
Field deepCopy() const
Definition Field.hpp:26
T getVolumeIntegral() const
Definition Field.hpp:60
Definition Mesh.h:15
Definition Archive.h:20