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