NEURON
phase2.hpp
Go to the documentation of this file.
1 /*
2 # =============================================================================
3 # Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
4 #
5 # See top-level LICENSE file for details.
6 # =============================================================================
7 */
8 
9 #pragma once
10 
14 
15 #include <memory>
16 #include <cstdint>
17 
18 namespace coreneuron {
19 struct NrnThread;
20 struct NrnThreadMembList;
21 struct Memb_func;
22 struct Memb_list;
23 struct NrnThreadChkpnt;
24 
25 class Phase2 {
26  public:
27  void read_file(FileHandler& F, const NrnThread& nt);
28  void read_direct(int thread_id, const NrnThread& nt);
29  void populate(NrnThread& nt, const UserParams& userParams);
30 
31  std::vector<int> preSynConditionEventFlags;
32 
33  // All of this is public for nrn_checkpoint
34  struct EventTypeBase {
35  double time;
36  };
37  struct NetConType_: public EventTypeBase {
39  };
40  struct SelfEventType_: public EventTypeBase {
44  double flag;
45  int movable;
47  };
48  struct PreSynType_: public EventTypeBase {
50  };
51  struct NetParEvent_: public EventTypeBase {};
55  };
56 
58  int vtype;
59  int mtype;
60  int ix;
63 
67  };
68  std::vector<VecPlayContinuous_> vec_play_continuous;
70 
71  std::vector<std::pair<int, std::shared_ptr<EventTypeBase>>> events;
72 
73  private:
74  void check_mechanism();
75  void transform_int_data(int elem0,
76  int nodecount,
77  int* pdata,
78  int i,
79  int dparam_size,
80  int layout,
81  int n_node_);
82  void set_net_send_buffer(Memb_list** ml_list, const std::vector<int>& pnt_offset);
83  void restore_events(FileHandler& F);
84  void fill_before_after_lists(NrnThread& nt, const std::vector<Memb_func>& memb_func);
85  void pdata_relocation(const NrnThread& nt, const std::vector<Memb_func>& memb_func);
86  void set_dependencies(const NrnThread& nt, const std::vector<Memb_func>& memb_func);
87  void handle_weights(NrnThread& nt, int n_netcon, NrnThreadChkpnt& ntc);
89  const std::vector<Memb_func>& memb_func,
90  NrnThreadChkpnt& ntc);
91  void set_vec_play(NrnThread& nt, NrnThreadChkpnt& ntc);
92 
94  int n_output;
96  int n_node;
97  int n_diam; // 0 if not needed, else n_node
98  int n_mech;
99  std::vector<int> mech_types;
100  std::vector<int> nodecounts;
101  int n_idata;
102  int n_vdata;
104  /* TO DO: when this is fixed use it like that
105  std::vector<double> actual_a;
106  std::vector<double> actual_b;
107  std::vector<double> actual_area;
108  std::vector<double> actual_v;
109  std::vector<double> actual_diam;
110  */
111  double* _data;
112  struct TML {
113  std::vector<int> nodeindices;
114  std::vector<int> pdata;
115  int type;
116  std::vector<int> iArray;
117  std::vector<double> dArray;
118  std::vector<int> pointer2type;
119  std::vector<uint32_t> nmodlrandom{};
120  };
121  std::vector<TML> tmls;
122  std::vector<int> output_vindex;
123  std::vector<double> output_threshold;
124  std::vector<int> pnttype;
125  std::vector<int> pntindex;
126  std::vector<double> weights;
127  std::vector<double> delay;
129 };
130 } // namespace coreneuron
void set_net_send_buffer(Memb_list **ml_list, const std::vector< int > &pnt_offset)
Definition: phase2.cpp:511
std::vector< int > pntindex
Definition: phase2.hpp:125
std::vector< int > mech_types
Definition: phase2.hpp:99
std::vector< int > nodecounts
Definition: phase2.hpp:100
int * v_parent_index
Definition: phase2.hpp:103
std::vector< double > weights
Definition: phase2.hpp:126
void pdata_relocation(const NrnThread &nt, const std::vector< Memb_func > &memb_func)
Definition: phase2.cpp:639
void set_vec_play(NrnThread &nt, NrnThreadChkpnt &ntc)
Definition: phase2.cpp:925
void handle_weights(NrnThread &nt, int n_netcon, NrnThreadChkpnt &ntc)
Definition: phase2.cpp:835
std::vector< TML > tmls
Definition: phase2.hpp:121
double * _data
Definition: phase2.hpp:111
void get_info_from_bbcore(NrnThread &nt, const std::vector< Memb_func > &memb_func, NrnThreadChkpnt &ntc)
Definition: phase2.cpp:867
void check_mechanism()
Check if MOD file used between NEURON and CoreNEURON is same.
Definition: phase2.cpp:470
void transform_int_data(int elem0, int nodecount, int *pdata, int i, int dparam_size, int layout, int n_node_)
Perform in memory transformation between AoS<>SoA for integer data.
Definition: phase2.cpp:496
void restore_events(FileHandler &F)
Definition: phase2.cpp:548
std::vector< double > output_threshold
Definition: phase2.hpp:123
std::vector< int > preSynConditionEventFlags
Definition: phase2.hpp:31
std::vector< int > pnttype
Definition: phase2.hpp:124
std::vector< VecPlayContinuous_ > vec_play_continuous
Definition: phase2.hpp:68
void read_direct(int thread_id, const NrnThread &nt)
Definition: phase2.cpp:279
std::vector< int > output_vindex
Definition: phase2.hpp:122
void read_file(FileHandler &F, const NrnThread &nt)
Definition: phase2.cpp:126
void set_dependencies(const NrnThread &nt, const std::vector< Memb_func > &memb_func)
Definition: phase2.cpp:765
std::vector< double > delay
Definition: phase2.hpp:127
std::vector< std::pair< int, std::shared_ptr< EventTypeBase > > > events
Definition: phase2.hpp:71
void populate(NrnThread &nt, const UserParams &userParams)
Definition: phase2.cpp:963
void fill_before_after_lists(NrnThread &nt, const std::vector< Memb_func > &memb_func)
Definition: phase2.cpp:606
#define nodecount
Definition: md1redef.h:39
#define i
Definition: md1redef.h:19
#define pdata
Definition: md1redef.h:37
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
std::vector< Memb_func > memb_func
Definition: init.cpp:145
A view into a set of mechanism instances.
Definition: nrnoc_ml.h:34
Represent main neuron object computed by single thread.
Definition: multicore.h:58
std::vector< int > pointer2type
Definition: phase2.hpp:118
std::vector< int > iArray
Definition: phase2.hpp:116
std::vector< double > dArray
Definition: phase2.hpp:117
std::vector< int > pdata
Definition: phase2.hpp:114
std::vector< uint32_t > nmodlrandom
Definition: phase2.hpp:119
std::vector< int > nodeindices
Definition: phase2.hpp:113
This structure is data needed is several part of nrn_setup, phase1 and phase2.
Definition: user_params.hpp:18