01: /*
02:  *  control.h
03:  *  dynamo.cgi
04:  *
05:  *  Created by ashley on 19/05/2009.
06:  *  Copyright 2009 __MyCompanyName__. All rights reserved.
07:  *
08:  */
09: 
10: enum _plottype {lineplot};
11: typedef enum _plottype plottype;
12: 
13: enum _integratortype {discreteintegrator, eulerintegrator, dde23integrator, dverkintegrator};
14: typedef enum _integratortype integratortype;
15: 
16: struct _plot {
17:         plottype type;
18:         int nlines;
19:         int ordinate;
20:         int *abscissae;
21:         char *label;
22:         char *title;
23:         char *xlabel;
24:         char *ylabel;
25: };
26: typedef struct _plot plot;
27: 
28: struct _constant {
29:         char *name;
30:         double value;
31:         char *info;
32:         int row;
33:         int column;
34: };
35: typedef struct _constant constant;
36: 
37: struct _variable {
38:         char *name;
39:         double value;
40:         
41:         char *linecolour;
42:         int lineStyle;
43:         char *markercolour;
44:         int markerstyle;
45:         int markersize;
46:         int linethickness;
47: };
48: typedef struct _variable variable;
49: 
50: struct _control {
51:         char *title;
52:         char *description;
53:         
54:         integratortype integrator;
55:         void (*fcn)();
56:         void (*init)();
57:         void (*output)();
58: 
59:         int nparameters;
60:         int nvariables;
61: //      char **variablenames;
62: //      double *variablevalues;
63:         variable **variables;
64: /*      char **parameternames;
65:         char **parameterinfo;
66:         double *parametervalues; */
67:         constant **parameters;
68:         
69:         int outputcounter;
70:         int maxoutput;
71:         double *results;
72:         
73:         int ncolumns;
74:         int nrows;
75:         
76:         int nplots;
77:         plot **plots;
78:         
79:         double t0;
80:         double t1;
81:         double dt;
82:         double tol;
83: };
84: typedef struct _control control;
85: 
86: char *astrcpy(char *source);
87: constant *makeconstant();
88: void freeconstant(constant *con);
89: variable *makevariable();
90: void freevariable(variable *var);
91: plot* makeplot(plottype t, int nlines, int ordinate, int *lines);
92: control *makecontrol(int n, int p, int m);
93: void freecontrol(control *c);
94: void initvariables(control *c, double *y);
95: void output(control *c, int n, double *y, double t);
96: void printresults(control *c);