27 template <
typename Derived>
30 const Eigen::MatrixBase<Derived>& value)
34 size_t dim = value.size();
35 size_t old_size = m_buffer.size();
40 m_indices.emplace_back(index, old_size);
43 m_buffer.resize(old_size + dim);
44 std::copy(value.begin(), value.end(), m_buffer.begin() + old_size);
52 m_indices.emplace_back(index, m_buffer.size());
53 m_buffer.emplace_back(value);
61 for (
auto it = m_indices.crbegin(); it != m_indices.crend(); ++it) {
62 const auto& [global, local] = *it;
71 size_t offset = other.
m_buffer.size();
72 std::copy(m_buffer.begin(), m_buffer.end(), std::back_inserter(other.
m_buffer));
77 [offset](
const auto& pr) {
78 const auto& [a, b] = pr;
79 return std::make_pair(a, b + offset);
87 for (
auto it = m_indices.crbegin(); it != m_indices.crend(); ++it) {
88 const auto& [global, local] = *it;
98 for (
auto iit = m_indices.cbegin(); iit != m_indices.cend(); ++iit) {
99 const auto& [global, local] = *iit;
100 if (global == index) {
101 return m_buffer.data() + local;
This class stores data of type T in a vector.
MapResult< D > vector_attribute(const int64_t index)
ConstMapResult< D > const_vector_attribute_from_start(const int64_t index, const std::vector< T > &data) const
Accesses the attribute using the specified vector as the underlying data This is internally used by t...
void try_caching(int64_t index, const Eigen::MatrixBase< Derived > &value)
void apply_to(Attribute< T > &attribute) const
std::vector< T > m_buffer
std::vector< std::pair< size_t, size_t > > m_indices
const T * get_value(int64_t index, size_t dim) const