source: cpp/frams/genetics/fF/fF_genotype.h @ 841

Last change on this file since 841 was 841, checked in by Maciej Komosinski, 7 months ago

Updated #includes after splitting stl-util into util-stl, util-file and util-string

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
2// Copyright (C) 1999-2017  Maciej Komosinski and Szymon Ulatowski.
3// See LICENSE.txt for details.
4
5#ifndef _FF_GENOTYPE_H_
6#define _FF_GENOTYPE_H_
7
8#include <stdio.h>
9#include <frams/param/param.h>
10
11//Growth parameters; see http://www.framsticks.com/foraminifera
12struct fF_growth_params
13{
14        int number_of_chambers;
15        double radius0x, radius0y, radius0z; //radius of 0th (initial) chamber
16        double scalex, scaley, scalez; //(cumulative) scaling of consecutive chambers
17        double translation;
18        double angle1, angle2;
19#define fF_PROPS_TO_MUTATE {0,4,5,6,7,8,9} //indexes of properties from paramtab; keep synchronized with fF_genotype.cpp
20
21        static ParamEntry paramtab[];
22        Param param;
23
24        fF_growth_params() :param(paramtab, this)
25        {
26                reset();
27        }
28
29        void reset()
30        {
31                param.setDefault();
32        }
33
34        bool load(const char* serialized)
35        {
36                SString s = serialized;
37                ParamInterface::LoadOptions opts;
38                return ((param.load(ParamInterface::FormatSingleLine, s, &opts) == param.getPropCount()) && (opts.offset == s.len()));
39        }
40
41        string save()
42        {
43                SString tmp;
44                param.saveSingleLine(tmp, NULL/*object containing default values for comparison*/, false/*add CR*/, false/*force field names*/);
45                return string(tmp.c_str());
46        }
47};
48
49#endif
Note: See TracBrowser for help on using the repository browser.