Ignore:
Timestamp:
02/26/14 20:21:22 (10 years ago)
Author:
sz
Message:

Genetics reorganization (affects ALL applications!):

  • Converters/Validators? are now configured/initialized in a more verbose but also less confusing way
  • At the same time, the PreconfiguredGenetics? object will help you avoid the increased complexity by creating the ready-to-use environment that is sufficient in 99% of cases (see the demos)
  • Format F genetics updated (work in progress)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/fF/fF_genotype.h

    r140 r145  
    88#include <stdio.h>
    99#include "common/stl-util.h"
    10 
     10#include <frams/param/param.h>
    1111
    1212struct fF_growth_params
    1313{
    1414        int number_of_chambers;
    15         double scalex, scaley, scalez; //scaling factors
    16         double translation; //translation factor, TF range [−1; 1]
     15        double scalex, scaley, scalez;
     16        double translation;
    1717        double angle1, angle2;
    1818
     19        static ParamEntry paramtab[];
     20        Param param;
     21
    1922        fF_growth_params()
     23                :param(paramtab, this)
    2024        {
    2125                reset();
     
    2428        void reset()
    2529        {
    26                 number_of_chambers = 1;
    27                 scalex = scaley = scalez = 1;
    28                 translation = 1;
    29                 angle1 = angle2 = 0;
     30                param.setDefault();
    3031        }
    3132
    3233        bool load(const char* serialized)
    3334        {
    34                 return sscanf(serialized, "%d %lf %lf %lf %lf %lf %lf", &number_of_chambers, &scalex, &scaley, &scalez, &translation, &angle1, &angle2) == 7;
     35                SString s = serialized;
     36                int p = 0; //position in string
     37                return ((param.load2(s, p)==7) && (p==s.len()));
    3538        }
    3639
    3740        string save()
    3841        {
    39                 return ssprintf("%d %f %f %f %f %f %f", number_of_chambers, scalex, scaley, scalez, translation, angle1, angle2);
     42                SString tmp;
     43                param.save2(tmp, NULL/*object containing default values for comparison*/, false/*add CR*/, false/*force field names*/);
     44                return string((const char*)tmp);
    4045        }
    4146};
Note: See TracChangeset for help on using the changeset viewer.