17 #include <unordered_map>
39 std::unordered_map<int, std::vector<int>>
secmap;
53 return std::accumulate(
secmap.begin(),
secmap.end(), 0, [](
int psum,
const auto& item) {
54 return psum + item.second.size();
95 [](
int psum,
const auto& secmap) {
96 return psum + secmap->num_sections();
105 [](
int psum,
const auto& secmap) {
106 return psum + secmap->num_compartments();
128 if (
type == secmap->type) {
133 std::cout <<
"Warning: Section mapping list " <<
to_string(
type) <<
" doesn't exist! \n";
143 return s->num_compartments();
151 return s->num_sections();
156 std::vector<double>::const_iterator begin,
157 std::vector<double>::const_iterator end) {
164 nrn_assert(curr_n_electrodes == 0 ||
n == curr_n_electrodes);
204 std::cerr <<
"CellMapping for gid " <<
std::to_string(
c->gid) <<
" already exists!\n";
219 [](
size_t total,
const auto& mapping) {
220 return total + mapping.second->num_electrodes();
222 _lfp.resize(lfp_size);
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
void nrn_abort(int errcode)
std::string to_string(EnumT e, const std::array< std::pair< EnumT, std::string_view >, N > &mapping, const std::string_view enum_name)
Converts an enum value to its corresponding string representation.
#define nrn_assert(x)
assert()-like macro, independent of NDEBUG status
int const size_t const size_t n
Compartment mapping information for a cell.
std::vector< size_t > electrode_offsets
Electrode offsets per LFP report (CSR-style, size = num_reports + 1).
std::vector< double > lfp_factors_flat
flat array of lfp factors: stride = num_electrodes, indexed as [i * stride + e]
void add_segment_lfp_factor(const int segment_id, std::vector< double >::const_iterator begin, std::vector< double >::const_iterator end)
add the lfp electrode factors of a segment_id
int num_compartments() const
return number of compartments in a cell
std::shared_ptr< SecMapping > get_seclist_mapping(const SectionType type) const
return section list mapping with given type
size_t num_electrodes() const
return the total number of electrodes
size_t get_seclist_compartment_count(const SectionType type) const
return compartment count for specific section list with given type
size_t get_seclist_section_count(const SectionType type) const
return segment count for specific section list with given type
int num_sections() const
total number of sections in a cell
std::vector< int > lfp_segment_ids
segment ids for lfp factors (one per compartment with LFP data)
void add_sec_map(std::shared_ptr< SecMapping > s)
add new SecMapping
std::vector< std::shared_ptr< SecMapping > > sec_mappings
list of section lists (like soma, axon, apic)
size_t size() const noexcept
number of section lists
Compartment mapping information for NrnThread.
void add_cell_mapping(std::shared_ptr< CellMapping > c)
add mapping information of new cell
size_t size() const
number of cells
std::unordered_map< int, std::shared_ptr< CellMapping > > cell_mappings
list of cells mapping
std::vector< double > _lfp
std::shared_ptr< CellMapping > get_cell_mapping(int gid) const
get cell mapping information for given gid if exist otherwise return nullptr.
std::vector< int > segment_ids
list of segment ids
void add_segment_id(const int segment_id)
add a new segment
void prepare_lfp()
Resize the lfp vector.
Section to segment mapping.
std::unordered_map< int, std::vector< int > > secmap
map of section and associated compartments
void add_segment(int sec, int seg)
add section to associated segment
size_t num_sections() const noexcept
return total number of sections in section list
SectionType type
name of section list
size_t num_compartments() const
return number of compartments in section list
SecMapping(SectionType t)