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

Last change on this file since 732 was 720, checked in by Maciej Komosinski, 7 years ago

Param::save2() renamed to saveSingleLine(); unified Param::load() so that it gets a single-line/multi-line format selector

  • 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 "common/stl-util.h"
10#include <frams/param/param.h>
11
12//Growth parameters; see http://www.framsticks.com/foraminifera
13struct fF_growth_params
14{
15        int number_of_chambers;
16        double radius0x, radius0y, radius0z; //radius of 0th (initial) chamber
17        double scalex, scaley, scalez; //(cumulative) scaling of consecutive chambers
18        double translation;
19        double angle1, angle2;
20#define fF_PROPS_TO_MUTATE {0,4,5,6,7,8,9} //indexes of properties from paramtab; keep synchronized with fF_genotype.cpp
21
22        static ParamEntry paramtab[];
23        Param param;
24
25        fF_growth_params() :param(paramtab, this)
26        {
27                reset();
28        }
29
30        void reset()
31        {
32                param.setDefault();
33        }
34
35        bool load(const char* serialized)
36        {
37                SString s = serialized;
38                ParamInterface::LoadOptions opts;
39                return ((param.load(ParamInterface::FormatSingleLine, s, &opts) == param.getPropCount()) && (opts.offset == s.len()));
40        }
41
42        string save()
43        {
44                SString tmp;
45                param.saveSingleLine(tmp, NULL/*object containing default values for comparison*/, false/*add CR*/, false/*force field names*/);
46                return string(tmp.c_str());
47        }
48};
49
50#endif
Note: See TracBrowser for help on using the repository browser.