damping.h Source File
|
CPP API
|
damping.h
Go to the documentation of this file.
71 class Damping : public std::tuple<typename S::Matrix, DampingLevel, DampingType, SimulationTime<FP>>
99 Damping(const Eigen::MatrixBase<ME>& m, DampingLevel level, DampingType type, SimulationTime<FP> t)
117 : Damping(Matrix::Constant(Shape(shape_args...).rows(), Shape(shape_args...).cols(), d), level, type, t)
365 auto ub = std::upper_bound(m_accumulated_dampings_cached.begin(), m_accumulated_dampings_cached.end(),
517 std::vector<std::tuple<std::reference_wrapper<const Matrix>, DampingLevel, DampingType>>& active_by_type,
558 std::vector<std::tuple<std::reference_wrapper<const Matrix>, DampingLevel, DampingType>> active_by_type;
598 std::vector<std::tuple<std::reference_wrapper<const Matrix>, DampingLevel, DampingType>>& active_by_type,
606 auto iter_active_same_type = std::find_if(active_by_type.begin(), active_by_type.end(), [&damping](auto& active) {
614 auto& sum_same_level = *std::find_if(sum_by_level.begin(), sum_by_level.end(), [&damping](auto& sum) {
618 get<MatrixIdx>(sum_same_level) += get<MatrixIdx>(damping) - get<MatrixIdx>(active_same_type).get();
623 active_by_type.emplace_back(get<MatrixIdx>(damping), get<DampingLevel>(damping), get<DampingType>(damping));
625 auto iter_sum_same_level = std::find_if(sum_by_level.begin(), sum_by_level.end(), [&damping](auto& sum) {
represent interventions or effects that affect contact frequencies between multiple groups.
Definition: damping.h:72
requires std::is_constructible_v< Shape, T... > Damping(T... shape_args)
create a default Damping.
Definition: damping.h:85
requires std::is_constructible_v< Shape, T... > Damping(FP d, SimulationTime< FP > t, T... shape_args)
create a Damping with constant coefficients and zero level and type.
Definition: damping.h:142
static IOResult< Damping > deserialize(IOContext &io)
deserialize an object of this class.
Definition: damping.h:232
Damping(const Eigen::MatrixBase< ME > &m, DampingLevel level, DampingType type, SimulationTime< FP > t)
create a Damping.
Definition: damping.h:99
const Matrix & get_coeffs() const
the coefficients of this damping.
Definition: damping.h:186
DampingLevel & get_level()
the level of this damping.
Definition: damping.h:162
friend void PrintTo(const Damping &self, std::ostream *os)
GTest printer.
Definition: damping.h:206
requires std::is_constructible_v< Shape, T... > Damping(FP d, DampingLevel level, DampingType type, SimulationTime< FP > t, T... shape_args)
create a Damping with constant coefficients.
Definition: damping.h:116
SimulationTime< FP > & get_time()
the time this damping becomes active.
Definition: damping.h:150
std::tuple< Matrix, DampingLevel, DampingType, SimulationTime< FP > > Base
Definition: damping.h:76
Damping(const Eigen::MatrixBase< ME > &m, SimulationTime< FP > t)
create a Damping at level and type zero
Definition: damping.h:128
reference operator[](size_t i)
access one damping in this collection.
Definition: damping.h:380
friend void PrintTo(const Dampings &self, std::ostream *os)
GTest printer.
Definition: damping.h:440
size_t get_num_dampings() const
get the number of matrices.
Definition: damping.h:404
bool operator==(const Dampings &other) const
equality operators.
Definition: damping.h:392
Dampings(std::initializer_list< value_type > il)
create damping collection.
Definition: damping.h:286
auto get_matrix_at(SimulationTime< FP > t) const
Computes the real contact frequency at a point in time.
Definition: damping.h:360
std::vector< std::tuple< Matrix, SimulationTime< FP > > > m_accumulated_dampings_cached
Definition: damping.h:545
void set_automatic_cache_update(bool b)
Disable the internal cache to speed up multiple modifications in a row.
Definition: damping.h:340
typename std::vector< value_type >::iterator iterator
Definition: damping.h:264
typename std::vector< value_type >::const_iterator const_iterator
Definition: damping.h:265
static IOResult< Dampings > deserialize(IOContext &io)
deserialize an object of this class.
Definition: damping.h:467
void automatic_cache_update()
updates the cache if automatic cache updates are enabled.
Definition: damping.h:504
static void update_active_dampings(const value_type &damping, std::vector< std::tuple< std::reference_wrapper< const Matrix >, DampingLevel, DampingType >> &active_by_type, std::vector< std::tuple< Matrix, DampingLevel >> &sum_by_level)
replace matrices of the same type, sum up matrices on the same level.
Definition: damping.h:596
static void inclusive_exclusive_sum_rec(Iter b, Iter e, Matrix &sum)
e.g.
Definition: damping.h:525
void update_cache()
compute the cache of accumulated dampings.
Definition: damping.h:550
static Matrix inclusive_exclusive_sum(const std::vector< Tuple > &v)
Definition: damping.h:535
requires std::is_constructible_v< Shape, T... > Dampings(T... shape_args)
create damping collection.
Definition: damping.h:275
Shape get_shape() const
dimensions of the damping matrix.
Definition: damping.h:412
base class to add default operator +, +=, -, -= to a class derived from TypeSafe.
Definition: type_safe.h:152
base class to add operator <, <=, >, >= to a class derived from TypeSafe.
Definition: type_safe.h:205
base class to add operator *, *=, /, /= with a scalar to a class derived from TypeSafe.
Definition: type_safe.h:179
typesafe wrapper around any type to make function arguments, tuple elements, etc.
Definition: type_safe.h:42
static min_max_return_type< ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 >, ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > >::type max(const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &a, const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &b)
Definition: ad.hpp:2596
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
auto failure(const IOStatus &s)
Create an object that is implicitly convertible to an error IOResult<T>.
Definition: io.h:380
@ InvalidValue
boost::outcome_v2::in_place_type_t< T > Tag
Type that is used for overload resolution.
Definition: io.h:407
details::ApplyResultT< F, T... > apply(IOContext &io, F f, const IOResult< T > &... rs)
Evaluate a function with zero or more unpacked IOResults as arguments.
Definition: io.h:481
requires(!std::is_trivial_v< T >) void BinarySerializerObject
Definition: binary_serializer.h:333
auto success()
Create an object that is implicitly convertible to a succesful IOResult<void>.
Definition: io.h:359
constexpr std::tuple_element< I, std::tuple< Index< CategoryTags >... > >::type & get(Index< CategoryTags... > &i) noexcept
Retrieves the Index (by reference) at the Ith position of a MultiIndex.
Definition: index.h:294
boost::outcome_v2::unchecked< T, IOStatus > IOResult
Value-or-error type for operations that return a value but can fail.
Definition: io.h:353
Generated by