Skip to content

Commit

Permalink
Merge branch 'master' into cornu/clean_mpispike
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Cornu authored Oct 2, 2023
2 parents 7ad9347 + 5868cdd commit 7a41b6e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 43 deletions.
4 changes: 2 additions & 2 deletions docs/courses/electrotonic_analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ NEURON's tools for electrotonic analysis are gathered into four different "style

- :ref:`log(A) vs. X <log(A)_vs_x>`

- :ref:`Shape <shape>`
- :ref:`Shape <electrotonic_shape_tool>`

They are accessible through :menuselection:`NEURON Main Menu --> Tools --> Impedance`. In this exercise you will start to learn how to use each of them. To save screen space, close a tool when you are done with it.

Expand Down Expand Up @@ -217,7 +217,7 @@ But synapses aren't voltage sources. They're much more like current sources. In
So just click on the *Vout* radio button and you see that a synapse attached to a basilar dendrite will produce nearly the same somatic PSP no matter how far it is from the soma! This is the phenomenon that David Jaffe and I call passive normalization : variation of somatic PSP amplitude with synaptic distance is reduced ("normalization"), and it doesn't require active currents to happen ("passive"). For more information, see our :ref:`paper <citations>`.


.. _shape:
.. _electrotonic_shape_tool:

The Shape Tool
++++++++++++++
Expand Down
61 changes: 20 additions & 41 deletions src/nrncvode/pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ MutexPool<T>::MutexPool(long count, int mkmut) {
pool_ = new T[count_];
pool_size_ = count;
items_ = new T*[count_];
{
for (long i = 0; i < count_; ++i)
items_[i] = pool_ + i;
for (long i = 0; i < count_; ++i) {
items_[i] = pool_ + i;
}
MUTCONSTRUCT(mkmut)
}
Expand All @@ -62,22 +61,15 @@ void MutexPool<T>::grow() {
chain_ = p;
long newcnt = 2 * count_;
T** itms = new T*[newcnt];
long i, j;
put_ += count_;
{
for (i = 0; i < get_; ++i) {
itms[i] = items_[i];
}
for (long i = 0; i < get_; ++i) {
itms[i] = items_[i];
}
{
for (i = get_, j = 0; j < count_; ++i, ++j) {
itms[i] = p->items_[j];
}
for (long i = get_, j = 0; j < count_; ++i, ++j) {
itms[i] = p->items_[j];
}
{
for (i = put_, j = get_; j < count_; ++i, ++j) {
itms[i] = items_[j];
}
for (long i = put_, j = get_; j < count_; ++i, ++j) {
itms[i] = items_[j];
}
delete[] items_;
delete[] p->items_;
Expand All @@ -88,35 +80,24 @@ void MutexPool<T>::grow() {

template <typename T>
MutexPool<T>::~MutexPool() {
{
if (chain_) {
delete chain_;
}
}
delete chain_;
delete[] pool_;
{
if (items_) {
delete[] items_;
}
}
delete[] items_;
MUTDESTRUCT
}

template <typename T>
T* MutexPool<T>::alloc() {
MUTLOCK {
if (nget_ >= count_) {
grow();
}
MUTLOCK
if (nget_ >= count_) {
grow();
}
T* item = items_[get_];
get_ = (get_ + 1) % count_;
++nget_;
{
if (nget_ > maxget_) {
maxget_ = nget_;
}
}

maxget_ = std::max(nget_, maxget_);

MUTUNLOCK
return item;
}
Expand All @@ -139,12 +120,10 @@ void MutexPool<T>::free_all() {
nget_ = 0;
get_ = 0;
put_ = 0;
{
for (pp = this; pp; pp = pp->chain_) {
for (i = 0; i < pp->pool_size_; ++i) {
items_[put_++] = pp->pool_ + i;
pp->pool_[i].clear();
}
for (pp = this; pp; pp = pp->chain_) {
for (i = 0; i < pp->pool_size_; ++i) {
items_[put_++] = pp->pool_ + i;
pp->pool_[i].clear();
}
}
assert(put_ == count_);
Expand Down

0 comments on commit 7a41b6e

Please sign in to comment.