diff --git a/arbor/backends/event.hpp b/arbor/backends/event.hpp index d17792aba2d2cbd093f43a02b348de10cf4fd6de..7792ce0248b71a3022b502a6457e74d4ba60fae7 100644 --- a/arbor/backends/event.hpp +++ b/arbor/backends/event.hpp @@ -50,7 +50,7 @@ inline deliverable_event_data event_data(const deliverable_event& ev) { // Sample events (raw values from back-end state). -using probe_handle = const fvm_value_type*; +using probe_handle = const arb_value_type*; struct raw_probe_info { probe_handle handle; // where the to-be-probed value sits diff --git a/arbor/backends/gpu/diffusion.hpp b/arbor/backends/gpu/diffusion.hpp index f07c0539da0200c8f0ba5f4e03d9ca31f4ec5bd6..7943812f3ae619ca00d4a53747a9ff87dc3ab833 100644 --- a/arbor/backends/gpu/diffusion.hpp +++ b/arbor/backends/gpu/diffusion.hpp @@ -9,30 +9,30 @@ namespace arb { namespace gpu { ARB_ARBOR_API void assemble_diffusion( - fvm_value_type* d, - fvm_value_type* rhs, - const fvm_value_type* invariant_d, - const fvm_value_type* concentration, - const fvm_value_type* voltage, - const fvm_value_type* current, - const fvm_value_type q, - const fvm_value_type* conductivity, - const fvm_value_type* area, - const fvm_index_type* cv_to_intdom, - const fvm_value_type* dt_intdom, - const fvm_index_type* perm, + arb_value_type* d, + arb_value_type* rhs, + const arb_value_type* invariant_d, + const arb_value_type* concentration, + const arb_value_type* voltage, + const arb_value_type* current, + const arb_value_type q, + const arb_value_type* conductivity, + const arb_value_type* area, + const arb_index_type* cv_to_intdom, + const arb_value_type* dt_intdom, + const arb_index_type* perm, unsigned n); ARB_ARBOR_API void solve_diffusion( - fvm_value_type* rhs, - fvm_value_type* d, // diagonal values - const fvm_value_type* u, // upper diagonal (and lower diagonal as the matrix is SPD) + arb_value_type* rhs, + arb_value_type* d, // diagonal values + const arb_value_type* u, // upper diagonal (and lower diagonal as the matrix is SPD) const level_metadata* level_meta, // information pertaining to each level - const fvm_index_type* level_lengths, // lengths of branches of every level concatenated - const fvm_index_type* level_parents, // parents of branches of every level concatenated - const fvm_index_type* block_index, // start index (exclusive) into levels for each gpu block - fvm_index_type* num_cells, // the number of cells packed into this single matrix - fvm_index_type* padded_size, // length of rhs, d, u, including padding + const arb_index_type* level_lengths, // lengths of branches of every level concatenated + const arb_index_type* level_parents, // parents of branches of every level concatenated + const arb_index_type* block_index, // start index (exclusive) into levels for each gpu block + arb_index_type* num_cells, // the number of cells packed into this single matrix + arb_index_type* padded_size, // length of rhs, d, u, including padding unsigned num_blocks, // number of blocks unsigned blocksize); // size of each block diff --git a/arbor/backends/gpu/diffusion_state.hpp b/arbor/backends/gpu/diffusion_state.hpp index cb18bcb92ca7f3ffa153aadb5d461c6f79d5a5e8..dd75d865ca17dc9ff5ed1565551be35b7462217e 100644 --- a/arbor/backends/gpu/diffusion_state.hpp +++ b/arbor/backends/gpu/diffusion_state.hpp @@ -410,7 +410,7 @@ public: // voltage [mV] // current density [A/m²] // conductivity [kS/m²] - void assemble(const_view dt_intdom, const_view concentration, const_view voltage, const_view current, const_view conductivity, fvm_value_type q) { + void assemble(const_view dt_intdom, const_view concentration, const_view voltage, const_view current, const_view conductivity, arb_value_type q) { assemble_diffusion(d.data(), rhs.data(), invariant_d.data(), diff --git a/arbor/backends/gpu/fine.hpp b/arbor/backends/gpu/fine.hpp index 540bcea838535bb718a6a377d3295199b8985c4a..de090d8e536c541513ec611189ca9c8e5d815201 100644 --- a/arbor/backends/gpu/fine.hpp +++ b/arbor/backends/gpu/fine.hpp @@ -70,15 +70,15 @@ struct level_metadata { // C wrappers around kernels ARB_ARBOR_API void gather( - const fvm_value_type* from, - fvm_value_type* to, - const fvm_index_type* p, + const arb_value_type* from, + arb_value_type* to, + const arb_index_type* p, unsigned n); ARB_ARBOR_API void scatter( - const fvm_value_type* from, - fvm_value_type* to, - const fvm_index_type* p, + const arb_value_type* from, + arb_value_type* to, + const arb_index_type* p, unsigned n); } // gpu diff --git a/arbor/backends/gpu/fvm.hpp b/arbor/backends/gpu/fvm.hpp index 79a373e94f68f2cc57b5061d962d743c7056c5f8..d49235785220cac86967e8838511cdae4f5e94d1 100644 --- a/arbor/backends/gpu/fvm.hpp +++ b/arbor/backends/gpu/fvm.hpp @@ -23,9 +23,9 @@ struct backend { static bool is_supported() { return true; } static std::string name() { return "gpu"; } - using value_type = fvm_value_type; - using index_type = fvm_index_type; - using size_type = fvm_size_type; + using value_type = arb_value_type; + using index_type = arb_index_type; + using size_type = arb_size_type; using array = arb::gpu::array; using iarray = arb::gpu::iarray; @@ -41,8 +41,8 @@ struct backend { } using threshold_watcher = arb::gpu::threshold_watcher; - using cable_solver = arb::gpu::matrix_state_fine<fvm_value_type, fvm_index_type>; - using diffusion_solver = arb::gpu::diffusion_state<fvm_value_type, fvm_index_type>; + using cable_solver = arb::gpu::matrix_state_fine<arb_value_type, arb_index_type>; + using diffusion_solver = arb::gpu::diffusion_state<arb_value_type, arb_index_type>; using deliverable_event_stream = arb::gpu::deliverable_event_stream; using sample_event_stream = arb::gpu::sample_event_stream; diff --git a/arbor/backends/gpu/gpu_store_types.hpp b/arbor/backends/gpu/gpu_store_types.hpp index ac215ed4370e486cec9cca82617f483d047fd081..51073c18acd157fdbb1806af9858f872ec39980d 100644 --- a/arbor/backends/gpu/gpu_store_types.hpp +++ b/arbor/backends/gpu/gpu_store_types.hpp @@ -15,8 +15,8 @@ namespace arb { namespace gpu { -using array = memory::device_vector<fvm_value_type>; -using iarray = memory::device_vector<fvm_index_type>; +using array = memory::device_vector<arb_value_type>; +using iarray = memory::device_vector<arb_index_type>; using deliverable_event_stream = arb::gpu::multi_event_stream<deliverable_event>; using sample_event_stream = arb::gpu::multi_event_stream<sample_event>; diff --git a/arbor/backends/gpu/matrix_fine.hpp b/arbor/backends/gpu/matrix_fine.hpp index 66997323c3e14773d97feb1f4325a68b8ba50ced..6d657c4c581b3a0d6b62fe707cf5a0745398c9a8 100644 --- a/arbor/backends/gpu/matrix_fine.hpp +++ b/arbor/backends/gpu/matrix_fine.hpp @@ -8,29 +8,29 @@ namespace arb { namespace gpu { ARB_ARBOR_API void assemble_matrix_fine( - fvm_value_type* d, - fvm_value_type* rhs, - const fvm_value_type* invariant_d, - const fvm_value_type* voltage, - const fvm_value_type* current, - const fvm_value_type* conductivity, - const fvm_value_type* cv_capacitance, - const fvm_value_type* area, - const fvm_index_type* cv_to_intdom, - const fvm_value_type* dt_intdom, - const fvm_index_type* perm, + arb_value_type* d, + arb_value_type* rhs, + const arb_value_type* invariant_d, + const arb_value_type* voltage, + const arb_value_type* current, + const arb_value_type* conductivity, + const arb_value_type* cv_capacitance, + const arb_value_type* area, + const arb_index_type* cv_to_intdom, + const arb_value_type* dt_intdom, + const arb_index_type* perm, unsigned n); ARB_ARBOR_API void solve_matrix_fine( - fvm_value_type* rhs, - fvm_value_type* d, // diagonal values - const fvm_value_type* u, // upper diagonal (and lower diagonal as the matrix is SPD) + arb_value_type* rhs, + arb_value_type* d, // diagonal values + const arb_value_type* u, // upper diagonal (and lower diagonal as the matrix is SPD) const level_metadata* level_meta, // information pertaining to each level - const fvm_index_type* level_lengths, // lengths of branches of every level concatenated - const fvm_index_type* level_parents, // parents of branches of every level concatenated - const fvm_index_type* block_index, // start index (exclusive) into levels for each gpu block - fvm_index_type* num_cells, // the number of cells packed into this single matrix - fvm_index_type* padded_size, // length of rhs, d, u, including padding + const arb_index_type* level_lengths, // lengths of branches of every level concatenated + const arb_index_type* level_parents, // parents of branches of every level concatenated + const arb_index_type* block_index, // start index (exclusive) into levels for each gpu block + arb_index_type* num_cells, // the number of cells packed into this single matrix + arb_index_type* padded_size, // length of rhs, d, u, including padding unsigned num_blocks, // number of blocks unsigned blocksize); // size of each block diff --git a/arbor/backends/gpu/matrix_state_flat.hpp b/arbor/backends/gpu/matrix_state_flat.hpp index bc50b7fce3ea10aa7c8a1bccf319c58e4b42f3f1..31b5cc17755848449ab1812e8e25951b537ffac7 100644 --- a/arbor/backends/gpu/matrix_state_flat.hpp +++ b/arbor/backends/gpu/matrix_state_flat.hpp @@ -15,25 +15,25 @@ namespace gpu { // CUDA implementation entry points: ARB_ARBOR_API void solve_matrix_flat( - fvm_value_type* rhs, - fvm_value_type* d, - const fvm_value_type* u, - const fvm_index_type* p, - const fvm_index_type* cell_cv_divs, + arb_value_type* rhs, + arb_value_type* d, + const arb_value_type* u, + const arb_index_type* p, + const arb_index_type* cell_cv_divs, int num_mtx); ARB_ARBOR_API void assemble_matrix_flat( - fvm_value_type* d, - fvm_value_type* rhs, - const fvm_value_type* invariant_d, - const fvm_value_type* voltage, - const fvm_value_type* current, - const fvm_value_type* conductivity, - const fvm_value_type* cv_capacitance, - const fvm_value_type* cv_area, - const fvm_index_type* cv_to_cell, - const fvm_value_type* dt_intdom, - const fvm_index_type* cell_to_intdom, + arb_value_type* d, + arb_value_type* rhs, + const arb_value_type* invariant_d, + const arb_value_type* voltage, + const arb_value_type* current, + const arb_value_type* conductivity, + const arb_value_type* cv_capacitance, + const arb_value_type* cv_area, + const arb_index_type* cv_to_cell, + const arb_value_type* dt_intdom, + const arb_index_type* cell_to_intdom, unsigned n); /// matrix state diff --git a/arbor/backends/gpu/multi_event_stream.cpp b/arbor/backends/gpu/multi_event_stream.cpp index c96c47d59e1135b06a10005b1d25f006696a9e34..11397df34630d193fdb836a95d4800e5769a121c 100644 --- a/arbor/backends/gpu/multi_event_stream.cpp +++ b/arbor/backends/gpu/multi_event_stream.cpp @@ -9,25 +9,25 @@ namespace gpu { // These wrappers are implemented in the multi_event_stream.cu file, which // is spearately compiled by nvcc, to protect nvcc from having to parse C++17. void mark_until_after_w(unsigned n, - fvm_index_type* mark, - fvm_index_type* span_end, - fvm_value_type* ev_time, - const fvm_value_type* t_until); + arb_index_type* mark, + arb_index_type* span_end, + arb_value_type* ev_time, + const arb_value_type* t_until); void mark_until_w(unsigned n, - fvm_index_type* mark, - fvm_index_type* span_end, - fvm_value_type* ev_time, - const fvm_value_type* t_until); + arb_index_type* mark, + arb_index_type* span_end, + arb_value_type* ev_time, + const arb_value_type* t_until); void drop_marked_events_w(unsigned n, - fvm_index_type* n_nonempty_stream, - fvm_index_type* span_begin, - fvm_index_type* span_end, - fvm_index_type* mark); + arb_index_type* n_nonempty_stream, + arb_index_type* span_begin, + arb_index_type* span_end, + arb_index_type* mark); void event_time_if_before_w(unsigned n, - fvm_index_type* span_begin, - fvm_index_type* span_end, - fvm_value_type* ev_time, - fvm_value_type* t_until); + arb_index_type* span_begin, + arb_index_type* span_end, + arb_value_type* ev_time, + arb_value_type* t_until); void multi_event_stream_base::clear() { memory::fill(span_begin_, 0u); diff --git a/arbor/backends/gpu/multi_event_stream.hpp b/arbor/backends/gpu/multi_event_stream.hpp index 83681db9fa41b920a488bea1b06a56e6e8d975b8..8171c895fbb6ba3245c3f27ca0cb1f7435614484 100644 --- a/arbor/backends/gpu/multi_event_stream.hpp +++ b/arbor/backends/gpu/multi_event_stream.hpp @@ -22,8 +22,8 @@ namespace gpu { class ARB_ARBOR_API multi_event_stream_base { public: using size_type = cell_size_type; - using value_type = fvm_value_type; - using index_type = fvm_index_type; + using value_type = arb_value_type; + using index_type = arb_index_type; using array = memory::device_vector<value_type>; using iarray = memory::device_vector<index_type>; diff --git a/arbor/backends/gpu/shared_state.cpp b/arbor/backends/gpu/shared_state.cpp index 382151b1fbfa6653d9e108a195a36f6edc4bcbfd..2a4583e2085e4777069b918dc19e37311667cf86 100644 --- a/arbor/backends/gpu/shared_state.cpp +++ b/arbor/backends/gpu/shared_state.cpp @@ -27,26 +27,26 @@ namespace gpu { // CUDA implementation entry points: void update_time_to_impl( - std::size_t n, fvm_value_type* time_to, const fvm_value_type* time, - fvm_value_type dt, fvm_value_type tmax); + std::size_t n, arb_value_type* time_to, const arb_value_type* time, + arb_value_type dt, arb_value_type tmax); void update_time_to_impl( - std::size_t n, fvm_value_type* time_to, const fvm_value_type* time, - fvm_value_type dt, fvm_value_type tmax); + std::size_t n, arb_value_type* time_to, const arb_value_type* time, + arb_value_type dt, arb_value_type tmax); void set_dt_impl( - fvm_size_type nintdom, fvm_size_type ncomp, fvm_value_type* dt_intdom, fvm_value_type* dt_comp, - const fvm_value_type* time_to, const fvm_value_type* time, const fvm_index_type* cv_to_intdom); + arb_size_type nintdom, arb_size_type ncomp, arb_value_type* dt_intdom, arb_value_type* dt_comp, + const arb_value_type* time_to, const arb_value_type* time, const arb_index_type* cv_to_intdom); void take_samples_impl( const multi_event_stream_state<raw_probe_info>& s, - const fvm_value_type* time, fvm_value_type* sample_time, fvm_value_type* sample_value); + const arb_value_type* time, arb_value_type* sample_time, arb_value_type* sample_value); -void add_scalar(std::size_t n, fvm_value_type* data, fvm_value_type v); +void add_scalar(std::size_t n, arb_value_type* data, arb_value_type v); // GPU-side minmax: consider CUDA kernel replacement. -std::pair<fvm_value_type, fvm_value_type> minmax_value_impl(fvm_size_type n, const fvm_value_type* v) { - auto v_copy = memory::on_host(memory::const_device_view<fvm_value_type>(v, n)); +std::pair<arb_value_type, arb_value_type> minmax_value_impl(arb_size_type n, const arb_value_type* v) { + auto v_copy = memory::on_host(memory::const_device_view<arb_value_type>(v, n)); return util::minmax_value(v_copy); } @@ -104,12 +104,12 @@ istim_state::istim_state(const fvm_stimulus_config& stim) { using util::assign; // Translate instance-to-CV index from stim to istim_state index vectors. - std::vector<fvm_index_type> accu_index_stage; + std::vector<arb_index_type> accu_index_stage; assign(accu_index_stage, util::index_into(stim.cv, stim.cv_unique)); std::size_t n = accu_index_stage.size(); - std::vector<fvm_value_type> envl_a, envl_t; - std::vector<fvm_index_type> edivs; + std::vector<arb_value_type> envl_a, envl_t; + std::vector<arb_index_type> edivs; frequency_ = make_const_view(stim.frequency); phase_ = make_const_view(stim.phase); @@ -127,7 +127,7 @@ istim_state::istim_state(const fvm_stimulus_config& stim) { util::append(envl_a, stim.envelope_amplitude[i]); util::append(envl_t, stim.envelope_time[i]); - edivs.push_back(fvm_index_type(envl_t.size())); + edivs.push_back(arb_index_type(envl_t.size())); } accu_index_ = make_const_view(accu_index_stage); @@ -179,15 +179,15 @@ void istim_state::add_current(const array& time, const iarray& cv_to_intdom, arr // Shared state methods: shared_state::shared_state( - fvm_size_type n_intdom, - fvm_size_type n_cell, - fvm_size_type n_detector, - const std::vector<fvm_index_type>& cv_to_intdom_vec, - const std::vector<fvm_index_type>& cv_to_cell_vec, - const std::vector<fvm_value_type>& init_membrane_potential, - const std::vector<fvm_value_type>& temperature_K, - const std::vector<fvm_value_type>& diam, - const std::vector<fvm_index_type>& src_to_spike, + arb_size_type n_intdom, + arb_size_type n_cell, + arb_size_type n_detector, + const std::vector<arb_index_type>& cv_to_intdom_vec, + const std::vector<arb_index_type>& cv_to_cell_vec, + const std::vector<arb_value_type>& init_membrane_potential, + const std::vector<arb_value_type>& temperature_K, + const std::vector<arb_value_type>& diam, + const std::vector<arb_index_type>& src_to_spike, unsigned // alignment parameter ignored. ): n_intdom(n_intdom), @@ -469,7 +469,7 @@ void shared_state::ions_init_concentration() { } } -void shared_state::update_time_to(fvm_value_type dt_step, fvm_value_type tmax) { +void shared_state::update_time_to(arb_value_type dt_step, arb_value_type tmax) { update_time_to_impl(n_intdom, time_to.data(), time.data(), dt_step, tmax); } @@ -481,11 +481,11 @@ void shared_state::add_stimulus_current() { stim_data.add_current(time, cv_to_intdom, current_density); } -std::pair<fvm_value_type, fvm_value_type> shared_state::time_bounds() const { +std::pair<arb_value_type, arb_value_type> shared_state::time_bounds() const { return minmax_value_impl(n_intdom, time.data()); } -std::pair<fvm_value_type, fvm_value_type> shared_state::voltage_bounds() const { +std::pair<arb_value_type, arb_value_type> shared_state::voltage_bounds() const { return minmax_value_impl(n_cv, voltage.data()); } diff --git a/arbor/backends/gpu/shared_state.hpp b/arbor/backends/gpu/shared_state.hpp index 20cef451b59e37a1599f570bc9e3c14a914c17a3..083c0315264d3dd976310aa19ba423366e644939 100644 --- a/arbor/backends/gpu/shared_state.hpp +++ b/arbor/backends/gpu/shared_state.hpp @@ -30,7 +30,7 @@ namespace gpu { * Xo_ cao external calcium concentration */ struct ARB_ARBOR_API ion_state { - using solver_type = arb::gpu::diffusion_state<fvm_value_type, fvm_index_type>; + using solver_type = arb::gpu::diffusion_state<arb_value_type, arb_index_type>; using solver_ptr = std::unique_ptr<solver_type>; bool write_eX_; // is eX written? @@ -125,14 +125,14 @@ struct ARB_ARBOR_API shared_state { memory::device_vector<arb_ion_state> ion_states_d_; }; - using cable_solver = arb::gpu::matrix_state_fine<fvm_value_type, fvm_index_type>; + using cable_solver = arb::gpu::matrix_state_fine<arb_value_type, arb_index_type>; cable_solver solver; static constexpr std::size_t alignment = std::max(array::alignment(), iarray::alignment()); - fvm_size_type n_intdom = 0; // Number of distinct integration domains. - fvm_size_type n_detector = 0; // Max number of detectors on all cells. - fvm_size_type n_cv = 0; // Total number of CVs. + arb_size_type n_intdom = 0; // Number of distinct integration domains. + arb_size_type n_detector = 0; // Max number of detectors on all cells. + arb_size_type n_cv = 0; // Total number of CVs. iarray cv_to_intdom; // Maps CV index to intdom index. iarray cv_to_cell; // Maps CV index to cell index. @@ -161,15 +161,15 @@ struct ARB_ARBOR_API shared_state { shared_state() = default; shared_state( - fvm_size_type n_intdom, - fvm_size_type n_cell, - fvm_size_type n_detector, - const std::vector<fvm_index_type>& cv_to_intdom_vec, - const std::vector<fvm_index_type>& cv_to_cell_vec, - const std::vector<fvm_value_type>& init_membrane_potential, - const std::vector<fvm_value_type>& temperature_K, - const std::vector<fvm_value_type>& diam, - const std::vector<fvm_index_type>& src_to_spike, + arb_size_type n_intdom, + arb_size_type n_cell, + arb_size_type n_detector, + const std::vector<arb_index_type>& cv_to_intdom_vec, + const std::vector<arb_index_type>& cv_to_cell_vec, + const std::vector<arb_value_type>& init_membrane_potential, + const std::vector<arb_value_type>& temperature_K, + const std::vector<arb_value_type>& diam, + const std::vector<arb_index_type>& src_to_spike, unsigned // align parameter ignored ); @@ -194,7 +194,7 @@ struct ARB_ARBOR_API shared_state { void ions_init_concentration(); // Set time_to to earliest of time+dt_step and tmax. - void update_time_to(fvm_value_type dt_step, fvm_value_type tmax); + void update_time_to(arb_value_type dt_step, arb_value_type tmax); // Set the per-intdom and per-compartment dt from time_to - time. void set_dt(); @@ -207,11 +207,11 @@ struct ARB_ARBOR_API shared_state { void integrate_diffusion(); // Return minimum and maximum time value [ms] across cells. - std::pair<fvm_value_type, fvm_value_type> time_bounds() const; + std::pair<arb_value_type, arb_value_type> time_bounds() const; // Return minimum and maximum voltage value [mV] across cells. // (Used for solution bounds checking.) - std::pair<fvm_value_type, fvm_value_type> voltage_bounds() const; + std::pair<arb_value_type, arb_value_type> voltage_bounds() const; // Take samples according to marked events in a sample_event_stream. void take_samples( diff --git a/arbor/backends/gpu/stimulus.hpp b/arbor/backends/gpu/stimulus.hpp index 736c0a160748ddf2bc2cbcc4ecc54366c7c2329f..1f44ecfd6bbc772b0c23e1310d474b73636de346 100644 --- a/arbor/backends/gpu/stimulus.hpp +++ b/arbor/backends/gpu/stimulus.hpp @@ -10,20 +10,20 @@ namespace gpu { struct istim_pp { // Stimulus constant and mutable data: - const fvm_index_type* accu_index; - const fvm_index_type* accu_to_cv; - const fvm_value_type* frequency; - const fvm_value_type* phase; - const fvm_value_type* envl_amplitudes; - const fvm_value_type* envl_times; - const fvm_index_type* envl_divs; - fvm_value_type* accu_stim; - fvm_index_type* envl_index; + const arb_index_type* accu_index; + const arb_index_type* accu_to_cv; + const arb_value_type* frequency; + const arb_value_type* phase; + const arb_value_type* envl_amplitudes; + const arb_value_type* envl_times; + const arb_index_type* envl_divs; + arb_value_type* accu_stim; + arb_index_type* envl_index; // Pointers to shared state data: - const fvm_value_type* time; - const fvm_index_type* cv_to_intdom; - fvm_value_type* current_density; + const arb_value_type* time; + const arb_index_type* cv_to_intdom; + arb_value_type* current_density; }; ARB_ARBOR_API void istim_add_current_impl(int n, const istim_pp& pp); diff --git a/arbor/backends/gpu/threshold_watcher.hpp b/arbor/backends/gpu/threshold_watcher.hpp index 2c391281c3908d02696d18c22711bb2600fd85b5..199565b284be2e5548f35f8ab40d1bdeca32d840 100644 --- a/arbor/backends/gpu/threshold_watcher.hpp +++ b/arbor/backends/gpu/threshold_watcher.hpp @@ -22,16 +22,16 @@ namespace gpu { void test_thresholds_impl( int size, - const fvm_index_type* cv_to_intdom, const fvm_value_type* t_after, const fvm_value_type* t_before, - const fvm_index_type* src_to_spike, fvm_value_type* time_since_spike, stack_storage<threshold_crossing>& stack, - fvm_index_type* is_crossed, fvm_value_type* prev_values, - const fvm_index_type* cv_index, const fvm_value_type* values, const fvm_value_type* thresholds, + const arb_index_type* cv_to_intdom, const arb_value_type* t_after, const arb_value_type* t_before, + const arb_index_type* src_to_spike, arb_value_type* time_since_spike, stack_storage<threshold_crossing>& stack, + arb_index_type* is_crossed, arb_value_type* prev_values, + const arb_index_type* cv_index, const arb_value_type* values, const arb_value_type* thresholds, bool record); void reset_crossed_impl( int size, - fvm_index_type* is_crossed, - const fvm_index_type* cv_index, const fvm_value_type* values, const fvm_value_type* thresholds); + arb_index_type* is_crossed, + const arb_index_type* cv_index, const arb_value_type* values, const arb_value_type* thresholds); class threshold_watcher { @@ -45,13 +45,13 @@ public: threshold_watcher(const execution_context& ctx): stack_(ctx.gpu) {} threshold_watcher( - const fvm_index_type* cv_to_intdom, - const fvm_index_type* src_to_spike, + const arb_index_type* cv_to_intdom, + const arb_index_type* src_to_spike, const array* t_before, const array* t_after, - const fvm_size_type num_cv, - const std::vector<fvm_index_type>& detector_cv_idx, - const std::vector<fvm_value_type>& thresholds, + const arb_size_type num_cv, + const std::vector<arb_index_type>& detector_cv_idx, + const std::vector<arb_value_type>& thresholds, const execution_context& ctx ): cv_to_intdom_(cv_to_intdom), @@ -136,9 +136,9 @@ private: /// Non-owning pointers to cv-to-intdom map, /// the values for to test against thresholds, /// and pointers to the time arrays - const fvm_index_type* cv_to_intdom_ = nullptr; - const fvm_value_type* values_ = nullptr; - const fvm_index_type* src_to_spike_ = nullptr; + const arb_index_type* cv_to_intdom_ = nullptr; + const arb_value_type* values_ = nullptr; + const arb_index_type* src_to_spike_ = nullptr; const array* t_before_ptr_ = nullptr; const array* t_after_ptr_ = nullptr; diff --git a/arbor/backends/multi_event_stream_state.hpp b/arbor/backends/multi_event_stream_state.hpp index 5331cd9e3dae13ec76ff9a9a92654f8dd6e44b0e..931dd551c930bb3cb14c3c2eecce10cbd7179c9b 100644 --- a/arbor/backends/multi_event_stream_state.hpp +++ b/arbor/backends/multi_event_stream_state.hpp @@ -11,20 +11,20 @@ template <typename EvData> struct multi_event_stream_state { using value_type = EvData; - fvm_size_type n; // number of streams + arb_size_type n; // number of streams const value_type* ev_data; // array of event data items - const fvm_index_type* begin_offset; // array of offsets to beginning of marked events - const fvm_index_type* end_offset; // array of offsets to end of marked events + const arb_index_type* begin_offset; // array of offsets to beginning of marked events + const arb_index_type* end_offset; // array of offsets to end of marked events - fvm_size_type n_streams() const { + arb_size_type n_streams() const { return n; } - const value_type* begin_marked(fvm_index_type i) const { + const value_type* begin_marked(arb_index_type i) const { return ev_data+begin_offset[i]; } - const value_type* end_marked(fvm_index_type i) const { + const value_type* end_marked(arb_index_type i) const { return ev_data+end_offset[i]; } }; diff --git a/arbor/backends/multicore/diffusion_solver.hpp b/arbor/backends/multicore/diffusion_solver.hpp index 112c646cbe0865645176713519db6c25892a293c..3df25a6d128eb1bd7dd41816bda923c217a4be22 100644 --- a/arbor/backends/multicore/diffusion_solver.hpp +++ b/arbor/backends/multicore/diffusion_solver.hpp @@ -80,7 +80,7 @@ struct diffusion_solver { // current density [A.m^-2] (per control volume and species) // diffusivity [???] (per control volume) // charge [e] - void assemble(const_view dt_intdom, const_view concentration, const_view voltage, const_view current, const_view conductivity, fvm_value_type q) { + void assemble(const_view dt_intdom, const_view concentration, const_view voltage, const_view current, const_view conductivity, arb_value_type q) { auto cell_cv_part = util::partition_view(cell_cv_divs); index_type ncells = cell_cv_part.size(); // loop over submatrices diff --git a/arbor/backends/multicore/fvm.hpp b/arbor/backends/multicore/fvm.hpp index fb0e17cbb4ee371526ffe6210370e36508201129..c65997efd4c06ced0e206cb3d1b9651637a74eb8 100644 --- a/arbor/backends/multicore/fvm.hpp +++ b/arbor/backends/multicore/fvm.hpp @@ -24,9 +24,9 @@ struct backend { static bool is_supported() { return true; } static std::string name() { return "cpu"; } - using value_type = fvm_value_type; - using index_type = fvm_index_type; - using size_type = fvm_size_type; + using value_type = arb_value_type; + using index_type = arb_index_type; + using size_type = arb_size_type; using array = arb::multicore::array; using iarray = arb::multicore::iarray; @@ -66,7 +66,7 @@ struct backend { context); } - static fvm_value_type* mechanism_field_data(arb::mechanism* mptr, const std::string& field); + static value_type* mechanism_field_data(arb::mechanism* mptr, const std::string& field); }; } // namespace multicore diff --git a/arbor/backends/multicore/multi_event_stream.hpp b/arbor/backends/multicore/multi_event_stream.hpp index 03c2c29df3bc727995d03c9a3c92cc8338f9ff9d..7ff24eb3633368a9ea6407fa406b0b54551327bf 100644 --- a/arbor/backends/multicore/multi_event_stream.hpp +++ b/arbor/backends/multicore/multi_event_stream.hpp @@ -23,8 +23,8 @@ namespace multicore { template <typename Event> class multi_event_stream { public: - using size_type = fvm_size_type; - using index_type = fvm_index_type; + using size_type = arb_size_type; + using index_type = arb_index_type; using event_type = Event; using event_time_type = ::arb::event_time_type<Event>; diff --git a/arbor/backends/multicore/multicore_common.hpp b/arbor/backends/multicore/multicore_common.hpp index b0b3ed4ec0b01aacfd8cb6113f0f3d60a57e25c1..c7b236047193225044ebb89ab36dd0f82db67c80 100644 --- a/arbor/backends/multicore/multicore_common.hpp +++ b/arbor/backends/multicore/multicore_common.hpp @@ -21,8 +21,8 @@ namespace multicore { template <typename V> using padded_vector = std::vector<V, util::padded_allocator<V>>; -using array = padded_vector<fvm_value_type>; -using iarray = padded_vector<fvm_index_type>; +using array = padded_vector<arb_value_type>; +using iarray = padded_vector<arb_index_type>; using deliverable_event_stream = arb::multicore::multi_event_stream<deliverable_event>; using sample_event_stream = arb::multicore::multi_event_stream<sample_event>; diff --git a/arbor/backends/multicore/shared_state.cpp b/arbor/backends/multicore/shared_state.cpp index ccc1a8024f02aaf9024af019e8e27361a4d45da3..3205034ee22b2bdbbc719d41cc114009745165ba 100644 --- a/arbor/backends/multicore/shared_state.cpp +++ b/arbor/backends/multicore/shared_state.cpp @@ -35,9 +35,9 @@ using util::make_span; using util::ptr_by_key; using util::value_by_key; -constexpr unsigned vector_length = (unsigned) simd::simd_abi::native_width<fvm_value_type>::value; -using simd_value_type = simd::simd<fvm_value_type, vector_length, simd::simd_abi::default_abi>; -using simd_index_type = simd::simd<fvm_index_type, vector_length, simd::simd_abi::default_abi>; +constexpr unsigned vector_length = (unsigned) simd::simd_abi::native_width<arb_value_type>::value; +using simd_value_type = simd::simd<arb_value_type, vector_length, simd::simd_abi::default_abi>; +using simd_index_type = simd::simd<arb_index_type, vector_length, simd::simd_abi::default_abi>; const int simd_width = simd::width<simd_value_type>(); // Pick alignment compatible with native SIMD width for explicitly @@ -47,7 +47,7 @@ const int simd_width = simd::width<simd_value_type>(); // these up to the compiler to optimize/auto-vectorize. inline unsigned min_alignment(unsigned align) { - unsigned simd_align = sizeof(fvm_value_type)*simd_width; + unsigned simd_align = sizeof(arb_value_type)*simd_width; return math::next_pow2(std::max(align, simd_align)); } @@ -116,8 +116,8 @@ istim_state::istim_state(const fvm_stimulus_config& stim, unsigned align): accu_stim_.resize(accu_to_cv_.size()); std::size_t n = accu_index_.size(); - std::vector<fvm_value_type> envl_a, envl_t; - std::vector<fvm_index_type> edivs; + std::vector<arb_value_type> envl_a, envl_t; + std::vector<arb_index_type> edivs; arb_assert(n==frequency_.size()); arb_assert(n==stim.envelope_time.size()); @@ -132,7 +132,7 @@ istim_state::istim_state(const fvm_stimulus_config& stim, unsigned align): util::append(envl_a, stim.envelope_amplitude[i]); util::append(envl_t, stim.envelope_time[i]); - edivs.push_back(fvm_index_type(envl_t.size())); + edivs.push_back(arb_index_type(envl_t.size())); } assign(envl_amplitudes_, envl_a); @@ -161,16 +161,16 @@ void istim_state::add_current(const array& time, const iarray& cv_to_intdom, arr // - the next envelope time is greater than simulation time, or // - it is the last valid index for the envelope. - fvm_index_type ei_left = envl_divs_[i]; - fvm_index_type ei_right = envl_divs_[i+1]; + arb_index_type ei_left = envl_divs_[i]; + arb_index_type ei_right = envl_divs_[i+1]; - fvm_index_type ai = accu_index_[i]; - fvm_index_type cv = accu_to_cv_[ai]; + arb_index_type ai = accu_index_[i]; + arb_index_type cv = accu_to_cv_[ai]; double t = time[cv_to_intdom[cv]]; if (ei_left==ei_right || t<envl_times_[ei_left]) continue; - fvm_index_type& ei = envl_index_[i]; + arb_index_type& ei = envl_index_[i]; while (ei+1<ei_right && envl_times_[ei+1]<=t) ++ei; double J = envl_amplitudes_[ei]; // current density (A/m²) @@ -194,15 +194,15 @@ void istim_state::add_current(const array& time, const iarray& cv_to_intdom, arr // shared_state methods: shared_state::shared_state( - fvm_size_type n_intdom, - fvm_size_type n_cell, - fvm_size_type n_detector, - const std::vector<fvm_index_type>& cv_to_intdom_vec, - const std::vector<fvm_index_type>& cv_to_cell_vec, - const std::vector<fvm_value_type>& init_membrane_potential, - const std::vector<fvm_value_type>& temperature_K, - const std::vector<fvm_value_type>& diam, - const std::vector<fvm_index_type>& src_to_spike, + arb_size_type n_intdom, + arb_size_type n_cell, + arb_size_type n_detector, + const std::vector<arb_index_type>& cv_to_intdom_vec, + const std::vector<arb_index_type>& cv_to_cell_vec, + const std::vector<arb_value_type>& init_membrane_potential, + const std::vector<arb_value_type>& temperature_K, + const std::vector<arb_value_type>& diam, + const std::vector<arb_index_type>& src_to_spike, unsigned align ): alignment(min_alignment(align)), @@ -307,12 +307,12 @@ void shared_state::ions_init_concentration() { } } -void shared_state::update_time_to(fvm_value_type dt_step, fvm_value_type tmax) { +void shared_state::update_time_to(arb_value_type dt_step, arb_value_type tmax) { using simd::assign; using simd::indirect; using simd::add; using simd::min; - for (fvm_size_type i = 0; i<n_intdom; i+=simd_width) { + for (arb_size_type i = 0; i<n_intdom; i+=simd_width) { simd_value_type t; assign(t, indirect(time.data()+i, simd_width)); t = min(add(t, dt_step), tmax); @@ -324,7 +324,7 @@ void shared_state::set_dt() { using simd::assign; using simd::indirect; using simd::sub; - for (fvm_size_type j = 0; j<n_intdom; j+=simd_width) { + for (arb_size_type j = 0; j<n_intdom; j+=simd_width) { simd_value_type t, t_to; assign(t, indirect(time.data()+j, simd_width)); assign(t_to, indirect(time_to.data()+j, simd_width)); @@ -333,7 +333,7 @@ void shared_state::set_dt() { indirect(dt_intdom.data()+j, simd_width) = dt; } - for (fvm_size_type i = 0; i<n_cv; i+=simd_width) { + for (arb_size_type i = 0; i<n_cv; i+=simd_width) { simd_index_type intdom_idx; assign(intdom_idx, indirect(cv_to_intdom.data()+i, simd_width)); @@ -347,11 +347,11 @@ void shared_state::add_stimulus_current() { stim_data.add_current(time, cv_to_intdom, current_density); } -std::pair<fvm_value_type, fvm_value_type> shared_state::time_bounds() const { +std::pair<arb_value_type, arb_value_type> shared_state::time_bounds() const { return util::minmax_value(time); } -std::pair<fvm_value_type, fvm_value_type> shared_state::voltage_bounds() const { +std::pair<arb_value_type, arb_value_type> shared_state::voltage_bounds() const { return util::minmax_value(voltage); } @@ -360,7 +360,7 @@ void shared_state::take_samples( array& sample_time, array& sample_value) { - for (fvm_size_type i = 0; i<s.n_streams(); ++i) { + for (arb_size_type i = 0; i<s.n_streams(); ++i) { auto begin = s.begin_marked(i); auto end = s.end_marked(i); diff --git a/arbor/backends/multicore/shared_state.hpp b/arbor/backends/multicore/shared_state.hpp index 149cc152da4fc8875504ddcd62d7a3798896c686..54edbdf6f7bfc0753f891f20ac1fb124550922ed 100644 --- a/arbor/backends/multicore/shared_state.hpp +++ b/arbor/backends/multicore/shared_state.hpp @@ -134,9 +134,9 @@ struct ARB_ARBOR_API shared_state { unsigned alignment = 1; // Alignment and padding multiple. util::padded_allocator<> alloc; // Allocator with corresponging alignment/padding. - fvm_size_type n_intdom = 0; // Number of integration domains. - fvm_size_type n_detector = 0; // Max number of detectors on all cells. - fvm_size_type n_cv = 0; // Total number of CVs. + arb_size_type n_intdom = 0; // Number of integration domains. + arb_size_type n_detector = 0; // Max number of detectors on all cells. + arb_size_type n_cv = 0; // Total number of CVs. iarray cv_to_intdom; // Maps CV index to integration domain index. iarray cv_to_cell; // Maps CV index to the first spike @@ -165,15 +165,15 @@ struct ARB_ARBOR_API shared_state { shared_state() = default; shared_state( - fvm_size_type n_intdom, - fvm_size_type n_cell, - fvm_size_type n_detector, - const std::vector<fvm_index_type>& cv_to_intdom_vec, - const std::vector<fvm_index_type>& cv_to_cell_vec, - const std::vector<fvm_value_type>& init_membrane_potential, - const std::vector<fvm_value_type>& temperature_K, - const std::vector<fvm_value_type>& diam, - const std::vector<fvm_index_type>& src_to_spike, + arb_size_type n_intdom, + arb_size_type n_cell, + arb_size_type n_detector, + const std::vector<arb_index_type>& cv_to_intdom_vec, + const std::vector<arb_index_type>& cv_to_cell_vec, + const std::vector<arb_value_type>& init_membrane_potential, + const std::vector<arb_value_type>& temperature_K, + const std::vector<arb_value_type>& diam, + const std::vector<arb_index_type>& src_to_spike, unsigned align ); @@ -195,10 +195,10 @@ struct ARB_ARBOR_API shared_state { void ions_init_concentration(); - void ions_nernst_reversal_potential(fvm_value_type temperature_K); + void ions_nernst_reversal_potential(arb_value_type temperature_K); // Set time_to to earliest of time+dt_step and tmax. - void update_time_to(fvm_value_type dt_step, fvm_value_type tmax); + void update_time_to(arb_value_type dt_step, arb_value_type tmax); // Set the per-integration domain and per-compartment dt from time_to - time. void set_dt(); @@ -211,11 +211,11 @@ struct ARB_ARBOR_API shared_state { void integrate_diffusion(); // Return minimum and maximum time value [ms] across cells. - std::pair<fvm_value_type, fvm_value_type> time_bounds() const; + std::pair<arb_value_type, arb_value_type> time_bounds() const; // Return minimum and maximum voltage value [mV] across cells. // (Used for solution bounds checking.) - std::pair<fvm_value_type, fvm_value_type> voltage_bounds() const; + std::pair<arb_value_type, arb_value_type> voltage_bounds() const; // Take samples according to marked events in a sample_event_stream. void take_samples( diff --git a/arbor/backends/multicore/threshold_watcher.hpp b/arbor/backends/multicore/threshold_watcher.hpp index 76a260d341fb8420e54f585ba6d2296fbd74a2ef..755c15919c830217e0b41f18c6d904a4c7931c8d 100644 --- a/arbor/backends/multicore/threshold_watcher.hpp +++ b/arbor/backends/multicore/threshold_watcher.hpp @@ -18,13 +18,13 @@ public: threshold_watcher(const execution_context& ctx) {} threshold_watcher( - const fvm_index_type* cv_to_intdom, - const fvm_index_type* src_to_spike, + const arb_index_type* cv_to_intdom, + const arb_index_type* src_to_spike, const array* t_before, const array* t_after, - const fvm_size_type num_cv, - const std::vector<fvm_index_type>& cv_index, - const std::vector<fvm_value_type>& thresholds, + const arb_size_type num_cv, + const std::vector<arb_index_type>& cv_index, + const std::vector<arb_value_type>& thresholds, const execution_context& context ): cv_to_intdom_(cv_to_intdom), @@ -54,7 +54,7 @@ public: values_ = values.data(); std::copy(values.begin(), values.end(), v_prev_.begin()); clear_crossings(); - for (fvm_size_type i = 0; i<n_cv_; ++i) { + for (arb_size_type i = 0; i<n_cv_; ++i) { is_crossed_[i] = values_[cv_index_[i]]>=thresholds_[i]; } } @@ -70,15 +70,15 @@ public: arb_assert(values_); // Reset all spike times to -1.0 indicating no spike has been recorded on the detector - const fvm_value_type* t_before = t_before_ptr_->data(); - const fvm_value_type* t_after = t_after_ptr_->data(); - for (fvm_size_type i = 0; i<n_cv_; ++i) { + const arb_value_type* t_before = t_before_ptr_->data(); + const arb_value_type* t_after = t_after_ptr_->data(); + for (arb_size_type i = 0; i<n_cv_; ++i) { auto cv = cv_index_[i]; auto intdom = cv_to_intdom_[cv]; auto v_prev = v_prev_[cv]; auto v = values_[cv]; auto thresh = thresholds_[i]; - fvm_index_type spike_idx = 0; + arb_index_type spike_idx = 0; if (!time_since_spike->empty()) { spike_idx = src_to_spike_[i]; @@ -110,7 +110,7 @@ public: } } - bool is_crossed(fvm_size_type i) const { + bool is_crossed(arb_size_type i) const { return is_crossed_[i]; } @@ -123,18 +123,18 @@ private: /// Non-owning pointers to cv-to-intdom map, /// the values for to test against thresholds, /// and pointers to the time arrays - const fvm_index_type* cv_to_intdom_ = nullptr; - const fvm_value_type* values_ = nullptr; - const fvm_index_type* src_to_spike_ = nullptr; + const arb_index_type* cv_to_intdom_ = nullptr; + const arb_value_type* values_ = nullptr; + const arb_index_type* src_to_spike_ = nullptr; const array* t_before_ptr_ = nullptr; const array* t_after_ptr_ = nullptr; /// Threshold watcher state. - fvm_size_type n_cv_ = 0; - std::vector<fvm_index_type> cv_index_; - std::vector<fvm_size_type> is_crossed_; - std::vector<fvm_value_type> thresholds_; - std::vector<fvm_value_type> v_prev_; + arb_size_type n_cv_ = 0; + std::vector<arb_index_type> cv_index_; + std::vector<arb_size_type> is_crossed_; + std::vector<arb_value_type> thresholds_; + std::vector<arb_value_type> v_prev_; std::vector<threshold_crossing> crossings_; }; diff --git a/arbor/backends/threshold_crossing.hpp b/arbor/backends/threshold_crossing.hpp index 3e5829d6552f465a439dd4be85d8095139d8b448..18a61822e37a027bc728a98e7695316210ac2f9f 100644 --- a/arbor/backends/threshold_crossing.hpp +++ b/arbor/backends/threshold_crossing.hpp @@ -7,8 +7,8 @@ namespace arb { // Representation of a single crossing event. struct threshold_crossing { - fvm_size_type index; // index of variable - fvm_value_type time; // time of crossing + arb_size_type index; // index of variable + arb_value_type time; // time of crossing friend bool operator==(threshold_crossing l, threshold_crossing r) { return l.index==r.index && l.time==r.time; diff --git a/arbor/fvm_layout.cpp b/arbor/fvm_layout.cpp index 20b4aa7e9a0b7c9cce1e7dd4833ad660631128e5..b68bf7e5139f769397a47bfac3d4b799fa9ef08d 100644 --- a/arbor/fvm_layout.cpp +++ b/arbor/fvm_layout.cpp @@ -97,7 +97,7 @@ cv_geometry::cv_geometry(const cable_cell& cell, const locset& ls): // Build location query map. auto n_cv = cv_parent.size(); branch_cv_map.resize(1); - std::vector<util::pw_elements<fvm_size_type>>& bmap = branch_cv_map.back(); + std::vector<util::pw_elements<arb_size_type>>& bmap = branch_cv_map.back(); for (auto cv: util::make_span(n_cv)) { for (auto cable: cables(cv)) { if (cable.branch>=bmap.size()) { @@ -109,10 +109,10 @@ cv_geometry::cv_geometry(const cable_cell& cell, const locset& ls): } } cv_to_cell.assign(n_cv, 0); - cell_cv_divs = {0, (fvm_index_type)n_cv}; + cell_cv_divs = {0, (arb_index_type)n_cv}; } -fvm_size_type cv_geometry::location_cv(size_type cell_idx, const mlocation& loc, cv_prefer::type prefer) const { +arb_size_type cv_geometry::location_cv(size_type cell_idx, const mlocation& loc, cv_prefer::type prefer) const { auto& pw_cv_offset = branch_cv_map.at(cell_idx).at(loc.branch); auto zero_extent = [&pw_cv_offset](auto j) { return pw_cv_offset.extent(j).first==pw_cv_offset.extent(j).second; @@ -358,7 +358,7 @@ ARB_ARBOR_API fvm_cv_discretization fvm_cv_discretize(const cable_cell& cell, co info.face_diffusivity[i] = 0.0; } - fvm_index_type p = D.geometry.cv_parent[i]; + arb_index_type p = D.geometry.cv_parent[i]; if (p!=-1) { auto parent_cables = D.geometry.cables(p); msize_t bid = cv_cables.front().branch; @@ -465,7 +465,7 @@ ARB_ARBOR_API fvm_cv_discretization fvm_cv_discretize(const std::vector<cable_ce // site. struct voltage_reference { - fvm_index_type cv = -1; + arb_index_type cv = -1; mlocation loc; }; @@ -512,7 +512,7 @@ bool cables_intersect_location(Seq&& cables, const mlocation& x) { [&x](const mcable& c) { return c.prox_pos<=x.pos && x.pos<=c.dist_pos; }); } -voltage_reference_pair fvm_voltage_reference_points(const morphology& morph, const cv_geometry& geom, fvm_size_type cell_idx, const mlocation& site) { +voltage_reference_pair fvm_voltage_reference_points(const morphology& morph, const cv_geometry& geom, arb_size_type cell_idx, const mlocation& site) { voltage_reference site_ref, parent_ref, child_ref; bool check_parent = true, check_child = true; msize_t bid = site.branch; @@ -602,7 +602,7 @@ voltage_reference_pair fvm_voltage_reference_points(const morphology& morph, con // Interpolate membrane voltage from reference points in adjacent CVs. -ARB_ARBOR_API fvm_voltage_interpolant fvm_interpolate_voltage(const cable_cell& cell, const fvm_cv_discretization& D, fvm_size_type cell_idx, const mlocation& site) { +ARB_ARBOR_API fvm_voltage_interpolant fvm_interpolate_voltage(const cable_cell& cell, const fvm_cv_discretization& D, arb_size_type cell_idx, const mlocation& site) { auto& embedding = cell.embedding(); fvm_voltage_interpolant vi; @@ -643,7 +643,7 @@ ARB_ARBOR_API fvm_voltage_interpolant fvm_interpolate_voltage(const cable_cell& // Axial current as linear combination of membrane voltages at reference points in adjacent CVs. -ARB_ARBOR_API fvm_voltage_interpolant fvm_axial_current(const cable_cell& cell, const fvm_cv_discretization& D, fvm_size_type cell_idx, const mlocation& site) { +ARB_ARBOR_API fvm_voltage_interpolant fvm_axial_current(const cable_cell& cell, const fvm_cv_discretization& D, arb_size_type cell_idx, const mlocation& site) { auto& embedding = cell.embedding(); fvm_voltage_interpolant vi; @@ -680,7 +680,7 @@ fvm_mechanism_data& append(fvm_mechanism_data& left, const fvm_mechanism_data& r using impl::append_offset; using impl::append_divs; - fvm_size_type target_offset = left.n_target; + arb_size_type target_offset = left.n_target; for (const auto& [k, R]: right.ions) { fvm_ion_config& L = left.ions[k]; @@ -744,13 +744,13 @@ fvm_mechanism_data& append(fvm_mechanism_data& left, const fvm_mechanism_data& r return left; } -ARB_ARBOR_API std::unordered_map<cell_member_type, fvm_size_type> fvm_build_gap_junction_cv_map( +ARB_ARBOR_API std::unordered_map<cell_member_type, arb_size_type> fvm_build_gap_junction_cv_map( const std::vector<cable_cell>& cells, const std::vector<cell_gid_type>& gids, const fvm_cv_discretization& D) { arb_assert(cells.size() == gids.size()); - std::unordered_map<cell_member_type, fvm_size_type> gj_cvs; + std::unordered_map<cell_member_type, arb_size_type> gj_cvs; for (auto cell_idx: util::make_span(0, cells.size())) { for (const auto& mech : cells[cell_idx].junctions()) { for (const auto& gj: mech.second) { @@ -764,7 +764,7 @@ ARB_ARBOR_API std::unordered_map<cell_member_type, fvm_size_type> fvm_build_gap_ ARB_ARBOR_API std::unordered_map<cell_gid_type, std::vector<fvm_gap_junction>> fvm_resolve_gj_connections( const std::vector<cell_gid_type>& gids, const cell_label_range& gj_data, - const std::unordered_map<cell_member_type, fvm_size_type>& gj_cvs, + const std::unordered_map<cell_member_type, arb_size_type>& gj_cvs, const recipe& rec) { // Construct and resolve all gj_connections. @@ -794,7 +794,7 @@ fvm_mechanism_data fvm_build_mechanism_data( const cable_cell& cell, const std::vector<fvm_gap_junction>& gj_conns, const fvm_cv_discretization& D, - fvm_size_type cell_idx); + arb_size_type cell_idx); ARB_ARBOR_API fvm_mechanism_data fvm_build_mechanism_data( const cable_cell_global_properties& gprop, @@ -823,11 +823,11 @@ fvm_mechanism_data fvm_build_mechanism_data( const cable_cell& cell, const std::vector<fvm_gap_junction>& gj_conns, const fvm_cv_discretization& D, - fvm_size_type cell_idx) + arb_size_type cell_idx) { - using size_type = fvm_size_type; - using index_type = fvm_index_type; - using value_type = fvm_value_type; + using size_type = arb_size_type; + using index_type = arb_index_type; + using value_type = arb_value_type; const mechanism_catalogue& catalogue = gprop.catalogue; const auto& embedding = cell.embedding(); diff --git a/arbor/fvm_layout.hpp b/arbor/fvm_layout.hpp index 2c26a398c5eee500f0794dfdfc97fae5791ddf91..d80575f55fbad0b1a865ff98f3f177b182933bda 100644 --- a/arbor/fvm_layout.hpp +++ b/arbor/fvm_layout.hpp @@ -59,8 +59,8 @@ namespace cv_prefer { struct ARB_ARBOR_API cv_geometry: public cell_cv_data_impl { using base = cell_cv_data_impl; - using size_type = fvm_size_type; - using index_type = fvm_index_type; + using size_type = arb_size_type; + using index_type = arb_index_type; std::vector<index_type> cv_to_cell; // Maps CV index to cell index. std::vector<index_type> cell_cv_divs; // Partitions CV indices by cell. @@ -138,15 +138,15 @@ ARB_ARBOR_API cv_geometry& append(cv_geometry&, const cv_geometry&); // midpoint of an unbranched CV. struct fvm_diffusion_info { - using value_type = fvm_value_type; + using value_type = arb_value_type; std::vector<value_type> face_diffusivity; std::vector<std::vector<pw_constant_fn>> axial_inv_diffusivity; }; struct fvm_cv_discretization { - using size_type = fvm_size_type; - using index_type = fvm_index_type; - using value_type = fvm_value_type; + using size_type = arb_size_type; + using index_type = arb_index_type; + using value_type = arb_value_type; cv_geometry geometry; @@ -184,22 +184,22 @@ ARB_ARBOR_API fvm_cv_discretization fvm_cv_discretize(const std::vector<cable_ce // interpolation) or the parent of the distal CV. struct fvm_voltage_interpolant { - fvm_index_type proximal_cv, distal_cv; - fvm_value_type proximal_coef, distal_coef; + arb_index_type proximal_cv, distal_cv; + arb_value_type proximal_coef, distal_coef; }; // Interpolated membrane voltage. -ARB_ARBOR_API fvm_voltage_interpolant fvm_interpolate_voltage(const cable_cell& cell, const fvm_cv_discretization& D, fvm_size_type cell_idx, const mlocation& site); +ARB_ARBOR_API fvm_voltage_interpolant fvm_interpolate_voltage(const cable_cell& cell, const fvm_cv_discretization& D, arb_size_type cell_idx, const mlocation& site); // Axial current as linear combiantion of voltages. -ARB_ARBOR_API fvm_voltage_interpolant fvm_axial_current(const cable_cell& cell, const fvm_cv_discretization& D, fvm_size_type cell_idx, const mlocation& site); +ARB_ARBOR_API fvm_voltage_interpolant fvm_axial_current(const cable_cell& cell, const fvm_cv_discretization& D, arb_size_type cell_idx, const mlocation& site); // Post-discretization data for point and density mechanism instantiation. struct fvm_mechanism_config { - using value_type = fvm_value_type; - using index_type = fvm_index_type; + using value_type = arb_value_type; + using index_type = arb_index_type; arb_mechanism_kind kind; @@ -230,8 +230,8 @@ struct fvm_mechanism_config { // Post-discretization data for ion channel state. struct fvm_ion_config { - using value_type = fvm_value_type; - using index_type = fvm_index_type; + using value_type = arb_value_type; + using index_type = arb_index_type; // Keep track whether eX, Xi, Xo are actually to be reset. bool revpot_written = false; @@ -258,8 +258,8 @@ struct fvm_ion_config { }; struct fvm_stimulus_config { - using value_type = fvm_value_type; - using index_type = fvm_index_type; + using value_type = arb_value_type; + using index_type = arb_index_type; // CV index for each stimulus instance; monotonically increasing. std::vector<index_type> cv; @@ -276,7 +276,7 @@ struct fvm_stimulus_config { }; // Maps gj {gid, lid} locations on a cell to their CV indices. -ARB_ARBOR_API std::unordered_map<cell_member_type, fvm_size_type> fvm_build_gap_junction_cv_map( +ARB_ARBOR_API std::unordered_map<cell_member_type, arb_size_type> fvm_build_gap_junction_cv_map( const std::vector<cable_cell>& cells, const std::vector<cell_gid_type>& gids, const fvm_cv_discretization& D); @@ -285,7 +285,7 @@ ARB_ARBOR_API std::unordered_map<cell_member_type, fvm_size_type> fvm_build_gap_ ARB_ARBOR_API std::unordered_map<cell_gid_type, std::vector<fvm_gap_junction>> fvm_resolve_gj_connections( const std::vector<cell_gid_type>& gids, const cell_label_range& gj_data, - const std::unordered_map<cell_member_type, fvm_size_type>& gj_cv, + const std::unordered_map<cell_member_type, arb_size_type>& gj_cv, const recipe& rec); struct fvm_mechanism_data { diff --git a/arbor/fvm_lowered_cell.hpp b/arbor/fvm_lowered_cell.hpp index 0316907b59a5bbe096ce55812a19efd368053f04..9dba2adecc65096881c7aa1c1cd8d32a661b1880 100644 --- a/arbor/fvm_lowered_cell.hpp +++ b/arbor/fvm_lowered_cell.hpp @@ -28,8 +28,8 @@ namespace arb { struct fvm_integration_result { util::range<const threshold_crossing*> crossings; - util::range<const fvm_value_type*> sample_time; - util::range<const fvm_value_type*> sample_value; + util::range<const arb_value_type*> sample_time; + util::range<const arb_value_type*> sample_value; }; // A sample for a probe may be derived from multiple 'raw' sampled @@ -196,7 +196,7 @@ struct probe_association_map { struct fvm_initialization_data { // Map from gid to integration domain id - std::vector<fvm_index_type> cell_to_intdom; + std::vector<arb_index_type> cell_to_intdom; // Handles for accessing lowered cell. std::vector<target_handle> target_handles; @@ -210,8 +210,8 @@ struct fvm_initialization_data { cell_label_range gap_junction_data; // Maps storing number of sources/targets per cell. - std::unordered_map<cell_gid_type, fvm_size_type> num_sources; - std::unordered_map<cell_gid_type, fvm_size_type> num_targets; + std::unordered_map<cell_gid_type, arb_size_type> num_sources; + std::unordered_map<cell_gid_type, arb_size_type> num_targets; }; // Common base class for FVM implementation on host or gpu back-end. @@ -224,12 +224,12 @@ struct fvm_lowered_cell { const recipe& rec) = 0; virtual fvm_integration_result integrate( - fvm_value_type tfinal, - fvm_value_type max_dt, + arb_value_type tfinal, + arb_value_type max_dt, std::vector<deliverable_event> staged_events, std::vector<sample_event> staged_samples) = 0; - virtual fvm_value_type time() const = 0; + virtual arb_value_type time() const = 0; virtual ~fvm_lowered_cell() {} }; diff --git a/arbor/fvm_lowered_cell_impl.hpp b/arbor/fvm_lowered_cell_impl.hpp index accfcb15641ac2b30dc5c11274113b674a4f33aa..9b10a0e4043870a1f5f2e5b5d1467d0b309ffb43 100644 --- a/arbor/fvm_lowered_cell_impl.hpp +++ b/arbor/fvm_lowered_cell_impl.hpp @@ -42,9 +42,9 @@ template <class Backend> class fvm_lowered_cell_impl: public fvm_lowered_cell { public: using backend = Backend; - using value_type = fvm_value_type; - using index_type = fvm_index_type; - using size_type = fvm_size_type; + using value_type = arb_value_type; + using index_type = arb_index_type; + using size_type = arb_size_type; fvm_lowered_cell_impl(execution_context ctx): context_(ctx), threshold_watcher_(ctx) {}; @@ -62,10 +62,10 @@ public: // Generates indom index for every gid, guarantees that gids belonging to the same supercell are in the same intdom // Fills cell_to_intdom map; returns number of intdoms - fvm_size_type fvm_intdom( + arb_size_type fvm_intdom( const recipe& rec, const std::vector<cell_gid_type>& gids, - std::vector<fvm_index_type>& cell_to_intdom); + std::vector<arb_index_type>& cell_to_intdom); value_type time() const override { return tmin_; } @@ -108,7 +108,7 @@ private: void update_ion_state(); // Throw if absolute value of membrane voltage exceeds bounds. - void assert_voltage_bounded(fvm_value_type bound); + void assert_voltage_bounded(arb_value_type bound); // Throw if any cell time not equal to tmin_ void assert_tmin(); @@ -349,7 +349,7 @@ void fvm_lowered_cell_impl<Backend>::update_ion_state() { } template <typename Backend> -void fvm_lowered_cell_impl<Backend>::assert_voltage_bounded(fvm_value_type bound) { +void fvm_lowered_cell_impl<Backend>::assert_voltage_bounded(arb_value_type bound) { auto v_minmax = state_->voltage_bounds(); if (v_minmax.first>=-bound && v_minmax.second<=bound) { return; @@ -474,7 +474,7 @@ fvm_initialization_data fvm_lowered_cell_impl<Backend>::initialize( auto it = util::max_element_by(fvm_info.num_sources, [](auto elem) {return util::second(elem);}); max_detector = it->second; } - std::vector<fvm_index_type> src_to_spike, cv_to_cell; + std::vector<arb_index_type> src_to_spike, cv_to_cell; if (post_events_) { for (auto cell_idx: make_span(ncell)) { @@ -544,7 +544,7 @@ fvm_initialization_data fvm_lowered_cell_impl<Backend>::initialize( layout.peer_cv = config.peer_cv; layout.weight.resize(layout.cv.size()); - std::vector<fvm_index_type> multiplicity_divs; + std::vector<arb_index_type> multiplicity_divs; auto multiplicity_part = util::make_partition(multiplicity_divs, layout.multiplicity); // Mechanism weights are F·α where α ∈ [0, 1] is the proportional @@ -650,10 +650,10 @@ fvm_initialization_data fvm_lowered_cell_impl<Backend>::initialize( } template <typename Backend> -fvm_size_type fvm_lowered_cell_impl<Backend>::fvm_intdom( +arb_size_type fvm_lowered_cell_impl<Backend>::fvm_intdom( const recipe& rec, const std::vector<cell_gid_type>& gids, - std::vector<fvm_index_type>& cell_to_intdom) { + std::vector<arb_index_type>& cell_to_intdom) { cell_to_intdom.resize(gids.size()); @@ -710,11 +710,11 @@ struct probe_resolution_data { const std::unordered_map<std::string, mechanism*>& mech_instance_by_name; // Backend state data for a given mechanism and state variable. - const fvm_value_type* mechanism_state(const std::string& name, const std::string& state_var) const { + const arb_value_type* mechanism_state(const std::string& name, const std::string& state_var) const { mechanism* m = util::value_by_key(mech_instance_by_name, name).value_or(nullptr); if (!m) return nullptr; - const fvm_value_type* data = state->mechanism_state_data(*m, state_var); + const arb_value_type* data = state->mechanism_state_data(*m, state_var); if (!data) throw cable_cell_error("no state variable '"+state_var+"' in mechanism '"+name+"'"); return data; @@ -729,10 +729,10 @@ struct probe_resolution_data { }; // Index into ion data from location. - std::optional<fvm_index_type> ion_location_index(const std::string& ion, mlocation loc) const { + std::optional<arb_index_type> ion_location_index(const std::string& ion, mlocation loc) const { if (state->ion_data.count(ion)) { return util::binary_search_index(M.ions.at(ion).cv, - fvm_index_type(D.geometry.location_cv(cell_idx, loc, cv_prefer::cv_nonempty))); + arb_index_type(D.geometry.location_cv(cell_idx, loc, cv_prefer::cv_nonempty))); } return std::nullopt; } @@ -783,7 +783,7 @@ void fvm_lowered_cell_impl<Backend>::resolve_probe_address( template <typename B> void resolve_probe(const cable_probe_membrane_voltage& p, probe_resolution_data<B>& R) { - const fvm_value_type* data = R.state->voltage.data(); + const arb_value_type* data = R.state->voltage.data(); for (mlocation loc: thingify(p.locations, R.cell.provider())) { fvm_voltage_interpolant in = fvm_interpolate_voltage(R.cell, R.D, R.cell_idx, loc); @@ -815,7 +815,7 @@ void resolve_probe(const cable_probe_membrane_voltage_cell& p, probe_resolution_ template <typename B> void resolve_probe(const cable_probe_axial_current& p, probe_resolution_data<B>& R) { - const fvm_value_type* data = R.state->voltage.data(); + const arb_value_type* data = R.state->voltage.data(); for (mlocation loc: thingify(p.locations, R.cell.provider())) { fvm_voltage_interpolant in = fvm_axial_current(R.cell, R.D, R.cell_idx, loc); @@ -831,7 +831,7 @@ template <typename B> void resolve_probe(const cable_probe_total_ion_current_density& p, probe_resolution_data<B>& R) { // Use interpolated probe with coeffs 1, -1 to represent difference between accumulated current density and stimulus. for (mlocation loc: thingify(p.locations, R.cell.provider())) { - fvm_index_type cv = R.D.geometry.location_cv(R.cell_idx, loc, cv_prefer::cv_nonempty); + arb_index_type cv = R.D.geometry.location_cv(R.cell_idx, loc, cv_prefer::cv_nonempty); const double* current_cv_ptr = R.state->current_density.data() + cv; auto opt_i = util::binary_search_index(R.M.stimuli.cv_unique, cv); @@ -883,7 +883,7 @@ void resolve_probe(const cable_probe_total_current_cell& p, probe_resolution_dat util::assign(r.cv_parent_cond, util::subrange_view(R.D.face_conductance, cell_cv_ival)); const auto& stim_cvs = R.M.stimuli.cv_unique; - const fvm_value_type* stim_src = R.state->stim_data.accu_stim_.data(); + const arb_value_type* stim_src = R.state->stim_data.accu_stim_.data(); r.cv_cables_divs = {0}; for (auto cv: R.D.geometry.cell_cvs(R.cell_idx)) { @@ -916,7 +916,7 @@ void resolve_probe(const cable_probe_stimulus_current_cell& p, probe_resolution_ fvm_probe_weighted_multi r; const auto& stim_cvs = R.M.stimuli.cv_unique; - const fvm_value_type* src = R.state->stim_data.accu_stim_.data(); + const arb_value_type* src = R.state->stim_data.accu_stim_.data(); for (auto cv: R.D.geometry.cell_cvs(R.cell_idx)) { auto opt_i = util::binary_search_index(stim_cvs, cv); @@ -938,14 +938,14 @@ void resolve_probe(const cable_probe_stimulus_current_cell& p, probe_resolution_ template <typename B> void resolve_probe(const cable_probe_density_state& p, probe_resolution_data<B>& R) { - const fvm_value_type* data = R.mechanism_state(p.mechanism, p.state); + const arb_value_type* data = R.mechanism_state(p.mechanism, p.state); if (!data) return; auto support = R.mechanism_support(p.mechanism); for (mlocation loc: thingify(p.locations, R.cell.provider())) { if (!support.intersects(loc)) continue; - fvm_index_type cv = R.D.geometry.location_cv(R.cell_idx, loc, cv_prefer::cv_nonempty); + arb_index_type cv = R.D.geometry.location_cv(R.cell_idx, loc, cv_prefer::cv_nonempty); auto opt_i = util::binary_search_index(R.M.mechanisms.at(p.mechanism).cv, cv); if (!opt_i) continue; @@ -957,7 +957,7 @@ template <typename B> void resolve_probe(const cable_probe_density_state_cell& p, probe_resolution_data<B>& R) { fvm_probe_multi r; - const fvm_value_type* data = R.mechanism_state(p.mechanism, p.state); + const arb_value_type* data = R.mechanism_state(p.mechanism, p.state); if (!data) return; mextent support = R.mechanism_support(p.mechanism); @@ -985,7 +985,7 @@ void resolve_probe(const cable_probe_point_state& p, probe_resolution_data<B>& R arb_assert(R.handles.size()==R.M.target_divs.back()); arb_assert(R.handles.size()==R.M.n_target); - const fvm_value_type* data = R.mechanism_state(p.mechanism, p.state); + const arb_value_type* data = R.mechanism_state(p.mechanism, p.state); if (!data) return; // Convert cell-local target number to cellgroup target number. @@ -1009,7 +1009,7 @@ void resolve_probe(const cable_probe_point_state& p, probe_resolution_data<B>& R template <typename B> void resolve_probe(const cable_probe_point_state_cell& p, probe_resolution_data<B>& R) { - const fvm_value_type* data = R.mechanism_state(p.mechanism, p.state); + const arb_value_type* data = R.mechanism_state(p.mechanism, p.state); if (!data) return; unsigned id = R.mech_instance_by_name.at(p.mechanism)->mechanism_id(); @@ -1058,7 +1058,7 @@ void resolve_probe(const cable_probe_ion_current_cell& p, probe_resolution_data< if (!R.state->ion_data.count(p.ion)) return; auto& ion_cvs = R.M.ions.at(p.ion).cv; - const fvm_value_type* src = R.state->ion_data.at(p.ion).iX_.data(); + const arb_value_type* src = R.state->ion_data.at(p.ion).iX_.data(); fvm_probe_weighted_multi r; for (auto cv: R.D.geometry.cell_cvs(R.cell_idx)) { @@ -1111,7 +1111,7 @@ void resolve_probe(const cable_probe_ion_diff_concentration& p, probe_resolution // Common implementation for int and ext concentrations across whole cell: template <typename B> -void resolve_ion_conc_common(const std::vector<fvm_index_type>& ion_cvs, const fvm_value_type* src, probe_resolution_data<B>& R) { +void resolve_ion_conc_common(const std::vector<arb_index_type>& ion_cvs, const arb_value_type* src, probe_resolution_data<B>& R) { fvm_probe_multi r; mcable_list cables; diff --git a/arbor/include/arbor/arb_types.h b/arbor/include/arbor/arb_types.h index 955fc9fd3076f272aa9e19e7e2cf439a99c74a25..23f84078deea9e0d48b2f0d11f4210235eaba191 100644 --- a/arbor/include/arbor/arb_types.h +++ b/arbor/include/arbor/arb_types.h @@ -5,10 +5,11 @@ #ifdef __cplusplus #include <cstdint> +using std::uint32_t; #else #include <stdint.h> #endif #include <arbor/arb_types.inc> -#endif // ndef ARB_TYPES_H +#endif // ARB_TYPES_H diff --git a/arbor/include/arbor/arb_types.inc b/arbor/include/arbor/arb_types.inc index 0062fd5aa2ad8a04af37c2880cd8bba22ab5e007..ac60304db32ca2250f28b2c5dda0a1475c22dc24 100644 --- a/arbor/include/arbor/arb_types.inc +++ b/arbor/include/arbor/arb_types.inc @@ -1,8 +1,4 @@ typedef double arb_value_type; typedef float arb_weight_type; typedef int arb_index_type; -#ifdef __cplusplus -typedef std::uint32_t arb_size_type; -#else typedef uint32_t arb_size_type; -#endif diff --git a/arbor/include/arbor/fvm_types.hpp b/arbor/include/arbor/fvm_types.hpp index 1b8849656b4054c0e51d049bbb6a339a1d856bb1..d6d86111e4c542e64fa4e515f316f98e0853a3d7 100644 --- a/arbor/include/arbor/fvm_types.hpp +++ b/arbor/include/arbor/fvm_types.hpp @@ -1,19 +1,15 @@ #pragma once -#include <arbor/arb_types.h> +#include <arbor/arb_types.hpp> #include <arbor/common_types.hpp> namespace arb { -using fvm_value_type = arb_value_type; -using fvm_size_type = arb_size_type; -using fvm_index_type = arb_index_type; - struct fvm_gap_junction { cell_lid_type local_idx; // Index relative to other gap junction sites on the cell. - fvm_size_type local_cv; // CV index of the local gap junction site. - fvm_size_type peer_cv; // CV index of the peer gap junction site. - fvm_value_type weight; // unit-less local weight of the connection. + arb_size_type local_cv; // CV index of the local gap junction site. + arb_size_type peer_cv; // CV index of the peer gap junction site. + arb_value_type weight; // unit-less local weight of the connection. }; ARB_DEFINE_LEXICOGRAPHIC_ORDERING(fvm_gap_junction, (a.local_cv, a.peer_cv, a.local_idx, a.weight), (b.local_cv, b.peer_cv, b.local_idx, b.weight)) diff --git a/arbor/include/arbor/mechanism.hpp b/arbor/include/arbor/mechanism.hpp index 8d30eb35f1933cfee0fedc13acc9756fc4d00c92..210bc7d46bd11b678f2359febcebbb6c269fbb97 100644 --- a/arbor/include/arbor/mechanism.hpp +++ b/arbor/include/arbor/mechanism.hpp @@ -18,18 +18,18 @@ class mechanism; using mechanism_ptr = std::unique_ptr<mechanism>; struct ion_state_view { - fvm_value_type* current_density; - fvm_value_type* reversal_potential; - fvm_value_type* internal_concentration; - fvm_value_type* external_concentration; - fvm_value_type* ionic_charge; + arb_value_type* current_density; + arb_value_type* reversal_potential; + arb_value_type* internal_concentration; + arb_value_type* external_concentration; + arb_value_type* ionic_charge; }; class mechanism { public: - using value_type = fvm_value_type; - using index_type = fvm_index_type; - using size_type = fvm_size_type; + using value_type = arb_value_type; + using index_type = arb_index_type; + using size_type = arb_size_type; mechanism(const arb_mechanism_type& m, const arb_mechanism_interface& i): mech_{m}, iface_{i}, ppack_{} { @@ -91,21 +91,21 @@ private: struct mechanism_layout { // Maps in-instance index to CV index. - std::vector<fvm_index_type> cv; + std::vector<arb_index_type> cv; // Maps in-instance index to peer CV index (only for gap-junctions). - std::vector<fvm_index_type> peer_cv; + std::vector<arb_index_type> peer_cv; // Maps in-instance index to compartment contribution. - std::vector<fvm_value_type> weight; + std::vector<arb_value_type> weight; // Number of logical point processes at in-instance index; // if empty, point processes are not coalesced and all multipliers are 1. - std::vector<fvm_index_type> multiplicity; + std::vector<arb_index_type> multiplicity; }; struct mechanism_overrides { - // Global scalar parameters (any value down-conversion to fvm_value_type is the + // Global scalar parameters (any value down-conversion to arb_value_type is the // responsibility of the mechanism). std::unordered_map<std::string, double> globals; diff --git a/arbor/include/arbor/morph/cv_data.hpp b/arbor/include/arbor/morph/cv_data.hpp index 38f24e72c19ef1cdf670fa3a8c8c7882ceb188a1..0b0abfb830df6fe748bc02b802ddefb8163a663a 100644 --- a/arbor/include/arbor/morph/cv_data.hpp +++ b/arbor/include/arbor/morph/cv_data.hpp @@ -18,16 +18,16 @@ struct cell_cv_data_impl; class ARB_ARBOR_API cell_cv_data { public: // Returns mcables comprising the CV at a given index. - mcable_list cables(fvm_size_type index) const; + mcable_list cables(arb_size_type index) const; // Returns the CV indices of the children of a given CV index. - std::vector<fvm_index_type> children(fvm_size_type index) const; + std::vector<arb_index_type> children(arb_size_type index) const; // Returns the CV index of the parent of a given CV index. - fvm_index_type parent(fvm_size_type index) const; + arb_index_type parent(arb_size_type index) const; // Returns total number of CVs. - fvm_size_type size() const; + arb_size_type size() const; cell_cv_data(const cable_cell& cell, const locset& lset); @@ -43,8 +43,8 @@ private: }; struct cv_proportion { - fvm_size_type idx; - fvm_value_type proportion; + arb_size_type idx; + arb_value_type proportion; }; // Construct cell_cv_geometry for cell from default cell discretization if it exists. diff --git a/arbor/mc_cell_group.cpp b/arbor/mc_cell_group.cpp index 0510c60f9b2528e2ec979380a0ad1ce856b52257..f3ac374b68357ced1cc12df5eac38dffbdd8808f 100644 --- a/arbor/mc_cell_group.cpp +++ b/arbor/mc_cell_group.cpp @@ -125,8 +125,8 @@ void reserve_scratch(fvm_probe_scratch& scratch, std::size_t n) { void run_samples( const missing_probe_info&, const sampler_call_info&, - const fvm_value_type*, - const fvm_value_type*, + const arb_value_type*, + const arb_value_type*, std::vector<sample_record>&, fvm_probe_scratch&) { @@ -136,14 +136,14 @@ void run_samples( void run_samples( const fvm_probe_scalar& p, const sampler_call_info& sc, - const fvm_value_type* raw_times, - const fvm_value_type* raw_samples, + const arb_value_type* raw_times, + const arb_value_type* raw_samples, std::vector<sample_record>& sample_records, fvm_probe_scratch&) { // Scalar probes do not need scratch space — provided that the user-presented - // sample type (double) matches the raw type (fvm_value_type). - static_assert(std::is_same<double, fvm_value_type>::value, "require sample value translation"); + // sample type (double) matches the raw type (arb_value_type). + static_assert(std::is_same<double, arb_value_type>::value, "require sample value translation"); sample_size_type n_sample = sc.end_offset-sc.begin_offset; sample_records.clear(); @@ -157,8 +157,8 @@ void run_samples( void run_samples( const fvm_probe_interpolated& p, const sampler_call_info& sc, - const fvm_value_type* raw_times, - const fvm_value_type* raw_samples, + const arb_value_type* raw_times, + const arb_value_type* raw_samples, std::vector<sample_record>& sample_records, fvm_probe_scratch& scratch) { @@ -187,8 +187,8 @@ void run_samples( void run_samples( const fvm_probe_multi& p, const sampler_call_info& sc, - const fvm_value_type* raw_times, - const fvm_value_type* raw_samples, + const arb_value_type* raw_times, + const arb_value_type* raw_samples, std::vector<sample_record>& sample_records, fvm_probe_scratch& scratch) { @@ -217,8 +217,8 @@ void run_samples( void run_samples( const fvm_probe_weighted_multi& p, const sampler_call_info& sc, - const fvm_value_type* raw_times, - const fvm_value_type* raw_samples, + const arb_value_type* raw_times, + const arb_value_type* raw_samples, std::vector<sample_record>& sample_records, fvm_probe_scratch& scratch) { @@ -260,8 +260,8 @@ void run_samples( void run_samples( const fvm_probe_interpolated_multi& p, const sampler_call_info& sc, - const fvm_value_type* raw_times, - const fvm_value_type* raw_samples, + const arb_value_type* raw_times, + const arb_value_type* raw_samples, std::vector<sample_record>& sample_records, fvm_probe_scratch& scratch) { @@ -307,8 +307,8 @@ void run_samples( void run_samples( const fvm_probe_membrane_currents& p, const sampler_call_info& sc, - const fvm_value_type* raw_times, - const fvm_value_type* raw_samples, + const arb_value_type* raw_times, + const arb_value_type* raw_samples, std::vector<sample_record>& sample_records, fvm_probe_scratch& scratch) { @@ -339,7 +339,7 @@ void run_samples( const double* v = raw_samples+offset; for (auto cv: util::make_span(n_cv)) { - fvm_index_type parent_cv = p.cv_parent[cv]; + arb_index_type parent_cv = p.cv_parent[cv]; if (parent_cv+1==0) continue; double cond = p.cv_parent_cond[cv]; @@ -381,8 +381,8 @@ void run_samples( // Generic run_samples dispatches on probe info variant type. void run_samples( const sampler_call_info& sc, - const fvm_value_type* raw_times, - const fvm_value_type* raw_samples, + const arb_value_type* raw_times, + const arb_value_type* raw_samples, std::vector<sample_record>& sample_records, fvm_probe_scratch& scratch) { @@ -404,8 +404,8 @@ void mc_cell_group::advance(epoch ep, time_type dt, const event_lane_subrange& e util::sort_by(idx_sorted_by_intdom, [&](cell_size_type i) { return cell_to_intdom_[i]; }); /// Event merging on integration domain could benefit from the use of the logic from `tree_merge_events` - fvm_index_type ev_begin = 0, ev_mid = 0, ev_end = 0; - fvm_index_type prev_intdom = -1; + arb_index_type ev_begin = 0, ev_mid = 0, ev_end = 0; + arb_index_type prev_intdom = -1; for (auto i: util::count_along(gids_)) { unsigned count_staged = 0; diff --git a/arbor/mc_cell_group.hpp b/arbor/mc_cell_group.hpp index 1379dae2bdd1f031bf9361d2439562216cb0caaf..45b6c540e8c7b2f9aef38aa8ee165fb9f5f8a84a 100644 --- a/arbor/mc_cell_group.hpp +++ b/arbor/mc_cell_group.hpp @@ -66,7 +66,7 @@ private: std::vector<cell_gid_type> gids_; // Map from gid to integration domain id - std::vector<fvm_index_type> cell_to_intdom_; + std::vector<arb_index_type> cell_to_intdom_; // Hash table for converting gid to local index std::unordered_map<cell_gid_type, cell_gid_type> gid_index_map_; diff --git a/arbor/morph/cv_data.cpp b/arbor/morph/cv_data.cpp index 719d609ab44566bed0c6e6b16d8bd304ba71afbc..ec4d68e762214e336b36d840a70a7e87a87626db 100644 --- a/arbor/morph/cv_data.cpp +++ b/arbor/morph/cv_data.cpp @@ -41,14 +41,14 @@ cell_cv_data_impl::cell_cv_data_impl(const cable_cell& cell, const locset& lset) // proximal 'head' points, and recursing down branches in the morphology // within each CV. - constexpr fvm_index_type no_parent = -1; - std::vector<std::pair<mlocation, fvm_index_type>> next_cv_head; // head loc, parent cv index + constexpr arb_index_type no_parent = -1; + std::vector<std::pair<mlocation, arb_index_type>> next_cv_head; // head loc, parent cv index next_cv_head.emplace_back(mlocation{mnpos, 0}, no_parent); mcable_list cables; std::vector<msize_t> branches; cv_cables_divs.push_back(0); - fvm_index_type cv_index = 0; + arb_index_type cv_index = 0; while (!next_cv_head.empty()) { auto next = pop(next_cv_head); @@ -110,30 +110,30 @@ cell_cv_data_impl::cell_cv_data_impl(const cable_cell& cell, const locset& lset) auto e = cv_children.end(); auto from = b; - for (fvm_index_type cv = 0; cv<n_cv; ++cv) { + for (arb_index_type cv = 0; cv<n_cv; ++cv) { from = std::partition_point(from, e, [cv, this](auto i) { return cv_parent[i]<=cv; }); cv_children_divs.push_back(from-b); } } -mcable_list cell_cv_data::cables(fvm_size_type cv_index) const { +mcable_list cell_cv_data::cables(arb_size_type cv_index) const { auto partn = util::partition_view(impl_->cv_cables_divs); auto view = util::subrange_view(impl_->cv_cables, partn[cv_index]); return mcable_list{view.begin(), view.end()}; } -std::vector<fvm_index_type> cell_cv_data::children(fvm_size_type cv_index) const { +std::vector<arb_index_type> cell_cv_data::children(arb_size_type cv_index) const { auto partn = util::partition_view(impl_->cv_children_divs); auto view = util::subrange_view(impl_->cv_children, partn[cv_index]); - return std::vector<fvm_index_type>{view.begin(), view.end()}; + return std::vector<arb_index_type>{view.begin(), view.end()}; } -fvm_index_type cell_cv_data::parent(fvm_size_type cv_index) const { +arb_index_type cell_cv_data::parent(arb_size_type cv_index) const { return impl_->cv_parent[cv_index]; } -fvm_size_type cell_cv_data::size() const { +arb_size_type cell_cv_data::size() const { return impl_->cv_parent.size(); } diff --git a/arbor/morph/cv_data.hpp b/arbor/morph/cv_data.hpp index 1e3e74713e804a93dc5528bc93b3cb0bf8845eb6..33644dc7b923141d30409462eeae1f1271a7e24a 100644 --- a/arbor/morph/cv_data.hpp +++ b/arbor/morph/cv_data.hpp @@ -11,11 +11,11 @@ namespace arb { struct cell_cv_data_impl { mcable_list cv_cables; // CV unbranched sections, partitioned by CV. - std::vector<fvm_index_type> cv_cables_divs; // Partitions cv_cables by CV index. + std::vector<arb_index_type> cv_cables_divs; // Partitions cv_cables by CV index. - std::vector<fvm_index_type> cv_parent; // Index of CV parent or size_type(-1) for a cell root CV. - std::vector<fvm_index_type> cv_children; // CV child indices, partitioned by CV, and then in order. - std::vector<fvm_index_type> cv_children_divs; // Paritions cv_children by CV index. + std::vector<arb_index_type> cv_parent; // Index of CV parent or size_type(-1) for a cell root CV. + std::vector<arb_index_type> cv_children; // CV child indices, partitioned by CV, and then in order. + std::vector<arb_index_type> cv_children_divs; // Paritions cv_children by CV index. cell_cv_data_impl() = default; cell_cv_data_impl(const cable_cell&, const locset&); diff --git a/mechanisms/default/hh.mod b/mechanisms/default/hh.mod index d4a34700cbc60375062b5cff9b911be07e76f93a..9c64142fb75dbcf7874896b034c1aad9648e520c 100644 --- a/mechanisms/default/hh.mod +++ b/mechanisms/default/hh.mod @@ -53,6 +53,7 @@ INITIAL { : potassium activation system alpha = n_alpha(v) beta = n_beta(v) + n = alpha/(alpha + beta) } diff --git a/test/unit/test_cv_geom.cpp b/test/unit/test_cv_geom.cpp index 2e7d58b476e0680d033ae3fd651b7319057ec2b7..cfca8a58de9fe5ac1c8f1c21c95d8d0b0dc687b3 100644 --- a/test/unit/test_cv_geom.cpp +++ b/test/unit/test_cv_geom.cpp @@ -29,7 +29,7 @@ using util::make_span; } for (auto cv: g.children(i)) { - if ((fvm_index_type)i != g.cv_parent.at(cv)) { + if ((arb_index_type)i != g.cv_parent.at(cv)) { return ::testing::AssertionFailure() << "CV " << i << " has child CV " << cv << " which has parent " << g.cv_parent.at(cv); } diff --git a/test/unit/test_fvm_layout.cpp b/test/unit/test_fvm_layout.cpp index 9bdd9bab6d0d96abd26b85b0afad6b53de84197a..f81c76fd498d519ca233c32b26222c83df007356 100644 --- a/test/unit/test_fvm_layout.cpp +++ b/test/unit/test_fvm_layout.cpp @@ -265,7 +265,7 @@ TEST(fvm_layout, mech_index) { auto& expsyn_config = M.mechanisms.at("expsyn"); auto& exp2syn_config = M.mechanisms.at("exp2syn"); - using ivec = std::vector<fvm_index_type>; + using ivec = std::vector<arb_index_type>; // HH on somas of two cells, with CVs 0 and 5. // Proportional area contrib: soma area/CV area. @@ -336,7 +336,7 @@ struct exp_instance { }; TEST(fvm_layout, coalescing_synapses) { - using ivec = std::vector<fvm_index_type>; + using ivec = std::vector<arb_index_type>; auto syn_desc = [&](const char* name, double val0, double val1) { mechanism_desc m(name); @@ -592,7 +592,7 @@ TEST(fvm_layout, synapse_targets) { EXPECT_TRUE(util::is_sorted(expsyn_cv)); EXPECT_TRUE(util::is_sorted(exp2syn_cv)); - using uvec = std::vector<fvm_size_type>; + using uvec = std::vector<arb_size_type>; uvec all_target_indices; util::append(all_target_indices, expsyn_target); util::append(all_target_indices, exp2syn_target); @@ -1228,7 +1228,7 @@ TEST(fvm_lowered, cell_group_gj) { EXPECT_EQ(expected[i], GJ1[i+10]); } - std::vector<fvm_index_type> expected_doms= {0u, 1u, 0u, 2u, 0u, 3u, 0u, 4u, 0u, 5u}; + std::vector<arb_index_type> expected_doms= {0u, 1u, 0u, 2u, 0u, 3u, 0u, 4u, 0u, 5u}; EXPECT_EQ(6u, num_dom0); EXPECT_EQ(6u, num_dom1); @@ -1513,9 +1513,9 @@ TEST(fvm_layout, ion_weights) { builder.add_branch(1, 200, 0.5, 0.5, 1, "dend"); builder.add_branch(1, 100, 0.5, 0.5, 1, "dend"); - using uvec = std::vector<fvm_size_type>; - using ivec = std::vector<fvm_index_type>; - using fvec = std::vector<fvm_value_type>; + using uvec = std::vector<arb_size_type>; + using ivec = std::vector<arb_index_type>; + using fvec = std::vector<arb_value_type>; //uvec mech_branches[] = { //{0}, {0,2}, {2, 3}, {0, 1, 2, 3}, {3} @@ -1536,8 +1536,8 @@ TEST(fvm_layout, ion_weights) { gprop.catalogue = make_unit_test_catalogue(); gprop.default_parameters = neuron_parameter_defaults; - fvm_value_type cai = gprop.default_parameters.ion_data["ca"].init_int_concentration.value(); - fvm_value_type cao = gprop.default_parameters.ion_data["ca"].init_ext_concentration.value(); + arb_value_type cai = gprop.default_parameters.ion_data["ca"].init_int_concentration.value(); + arb_value_type cao = gprop.default_parameters.ion_data["ca"].init_ext_concentration.value(); for (auto& v: expected_init_iconc) { for (auto& iconc: v) { @@ -1565,9 +1565,9 @@ TEST(fvm_layout, ion_weights) { EXPECT_EQ(expected_ion_cv[run], ca.cv); - EXPECT_TRUE(testing::seq_almost_eq<fvm_value_type>(expected_init_iconc[run], ca.init_iconc)); + EXPECT_TRUE(testing::seq_almost_eq<arb_value_type>(expected_init_iconc[run], ca.init_iconc)); - EXPECT_TRUE(util::all_of(ca.init_econc, [cao](fvm_value_type v) { return v==cao; })); + EXPECT_TRUE(util::all_of(ca.init_econc, [cao](arb_value_type v) { return v==cao; })); } } @@ -1646,7 +1646,7 @@ TEST(fvm_layout, revpot) { // of the second cell. auto soma1_index = D.geometry.cell_cv_divs[1]; ASSERT_EQ(1u, M.mechanisms.count(write_eb_ec.name())); - EXPECT_EQ((std::vector<fvm_index_type>(1, soma1_index)), M.mechanisms.at(write_eb_ec.name()).cv); + EXPECT_EQ((std::vector<arb_index_type>(1, soma1_index)), M.mechanisms.at(write_eb_ec.name()).cv); } } @@ -1674,7 +1674,7 @@ TEST(fvm_layout, vinterp_cable) { for (auto pos: site_pos) { mlocation site{0, pos}; - fvm_index_type expected_distal; + arb_index_type expected_distal; if (pos<0.3) { expected_distal = 1; } @@ -1687,7 +1687,7 @@ TEST(fvm_layout, vinterp_cable) { else { expected_distal = 4; } - fvm_index_type expected_proximal = expected_distal-1; + arb_index_type expected_proximal = expected_distal-1; fvm_voltage_interpolant I = fvm_interpolate_voltage(cell, D, 0, site); diff --git a/test/unit/test_fvm_lowered.cpp b/test/unit/test_fvm_lowered.cpp index 55f10243cb64ca0f6125eb06f914587921efbd7b..334d4819ec833a50aa0c89a77eb19c74f1aee420 100644 --- a/test/unit/test_fvm_lowered.cpp +++ b/test/unit/test_fvm_lowered.cpp @@ -300,8 +300,8 @@ TEST(fvm_lowered, stimulus) { std::vector<cable_cell> cells{desc}; - const fvm_size_type soma_cv = 0u; - const fvm_size_type tip_cv = 5u; + const arb_size_type soma_cv = 0u; + const arb_size_type tip_cv = 5u; // The implementation of the stimulus is tested by creating a lowered cell, then // testing that the correct currents are injected at the correct control volumes @@ -455,7 +455,7 @@ TEST(fvm_lowered, derived_mechs) { // Both mechanisms will have the same internal name, "test_kin1". - using fvec = std::vector<fvm_value_type>; + using fvec = std::vector<arb_value_type>; fvec tau_values; for (auto& mech: fvcell.*private_mechanisms_ptr) { ASSERT_TRUE(mech); @@ -572,20 +572,20 @@ TEST(fvm_lowered, ionic_concentrations) { auto cat = make_unit_test_catalogue(); // one cell, one CV: - fvm_size_type ncell = 1; - fvm_size_type ncv = 1; - std::vector<fvm_index_type> cv_to_intdom(ncv, 0); - std::vector<fvm_value_type> temp(ncv, 23); - std::vector<fvm_value_type> diam(ncv, 1.); - std::vector<fvm_value_type> vinit(ncv, -65); - std::vector<fvm_index_type> src_to_spike = {}; + arb_size_type ncell = 1; + arb_size_type ncv = 1; + std::vector<arb_index_type> cv_to_intdom(ncv, 0); + std::vector<arb_value_type> temp(ncv, 23); + std::vector<arb_value_type> diam(ncv, 1.); + std::vector<arb_value_type> vinit(ncv, -65); + std::vector<arb_index_type> src_to_spike = {}; fvm_ion_config ion_config; mechanism_layout layout; mechanism_overrides overrides; layout.weight.assign(ncv, 1.); - for (fvm_size_type i = 0; i<ncv; ++i) { + for (arb_size_type i = 0; i<ncv; ++i) { layout.cv.push_back(i); ion_config.cv.push_back(i); } @@ -617,7 +617,7 @@ TEST(fvm_lowered, ionic_concentrations) { read_cai_mech->initialize(); write_cai_mech->initialize(); - std::vector<fvm_value_type> expected_s_values(ncv, 2.3e-4); + std::vector<arb_value_type> expected_s_values(ncv, 2.3e-4); EXPECT_EQ(expected_s_values, mechanism_field(read_cai_mech.get(), "s")); @@ -811,10 +811,10 @@ TEST(fvm_lowered, integration_domains) { fvm_cell fvcell(*context); std::vector<cell_gid_type> gids = {11u, 5u, 2u, 3u, 0u, 8u, 7u}; - std::vector<fvm_index_type> cell_to_intdom; + std::vector<arb_index_type> cell_to_intdom; auto num_dom = fvcell.fvm_intdom(gap_recipe_0(), gids, cell_to_intdom); - std::vector<fvm_index_type> expected_doms= {0u, 1u, 2u, 2u, 1u, 3u, 2u}; + std::vector<arb_index_type> expected_doms= {0u, 1u, 2u, 2u, 1u, 3u, 2u}; EXPECT_EQ(4u, num_dom); EXPECT_EQ(expected_doms, cell_to_intdom); @@ -824,10 +824,10 @@ TEST(fvm_lowered, integration_domains) { fvm_cell fvcell(*context); std::vector<cell_gid_type> gids = {11u, 5u, 2u, 3u, 0u, 8u, 7u}; - std::vector<fvm_index_type> cell_to_intdom; + std::vector<arb_index_type> cell_to_intdom; auto num_dom = fvcell.fvm_intdom(gap_recipe_1(), gids, cell_to_intdom); - std::vector<fvm_index_type> expected_doms= {0u, 1u, 2u, 3u, 4u, 5u, 6u}; + std::vector<arb_index_type> expected_doms= {0u, 1u, 2u, 3u, 4u, 5u, 6u}; EXPECT_EQ(7u, num_dom); EXPECT_EQ(expected_doms, cell_to_intdom); @@ -837,10 +837,10 @@ TEST(fvm_lowered, integration_domains) { fvm_cell fvcell(*context); std::vector<cell_gid_type> gids = {5u, 2u, 3u, 0u}; - std::vector<fvm_index_type> cell_to_intdom; + std::vector<arb_index_type> cell_to_intdom; auto num_dom = fvcell.fvm_intdom(gap_recipe_2(), gids, cell_to_intdom); - std::vector<fvm_index_type> expected_doms= {0u, 0u, 0u, 0u}; + std::vector<arb_index_type> expected_doms= {0u, 0u, 0u, 0u}; EXPECT_EQ(1u, num_dom); EXPECT_EQ(expected_doms, cell_to_intdom); @@ -1014,7 +1014,7 @@ TEST(fvm_lowered, label_data) { // Check correct synapse, deterctor and gj data decorated_recipe rec(ncell); - std::vector<fvm_index_type> cell_to_intdom; + std::vector<arb_index_type> cell_to_intdom; std::vector<target_handle> targets; probe_association_map probe_map; diff --git a/test/unit/test_kinetic_linear.cpp b/test/unit/test_kinetic_linear.cpp index 3b2e9cf99b44f9888c4e351ee3d591fcd92f36bf..2e900b1a2cc93d9385034b8a868f0a609bae3626 100644 --- a/test/unit/test_kinetic_linear.cpp +++ b/test/unit/test_kinetic_linear.cpp @@ -27,23 +27,23 @@ ACCESS_BIND(std::unique_ptr<shared_state> fvm_cell::*, private_state_ptr, &fvm_c template <typename backend> void run_test(std::string mech_name, std::vector<std::string> state_variables, - std::vector<fvm_value_type> t0_values, - std::vector<fvm_value_type> t1_values, - fvm_value_type dt) { + std::vector<arb_value_type> t0_values, + std::vector<arb_value_type> t1_values, + arb_value_type dt) { auto cat = make_unit_test_catalogue(); - fvm_size_type ncell = 1; - fvm_size_type ncv = 1; - std::vector<fvm_index_type> cv_to_intdom(ncv, 0); + arb_size_type ncell = 1; + arb_size_type ncv = 1; + std::vector<arb_index_type> cv_to_intdom(ncv, 0); auto instance = cat.instance(backend::kind, mech_name); auto& test = instance.mech; - std::vector<fvm_value_type> temp(ncv, 300.); - std::vector<fvm_value_type> diam(ncv, 1.); - std::vector<fvm_value_type> vinit(ncv, -65); - std::vector<fvm_index_type> src_to_spike = {}; + std::vector<arb_value_type> temp(ncv, 300.); + std::vector<arb_value_type> diam(ncv, 1.); + std::vector<arb_value_type> vinit(ncv, -65); + std::vector<arb_index_type> src_to_spike = {}; auto shared_state = std::make_unique<typename backend::shared_state>( ncell, ncell, 0, cv_to_intdom, cv_to_intdom, vinit, temp, diam, src_to_spike, test->data_alignment()); @@ -52,7 +52,7 @@ void run_test(std::string mech_name, mechanism_overrides overrides; layout.weight.assign(ncv, 1.); - for (fvm_size_type i = 0; i<ncv; ++i) { + for (arb_size_type i = 0; i<ncv; ++i) { layout.cv.push_back(i); } @@ -85,9 +85,9 @@ void run_test(std::string mech_name, TEST(mech_kinetic, kinetic_linear_scaled) { std::vector<std::string> state_variables = {"s", "h", "d"}; - std::vector<fvm_value_type> t0_values = {0.5, 0.2, 0.3}; - std::vector<fvm_value_type> t1_0_values = {0.373297, 0.591621, 0.0350817}; - std::vector<fvm_value_type> t1_1_values = {0.329897, 0.537371, 0.132732}; + std::vector<arb_value_type> t0_values = {0.5, 0.2, 0.3}; + std::vector<arb_value_type> t1_0_values = {0.373297, 0.591621, 0.0350817}; + std::vector<arb_value_type> t1_1_values = {0.329897, 0.537371, 0.132732}; run_test<multicore::backend>("test0_kin_compartment", state_variables, t0_values, t1_0_values, 0.5); run_test<multicore::backend>("test1_kin_compartment", state_variables, t0_values, t1_1_values, 0.5); @@ -96,9 +96,9 @@ TEST(mech_kinetic, kinetic_linear_scaled) { TEST(mech_kinetic, kinetic_linear_1_conserve) { std::vector<std::string> state_variables = {"s", "h", "d"}; - std::vector<fvm_value_type> t0_values = {0.5, 0.2, 0.3}; - std::vector<fvm_value_type> t1_0_values = {0.380338, 0.446414, 0.173247}; - std::vector<fvm_value_type> t1_1_values = {0.218978, 0.729927, 0.0510949}; + std::vector<arb_value_type> t0_values = {0.5, 0.2, 0.3}; + std::vector<arb_value_type> t1_0_values = {0.380338, 0.446414, 0.173247}; + std::vector<arb_value_type> t1_1_values = {0.218978, 0.729927, 0.0510949}; run_test<multicore::backend>("test0_kin_diff", state_variables, t0_values, t1_0_values, 0.5); run_test<multicore::backend>("test0_kin_conserve", state_variables, t0_values, t1_0_values, 0.5); @@ -107,9 +107,9 @@ TEST(mech_kinetic, kinetic_linear_1_conserve) { TEST(mech_kinetic, kinetic_linear_2_conserve) { std::vector<std::string> state_variables = {"a", "b", "x", "y"}; - std::vector<fvm_value_type> t0_values = {0.2, 0.8, 0.6, 0.4}; - std::vector<fvm_value_type> t1_0_values = {0.217391304, 0.782608696, 0.33333333, 0.66666666}; - std::vector<fvm_value_type> t1_1_values = {0.230769, 0.769231, 0.189189, 0.810811}; + std::vector<arb_value_type> t0_values = {0.2, 0.8, 0.6, 0.4}; + std::vector<arb_value_type> t1_0_values = {0.217391304, 0.782608696, 0.33333333, 0.66666666}; + std::vector<arb_value_type> t1_1_values = {0.230769, 0.769231, 0.189189, 0.810811}; run_test<multicore::backend>("test1_kin_diff", state_variables, t0_values, t1_0_values, 0.5); run_test<multicore::backend>("test1_kin_conserve", state_variables, t0_values, t1_0_values, 0.5); @@ -118,9 +118,9 @@ TEST(mech_kinetic, kinetic_linear_2_conserve) { TEST(mech_kinetic, kinetic_nonlinear) { std::vector<std::string> state_variables = {"a", "b", "c"}; - std::vector<fvm_value_type> t0_values = {0.2, 0.3, 0.5}; - std::vector<fvm_value_type> t1_0_values = {0.222881, 0.31144, 0.48856}; - std::vector<fvm_value_type> t1_1_values = {0.2078873133, 0.34222075, 0.45777925}; + std::vector<arb_value_type> t0_values = {0.2, 0.3, 0.5}; + std::vector<arb_value_type> t1_0_values = {0.222881, 0.31144, 0.48856}; + std::vector<arb_value_type> t1_1_values = {0.2078873133, 0.34222075, 0.45777925}; run_test<multicore::backend>("test2_kin_diff", state_variables, t0_values, t1_0_values, 0.025); run_test<multicore::backend>("test3_kin_diff", state_variables, t0_values, t1_1_values, 0.025); @@ -129,22 +129,22 @@ TEST(mech_kinetic, kinetic_nonlinear) { TEST(mech_kinetic, normal_nonlinear_0) { std::vector<std::string> state_variables = {"a", "b", "c"}; - std::vector<fvm_value_type> t0_values = {0.2, 0.3, 0.5}; - std::vector<fvm_value_type> t1_values = {0.2078873133, 0.34222075, 0.45777925}; + std::vector<arb_value_type> t0_values = {0.2, 0.3, 0.5}; + std::vector<arb_value_type> t1_values = {0.2078873133, 0.34222075, 0.45777925}; run_test<multicore::backend>("test5_nonlinear_diff", state_variables, t0_values, t1_values, 0.025); } TEST(mech_kinetic, normal_nonlinear_1) { std::vector<std::string> state_variables = {"p"}; - std::vector<fvm_value_type> t0_values = {1}; - std::vector<fvm_value_type> t1_values = {1.0213199524}; + std::vector<arb_value_type> t0_values = {1}; + std::vector<arb_value_type> t1_values = {1.0213199524}; run_test<multicore::backend>("test6_nonlinear_diff", state_variables, t0_values, t1_values, 0.025); } TEST(mech_kinetic, kinetic_nonlinear_scaled) { std::vector<std::string> state_variables = {"A", "B", "C", "d", "e"}; - std::vector<fvm_value_type> t0_values = {4.5, 6.6, 0.28, 2, 0}; - std::vector<fvm_value_type> t1_values = {4.087281958014442, + std::vector<arb_value_type> t0_values = {4.5, 6.6, 0.28, 2, 0}; + std::vector<arb_value_type> t1_values = {4.087281958014442, 6.224088678118931, 0.6559113218810689, 1.8315624742412617, @@ -155,7 +155,7 @@ TEST(mech_kinetic, kinetic_nonlinear_scaled) { TEST(mech_linear, linear_system) { std::vector<std::string> state_variables = {"h", "s", "d"}; - std::vector<fvm_value_type> values = {0.5, 0.2, 0.3}; + std::vector<arb_value_type> values = {0.5, 0.2, 0.3}; run_test<multicore::backend>("test_linear_state", state_variables, {}, values, 0.5); run_test<multicore::backend>("test_linear_init", state_variables, values, {}, 0.5); @@ -165,9 +165,9 @@ TEST(mech_linear, linear_system) { #ifdef ARB_GPU_ENABLED TEST(mech_kinetic_gpu, kinetic_linear_scaled) { std::vector<std::string> state_variables = {"s", "h", "d"}; - std::vector<fvm_value_type> t0_values = {0.5, 0.2, 0.3}; - std::vector<fvm_value_type> t1_0_values = {0.373297, 0.591621, 0.0350817}; - std::vector<fvm_value_type> t1_1_values = {0.329897, 0.537371, 0.132732}; + std::vector<arb_value_type> t0_values = {0.5, 0.2, 0.3}; + std::vector<arb_value_type> t1_0_values = {0.373297, 0.591621, 0.0350817}; + std::vector<arb_value_type> t1_1_values = {0.329897, 0.537371, 0.132732}; run_test<gpu::backend>("test0_kin_compartment", state_variables, t0_values, t1_0_values, 0.5); run_test<gpu::backend>("test1_kin_compartment", state_variables, t0_values, t1_1_values, 0.5); @@ -175,9 +175,9 @@ TEST(mech_kinetic_gpu, kinetic_linear_scaled) { TEST(mech_kinetic_gpu, kinetic_linear_1_conserve) { std::vector<std::string> state_variables = {"s", "h", "d"}; - std::vector<fvm_value_type> t0_values = {0.5, 0.2, 0.3}; - std::vector<fvm_value_type> t1_0_values = {0.380338, 0.446414, 0.173247}; - std::vector<fvm_value_type> t1_1_values = {0.218978, 0.729927, 0.0510949}; + std::vector<arb_value_type> t0_values = {0.5, 0.2, 0.3}; + std::vector<arb_value_type> t1_0_values = {0.380338, 0.446414, 0.173247}; + std::vector<arb_value_type> t1_1_values = {0.218978, 0.729927, 0.0510949}; run_test<gpu::backend>("test0_kin_diff", state_variables, t0_values, t1_0_values, 0.5); run_test<gpu::backend>("test0_kin_conserve", state_variables, t0_values, t1_0_values, 0.5); @@ -186,9 +186,9 @@ TEST(mech_kinetic_gpu, kinetic_linear_1_conserve) { TEST(mech_kinetic_gpu, kinetic_linear_2_conserve) { std::vector<std::string> state_variables = {"a", "b", "x", "y"}; - std::vector<fvm_value_type> t0_values = {0.2, 0.8, 0.6, 0.4}; - std::vector<fvm_value_type> t1_0_values = {0.217391304, 0.782608696, 0.33333333, 0.66666666}; - std::vector<fvm_value_type> t1_1_values = {0.230769, 0.769231, 0.189189, 0.810811}; + std::vector<arb_value_type> t0_values = {0.2, 0.8, 0.6, 0.4}; + std::vector<arb_value_type> t1_0_values = {0.217391304, 0.782608696, 0.33333333, 0.66666666}; + std::vector<arb_value_type> t1_1_values = {0.230769, 0.769231, 0.189189, 0.810811}; run_test<gpu::backend>("test1_kin_diff", state_variables, t0_values, t1_0_values, 0.5); run_test<gpu::backend>("test1_kin_conserve", state_variables, t0_values, t1_0_values, 0.5); @@ -197,9 +197,9 @@ TEST(mech_kinetic_gpu, kinetic_linear_2_conserve) { TEST(mech_kinetic_gpu, kinetic_nonlinear) { std::vector<std::string> state_variables = {"a", "b", "c"}; - std::vector<fvm_value_type> t0_values = {0.2, 0.3, 0.5}; - std::vector<fvm_value_type> t1_0_values = {0.222881, 0.31144, 0.48856}; - std::vector<fvm_value_type> t1_1_values = {0.2078873133, 0.34222075, 0.45777925}; + std::vector<arb_value_type> t0_values = {0.2, 0.3, 0.5}; + std::vector<arb_value_type> t1_0_values = {0.222881, 0.31144, 0.48856}; + std::vector<arb_value_type> t1_1_values = {0.2078873133, 0.34222075, 0.45777925}; run_test<gpu::backend>("test2_kin_diff", state_variables, t0_values, t1_0_values, 0.025); run_test<gpu::backend>("test3_kin_diff", state_variables, t0_values, t1_1_values, 0.025); @@ -207,22 +207,22 @@ TEST(mech_kinetic_gpu, kinetic_nonlinear) { TEST(mech_kinetic_gpu, normal_nonlinear_0) { std::vector<std::string> state_variables = {"a", "b", "c"}; - std::vector<fvm_value_type> t0_values = {0.2, 0.3, 0.5}; - std::vector<fvm_value_type> t1_values = {0.2078873133, 0.34222075, 0.45777925}; + std::vector<arb_value_type> t0_values = {0.2, 0.3, 0.5}; + std::vector<arb_value_type> t1_values = {0.2078873133, 0.34222075, 0.45777925}; run_test<gpu::backend>("test5_nonlinear_diff", state_variables, t0_values, t1_values, 0.025); } TEST(mech_kinetic_gpu, normal_nonlinear_1) { std::vector<std::string> state_variables = {"p"}; - std::vector<fvm_value_type> t0_values = {1}; - std::vector<fvm_value_type> t1_values = {1.0213199524}; + std::vector<arb_value_type> t0_values = {1}; + std::vector<arb_value_type> t1_values = {1.0213199524}; run_test<gpu::backend>("test6_nonlinear_diff", state_variables, t0_values, t1_values, 0.025); } TEST(mech_kinetic_gpu, kinetic_nonlinear_scaled) { std::vector<std::string> state_variables = {"A", "B", "C", "d", "e"}; - std::vector<fvm_value_type> t0_values = {4.5, 6.6, 0.28, 2, 0}; - std::vector<fvm_value_type> t1_values = {4.087281958014442, + std::vector<arb_value_type> t0_values = {4.5, 6.6, 0.28, 2, 0}; + std::vector<arb_value_type> t1_values = {4.087281958014442, 6.224088678118931, 0.6559113218810689, 1.8315624742412617, @@ -233,7 +233,7 @@ TEST(mech_kinetic_gpu, kinetic_nonlinear_scaled) { TEST(mech_linear_gpu, linear_system) { std::vector<std::string> state_variables = {"h", "s", "d"}; - std::vector<fvm_value_type> values = {0.5, 0.2, 0.3}; + std::vector<arb_value_type> values = {0.5, 0.2, 0.3}; run_test<gpu::backend>("test_linear_state", state_variables, {}, values, 0.5); run_test<gpu::backend>("test_linear_init", state_variables, {}, values, 0.5); diff --git a/test/unit/test_matrix_cpuvsgpu.cpp b/test/unit/test_matrix_cpuvsgpu.cpp index 8a00ddf4e8e27cdca67f36d9850ac08a1bcec860..ed172ba08e36756cfc71591a638d969f05808093 100644 --- a/test/unit/test_matrix_cpuvsgpu.cpp +++ b/test/unit/test_matrix_cpuvsgpu.cpp @@ -39,8 +39,8 @@ TEST(matrix, assemble) using gpu_state = gpu::backend::cable_solver; using mc_state = multicore::backend::cable_solver; - using T = fvm_value_type; - using I = fvm_index_type; + using T = arb_value_type; + using I = arb_index_type; using gpu_array = typename gpu::backend::array; using host_array = typename multicore::backend::array; diff --git a/test/unit/test_matrix_gpu.cpp b/test/unit/test_matrix_gpu.cpp index d015d2afe30dbba60663a3ee36f88ab657d2db90..85be75df148e690f906b1d63cd93689b04390565 100644 --- a/test/unit/test_matrix_gpu.cpp +++ b/test/unit/test_matrix_gpu.cpp @@ -39,8 +39,8 @@ using std::end; // test that the flat and interleaved storage back ends produce identical results TEST(matrix, backends) { - using T = fvm_value_type; - using I = fvm_index_type; + using T = arb_value_type; + using I = arb_index_type; using state_flat = gpu::matrix_state_flat<T, I>; using state_fine = gpu::matrix_state_fine<T, I>; diff --git a/test/unit/test_mech_temp_diam.cpp b/test/unit/test_mech_temp_diam.cpp index 49a720aa9d3565a6f8927e8da4da78a20eee5fe3..d3adf7ad0c3cc16b798922c68a39792a00ba89dd 100644 --- a/test/unit/test_mech_temp_diam.cpp +++ b/test/unit/test_mech_temp_diam.cpp @@ -20,9 +20,9 @@ void run_celsius_test() { // one cell, three CVs: - fvm_size_type ncell = 1; - fvm_size_type ncv = 3; - std::vector<fvm_index_type> cv_to_intdom(ncv, 0); + arb_size_type ncell = 1; + arb_size_type ncv = 3; + std::vector<arb_index_type> cv_to_intdom(ncv, 0); auto instance = cat.instance(backend::kind, "celsius_test"); auto& celsius_test = instance.mech; @@ -30,10 +30,10 @@ void run_celsius_test() { double temperature_K = 300.; double temperature_C = temperature_K-273.15; - std::vector<fvm_value_type> temp(ncv, temperature_K); - std::vector<fvm_value_type> diam(ncv, 1.); - std::vector<fvm_value_type> vinit(ncv, -65); - std::vector<fvm_index_type> src_to_spike = {}; + std::vector<arb_value_type> temp(ncv, temperature_K); + std::vector<arb_value_type> diam(ncv, 1.); + std::vector<arb_value_type> vinit(ncv, -65); + std::vector<arb_index_type> src_to_spike = {}; auto shared_state = std::make_unique<typename backend::shared_state>( ncell, ncell, 0, cv_to_intdom, cv_to_intdom, vinit, temp, diam, src_to_spike, celsius_test->data_alignment()); @@ -42,7 +42,7 @@ void run_celsius_test() { mechanism_overrides overrides; layout.weight.assign(ncv, 1.); - for (fvm_size_type i = 0; i<ncv; ++i) { + for (arb_size_type i = 0; i<ncv; ++i) { layout.cv.push_back(i); } @@ -52,7 +52,7 @@ void run_celsius_test() { // expect 0 value in state 'c' after init: celsius_test->initialize(); - std::vector<fvm_value_type> expected_c_values(ncv, 0.); + std::vector<arb_value_type> expected_c_values(ncv, 0.); EXPECT_EQ(expected_c_values, mechanism_field(celsius_test.get(), "c")); @@ -70,24 +70,24 @@ void run_diam_test() { // one cell, three CVs: - fvm_size_type ncell = 1; - fvm_size_type ncv = 3; - std::vector<fvm_index_type> cv_to_intdom(ncv, 0); + arb_size_type ncell = 1; + arb_size_type ncv = 3; + std::vector<arb_index_type> cv_to_intdom(ncv, 0); auto instance = cat.instance(backend::kind, "diam_test"); auto& celsius_test = instance.mech; - std::vector<fvm_value_type> temp(ncv, 300.); - std::vector<fvm_value_type> vinit(ncv, -65); - std::vector<fvm_value_type> diam(ncv); - std::vector<fvm_index_type> src_to_spike = {}; + std::vector<arb_value_type> temp(ncv, 300.); + std::vector<arb_value_type> vinit(ncv, -65); + std::vector<arb_value_type> diam(ncv); + std::vector<arb_index_type> src_to_spike = {}; mechanism_layout layout; mechanism_overrides overrides; layout.weight.assign(ncv, 1.); - for (fvm_size_type i = 0; i < ncv; ++i) { + for (arb_size_type i = 0; i < ncv; ++i) { diam[i] = i*2 + 0.1; layout.cv.push_back(i); } @@ -102,7 +102,7 @@ void run_diam_test() { // expect 0 value in state 'd' after init: celsius_test->initialize(); - std::vector<fvm_value_type> expected_d_values(ncv, 0.); + std::vector<arb_value_type> expected_d_values(ncv, 0.); EXPECT_EQ(expected_d_values, mechanism_field(celsius_test.get(), "d")); diff --git a/test/unit/test_mechcat.cpp b/test/unit/test_mechcat.cpp index 8c863b6100e94fc70808b9794d4cdf09bdea2d7e..edd754980da37557e5c1fd842820a19a7dd60306 100644 --- a/test/unit/test_mechcat.cpp +++ b/test/unit/test_mechcat.cpp @@ -54,15 +54,15 @@ mechanism_info mk_fleeb_info() { // Backend classes: struct test_backend { - using iarray = std::vector<fvm_index_type>; - using array = std::vector<fvm_value_type>; + using iarray = std::vector<arb_index_type>; + using array = std::vector<arb_value_type>; test_backend(const std::unordered_map<std::string, arb_ion_state>& ions_): shared_{ions_} {} struct shared_state { shared_state(const std::unordered_map<std::string, arb_ion_state>& ions_): ions{ions_} {} - void instantiate(mechanism& m, fvm_size_type id, const mechanism_overrides& o, const mechanism_layout& l) { + void instantiate(mechanism& m, arb_size_type id, const mechanism_overrides& o, const mechanism_layout& l) { m.ppack_ = {0}; m.ppack_.width = l.cv.size(); m.ppack_.mechanism_id = id; @@ -84,7 +84,7 @@ struct test_backend { } } - std::unordered_map<std::string, fvm_value_type> overrides; + std::unordered_map<std::string, arb_value_type> overrides; std::unordered_map<std::string, arb_ion_state> ions; std::unordered_map<arb_size_type, std::vector<arb_ion_state>> storage; }; diff --git a/test/unit/test_partition_by_constraint.cpp b/test/unit/test_partition_by_constraint.cpp index 2e8a29ad283757ebc89971519482d8e52fef76bf..2a14b7fe506491a4f39ea80d2511d9891ca2c26a 100644 --- a/test/unit/test_partition_by_constraint.cpp +++ b/test/unit/test_partition_by_constraint.cpp @@ -13,8 +13,8 @@ using namespace arb; using iarray = multicore::iarray; -constexpr unsigned vector_length = (unsigned) simd::simd_abi::native_width<fvm_value_type>::value; -using simd_value_type = simd::simd<fvm_value_type, vector_length, simd::simd_abi::default_abi>; +constexpr unsigned vector_length = (unsigned) simd::simd_abi::native_width<arb_value_type>::value; +using simd_value_type = simd::simd<arb_value_type, vector_length, simd::simd_abi::default_abi>; const int simd_width_ = simd::width<simd_value_type>(); const int input_size_ = 1024; diff --git a/test/unit/test_probe.cpp b/test/unit/test_probe.cpp index 7cf962832fb4b147794d1872fc78ea08088c4b9a..a122552a39a5fca9e9487992081c3d9e71081e5b 100644 --- a/test/unit/test_probe.cpp +++ b/test/unit/test_probe.cpp @@ -101,7 +101,7 @@ static morphology make_stick_morphology() { template <typename Backend> void run_v_i_probe_test(const context& ctx) { using fvm_cell = typename backend_access<Backend>::fvm_cell; - auto deref = [](const fvm_value_type* p) { return backend_access<Backend>::deref(p); }; + auto deref = [](const arb_value_type* p) { return backend_access<Backend>::deref(p); }; soma_cell_builder builder(12.6157/2.0); builder.add_branch(0, 200, 1.0/2, 1.0/2, 1, "dend"); @@ -174,7 +174,7 @@ void run_v_i_probe_test(const context& ctx) { // the voltage probes (cell membrane potential should be constant), and // zero for the current probe (including stimulus component). - fvm_value_type resting = voltage[0]; + arb_value_type resting = voltage[0]; EXPECT_NE(0.0, resting); EXPECT_EQ(resting, deref(p0a)); @@ -260,7 +260,7 @@ void run_v_cell_probe_test(const context& ctx) { template <typename Backend> void run_expsyn_g_probe_test(const context& ctx) { using fvm_cell = typename backend_access<Backend>::fvm_cell; - auto deref = [](const fvm_value_type* p) { return backend_access<Backend>::deref(p); }; + auto deref = [](const arb_value_type* p) { return backend_access<Backend>::deref(p); }; const double tau = 2.0; EXPECT_EQ(tau, global_default_catalogue()["expsyn"].parameters.at("tau").default_value); @@ -323,8 +323,8 @@ void run_expsyn_g_probe_test(const context& ctx) { const double dt = 0.001; lcell.integrate(tfinal, dt, evs, {}); - fvm_value_type g0 = deref(p0); - fvm_value_type g1 = deref(p1); + arb_value_type g0 = deref(p0); + arb_value_type g1 = deref(p1); // Expected value: weight*exp(-(t_final-t_event)/tau). double expected_g0 = 0.5*std::exp(-(tfinal-1.0)/tau); @@ -435,7 +435,7 @@ void run_expsyn_g_cell_probe_test(const context& ctx) { std::vector<double> expected_uncoalesced_value(targets.size()); std::vector<double> target_cv(targets.size(), (unsigned)-1); - std::unordered_map<fvm_size_type, unsigned> cv_expsyn_count; + std::unordered_map<arb_size_type, unsigned> cv_expsyn_count; for (unsigned j = 0; j<n_expsyn; ++j) { ASSERT_EQ(1u, expsyn_target_loc_map.count(m[j].target)); @@ -485,7 +485,7 @@ void run_expsyn_g_cell_probe_test(const context& ctx) { template <typename Backend> void run_ion_density_probe_test(const context& ctx) { using fvm_cell = typename backend_access<Backend>::fvm_cell; - auto deref = [](const fvm_value_type* p) { return backend_access<Backend>::deref(p); }; + auto deref = [](const arb_value_type* p) { return backend_access<Backend>::deref(p); }; // Use test mechanism write_Xi_Xo to check ion concentration probes and // density mechanism state probes. @@ -658,7 +658,7 @@ void run_ion_density_probe_test(const context& ctx) { template <typename Backend> void run_partial_density_probe_test(const context& ctx) { using fvm_cell = typename backend_access<Backend>::fvm_cell; - auto deref = [](const fvm_value_type* p) { return backend_access<Backend>::deref(p); }; + auto deref = [](const arb_value_type* p) { return backend_access<Backend>::deref(p); }; // Use test mechanism param_as_state to query averaged state values in CVs with // partial coverage by the mechanism. diff --git a/test/unit/test_spikes.cpp b/test/unit/test_spikes.cpp index d3279169a2f47d13460736288b03c2b87ddeec2f..5453a55eff16dd943d3396a205269b7a3e9df447 100644 --- a/test/unit/test_spikes.cpp +++ b/test/unit/test_spikes.cpp @@ -48,7 +48,7 @@ TEST(SPIKES_TEST_CLASS, threshold_watcher) { const std::vector<value_type> thresh{1., 2., 3.}; std::vector<int> src_to_spike_vec = {0, 1, 5}; - std::vector<fvm_value_type> time_since_spike_vec(10); + std::vector<arb_value_type> time_since_spike_vec(10); memory::fill(time_since_spike_vec, -1.0); // all values are initially 0, except for values[5] which we set diff --git a/test/unit/test_synapses.cpp b/test/unit/test_synapses.cpp index cd82579fdc07c5895738d854991dbec9c8a224b4..49014a03bdfff9ed31bfe30472cea5fee1bcfeec 100644 --- a/test/unit/test_synapses.cpp +++ b/test/unit/test_synapses.cpp @@ -70,8 +70,8 @@ auto unique_cast(std::unique_ptr<B> p) { TEST(synapses, syn_basic_state) { using util::fill; - using value_type = fvm_value_type; - using index_type = fvm_index_type; + using value_type = arb_value_type; + using index_type = arb_index_type; int num_syn = 4; int num_comp = 4; @@ -168,16 +168,16 @@ TEST(synapses, syn_basic_state) { expsyn->deliver_events(evts); exp2syn->deliver_events(evts); - using fvec = std::vector<fvm_value_type>; + using fvec = std::vector<arb_value_type>; - EXPECT_TRUE(testing::seq_almost_eq<fvm_value_type>( + EXPECT_TRUE(testing::seq_almost_eq<arb_value_type>( fvec({0, 3.14f, 0, 1.41f}), mechanism_field(expsyn, "g"))); double factor = mechanism_field(exp2syn, "factor")[0]; EXPECT_TRUE(factor>1.); fvec expected = {2.71f*factor, 0, 0.07f*factor, 0}; - EXPECT_TRUE(testing::seq_almost_eq<fvm_value_type>(expected, mechanism_field(exp2syn, "A"))); - EXPECT_TRUE(testing::seq_almost_eq<fvm_value_type>(expected, mechanism_field(exp2syn, "B"))); + EXPECT_TRUE(testing::seq_almost_eq<arb_value_type>(expected, mechanism_field(exp2syn, "A"))); + EXPECT_TRUE(testing::seq_almost_eq<arb_value_type>(expected, mechanism_field(exp2syn, "B"))); }