Changeset 896 for cpp/frams/model


Ignore:
Timestamp:
11/30/19 01:30:22 (4 years ago)
Author:
Maciej Komosinski
Message:

Replaced #defined macros for popular random-related operations with functions

Location:
cpp/frams/model
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/model/model.cpp

    r815 r896  
    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-2019  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    8383        updateRefno();
    8484        if (using_checkpoints)
    85                 for (vector<Model*>::const_iterator it = mod.checkpoints.begin(); it != mod.checkpoints.end(); it++)
    86                 {
    87                 Model *m = *it;
    88                 Model *n = new Model(*m, m->autobuildmaps, false, true);
    89                 checkpoints.push_back(n);
     85                for (vector<Model *>::const_iterator it = mod.checkpoints.begin(); it != mod.checkpoints.end(); it++)
     86                {
     87                        Model *m = *it;
     88                        Model *n = new Model(*m, m->autobuildmaps, false, true);
     89                        checkpoints.push_back(n);
    9090                }
    9191}
     
    152152void Model::clear()
    153153{
    154         FOREACH(Part*, p, parts)
     154        FOREACH(Part *, p, parts)
    155155                delete p;
    156         FOREACH(Joint*, j, joints)
     156        FOREACH(Joint *, j, joints)
    157157                delete j;
    158         FOREACH(Neuro*, n, neurons)
     158        FOREACH(Neuro *, n, neurons)
    159159                delete n;
    160160        parts.clear(); joints.clear(); neurons.clear();
     
    164164        geno = Geno();
    165165        f0geno = Geno();
    166         for (vector<Model*>::iterator it = checkpoints.begin(); it != checkpoints.end(); it++)
     166        for (vector<Model *>::iterator it = checkpoints.begin(); it != checkpoints.end(); it++)
    167167                delete *it;
    168168        checkpoints.clear();
     
    195195void Model::removeNeuros(SList &nlist)
    196196{
    197         FOREACH(Neuro*, nu, nlist)
     197        FOREACH(Neuro *, nu, nlist)
    198198        {
    199199                int i = findNeuro(nu);
     
    209209                SList jlist;
    210210                findJoints(jlist, p);
    211                 FOREACH(Joint*, j, jlist)
     211                FOREACH(Joint *, j, jlist)
    212212                {
    213213                        int i = findJoint(j);
     
    240240void Model::removeNeuro(int neuroindex, bool removereferences)
    241241{
    242         Neuro* thisN = getNeuro(neuroindex);
     242        Neuro *thisN = getNeuro(neuroindex);
    243243
    244244        if (removereferences)
    245245        {
    246                 Neuro* n;
     246                Neuro *n;
    247247                // remove all references to thisN
    248                 for (int i = 0; n = (Neuro*)neurons(i); i++)
     248                for (int i = 0; n = (Neuro *)neurons(i); i++)
    249249                {
    250250                        Neuro *inp;
     
    252252                                if (inp == thisN)
    253253                                {
    254                                 n->removeInput(j);
    255                                 j--;
     254                                        n->removeInput(j);
     255                                        j--;
    256256                                }
    257257                }
     
    262262}
    263263
    264 MultiMap& Model::getMap()
     264MultiMap &Model::getMap()
    265265{
    266266        if (!map) map = new MultiMap();
     
    277277}
    278278
    279 void Model::makeGenToGenMap(MultiMap& result, const MultiMap& gen1tomodel, const MultiMap& gen2tomodel)
     279void Model::makeGenToGenMap(MultiMap &result, const MultiMap &gen1tomodel, const MultiMap &gen2tomodel)
    280280{
    281281        result.clear();
     
    285285}
    286286
    287 void Model::getCurrentToF0Map(MultiMap& result)
     287void Model::getCurrentToF0Map(MultiMap &result)
    288288{
    289289        result.clear();
    290290        if (!map) return;
    291         const MultiMap& f0m = getF0Map();
     291        const MultiMap &f0m = getF0Map();
    292292        makeGenToGenMap(result, *map, f0m);
    293293}
     
    312312}
    313313
    314 Model::ItemType Model::itemTypeFromLinePrefix(const char* line)
    315 {
    316         struct PrefixAndItem { const char* prefix; ItemType type; };
     314Model::ItemType Model::itemTypeFromLinePrefix(const char *line)
     315{
     316        struct PrefixAndItem { const char *prefix; ItemType type; };
    317317        static const PrefixAndItem types[] = { { "m:", ModelType }, { "p:", PartType }, { "j:", JointType }, { "n:", NeuronType }, { "c:", NeuronConnectionType }, { F0_CHECKPOINT_LINE, CheckpointType }, { NULL } };
    318318        for (const PrefixAndItem *t = types; t->prefix != NULL; t++)
    319319        {
    320                 const char* in = line;
    321                 const char* pattern = t->prefix;
     320                const char *in = line;
     321                const char *pattern = t->prefix;
    322322                for (; *in == *pattern; in++, pattern++)
    323323                        if (*pattern == ':')
     
    355355        for (; f0txt.getNextToken(pos, line, '\n'); lnum++)
    356356        {
    357                 const char* line_ptr = line.c_str();
     357                const char *line_ptr = line.c_str();
    358358                for (; *line_ptr; line_ptr++)
    359359                        if (!strchr(" \r\t", *line_ptr)) break;
     
    361361                if (!*line_ptr) continue;
    362362
    363                 const char* colon = strchr(line_ptr, ':');
     363                const char *colon = strchr(line_ptr, ':');
    364364                ItemType type = UnknownType;
    365365                SString excluding_prefix;
     
    414414}
    415415
    416 const MultiMap& Model::getF0Map()
     416const MultiMap &Model::getF0Map()
    417417{
    418418        if (!f0map)
     
    472472        }
    473473
    474         for (i = 0; p = (Part*)parts(i); i++)
     474        for (i = 0; p = (Part *)parts(i); i++)
    475475        {
    476476                partparam.select(p);
     
    481481                        map->add(len, gen.len() - 1, partToMap(i));
    482482        }
    483         for (i = 0; j = (Joint*)joints(i); i++)
     483        for (i = 0; j = (Joint *)joints(i); i++)
    484484        {
    485485                jointparam.select(j);
     
    491491                        map->add(len, gen.len() - 1, jointToMap(i));
    492492        }
    493         for (i = 0; n = (Neuro*)neurons(i); i++)
     493        for (i = 0; n = (Neuro *)neurons(i); i++)
    494494        {
    495495                neuroparam.select(n);
     
    502502        for (a = 0; a < neurons.size(); a++)
    503503        { // inputs
    504                 n = (Neuro*)neurons(a);
     504                n = (Neuro *)neurons(a);
    505505                //      if ((n->getInputCount()==1)&&(n->getInput(0).refno <= n->refno))
    506506                //              continue; // already done with Neuro::conn_refno
     
    510510                        double w;
    511511                        NeuroConn nc;
    512                         Neuro* n2 = n->getInput(b, w);
     512                        Neuro *n2 = n->getInput(b, w);
    513513                        //              if (((n2.parentcount==1)&&(n2.parent)&&(n2.parent->refno < n2.refno)) ^
    514514                        //                  (n2.neuro_refno>=0))
     
    533533        }
    534534
    535         for (vector<Model*>::const_iterator it = checkpoints.begin(); it != checkpoints.end(); it++)
     535        for (vector<Model *>::const_iterator it = checkpoints.begin(); it != checkpoints.end(); it++)
    536536        {
    537537                Geno g = (*it)->getF0Geno();
     
    562562}
    563563
    564 Model* Model::getCheckpoint(int i)
     564Model *Model::getCheckpoint(int i)
    565565{
    566566        return checkpoints[i];
     
    575575}
    576576
    577 void Model::setGeno(const Geno& newgeno)
     577void Model::setGeno(const Geno &newgeno)
    578578{
    579579        geno = newgeno;
     
    586586        delMap();
    587587        delF0Map();
    588         for (i = 0; p = (Part*)parts(i); i++)
     588        for (i = 0; p = (Part *)parts(i); i++)
    589589                p->clearMapping();
    590         for (i = 0; j = (Joint*)joints(i); i++)
     590        for (i = 0; j = (Joint *)joints(i); i++)
    591591                j->clearMapping();
    592         for (i = 0; n = (Neuro*)neurons(i); i++)
     592        for (i = 0; n = (Neuro *)neurons(i); i++)
    593593                n->clearMapping();
    594594}
     
    607607                        Part *p; Joint *j; Neuro *n;
    608608                        int i;
    609                         for (i = 0; p = (Part*)parts(i); i++)
     609                        for (i = 0; p = (Part *)parts(i); i++)
    610610                                if (p->getMapping())
    611611                                        map->add(*p->getMapping(), partToMap(i));
    612                         for (i = 0; j = (Joint*)joints(i); i++)
     612                        for (i = 0; j = (Joint *)joints(i); i++)
    613613                                if (j->getMapping())
    614614                                        map->add(*j->getMapping(), jointToMap(i));
    615                         for (i = 0; n = (Neuro*)neurons(i); i++)
     615                        for (i = 0; n = (Neuro *)neurons(i); i++)
    616616                                if (n->getMapping())
    617617                                        map->add(*n->getMapping(), neuroToMap(i));
     
    629629}
    630630
    631 Pt3D Model::whereDelta(const Part& start, const Pt3D& rot, const Pt3D& delta)
     631Pt3D Model::whereDelta(const Part &start, const Pt3D &rot, const Pt3D &delta)
    632632{
    633633        Orient roto;
     
    641641}
    642642
    643 int Model::addFromString(ItemType item_type, const SString &singleline, const MultiRange* srcrange)
     643int Model::addFromString(ItemType item_type, const SString &singleline, const MultiRange *srcrange)
    644644{
    645645        return addFromString(item_type, singleline, 0, srcrange);
    646646}
    647647
    648 int Model::addFromString(ItemType item_type, const SString &singleline, int line_num, const MultiRange* srcrange)
     648int Model::addFromString(ItemType item_type, const SString &singleline, int line_num, const MultiRange *srcrange)
    649649{
    650650        SString error_message;
     
    654654                if (error_message.len() == 0) // generic error when no detailed message is available
    655655                        error_message = "Invalid f0 code";
    656                 if (line_num>0)
     656                if (line_num > 0)
    657657                        error_message += SString::sprintf(", line #%d", line_num);
    658658                error_message += nameForErrors();
     
    662662}
    663663
    664 int Model::addFromStringNoLog(ItemType item_type, const SString &line, SString& error_message, const MultiRange* srcrange)
     664int Model::addFromStringNoLog(ItemType item_type, const SString &line, SString &error_message, const MultiRange *srcrange)
    665665{
    666666        error_message = SString::empty();
     
    831831SString Model::nameForErrors() const
    832832{
    833         if (geno.getName().len()>0)
     833        if (geno.getName().len() > 0)
    834834                return SString::sprintf(" in '%s'", geno.getName().c_str());
    835835        return SString::empty();
     
    850850        else
    851851        {
    852                 Pt3D bbmin = ((Part*)parts(0))->p, bbmax = bbmin;
     852                Pt3D bbmin = ((Part *)parts(0))->p, bbmax = bbmin;
    853853                for (i = 0; i < parts.size(); i++)
    854854                {
    855                         p = (Part*)parts(i);
     855                        p = (Part *)parts(i);
    856856                        p->owner = this;
    857857                        if (checklevel > 0)
     
    894894                for (i = 0; i < joints.size(); i++)
    895895                {
    896                         j = (Joint*)joints(i);
     896                        j = (Joint *)joints(i);
    897897                        // VALIDMINMAX are managed manually when adding joint properties in f0-def!
    898898                        // (could be made dynamic but not really worth the effort)
     
    979979        for (i = 0; i < neurons.size(); i++)
    980980        {
    981                 n = (Neuro*)neurons(i);
     981                n = (Neuro *)neurons(i);
    982982                n->part_refno = (n->part) ? n->part->refno : -1;
    983983                n->joint_refno = (n->joint) ? n->joint->refno : -1;
     
    991991                        for (i = 0; i < parts.size(); i++)
    992992                        {
    993                                 p = (Part*)parts(i);
     993                                p = (Part *)parts(i);
    994994                                if (p->mass <= 0.001)
    995995                                        p->mass = 1.0;
     
    10031003                                for (i = 0; i < joints.size(); i++)
    10041004                                {
    1005                                         j = (Joint*)joints(i);
    1006                                         if (j->part1->flags&LINKFLAG)
     1005                                        j = (Joint *)joints(i);
     1006                                        if (j->part1->flags & LINKFLAG)
    10071007                                        {
    1008                                                 if (!(j->part2->flags&LINKFLAG))
     1008                                                if (!(j->part2->flags & LINKFLAG))
    10091009                                                {
    10101010                                                        change = 1;
     
    10131013                                        }
    10141014                                        else
    1015                                                 if (j->part2->flags&LINKFLAG)
     1015                                                if (j->part2->flags & LINKFLAG)
    10161016                                                {
    1017                                                 if (!(j->part1->flags&LINKFLAG))
    1018                                                 {
    1019                                                         change = 1;
    1020                                                         j->part1->flags |= LINKFLAG;
    1021                                                 }
     1017                                                        if (!(j->part1->flags & LINKFLAG))
     1018                                                        {
     1019                                                                change = 1;
     1020                                                                j->part1->flags |= LINKFLAG;
     1021                                                        }
    10221022                                                }
    10231023                                }
     
    10251025                        for (i = 0; i < parts.size(); i++)
    10261026                        {
    1027                                 p = (Part*)parts(i);
    1028                                 if (!(p->flags&LINKFLAG))
     1027                                p = (Part *)parts(i);
     1028                                if (!(p->flags & LINKFLAG))
    10291029                                {
    10301030                                        logPrintf("Model", "internalCheck", LOG_ERROR, "Not all parts connected (eg. Part #0 and Part #%d)%s", i, nameForErrors().c_str());
     
    10371037                for (i = 0; i < joints.size(); i++)
    10381038                {
    1039                         j = (Joint*)joints(i);
     1039                        j = (Joint *)joints(i);
    10401040                        if (j->p1_refno == j->p2_refno)
    10411041                        {
     
    10461046                        for (k = i + 1; k < joints.size(); k++)
    10471047                        {
    1048                                 Joint* j2 = (Joint*)joints(k);
     1048                                Joint *j2 = (Joint *)joints(k);
    10491049                                if (((j->p1_refno == j2->p1_refno) && (j->p2_refno == j2->p2_refno))
    10501050                                        || ((j->p1_refno == j2->p2_refno) && (j->p2_refno == j2->p1_refno)))
     
    10731073}
    10741074
    1075 const Geno& Model::getGeno() const
     1075const Geno &Model::getGeno() const
    10761076{
    10771077        return geno;
     
    11061106}
    11071107
    1108 Part* Model::getPart(int i) const
    1109 {
    1110         return ((Part*)parts(i));
     1108Part *Model::getPart(int i) const
     1109{
     1110        return ((Part *)parts(i));
    11111111}
    11121112
     
    11161116}
    11171117
    1118 Joint* Model::getJoint(int i) const
    1119 {
    1120         return ((Joint*)joints(i));
    1121 }
    1122 
    1123 int Model::findJoints(SList& result, const Part* part)
     1118Joint *Model::getJoint(int i) const
     1119{
     1120        return ((Joint *)joints(i));
     1121}
     1122
     1123int Model::findJoints(SList &result, const Part *part)
    11241124{
    11251125        Joint *j;
    11261126        int n0 = result.size();
    11271127        if (part)
    1128                 for (int i = 0; j = (Joint*)joints(i); i++)
    1129                         if ((j->part1 == part) || (j->part2 == part)) result += (void*)j;
     1128                for (int i = 0; j = (Joint *)joints(i); i++)
     1129                        if ((j->part1 == part) || (j->part2 == part)) result += (void *)j;
    11301130        return result.size() - n0;
    11311131}
    11321132
    1133 int Model::findNeuro(Neuro* n)
     1133int Model::findNeuro(Neuro *n)
    11341134{
    11351135        return neurons.find(n);
    11361136}
    11371137
    1138 int Model::findPart(Part* p)
     1138int Model::findPart(Part *p)
    11391139{
    11401140        return parts.find(p);
    11411141}
    11421142
    1143 int Model::findJoint(Joint* j)
     1143int Model::findJoint(Joint *j)
    11441144{
    11451145        return joints.find(j);
     
    11481148int Model::findJoint(Part *p1, Part *p2)
    11491149{
    1150         Joint* j;
     1150        Joint *j;
    11511151        for (int i = 0; j = getJoint(i); i++)
    11521152                if ((j->part1 == p1) && (j->part2 == p2)) return i;
     
    11611161}
    11621162
    1163 Neuro* Model::getNeuro(int i) const
    1164 {
    1165         return (Neuro*)neurons(i);
     1163Neuro *Model::getNeuro(int i) const
     1164{
     1165        return (Neuro *)neurons(i);
    11661166}
    11671167
     
    11741174}
    11751175
    1176 int Model::findNeuros(SList& result,
    1177         const char* classname, const Part* part, const Joint* joint)
     1176int Model::findNeuros(SList &result,
     1177        const char *classname, const Part *part, const Joint *joint)
    11781178{
    11791179        Neuro *nu;
    11801180        SString cn(classname);
    11811181        int n0 = result.size();
    1182         for (int i = 0; nu = (Neuro*)neurons(i); i++)
     1182        for (int i = 0; nu = (Neuro *)neurons(i); i++)
    11831183        {
    11841184                if (part)
     
    11881188                if (classname)
    11891189                        if (nu->getClassName() != cn) continue;
    1190                 result += (void*)nu;
     1190                result += (void *)nu;
    11911191        }
    11921192        return result.size() - n0;
     
    12021202        {
    12031203                Part *p = getPart(i);
    1204                 p->p.x += (rnd01 - 0.5)*amount;
    1205                 p->p.y += (rnd01 - 0.5)*amount;
    1206                 p->p.z += (rnd01 - 0.5)*amount;
     1204                p->p.x += (rndDouble(1) - 0.5) * amount;
     1205                p->p.y += (rndDouble(1) - 0.5) * amount;
     1206                p->p.z += (rndDouble(1) - 0.5) * amount;
    12071207        }
    12081208        for (i = 0; i < joints.size(); i++)
     
    12151215}
    12161216
    1217 void Model::move(const Pt3D& shift)
    1218 {
    1219         FOREACH(Part*, p, parts)
     1217void Model::move(const Pt3D &shift)
     1218{
     1219        FOREACH(Part *, p, parts)
    12201220                p->p += shift;
    12211221}
    12221222
    1223 void Model::rotate(const Orient& rotation)
    1224 {
    1225         FOREACH(Part*, p, parts)
     1223void Model::rotate(const Orient &rotation)
     1224{
     1225        FOREACH(Part *, p, parts)
    12261226        {
    12271227                p->p = rotation.transform(p->p);
     
    12301230}
    12311231
    1232 void Model::buildUsingSolidShapeTypes(const Model& src_ballandstick_shapes, Part::Shape use_shape, double thickness)
     1232void Model::buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape, double thickness)
    12331233{
    12341234        for (int i = 0; i < src_ballandstick_shapes.getJointCount(); i++)
     
    12471247                for (int i = 0; i < src_ballandstick_shapes.getPartCount(); i++)
    12481248                {
    1249                 Part *op = src_ballandstick_shapes.getPart(i);
    1250                 Part *p = addNewPart(Part::SHAPE_ELLIPSOID); //always using spherical shape regardless of the 'use_shape' parameter - 'use shape' is meant for sticks!
    1251                 p->p = op->p;
    1252                 p->rot = op->rot;
    1253                 p->scale.x = p->scale.y = p->scale.z = thickness;
     1249                        Part *op = src_ballandstick_shapes.getPart(i);
     1250                        Part *p = addNewPart(Part::SHAPE_ELLIPSOID); //always using spherical shape regardless of the 'use_shape' parameter - 'use shape' is meant for sticks!
     1251                        p->p = op->p;
     1252                        p->rot = op->rot;
     1253                        p->scale.x = p->scale.y = p->scale.z = thickness;
    12541254                }
    12551255        for (int i = 0; i < src_ballandstick_shapes.getPartCount(); i++)
     
    12751275}
    12761276
    1277 SolidsShapeTypeModel::SolidsShapeTypeModel(Model& m, Part::Shape use_shape, double thickness)
     1277SolidsShapeTypeModel::SolidsShapeTypeModel(Model &m, Part::Shape use_shape, double thickness)
    12781278{
    12791279        using_model = converted_model = NULL;
     
    13341334class MaxNeuro : public Neuro { public: MaxNeuro() { Param par(f0_neuro_paramtab, this); par.setMax(); } };
    13351335
    1336 Part& Model::getMinPart() { static MinPart part; return part; }
    1337 Part& Model::getMaxPart() { static MaxPart part; return part; }
    1338 Part& Model::getDefPart() { static Part part; return part; }
    1339 Joint& Model::getMinJoint() { static MinJoint joint; return joint; }
    1340 Joint& Model::getMaxJoint() { static MaxJoint joint; return joint; }
    1341 Joint& Model::getDefJoint() { static Joint joint; return joint; }
    1342 Neuro& Model::getMinNeuro() { static MinNeuro neuro; return neuro; }
    1343 Neuro& Model::getMaxNeuro() { static MaxNeuro neuro; return neuro; }
    1344 Neuro& Model::getDefNeuro() { static Neuro neuro; return neuro; }
     1336Part &Model::getMinPart() { static MinPart part; return part; }
     1337Part &Model::getMaxPart() { static MaxPart part; return part; }
     1338Part &Model::getDefPart() { static Part part; return part; }
     1339Joint &Model::getMinJoint() { static MinJoint joint; return joint; }
     1340Joint &Model::getMaxJoint() { static MaxJoint joint; return joint; }
     1341Joint &Model::getDefJoint() { static Joint joint; return joint; }
     1342Neuro &Model::getMinNeuro() { static MinNeuro neuro; return neuro; }
     1343Neuro &Model::getMaxNeuro() { static MaxNeuro neuro; return neuro; }
     1344Neuro &Model::getDefNeuro() { static Neuro neuro; return neuro; }
  • cpp/frams/model/model.h

    r815 r896  
    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-2019  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    7777        SList parts, joints, neurons;
    7878        char partmappingchanged;
    79         vector<Model*> checkpoints;
     79        vector<Model *> checkpoints;
    8080
    8181        void internalCopy(const Model &mod);
     
    141141
    142142        int getCheckpointCount();
    143         Model* getCheckpoint(int i);
     143        Model *getCheckpoint(int i);
    144144
    145145        /// The bounding box size. Valid if the model is valid. Read only.
     
    201201
    202202        /// change source genotype
    203         void setGeno(const Geno& newgeno);
     203        void setGeno(const Geno &newgeno);
    204204
    205205        /** @return f0 genotype - generated from current model state
     
    241241                @see convmap
    242242                */
    243         void getCurrentToF0Map(MultiMap& m);
     243        void getCurrentToF0Map(MultiMap &m);
    244244
    245245        void setValidationLevel(int level)
     
    250250        /// calculate location of the new part connected to the existing one
    251251        /// using delta option
    252         Pt3D whereDelta(const Part& start, const Pt3D& rot, const Pt3D& delta);
     252        Pt3D whereDelta(const Part &start, const Pt3D &rot, const Pt3D &delta);
    253253
    254254        /// create the whole model from scratch, using current genotype
     
    256256
    257257        /// setGeno(newgeno); rebuild();
    258         void rebuild(const Geno& newgeno, bool buildmaps) { setGeno(newgeno); rebuild(buildmaps); }
     258        void rebuild(const Geno &newgeno, bool buildmaps) { setGeno(newgeno); rebuild(buildmaps); }
    259259
    260260        /// reuse current model object but discard all model data
     
    262262
    263263        enum ItemType { UnknownType, ModelType, PartType, JointType, NeuronType, NeuronConnectionType, CheckpointType };
    264         static ItemType itemTypeFromLinePrefix(const char* line);
     264        static ItemType itemTypeFromLinePrefix(const char *line);
    265265        /** Execute single line of <B>f0</B> genotype.
    266266                Return value is non-negative reference number of the created item,
     
    270270                @param srcrange source genotype range which will be mapped to this element
    271271                */
    272         int addFromString(ItemType item_type, const SString &singleline, int line_num, const MultiRange* srcrange = NULL);
     272        int addFromString(ItemType item_type, const SString &singleline, int line_num, const MultiRange *srcrange = NULL);
    273273        /** Execute single line of <B>f0</B> genotype - compatiblity variant */
    274         int addFromString(ItemType item_type, const SString &singleline, const MultiRange* srcrange = NULL);
     274        int addFromString(ItemType item_type, const SString &singleline, const MultiRange *srcrange = NULL);
    275275        /** Execute single line of <B>f0</B> genotype - low level variant, used by Model::build(), error messages returned as string instead of calling logger */
    276         int addFromStringNoLog(ItemType item_type, const SString &singleline, SString& error_message, const MultiRange* srcrange = 0);
     276        int addFromStringNoLog(ItemType item_type, const SString &singleline, SString &error_message, const MultiRange *srcrange = 0);
    277277
    278278        /// separate build stages (for future use)
     
    357357
    358358        /// @return part index or -1 if not found in the model
    359         int findPart(Part* p);
     359        int findPart(Part *p);
    360360        /// @return joint index or -1 if not found in the model
    361         int findJoint(Joint* j);
     361        int findJoint(Joint *j);
    362362        /// @return neuro index or -1 if not found in the model
    363         int findNeuro(Neuro* nu);
     363        int findNeuro(Neuro *nu);
    364364        /// @return joint index or -1 if not found in the model
    365365        int findJoint(Part *p1, Part *p2);
     
    368368                @param result objects will be appended here
    369369                @return number of objects found  */
    370         int findNeuros(SList& result, const char* classname = 0, const Part* part = 0, const Joint* joint = 0);
     370        int findNeuros(SList &result, const char *classname = 0, const Part *part = 0, const Joint *joint = 0);
    371371
    372372        /** search for joints connected to the part
    373373                @param result objects will be appended here
    374374                @return number of objects found  */
    375         int findJoints(SList& result, const Part* part = 0);
     375        int findJoints(SList &result, const Part *part = 0);
    376376
    377377        void disturb(double amount);
    378         void move(const Pt3D& shift);
     378        void move(const Pt3D &shift);
    379379        /// rotate around the origin (move-rotate-move to rotate around arbitrary point)
    380         void rotate(const Orient& rotation);
     380        void rotate(const Orient &rotation);
    381381        /// rotate around the origin (move-rotate-move to rotate around arbitrary point)
    382         void rotate(const Pt3D& angles) { Orient o = Orient_1; o.rotate(angles); rotate(o); }
     382        void rotate(const Pt3D &angles) { Orient o = Orient_1; o.rotate(angles); rotate(o); }
    383383
    384384        /// build this model using solid shape types, based on the provided ball-and-stick model. See also shapeconvert.cpp.
    385         void buildUsingSolidShapeTypes(const Model& src_ballandstick_shapes, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = 0.2);
     385        void buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = 0.2);
    386386
    387387protected:
     
    403403        static int mapToNeuro(int i);
    404404
    405         static void makeGenToGenMap(MultiMap& result, const MultiMap& gen1tomodel, const MultiMap& gen2tomodel);
     405        static void makeGenToGenMap(MultiMap &result, const MultiMap &gen1tomodel, const MultiMap &gen2tomodel);
    406406
    407407        ///////////////////////////
    408408
    409         static Part& getMinPart();
    410         static Part& getMaxPart();
    411         static Part& getDefPart();
    412         static Joint& getMinJoint();
    413         static Joint& getMaxJoint();
    414         static Joint& getDefJoint();
    415         static Neuro& getMinNeuro();
    416         static Neuro& getMaxNeuro();
    417         static Neuro& getDefNeuro();
     409        static Part &getMinPart();
     410        static Part &getMaxPart();
     411        static Part &getDefPart();
     412        static Joint &getMinJoint();
     413        static Joint &getMaxJoint();
     414        static Joint &getDefJoint();
     415        static Neuro &getMinNeuro();
     416        static Neuro &getMaxNeuro();
     417        static Neuro &getDefNeuro();
    418418};
    419419
     
    436436        Model *converted_model;
    437437        Model *using_model;
    438         SolidsShapeTypeModel(Model& m, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = 0.2);
    439         operator Model&() { return *using_model; }
    440         Model& getModel() { return *using_model; }
     438        SolidsShapeTypeModel(Model &m, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = 0.2);
     439        operator Model &() { return *using_model; }
     440        Model &getModel() { return *using_model; }
    441441        ~SolidsShapeTypeModel() { if (converted_model) delete converted_model; }
    442442};
Note: See TracChangeset for help on using the changeset viewer.