00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _PDE_HH_
00025 #define _PDE_HH_
00026 #include <stdio.h>
00027 #include <float.h>
00028 #include "graph.h"
00029
00030 class CellularPotts;
00031 class PDE {
00032
00033 friend class Info;
00034
00035 public:
00036
00044 PDE(const int layers, const int sizex,
00045 const int sizey);
00046
00047
00048
00049 virtual ~PDE();
00050
00056 void Plot(Graphics *g, const int layer=0);
00057
00063 void Plot(Graphics *g, CellularPotts *cpm, const int layer=0);
00064
00071 void ContourPlot(Graphics *g, int layer=0, int colour=1);
00072
00074 inline int SizeX() const {
00075 return sizex;
00076 }
00077
00079 inline int SizeY() const {
00080 return sizey;
00081 }
00082
00084 inline int Layers() const {
00085 return layers;
00086 }
00087
00095 inline double Sigma(const int layer, const int x, const int y) const {
00096 return sigma[layer][x][y];
00097 }
00098
00106 inline void setValue(const int layer, const int x, const int y, const double value) {
00107 sigma[layer][x][y]=value;
00108 }
00109
00116 inline void addtoValue(const int layer, const int x, const int y, const double value) {
00117 sigma[layer][x][y]+=value;
00118 }
00119
00125 inline double Max(int l) {
00126 double max=sigma[l][0][0];
00127 int loop=sizex*sizey;
00128 for (int i=1;i<loop;i++)
00129 if (sigma[l][0][i]>max) {
00130 max=sigma[l][0][i];
00131 }
00132 return max;
00133 }
00139 inline double Min(int l) {
00140 double min=sigma[l][0][0];
00141 int loop=sizex*sizey;
00142 for (int i=1;i<loop;i++)
00143 if (sigma[l][0][i]<min) {
00144 min=sigma[l][0][i];
00145 }
00146 return min;
00147 }
00148
00160 void Diffuse(int repeat);
00161
00165 void NoFluxBoundaries(void);
00166
00170 void AbsorbingBoundaries(void);
00171
00175 void PeriodicBoundaries(void);
00176
00185 void Secrete(CellularPotts *cpm);
00186
00189 inline double TheTime(void) const {
00190 return thetime;
00191 }
00192
00198 double GetChemAmount(const int layer=-1);
00199
00210 void GradC(int layer=0, int first_grad_layer=1);
00211
00225 void PlotVectorField(Graphics &g, int stride, int linelength, int first_grad_layer=1);
00226
00227 protected:
00228
00229 double ***sigma;
00230
00231
00232
00233
00234
00235
00236 double ***alt_sigma;
00237
00238 int sizex;
00239 int sizey;
00240 int layers;
00241
00242
00243
00244
00251 virtual int MapColour(double val);
00252
00254 PDE(void);
00255
00261 virtual double ***AllocateSigma(const int layers, const int sx, const int sy);
00262
00263 private:
00264 static const int nx[9], ny[9];
00265 double thetime;
00266
00267 };
00268
00269
00270 #endif