AutoPas  3.0.0
Loading...
Searching...
No Matches
OwnershipState.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <bitset>
11#include <iostream>
12
13namespace autopas {
19enum class OwnershipState : int64_t {
23 dummy = 0b0000, // 0
25 owned = 0b0001, // 1
27 halo = 0b0010, // 2
28};
29
37 return static_cast<OwnershipState>(static_cast<int64_t>(a) & static_cast<int64_t>(b));
38}
39
47 return static_cast<OwnershipState>(static_cast<int64_t>(a) | static_cast<int64_t>(b));
48}
49
56constexpr int64_t toInt64(const OwnershipState a) { return static_cast<int64_t>(a); }
57
65[[maybe_unused]] static std::ostream &operator<<(std::ostream &os, const OwnershipState &ownershipState) {
66 switch (ownershipState) {
68 os << "dummy";
69 break;
71 os << "owned";
72 break;
74 os << "halo";
75 break;
76 default:
77 os << "unknown state: 0b" << std::bitset<4>(static_cast<int64_t>(ownershipState));
78 break;
79 }
80 return os;
81}
82} // namespace autopas
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32
static std::ostream & operator<<(std::ostream &os, const OwnershipState &ownershipState)
Insertion operator for OwnershipState.
Definition: OwnershipState.h:65
constexpr int64_t toInt64(const OwnershipState a)
Returns the int64_t value of a given OwnershipState.
Definition: OwnershipState.h:56
constexpr OwnershipState operator|(const OwnershipState a, const OwnershipState b)
Bitwise OR operator for OwnershipState.
Definition: OwnershipState.h:46
OwnershipState
Enum that specifies the state of ownership.
Definition: OwnershipState.h:19
@ dummy
Dummy or deleted state, a particle with this state is not an actual particle!
@ halo
Halo state, a particle with this state is an actual particle, but not owned by the current AutoPas ob...
@ owned
Owned state, a particle with this state is an actual particle and owned by the current AutoPas object...
constexpr OwnershipState operator&(const OwnershipState a, const OwnershipState b)
Bitwise AND operator for OwnershipState.
Definition: OwnershipState.h:36