NEURON
neuron::container::detail::field_data< Tag, impl > Struct Template Reference

#include <soa_container.hpp>

Public Types

using data_type = typename Tag::type
 

Public Member Functions

 field_data (Tag tag)
 
 ~field_data ()
 
Tag const & tag () const
 Return a reference to the tag instance. More...
 
template<may_cause_reallocation might_reallocate, typename Callable >
Callable for_each_vector (Callable callable)
 
template<typename Callable >
Callable for_each_vector (Callable callable) const
 
bool active () const
 
void set_active (bool enable, std::size_t size)
 
data_type *const * data_ptrs () const
 
int const * array_dims () const
 
int const * array_dim_prefix_sums () const
 

Private Attributes

Tag m_tag
 Tag type instance. More...
 
std::vector< data_typem_storage
 Storage for the data associated with Tag. More...
 
std::unique_ptr< data_type *[]> m_data_ptr
 Storage where we maintain an up-to-date cache of m_storage.data(). More...
 
int m_array_dim
 Array dimension of the data associated with Tag. More...
 

Detailed Description

template<typename Tag, FieldImplementation impl>
struct neuron::container::detail::field_data< Tag, impl >

Definition at line 223 of file soa_container.hpp.

Member Typedef Documentation

◆ data_type

template<typename Tag , FieldImplementation impl>
using neuron::container::detail::field_data< Tag, impl >::data_type = typename Tag::type

Definition at line 226 of file soa_container.hpp.

Constructor & Destructor Documentation

◆ field_data()

template<typename Tag , FieldImplementation impl>
neuron::container::detail::field_data< Tag, impl >::field_data ( Tag  tag)
inline

Definition at line 228 of file soa_container.hpp.

◆ ~field_data()

template<typename Tag , FieldImplementation impl>
neuron::container::detail::field_data< Tag, impl >::~field_data ( )
inline

Definition at line 236 of file soa_container.hpp.

Member Function Documentation

◆ active()

template<typename Tag , FieldImplementation impl>
bool neuron::container::detail::field_data< Tag, impl >::active ( ) const
inline

Definition at line 277 of file soa_container.hpp.

◆ array_dim_prefix_sums()

template<typename Tag , FieldImplementation impl>
int const* neuron::container::detail::field_data< Tag, impl >::array_dim_prefix_sums ( ) const
inline

Definition at line 317 of file soa_container.hpp.

◆ array_dims()

template<typename Tag , FieldImplementation impl>
int const* neuron::container::detail::field_data< Tag, impl >::array_dims ( ) const
inline

Definition at line 313 of file soa_container.hpp.

◆ data_ptrs()

template<typename Tag , FieldImplementation impl>
data_type* const* neuron::container::detail::field_data< Tag, impl >::data_ptrs ( ) const
inline

Definition at line 309 of file soa_container.hpp.

◆ for_each_vector() [1/2]

template<typename Tag , FieldImplementation impl>
template<may_cause_reallocation might_reallocate, typename Callable >
Callable neuron::container::detail::field_data< Tag, impl >::for_each_vector ( Callable  callable)
inline

Definition at line 249 of file soa_container.hpp.

◆ for_each_vector() [2/2]

template<typename Tag , FieldImplementation impl>
template<typename Callable >
Callable neuron::container::detail::field_data< Tag, impl >::for_each_vector ( Callable  callable) const
inline

Definition at line 265 of file soa_container.hpp.

◆ set_active()

template<typename Tag , FieldImplementation impl>
void neuron::container::detail::field_data< Tag, impl >::set_active ( bool  enable,
std::size_t  size 
)
inline

Definition at line 282 of file soa_container.hpp.

◆ tag()

template<typename Tag , FieldImplementation impl>
Tag const& neuron::container::detail::field_data< Tag, impl >::tag ( ) const
inline

Return a reference to the tag instance.

Definition at line 244 of file soa_container.hpp.

Member Data Documentation

◆ m_array_dim

template<typename Tag , FieldImplementation impl>
int neuron::container::detail::field_data< Tag, impl >::m_array_dim
private

Array dimension of the data associated with Tag.

Invariant
m_array_dim is equal to m_tag.array_dimension(), if that function exists, or 1.
See also
field_data<Tag, true>::m_array_dims for the motivation.

Definition at line 361 of file soa_container.hpp.

◆ m_data_ptr

template<typename Tag , FieldImplementation impl>
std::unique_ptr<data_type*[]> neuron::container::detail::field_data< Tag, impl >::m_data_ptr
private

Storage where we maintain an up-to-date cache of m_storage.data().

Invariant
m_storage.data() is equal to m_data_ptr.
See also
field_data<Tag, true>::m_data_ptrs for the motivation.

This is declared as an array (of size 1) to simplify the implementation of defer_delete. For FieldImplementation::OptionalSingle then whether or not this is null encodes whether or not the field is active. For FieldImplementation::AlwaysSingle it is never null.

Definition at line 353 of file soa_container.hpp.

◆ m_storage

template<typename Tag , FieldImplementation impl>
std::vector<data_type> neuron::container::detail::field_data< Tag, impl >::m_storage
private

Storage for the data associated with Tag.

This is one of the "large" data arrays holding the model data. Because this specialisation of field_data is for Tag types that don't have num_variables() members, such as Node::field::Voltage, there is exactly one vector per instance of field_data. Because the fields in Node::storage all have array dimension 1, in that case the size of this vector is the number of Node instances in the program.

Definition at line 342 of file soa_container.hpp.

◆ m_tag

template<typename Tag , FieldImplementation impl>
Tag neuron::container::detail::field_data< Tag, impl >::m_tag
private

Tag type instance.

An instance of soa contains an instance of field_data for each tag type in its Tags... pack. The instance of the tag type contains the metadata about the field it represents, and field_data adds the actual data for that field. For example, with Tag = Node::field::Voltage, which represents the voltage in a given Node, m_tag is just an empty type that defines the data_type and default value of voltages.

Definition at line 331 of file soa_container.hpp.


The documentation for this struct was generated from the following file: