IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
ParticleAttribBase.h
Go to the documentation of this file.
1//
2// Class ParticleAttribBase
3// Base class for all particle attribute classes.
4//
5// This class is used as the generic base class for all (templated) classes
6// which represent a single attribute of a Particle. An attribute class
7// contains a Kokkos::View of data for N particles, and methods to operate with
8// this data.
9//
10// This base class provides virtual methods used to create and destroy
11// elements of the attribute array.
12//
13
14#ifndef IPPL_PARTICLE_ATTRIB_BASE_H
15#define IPPL_PARTICLE_ATTRIB_BASE_H
16
17#include "Types/IpplTypes.h"
18#include "Types/ViewTypes.h"
19
20#include "Communicate/Archive.h"
21
22namespace ippl {
23 namespace detail {
24 template <typename MemorySpace = Kokkos::DefaultExecutionSpace::memory_space>
26 template <class... Properties>
27 struct WithMemSpace {
28 using memory_space = typename Kokkos::View<char*, Properties...>::memory_space;
30 };
31
32 public:
34 using memory_space = MemorySpace;
35 using execution_space = typename memory_space::execution_space;
36
37 template <typename... Properties>
38 using with_properties = typename WithMemSpace<Properties...>::type;
39
40 ParticleAttribBase(){this->name_m = "UNNAMED_attribute";}
41
42 virtual void set_name(const std::string & name_) = 0;
43
44 virtual std::string get_name() const = 0;
45
46 virtual void create(size_type) = 0;
47
48 virtual void destroy(const hash_type&, const hash_type&, size_type) = 0;
49 virtual size_type packedSize(const size_type) const = 0;
50
51 virtual void pack(const hash_type&) = 0;
52
53 virtual void unpack(size_type) = 0;
54
55 virtual void serialize(Archive<memory_space>& ar, size_type nsends) = 0;
56
57 virtual void deserialize(Archive<memory_space>& ar, size_type nrecvs) = 0;
58
59 virtual size_type size() const = 0;
60
61 virtual ~ParticleAttribBase() = default;
62
63 void setParticleCount(size_type& num) { localNum_mp = &num; }
65
66 virtual void applyPermutation(const hash_type&) = 0;
67 virtual void internalCopy(const hash_type&) = 0;
68
69 protected:
71 std::string name_m;
72 };
73 } // namespace detail
74} // namespace ippl
75
76#endif
Definition Archive.h:20
typename detail::ViewType< int, 1, MemorySpace >::view_type hash_type
Definition ViewTypes.h:49
std::size_t size_type
Definition IpplTypes.h:13
virtual ~ParticleAttribBase()=default
virtual void applyPermutation(const hash_type &)=0
virtual void unpack(size_type)=0
virtual void destroy(const hash_type &, const hash_type &, size_type)=0
virtual void deserialize(Archive< memory_space > &ar, size_type nrecvs)=0
ippl::detail::hash_type< memory_space > hash_type
virtual void create(size_type)=0
virtual size_type size() const =0
typename WithMemSpace< Properties... >::type with_properties
typename memory_space::execution_space execution_space
virtual std::string get_name() const =0
virtual size_type packedSize(const size_type) const =0
virtual void set_name(const std::string &name_)=0
virtual void serialize(Archive< memory_space > &ar, size_type nsends)=0
virtual void pack(const hash_type &)=0
virtual void internalCopy(const hash_type &)=0
ParticleAttribBase< memory_space > type
typename Kokkos::View< char *, Properties... >::memory_space memory_space