From cdc2e6dbaa2b8807327f169f7a178665eed87267 Mon Sep 17 00:00:00 2001 From: nrnhines Date: Fri, 29 Sep 2023 17:35:22 -0400 Subject: [PATCH 1/2] Update electrotonic_analysis.rst (#2564) "Shape" links to documentation of the Shape class. This is incorrect. The link should be to the heading The Shape Tool --- docs/courses/electrotonic_analysis.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/courses/electrotonic_analysis.rst b/docs/courses/electrotonic_analysis.rst index e63b052617..092b6c0078 100644 --- a/docs/courses/electrotonic_analysis.rst +++ b/docs/courses/electrotonic_analysis.rst @@ -51,7 +51,7 @@ NEURON's tools for electrotonic analysis are gathered into four different "style - :ref:`log(A) vs. X ` -- :ref:`Shape ` +- :ref:`Shape ` 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. @@ -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 `. -.. _shape: +.. _electrotonic_shape_tool: The Shape Tool ++++++++++++++ From 5868cddcf2ffdffeee7d7132ef4f4afc71dde15e Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Mon, 2 Oct 2023 13:54:50 +0200 Subject: [PATCH 2/2] Stylistic improvements for `MutexPool`. (#2556) --- src/nrncvode/pool.h | 61 +++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 41 deletions(-) diff --git a/src/nrncvode/pool.h b/src/nrncvode/pool.h index 5b2f7f5cae..c062e93ad3 100644 --- a/src/nrncvode/pool.h +++ b/src/nrncvode/pool.h @@ -47,9 +47,8 @@ MutexPool::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) } @@ -62,22 +61,15 @@ void MutexPool::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_; @@ -88,35 +80,24 @@ void MutexPool::grow() { template MutexPool::~MutexPool() { - { - if (chain_) { - delete chain_; - } - } + delete chain_; delete[] pool_; - { - if (items_) { - delete[] items_; - } - } + delete[] items_; MUTDESTRUCT } template T* MutexPool::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; } @@ -139,12 +120,10 @@ void MutexPool::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_);