#include <cm_tree.h>
Public Member Functions | |
| CompTree () | |
| ~CompTree () | |
| void | add_compartment (const long parent_index) |
| add a compartment to the tree structure | |
| void | add_compartment (const long parent_index, const Dictionary &compartment_params) |
| void | add_compartment (Compartment *compartment, const long parent_index) |
| void | pre_run_hook () |
| initialize the tree for simulation | |
| void | init_pointers () |
| fix all pointers in the tree, the tree structure should not be modified between calling this function and starting the simulation | |
| void | set_syn_buffers (std::vector< RingBuffer > &syn_buffers) |
| associate each receptor with a spike buffer | |
| std::map< std::string, double * > | get_recordables () |
| make all state variables accessible for recording | |
| Compartment * | get_compartment (const long compartment_index) const |
| get a compartment pointer from the tree | |
| Compartment * | get_compartment (const long compartment_index, Compartment *compartment, const long raise_flag) const |
| Compartment * | get_compartment_opt (const long compartment_indx) const |
| Get the compartment corresponding to the provided index in the tree. | |
| Compartment * | get_root () const |
| long | get_size () const |
| get tree size (number of compartments) | |
| std::vector< double > | get_voltage () const |
| get voltage values | |
| double | get_compartment_voltage (const long compartment_index) |
| Return voltage of single compartment voltage, indicated by the compartment_index. | |
| void | construct_matrix (const long lag) |
| construct the numerical integration matrix and vector | |
| void | solve_matrix () |
| solve the matrix equation for next timestep voltage | |
| void | print_tree () const |
| print function | |
Private Member Functions | |
| void | solve_matrix_downsweep (Compartment *compartment_ptr, std::vector< Compartment * >::iterator leaf_it) |
| recursion functions for matrix inversion | |
| void | solve_matrix_upsweep (Compartment *compartment, double vv) |
| void | set_parents () |
| functions for pointer initialization | |
| void | set_compartments () |
Creates a vector of compartment pointers, organized in the order in which they were added by add_compartment() | |
| void | set_leafs () |
| Creates a vector of compartment pointers of compartments that are also leafs of the tree. | |
Private Attributes | |
| Compartment | root_ |
| structural data containers for the compartment model | |
| std::vector< long > | compartment_indices_ |
| std::vector< Compartment * > | compartments_ |
| std::vector< Compartment * > | leafs_ |
| long | size_ = 0 |
| nest::CompTree::CompTree | ( | ) |
References compartments_, and leafs_.
|
inline |
| void nest::CompTree::add_compartment | ( | Compartment * | compartment, |
| const long | parent_index | ||
| ) |
we do not raise an UnknownCompartment exception from within get_compartment(), because we want to print a more informative exception message
References nest::Compartment::children, nest::Compartment::comp_index, compartment_indices_, get_compartment(), get_root(), root_, set_compartments(), and size_.
| void nest::CompTree::add_compartment | ( | const long | parent_index | ) |
add a compartment to the tree structure
Add a compartment to the tree structure via the python interface root should have -1 as parent index.
Add root compartment first. Assumes parent of compartment is already added
References add_compartment(), and size_.
Referenced by add_compartment(), add_compartment(), and nest::cm_default::add_compartment_().
| void nest::CompTree::add_compartment | ( | const long | parent_index, |
| const Dictionary & | compartment_params | ||
| ) |
| void nest::CompTree::construct_matrix | ( | const long | lag | ) |
construct the numerical integration matrix and vector
Construct the matrix equation to be solved to advance the model one timestep.
References compartments_.
Referenced by nest::cm_default::update().
| Compartment * nest::CompTree::get_compartment | ( | const long | compartment_index | ) | const |
get a compartment pointer from the tree
Get the compartment corresponding to the provided index in the tree.
This function gets the compartments by a recursive search through the tree.
The overloaded functions looks only in the subtree of the provided compartment, and also has the option to throw an error if no compartment corresponding to compartment_index is found in the tree
References get_compartment(), and get_root().
Referenced by add_compartment(), nest::cm_default::add_receptor_(), get_compartment(), get_compartment(), nest::cm_default::get_status(), nest::cm_default::handles_test_event(), set_compartments(), and set_parents().
| Compartment * nest::CompTree::get_compartment | ( | const long | compartment_index, |
| Compartment * | compartment, | ||
| const long | raise_flag | ||
| ) | const |
References nest::Compartment::children, nest::Compartment::comp_index, and get_compartment().
| Compartment * nest::CompTree::get_compartment_opt | ( | const long | compartment_idx | ) | const |
Get the compartment corresponding to the provided index in the tree.
Optimized trough the use of a pointer vector containing all compartments. Calling this function before CompTree::init_pointers() is called will result in a segmentation fault
References compartments_.
Referenced by nest::cm_default::handle().
| double nest::CompTree::get_compartment_voltage | ( | const long | compartment_index | ) |
Return voltage of single compartment voltage, indicated by the compartment_index.
References compartments_.
| std::map< std::string, double * > nest::CompTree::get_recordables | ( | ) |
make all state variables accessible for recording
Returns a map of variable names and pointers to the recordables.
add recordables for all compartments, suffixed by compartment_idx, to "recordables"
References compartments_.
Referenced by nest::cm_default::init_recordables_pointers_().
|
inline |
References root_.
Referenced by add_compartment(), get_compartment(), nest::cm_default::handles_test_event(), and nest::cm_default::update().
|
inline |
get tree size (number of compartments)
References size_.
Referenced by nest::cm_default::get_status(), nest::cm_default::handles_test_event(), and nest::cm_default::set_status().
| std::vector< double > nest::CompTree::get_voltage | ( | ) | const |
get voltage values
Returns vector of voltage values, indices correspond to compartments in compartments_
References compartments_.
| void nest::CompTree::init_pointers | ( | ) |
fix all pointers in the tree, the tree structure should not be modified between calling this function and starting the simulation
Initialize all tree structure pointers.
References set_compartments(), set_leafs(), and set_parents().
Referenced by nest::cm_default::pre_run_hook().
| void nest::CompTree::pre_run_hook | ( | ) |
initialize the tree for simulation
Initialize state variables.
References nest::Compartment::comp_index, compartments_, and root_.
Referenced by nest::cm_default::pre_run_hook().
| void nest::CompTree::print_tree | ( | ) | const |
print function
Print the tree graph.
References nest::Compartment::ca, nest::Compartment::comp_index, compartments_, nest::Compartment::el, nest::Compartment::gc, nest::Compartment::gl, and nest::Compartment::parent.
|
private |
Creates a vector of compartment pointers, organized in the order in which they were added by add_compartment()
References compartment_indices_, compartments_, and get_compartment().
Referenced by add_compartment(), and init_pointers().
|
private |
Creates a vector of compartment pointers of compartments that are also leafs of the tree.
References compartments_, and leafs_.
Referenced by init_pointers().
|
private |
functions for pointer initialization
For each compartments, sets its pointer towards its parent compartment.
References compartment_indices_, get_compartment(), nest::Compartment::p_index, nest::Compartment::parent, and root_.
Referenced by init_pointers().
| void nest::CompTree::set_syn_buffers | ( | std::vector< RingBuffer > & | syn_buffers | ) |
associate each receptor with a spike buffer
Initializes pointers for the spike buffers for all synapse receptors.
References nest::Compartment::compartment_currents, compartments_, and nest::CompartmentCurrents::set_syn_buffers().
Referenced by nest::cm_default::pre_run_hook().
| void nest::CompTree::solve_matrix | ( | ) |
solve the matrix equation for next timestep voltage
Solve matrix with O(n) algorithm.
References leafs_, root_, solve_matrix_downsweep(), and solve_matrix_upsweep().
Referenced by nest::cm_default::update().
|
private |
recursion functions for matrix inversion
References nest::Compartment::children, nest::Compartment::gather_input(), nest::Compartment::io(), leafs_, nest::Compartment::n_passed, nest::Compartment::parent, and solve_matrix_downsweep().
Referenced by solve_matrix(), and solve_matrix_downsweep().
|
private |
References nest::Compartment::calc_v(), nest::Compartment::children, and solve_matrix_upsweep().
Referenced by solve_matrix(), and solve_matrix_upsweep().
|
private |
Referenced by add_compartment(), set_compartments(), and set_parents().
|
private |
|
private |
Referenced by CompTree(), set_leafs(), solve_matrix(), and solve_matrix_downsweep().
|
mutableprivate |
structural data containers for the compartment model
Referenced by add_compartment(), get_root(), pre_run_hook(), set_parents(), and solve_matrix().
|
private |
Referenced by add_compartment(), add_compartment(), add_compartment(), and get_size().