#include <symtensor/MultipoleMoment.h>
template<std::size_t Order, typename ... Tensors>
MultipoleMoment class
Generic multipole type.
Template parameters | |
---|---|
Order | the rank of the highest symmetric tensor |
Tensors | prefix of types which make up the lowest ranks of the multipole. Must end in a Symmetric tensor – the final type is "promoted" to produce higher rank tensors until the requested Order is reached. |
Base classes
-
template<typename Implementation, typename Tuple>class MultipoleBaseFromTuple<MultipoleMoment<Order, Tensors...>, TensorSequence<Order, last_type<Tensors...>::Scalar, Tensors...>>
- Helper class for defining a multipole based on an std::tuple of tensors.
Public types
- using TensorTuple = std::tuple<Tensors...>
- using Index = typename last_type_of_tuple<TensorTuple>::Index
- Index type used to access tensor members Common to all contained tensors, as they should all have the same size.
-
template<std::size_t R>using TensorType = std::tuple_element_t<indexForRank(R), TensorTuple>
- using Ranks = std::integer_sequence<std::size_t, Rank<Tensors>()...>
Public static variables
- static std::size_t Order constexpr
- Multipole order, equivalent to the rank of the highest contained tensor.
- static std::size_t NumTensors constexpr
- Number of contained elements, all assumed to be tensors. A multipole may have a scalar component; this is treated a tensor of rank 0.
Constructors
-
template<indexable Vector>static auto FromVector(const Vector& vector) -> ALWAYS_INLINE Implementation constexpr
- Creator method from a single vector.
Member access
-
template<std::size_t R>auto tensor() const -> const auto& constexpr
- Tensor access by rank.
-
template<std::size_t R>auto tensor() -> auto& constexpr
- Tensor access by rank.
-
template<Index... Indices>auto at() const -> const auto& constexpr
- Direct access to members of tensors.
-
template<Index... Indices>auto at() -> auto& constexpr
- Direct access to members of tensors.
Multipole-scalar operations
-
template<typename T>auto operator+=(const T& scalar) -> Implementation& constexpr
- Element-wise addition of a scalar.
-
template<typename T>auto operator-=(const T& scalar) -> Implementation& constexpr
- Element-wise subtraction of a scalar.
-
template<typename T>auto operator*=(const T& scalar) -> Implementation& constexpr
- Element-wise multiplication by a scalar.
-
template<typename T>auto operator+(const T& scalar) const -> Implementation constexpr
- Element-wise addition of a scalar.
-
template<typename T>auto operator-(const T& scalar) const -> Implementation constexpr
- Element-wise subtraction of a scalar.
-
template<typename T>auto operator*(const T& scalar) const -> Implementation constexpr
- Element-wise multiplication by a scalar.
-
template<typename T>auto operator/(const T& scalar) const -> Implementation constexpr
- Element-wise division by a scalar.
Multipole-multipole operations
- auto operator+=(const Implementation& other) -> Implementation& constexpr
- Element-wise addition with another multipole.
- auto operator-=(const Implementation& other) -> Implementation& constexpr
- Element-wise subtraction by another multipole.
- auto operator*=(const Implementation& other) -> Implementation& constexpr
- Element-wise multiplication by another multipole.
- auto operator/=(const Implementation& other) -> Implementation& constexpr
- Element-wise division by another multipole.
- auto operator+(const Implementation& other) const -> Implementation constexpr
- Element-wise addition with another multipole.
- auto operator-(const Implementation& other) const -> Implementation constexpr
- Element-wise subtraction by another multipole.
- auto operator*(const Implementation& other) const -> Implementation constexpr
- Element-wise multiplication by another multipole.
- auto operator/(const Implementation& other) const -> Implementation constexpr
- Element-wise division by another multipole.
Comparison operators
- auto operator==(const Self& other) const -> bool defaulted constexpr
- Comparison with another multipole.
std::tuple compatibility
- auto underlying_tuple() const -> const TensorTuple& constexpr
- direct access to the tuple of tensors which comprises the multipole
- auto underlying_tuple() -> TensorTuple& constexpr
- direct access to the tuple of tensors which comprises the multipole
-
template<std::size_t I>auto get() & -> auto& constexpr
- element access for use with structured bindings
-
template<std::size_t I>auto get() const & -> const auto& constexpr
- element access for use with structured bindings
-
template<std::size_t I>auto get() && -> auto&& constexpr
- element access for use with structured bindings
Typedef documentation
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
using symtensor:: MultipoleMoment<Order, Tensors>:: TensorTuple = std::tuple<Tensors...>
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
using symtensor:: MultipoleMoment<Order, Tensors>:: Index = typename last_type_of_tuple<TensorTuple>::Index
Index type used to access tensor members Common to all contained tensors, as they should all have the same size.
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<std::size_t R>
using symtensor:: MultipoleMoment<Order, Tensors>:: TensorType = std::tuple_element_t<indexForRank(R), TensorTuple>
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
using symtensor:: MultipoleMoment<Order, Tensors>:: Ranks = std::integer_sequence<std::size_t, Rank<Tensors>()...>
Function documentation
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<indexable Vector>
static ALWAYS_INLINE Implementation symtensor:: MultipoleMoment<Order, Tensors>:: FromVector(const Vector& vector) constexpr
Creator method from a single vector.
Template parameters | |
---|---|
Vector | vector type, must have a subscript operator and provide at least D elements |
Parameters | |
vector | base vector |
Tensors are produced by repeatedly performing cartesian products with the vector.
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<std::size_t R>
const auto& symtensor:: MultipoleMoment<Order, Tensors>:: tensor() const constexpr
Tensor access by rank.
Template parameters | |
---|---|
R | Rank of the tensor to retrieve |
Returns | reference to the tensor with the requested rank |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<std::size_t R>
auto& symtensor:: MultipoleMoment<Order, Tensors>:: tensor() constexpr
Tensor access by rank.
Template parameters | |
---|---|
R | Rank of the tensor to retrieve |
Returns | reference to the tensor with the requested rank |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<Index... Indices>
const auto& symtensor:: MultipoleMoment<Order, Tensors>:: at() const constexpr
Direct access to members of tensors.
Template parameters | |
---|---|
Indices | Sequence of R Index values which specify an element of a tensor. The number of indices determines which tensor is accessed. Indices may be in arbitrary order, because the tensor is symmetric. |
Returns | the scalar element at the requested index |
Passes through to the appropriate symmetric tensor member accessor SymmetricTensorBase::
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<Index... Indices>
auto& symtensor:: MultipoleMoment<Order, Tensors>:: at() constexpr
Direct access to members of tensors.
Template parameters | |
---|---|
Indices | Sequence of R Index values which specify an element of a tensor. The number of indices determines which tensor is accessed. Indices may be in arbitrary order, because the tensor is symmetric. |
Returns | the scalar element at the requested index |
Passes through to the appropriate symmetric tensor member accessor SymmetricTensorBase::
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<typename T>
Implementation& symtensor:: MultipoleMoment<Order, Tensors>:: operator+=(const T& scalar) constexpr
Element-wise addition of a scalar.
Parameters | |
---|---|
scalar | value to add to each tensor of the multipole |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<typename T>
Implementation& symtensor:: MultipoleMoment<Order, Tensors>:: operator-=(const T& scalar) constexpr
Element-wise subtraction of a scalar.
Parameters | |
---|---|
scalar | value to subtract from each tensor of the multipole |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<typename T>
Implementation& symtensor:: MultipoleMoment<Order, Tensors>:: operator*=(const T& scalar) constexpr
Element-wise multiplication by a scalar.
Parameters | |
---|---|
scalar | value to multiply each tensor of the multipole by. |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<typename T>
Implementation symtensor:: MultipoleMoment<Order, Tensors>:: operator+(const T& scalar) const constexpr
Element-wise addition of a scalar.
Parameters | |
---|---|
scalar | value to add to each tensor of the multipole |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<typename T>
Implementation symtensor:: MultipoleMoment<Order, Tensors>:: operator-(const T& scalar) const constexpr
Element-wise subtraction of a scalar.
Parameters | |
---|---|
scalar | value to subtract from each tensor of the multipole |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<typename T>
Implementation symtensor:: MultipoleMoment<Order, Tensors>:: operator*(const T& scalar) const constexpr
Element-wise multiplication by a scalar.
Parameters | |
---|---|
scalar | value to multiply each tensor of the multipole by. |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<typename T>
Implementation symtensor:: MultipoleMoment<Order, Tensors>:: operator/(const T& scalar) const constexpr
Element-wise division by a scalar.
Parameters | |
---|---|
scalar | value to divide each element of the multipole by. |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
Implementation& symtensor:: MultipoleMoment<Order, Tensors>:: operator+=(const Implementation& other) constexpr
Element-wise addition with another multipole.
Parameters | |
---|---|
other | multipole to add with this multipole |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
Implementation& symtensor:: MultipoleMoment<Order, Tensors>:: operator-=(const Implementation& other) constexpr
Element-wise subtraction by another multipole.
Parameters | |
---|---|
other | multipole to subtract from this multipole |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
Implementation& symtensor:: MultipoleMoment<Order, Tensors>:: operator*=(const Implementation& other) constexpr
Element-wise multiplication by another multipole.
Parameters | |
---|---|
other | multipole to multiply with this multipole |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
Implementation& symtensor:: MultipoleMoment<Order, Tensors>:: operator/=(const Implementation& other) constexpr
Element-wise division by another multipole.
Parameters | |
---|---|
other | multipole to divide this multipole by |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
Implementation symtensor:: MultipoleMoment<Order, Tensors>:: operator+(const Implementation& other) const constexpr
Element-wise addition with another multipole.
Parameters | |
---|---|
other | multipole to add with this multipole |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
Implementation symtensor:: MultipoleMoment<Order, Tensors>:: operator-(const Implementation& other) const constexpr
Element-wise subtraction by another multipole.
Parameters | |
---|---|
other | multipole to subtract from this multipole |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
Implementation symtensor:: MultipoleMoment<Order, Tensors>:: operator*(const Implementation& other) const constexpr
Element-wise multiplication by another multipole.
Parameters | |
---|---|
other | multipole to multiply with this multipole |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
Implementation symtensor:: MultipoleMoment<Order, Tensors>:: operator/(const Implementation& other) const constexpr
Element-wise division by another multipole.
Parameters | |
---|---|
other | multipole to divide this multipole by |
Returns | the modified multipole |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
bool symtensor:: MultipoleMoment<Order, Tensors>:: operator==(const Self& other) const defaulted constexpr
Comparison with another multipole.
Parameters | |
---|---|
other | multipole to compare with |
Returns | true if all elements of the multipoles are equivalent, false otherwise |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
const TensorTuple& symtensor:: MultipoleMoment<Order, Tensors>:: underlying_tuple() const constexpr
direct access to the tuple of tensors which comprises the multipole
Returns | reference to the std::tuple of tensors. |
---|
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
TensorTuple& symtensor:: MultipoleMoment<Order, Tensors>:: underlying_tuple() constexpr
direct access to the tuple of tensors which comprises the multipole
Returns | reference to the std::tuple of tensors. |
---|
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<std::size_t I>
auto& symtensor:: MultipoleMoment<Order, Tensors>:: get() & constexpr
element access for use with structured bindings
Template parameters | |
---|---|
I | index of the element to retrieve (not necessarily the same as Rank) |
Returns | reference to the tensor |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<std::size_t I>
const auto& symtensor:: MultipoleMoment<Order, Tensors>:: get() const & constexpr
element access for use with structured bindings
Template parameters | |
---|---|
I | index of the element to retrieve (not necessarily the same as Rank) |
Returns | reference to the tensor |
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
template<std::size_t I>
auto&& symtensor:: MultipoleMoment<Order, Tensors>:: get() && constexpr
element access for use with structured bindings
Template parameters | |
---|---|
I | index of the element to retrieve (not necessarily the same as Rank) |
Returns | reference to the tensor |
Variable documentation
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
static std::size_t symtensor:: MultipoleMoment<Order, Tensors>:: Order constexpr
Multipole order, equivalent to the rank of the highest contained tensor.
#include <symtensor/MultipoleBase.h>
template<std::size_t Order, typename ... Tensors>
static std::size_t symtensor:: MultipoleMoment<Order, Tensors>:: NumTensors constexpr
Number of contained elements, all assumed to be tensors. A multipole may have a scalar component; this is treated a tensor of rank 0.