6 #include "DataStructures/ComplexDataVector.hpp" 23 template <
typename T,
int Spin,
bool is_vector = is_derived_of_vector_impl_v<T>>
26 template <
typename T,
int Spin>
29 constexpr
static int spin = Spin;
40 template <
typename Rhs>
42 : data_{rhs.data()} {}
44 template <
typename Rhs>
46 : data_{std::move(rhs.data())} {}
49 SpinWeighted(T&& rhs) noexcept : data_{std::move(rhs)} {}
51 template <
typename Rhs>
57 template <
typename Rhs>
59 data_ = std::move(rhs.data());
68 data_ = std::move(rhs);
72 T& data() noexcept {
return data_; }
73 const T& data()
const noexcept {
return data_; }
79 template <
typename T,
int Spin>
82 constexpr
static int spin = Spin;
86 template <
typename ValueType>
87 void set_data_ref(ValueType*
const start,
const size_t set_size) noexcept {
88 data_.set_data_ref(start, set_size);
100 template <
typename Rhs>
102 : data_{rhs.data()} {}
104 template <
typename Rhs>
106 : data_{std::move(rhs.data())} {}
109 SpinWeighted(T&& rhs) noexcept : data_{std::move(rhs)} {}
111 template <
typename Rhs>
117 template <
typename Rhs>
119 data_ = std::move(rhs.data());
128 data_ = std::move(rhs);
132 T& data() noexcept {
return data_; }
133 const T& data()
const noexcept {
return data_; }
145 template <
typename T>
148 template <
typename T,
int S>
152 template <
typename T>
160 template <
typename InternalType,
typename T>
163 template <
typename InternalType,
int S>
168 template <
typename InternalType,
typename T>
169 constexpr
bool is_spin_weighted_of_v =
178 template <
typename T1,
typename T2>
181 template <
typename T,
int Spin1,
int Spin2>
187 template <
typename T1,
typename T2>
188 constexpr
bool is_spin_weighted_of_same_type_v =
197 template <
typename T1,
typename T2,
int Spin>
202 return {lhs.data() + rhs.data()};
204 template <
typename T>
208 return {lhs.data() + rhs};
210 template <
typename T>
212 decltype(std::declval<T>() + std::declval<get_vector_element_type_t<T>>()),
215 const get_vector_element_type_t<T>& rhs) noexcept {
216 return {lhs.data() + rhs};
218 template <
typename T>
222 return {lhs + rhs.data()};
224 template <
typename T>
226 decltype(std::declval<get_vector_element_type_t<T>>() + std::declval<T>()),
228 operator+(
const get_vector_element_type_t<T>& lhs,
230 return {lhs + rhs.data()};
240 template <
typename T1,
typename T2,
int Spin>
245 return {lhs.data() - rhs.data()};
247 template <
typename T>
251 return {lhs.data() - rhs};
253 template <
typename T>
255 decltype(std::declval<T>() - std::declval<get_vector_element_type_t<T>>()),
258 const get_vector_element_type_t<T>& rhs) noexcept {
259 return {lhs.data() - rhs};
261 template <
typename T>
265 return {lhs - rhs.data()};
267 template <
typename T>
269 decltype(std::declval<get_vector_element_type_t<T>>() - std::declval<T>()),
271 operator-(
const get_vector_element_type_t<T>& lhs,
273 return {lhs - rhs.data()};
283 template <
typename T1,
typename T2,
int Spin1,
int Spin2>
285 decltype(std::declval<T1>() * std::declval<T2>()), Spin1 + Spin2>
288 return {lhs.data() * rhs.data()};
290 template <
typename T,
int Spin>
294 return {lhs.data() * rhs};
296 template <
typename T,
int Spin>
298 decltype(std::declval<T>() * std::declval<get_vector_element_type_t<T>>()),
301 const get_vector_element_type_t<T>& rhs) noexcept {
302 return {lhs.data() * rhs};
304 template <
typename T,
int Spin>
308 return {lhs * rhs.data()};
310 template <
typename T,
int Spin>
312 decltype(std::declval<get_vector_element_type_t<T>>() * std::declval<T>()),
314 operator*(
const get_vector_element_type_t<T>& lhs,
316 return {lhs * rhs.data()};
326 template <
typename T1,
typename T2,
int Spin1,
int Spin2>
328 decltype(std::declval<T1>() / std::declval<T2>()), Spin1 - Spin2>
331 return {lhs.data() / rhs.data()};
333 template <
typename T,
int Spin>
337 return {lhs.data() / rhs};
339 template <
typename T,
int Spin>
341 decltype(std::declval<T>() / std::declval<get_vector_element_type_t<T>>()),
344 const get_vector_element_type_t<T>& rhs) noexcept {
345 return {lhs.data() / rhs};
347 template <
typename T,
int Spin>
351 return {lhs / rhs.data()};
353 template <
typename T,
int Spin>
355 decltype(std::declval<get_vector_element_type_t<T>>() / std::declval<T>()),
357 operator/(
const get_vector_element_type_t<T>& lhs,
359 return {lhs / rhs.data()};
363 template <
typename T,
int Spin>
366 return {conj(value.data())};
373 template <
typename T1,
typename T2,
int Spin>
377 return lhs.data() == rhs.data();
379 template <
typename T>
381 const T& rhs) noexcept {
382 return lhs.data() == rhs;
384 template <
typename T>
387 return lhs == rhs.data();
395 template <
typename T1,
typename T2,
int Spin>
399 return not(lhs == rhs);
401 template <
typename T>
403 const T& rhs) noexcept {
404 return not(lhs == rhs);
406 template <
typename T>
409 return not(lhs == rhs);
414 template <
int Spin1,
int Spin2,
typename SpinWeightedType1,
415 typename SpinWeightedType2>
418 template <
typename ValueType>
421 const ValueType value) noexcept {
423 make_with_value<SpinWeightedType1>(input.data(), value)};
427 template <
int Spin,
typename SpinWeightedType,
typename MakeWithType>
429 template <
typename ValueType>
431 const MakeWithType& input,
const ValueType value) noexcept {
433 make_with_value<SpinWeightedType>(input, value)};
Implementations of make_with_value.
Definition: DenseVector.hpp:61
This is a std::true_type if the provided type is a SpinWeighted of any type and spin, otherwise is a std::false_type.
Definition: SpinWeighted.hpp:146
This is a std::true_type if the provided type T1 is a SpinWeighted and T2 is a SpinWeighted, and both have the same internal type, but any combination of spin weights.
Definition: SpinWeighted.hpp:179
auto operator*(const TensorExpression< T1, X, Symm1, IndexList1, Args1 > &t1, const TensorExpression< T2, X, Symm2, IndexList2, Args2 > &t2)
Definition: Product.hpp:89
Defines the type alias Requires.
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args)
Apply the function f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1595
Definition: MakeWithValue.hpp:20
Make a spin-weighted type T with spin-weight Spin. Mathematical operators are restricted to addition...
Definition: SpinWeighted.hpp:24
#define SPECTRE_ALWAYS_INLINE
Always inline a function. Only use this if you benchmarked the code.
Definition: ForceInline.hpp:20
This is a std::true_type if the provided type T is a SpinWeighted of InternalType and any spin...
Definition: SpinWeighted.hpp:161
Defines macro to always inline a function.
Defines type traits, some of which are future STL type_traits header.
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12