Changeset 933 for cpp/frams/neuro


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

When constructing a neuron, check whether it supports the shape type of the model (BALL_AND_STICK / SOLIDS) and warn if it does not

File:
1 edited

Legend:

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

    r790 r933  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    2222}
    2323
    24 NeuroImpl* NeuroFactory::createNeuroImpl(NeuroClass *nc)
     24NeuroImpl* NeuroFactory::createNeuroImpl(NeuroClass *nc, Model::ShapeType shape_type)
    2525{
    2626        if (!nc) return 0;
    2727        if (!nc->active) return 0;
     28        if (!(nc->supported_shape_types & (1 << (int)shape_type)))
     29        {
     30                logPrintf("NeuroFactory", "createNeuroImpl", LOG_WARN,
     31                        "Neuro class '%s' does not support shape type '%d'", nc->name.c_str(), (int)shape_type);
     32                return NULL;
     33        }
    2834        NeuroImpl* ni = getImplementation(nc);
    2935        if (!ni) return 0;
     
    99105        if (removed.len())
    100106                logPrintf("NeuroFactory", "removeUninmplemented", LOG_INFO,
    101                 "Removed Neuro classes: %s", removed.c_str());
     107                        "Removed Neuro classes: %s", removed.c_str());
    102108}
Note: See TracChangeset for help on using the changeset viewer.