populations.h Source File
|
CPP API
|
populations.h
Go to the documentation of this file.
83 Base::template convert<typename Base::Type::Type>().template convert<UncertainValue<OtherType>>());
139 return std::accumulate(s.begin(), s.end(), FP(0.0), [](const FP& a, const UncertainValue<FP>& b) {
270 log_warning("Constraint check: Compartment number {} changed from {} to {}", i, this->array()[i],
274 log_error("Constraint check: Compartment number {} changed from {} to {}", i, this->array()[i], 0);
A class template for an array with custom indices.
Definition: custom_index_array.h:136
requires(std::is_constructible_v< Type, Ts... >) CustomIndexArray(Index const &dims
CustomIndexArray constructor, that initializes the array to constant instances of CustsomIndexArray::...
size_t get_flat_index(Index const &index) const
get_flat_index returns the flat index into the stored array, given the indices of each category
Definition: custom_index_array.h:309
constexpr size_t numel() const
numel returns the number of elements
Definition: custom_index_array.h:193
static IOResult< Derived > deserialize(IOContext &io, Tag< Derived >)
deserialize an object of a class derived from this class.
Definition: custom_index_array.h:758
::mio::Index< Tags... > Index
Definition: custom_index_array.h:139
Ts && args
Definition: custom_index_array.h:164
auto const & array() const
array returns a reference to the internally stored flat array.
Definition: custom_index_array.h:250
An Index with more than one template parameter combines several Index objects.
Definition: index.h:181
void set_total(FP value)
set_total sets the total population
Definition: populations.h:216
FP get_total() const
get_total returns the total population of all compartments
Definition: populations.h:178
decltype(auto) get_from(Arr &&y, Index const &cats) const
get_from returns the value of a flat container at the flat index corresponding to set of enum values.
Definition: populations.h:123
bool apply_constraints()
Checks whether all compartments have non-negative values.
Definition: populations.h:264
FP get_group_total(mio::Index< T > group_idx) const
get_group_total returns the total population of a group in one category
Definition: populations.h:136
bool check_constraints() const
Checks whether all compartments have non-negative values and logs an error if constraint is not satis...
Definition: populations.h:287
size_t get_num_compartments() const
get_num_compartments returns the number of compartments
Definition: populations.h:93
void set_difference_from_group_total(Index const &midx, FP total_group_population)
set_difference_from_group_total sets the total population for a given group from a difference
Definition: populations.h:194
void set_difference_from_total(Index midx, FP total_population)
set_difference_from_total takes a total population as input and sets the compartment of a given index...
Definition: populations.h:240
Eigen::VectorX< FP > get_compartments() const
get_compartments returns an Eigen copy of the vector of populations.
Definition: populations.h:103
requires std::is_constructible_v< UncertainValue< FP >, Ts... > Populations(Index const &sizes, Ts... args)
Definition: populations.h:62
void set_group_total(mio::Index< T > group_idx, FP value)
set_group_total sets the total population for a given group
Definition: populations.h:156
requires std::convertible_to< typename Base::Type::Type, OtherType > Populations< OtherType, Categories... > convert() const
Convert internally stored data to OtherType and save into new Populations.
Definition: populations.h:80
Populations(Base &&array)
Create populations by taking ownership of a CustomIndexArray.
Definition: populations.h:68
static IOResult< Populations > deserialize(IOContext &io)
deserialize an object of this class.
Definition: populations.h:304
ad::internal::unary_intermediate< AD_TAPE_REAL, ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 >, ad::operations::ad_fabs< AD_TAPE_REAL > > fabs(const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &x1)
Definition: ad.hpp:1133
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
boost::outcome_v2::in_place_type_t< T > Tag
Type that is used for overload resolution.
Definition: io.h:407
void log_warning(spdlog::string_view_t fmt, const Args &... args)
Definition: logging.h:112
void log_error(spdlog::string_view_t fmt, const Args &... args)
Definition: logging.h:100
boost::outcome_v2::unchecked< T, IOStatus > IOResult
Value-or-error type for operations that return a value but can fail.
Definition: io.h:353
Definition: io.h:94
Generated by