Last change
on this file since 667 was
667,
checked in by Maciej Komosinski, 7 years ago
|
- fF foraminifera encoding supports scaling (radius) of the initial chamber (three new parameters added: radii for x,y,z)
- mutation ignores these three parameters
- float -> double for consistency everywhere
|
-
Property svn:eol-style set to
native
|
File size:
1.2 KB
|
Rev | Line | |
---|
[286] | 1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/ |
---|
[667] | 2 | // Copyright (C) 1999-2017 Maciej Komosinski and Szymon Ulatowski. |
---|
[286] | 3 | // See LICENSE.txt for details. |
---|
[140] | 4 | |
---|
| 5 | #ifndef _FF_GENOTYPE_H_ |
---|
| 6 | #define _FF_GENOTYPE_H_ |
---|
| 7 | |
---|
| 8 | #include <stdio.h> |
---|
| 9 | #include "common/stl-util.h" |
---|
[145] | 10 | #include <frams/param/param.h> |
---|
[140] | 11 | |
---|
[176] | 12 | //Growth parameters; see http://www.framsticks.com/foraminifera |
---|
[140] | 13 | struct fF_growth_params |
---|
| 14 | { |
---|
| 15 | int number_of_chambers; |
---|
[667] | 16 | double radius0x, radius0y, radius0z; //radius of 0th (initial) chamber |
---|
| 17 | double scalex, scaley, scalez; //(cumulative) scaling of consecutive chambers |
---|
[145] | 18 | double translation; |
---|
[140] | 19 | double angle1, angle2; |
---|
[667] | 20 | #define fF_PROPS_TO_MUTATE {0,4,5,6,7,8,9} //indexes of properties from paramtab; keep synchronized with fF_genotype.cpp |
---|
[140] | 21 | |
---|
[145] | 22 | static ParamEntry paramtab[]; |
---|
| 23 | Param param; |
---|
| 24 | |
---|
[667] | 25 | fF_growth_params() :param(paramtab, this) |
---|
[140] | 26 | { |
---|
| 27 | reset(); |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | void reset() |
---|
| 31 | { |
---|
[145] | 32 | param.setDefault(); |
---|
[140] | 33 | } |
---|
| 34 | |
---|
| 35 | bool load(const char* serialized) |
---|
| 36 | { |
---|
[145] | 37 | SString s = serialized; |
---|
| 38 | int p = 0; //position in string |
---|
[667] | 39 | return ((param.load2(s, p) == param.getPropCount()) && (p == s.len())); |
---|
[140] | 40 | } |
---|
| 41 | |
---|
| 42 | string save() |
---|
| 43 | { |
---|
[145] | 44 | SString tmp; |
---|
| 45 | param.save2(tmp, NULL/*object containing default values for comparison*/, false/*add CR*/, false/*force field names*/); |
---|
[348] | 46 | return string(tmp.c_str()); |
---|
[140] | 47 | } |
---|
| 48 | }; |
---|
| 49 | |
---|
| 50 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.