[med-svn] [cnrun] 08/11: fix decimate and putout

andrei zavada hmmr-guest at moszumanska.debian.org
Sat Jan 30 17:27:51 UTC 2016


This is an automated email from the git hooks/post-receive script.

hmmr-guest pushed a commit to branch WIP
in repository cnrun.

commit b1fdd3a24b49f30d378d221b20bdb76031cdf5d0
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Tue Jan 12 05:18:28 2016 +0200

    fix decimate and putout
    
    * don't delete synapses;
    * restart iteration over units after delete.
---
 upstream/src/libcnrun/model/tags.cc | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/upstream/src/libcnrun/model/tags.cc b/upstream/src/libcnrun/model/tags.cc
index 847529d..96b32aa 100644
--- a/upstream/src/libcnrun/model/tags.cc
+++ b/upstream/src/libcnrun/model/tags.cc
@@ -142,21 +142,19 @@ process_putout_tags( const list<STagGroup> &ToRemove)
         regex_t RE;
         for ( auto& P : ToRemove ) {
                 if (0 != regcomp( &RE, P.pattern.c_str(), REG_EXTENDED | REG_NOSUB)) {
-                        vp( 0,  stderr, "Invalid regexp in process_putout_tags: \"%s\"\n", P.pattern.c_str());
+                        vp( 0, stderr, "Invalid regexp in process_putout_tags: \"%s\"\n", P.pattern.c_str());
                         continue;
                 }
-                auto Ui = units.rbegin();
-                while ( Ui != units.rend() ) {
-                        ++Ui;
-                        auto& U = **prev(Ui);
-                        if ( regexec( &RE, U._label, 0, 0, 0) == 0 ) {
-                                vp( 2, " (put out unit \"%s\")\n", U._label);
-                                delete &U;
+        repeat:
+                for ( auto U : units )
+                        if ( U->is_neuron() and
+                             regexec( &RE, U->_label, 0, 0, 0) == 0 ) {
+                                delete U;
+                                vp( 2, " (put out unit \"%s\")\n", U->_label);
                                 ++count;
+                                goto repeat;
                         }
-                }
         }
-
         cull_blind_synapses();
 
         return count;
@@ -179,7 +177,8 @@ process_decimate_tags( const list<STagGroupDecimate> &ToDecimate)
               // collect group
                 vector<C_BaseUnit*> dcmgroup;
                 for ( auto& U : units )
-                        if ( regexec( &RE, U->_label, 0, 0, 0) == 0 )
+                        if ( U->is_neuron() and
+                             regexec( &RE, U->_label, 0, 0, 0) == 0 )
                                 dcmgroup.push_back( U);
                 random_shuffle( dcmgroup.begin(), dcmgroup.end());
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/cnrun.git



More information about the debian-med-commit mailing list