NEURON
model_data.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <optional>
3 #include <vector>
4 
6 
7 // Forward declare Datum
8 namespace neuron::container {
9 struct generic_data_handle;
10 }
12 namespace neuron::cache {
13 struct Mechanism {
14  /**
15  * @brief Raw pointers into pointer data for use during simulation.
16  *
17  * pdata_ptr_cache contains pointers to the start of the storage for each pdata variable that is
18  * flattened into the pdata member of this struct, and nullptr elsewhere. Compared to using
19  * pdata directly this avoids exposing details such as the container used.
20  */
21  std::vector<double* const*> pdata_ptr_cache{};
22  std::vector<std::vector<double*>> pdata{}; // raw pointers for use during simulation
23  std::vector<std::vector<Datum*>> pdata_hack{}; // temporary storage used when populating pdata;
24  // should go away when pdata are SoA
25 };
26 struct Thread {
27  /**
28  * @brief Offset into global Node storage for this thread.
29  */
30  std::size_t node_data_offset{};
31  /**
32  * @brief Offsets into global mechanism storage for this thread (one per mechanism)
33  */
34  std::vector<std::size_t> mechanism_offset{};
35 };
36 struct Model {
37  std::vector<Thread> thread{};
38  std::vector<Mechanism> mechanism{};
39 };
40 extern std::optional<Model> model;
41 } // namespace neuron::cache
42 namespace neuron::container {
43 cache::ModelMemoryUsage memory_usage(const std::optional<neuron::cache::Model>& model);
44 cache::ModelMemoryUsage memory_usage(const neuron::cache::Model& model);
45 } // namespace neuron::container
std::optional< Model > model
Definition: container.cpp:59
cache::ModelMemoryUsage memory_usage(const std::optional< neuron::cache::Model > &model)
Model & model()
Access the global Model instance.
Definition: model_data.hpp:206
std::vector< double *const * > pdata_ptr_cache
Raw pointers into pointer data for use during simulation.
Definition: model_data.hpp:21
std::vector< std::vector< double * > > pdata
Definition: model_data.hpp:22
std::vector< std::vector< Datum * > > pdata_hack
Definition: model_data.hpp:23
std::vector< Mechanism > mechanism
Definition: model_data.hpp:38
std::vector< Thread > thread
Definition: model_data.hpp:37
std::size_t node_data_offset
Offset into global Node storage for this thread.
Definition: model_data.hpp:30
std::vector< std::size_t > mechanism_offset
Offsets into global mechanism storage for this thread (one per mechanism)
Definition: model_data.hpp:34
Non-template stable handle to a generic value.