Ignore:
Timestamp:
05/28/20 18:00:45 (4 years ago)
Author:
Maciej Komosinski
Message:

Neuron classes now have a property (a bit field) that says whether each neuron class supports model shape BALL_AND_STICK, SOLIDS, or both

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/neuro/neuroimpl.cpp

    r896 r932  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    4646        , ChannelSpace *ch
    4747#endif
    48         )
     48)
    4949        :mod(model), config(conf),
    5050        isbuilt(1), errorcount(0)
     
    6969        for (i = 0; n = mod.getNeuro(i); i++)
    7070        {
    71                 ni = conf.factory->createNeuroImpl(n);
     71                ni = conf.factory->createNeuroImpl(n, mod.getShapeType());
    7272                n->userdata[mytags_id] = ni;
    7373                if (!ni)
     
    8585        for (i = 0; n = mod.getNeuro(i); i++)
    8686        {
    87                 n->state += (rndDouble(1) - 0.5)*config.randominit;
     87                n->state += (rndDouble(1) - 0.5) * config.randominit;
    8888                ni = (NeuroImpl*)n->userdata[mytags_id];
    8989                if (!ni) continue;
     
    9898                ni->status = NeuroImpl::InitOk;
    9999                int order = ni->getSimOrder();
    100                 if (order < 0) order = 0; else if (order>2) order = 2;
     100                if (order < 0) order = 0; else if (order > 2) order = 2;
    101101                if (order < minorder) minorder = order;
    102102                if (order > maxorder) maxorder = order;
     
    189189double NeuroImpl::getNewState(int channel)
    190190{
    191         if (neuro->flags&Neuro::HoldState) return getState(channel);
     191        if (neuro->flags & Neuro::HoldState) return getState(channel);
    192192        if (channel >= channels) channel = channels - 1;
    193193        if (channel <= 0) { return newstate; }
     
    204204void NeuroImpl::commit()
    205205{
    206         if (!(neuro->flags&Neuro::HoldState))
     206        if (!(neuro->flags & Neuro::HoldState))
    207207        {
    208208                if (channels > 1)
     
    211211                if (owner->getConfig().nnoise > 0.0)
    212212                {
    213                         neuro->state += RndGen.GaussStd()*owner->getConfig().nnoise;
     213                        neuro->state += RndGen.GaussStd() * owner->getConfig().nnoise;
    214214                        if (channels > 1)
    215215                                for (int i = 0; i < chstate.size(); i++)
    216                                         chstate(0) += RndGen.GaussStd()*owner->getConfig().nnoise;
     216                                        chstate(0) += RndGen.GaussStd() * owner->getConfig().nnoise;
    217217                }
    218218        }
     
    270270        double w;
    271271        while (inp = neuro->getInput(startwith++, w))
    272                 sum += inp->state*w;
     272                sum += inp->state * w;
    273273        return sum;
    274274}
Note: See TracChangeset for help on using the changeset viewer.