00001 #define XMIN bounds[0]
00002 #define XMAX bounds[1]
00003
00007 enum BoundaryTypes {
00008 insideBoundary=0,
00009 periodicBoundary,
00010 elasticBoundary,
00011 openBoundary,
00012 maxBoundaryTypes
00013 };
00018 struct Boundary {
00019 int idir,
00020 iside;
00021 REAL *xmin,*xmax;
00022 BoundaryTypes type;
00023 bool adiabatic;
00024 REAL
00025 area,
00026 temperature;
00027 List<Gas> gases;
00028 Reaction *reactions;
00029
00030 Boundary() {
00031 idir=iside=-1;
00032 xmin=xmax=NULL;
00033 type=elasticBoundary;
00034 adiabatic=true;
00035 temperature=0.0;
00036 area=0.0;
00037 reactions=NULL;
00038 }
00040 ~Boundary() {
00041
00042 }
00043 inline REAL Area() {return area;}
00044 inline void Area(REAL a){ area=a; }
00045 inline REAL Temperature() {return temperature;}
00046 inline void Temperature(REAL t){ temperature=t; }
00047 void init(int i, int j, REAL ymin[], REAL ymax[], int nspecies);
00048 void Inject(
00049 int specietype,
00050 REAL vavx,
00051 REAL temperature,
00052 Collection<Molecule> *molecules
00053 );
00054 };
00063 class Bulk {
00064 REAL temperature,volume,
00065 xmin[DIM],xmax[DIM];
00066 public:
00067 List<Gas> gases;
00068 inline REAL Temperature() {return temperature; }
00069 inline void Temperature(REAL temp) {temperature=temp;}
00070 inline REAL Volume() {return volume; }
00071 inline void Volume(REAL vol) {volume=vol;}
00072 void init(REAL xmin[], REAL xmax[]);
00074 Molecule *inject(int specie, REAL velocity, Collection<Molecule> *molecules);
00076 };
00083 class Domain {
00084 int *distribution;
00085 REAL bounds[2][DIM];
00086 char boundaryName[maxBoundaryTypes][WORDLENGTH];
00087 Bulk bulk;
00088 Boundary boundaries[DIM][2];
00089 Collection<Molecule> molecules;
00090 Pool<Molecule> *pool;
00091 public:
00092 Domain(char *filename);
00093 ~Domain();
00094 inline void BoundaryType(enum BoundaryTypes b, int idir, int inside) {
00095 if(idir<0||idir>=DIM||inside<0||inside>2) {
00096 fprintf(stderr,"ERROR: Invalid boundary index: %d, %d in BoundaryType\n",idir,inside);
00097 exit(1);
00098 }
00099 boundaries[idir][inside].type=b;
00100 };
00101 inline enum BoundaryTypes BoundaryType(int idir, int inside) {
00102 if(idir<0||idir>=DIM||inside<0||inside>2) {
00103 fprintf(stderr,"ERROR: Invelid boundary index: %d, %d in BoundaryType\n",idir,inside);
00104 exit(1);
00105 }
00106 return boundaries[idir][inside].type;
00107 };
00108 inline void setMinBound(int i, REAL x){ bounds[0][i]=x;};
00109 inline void setMaxBound(int i, REAL x){ bounds[1][i]=x;};
00110 inline REAL minBound(int i){ return bounds[0][i];};
00111 inline REAL maxBound(int i){ return bounds[1][i];};
00112
00113 int computeBounds(REAL x0[], REAL x1[]);
00114
00115 inline Collection<Molecule> *Molecules(){ return &molecules; };
00116
00117 int run(int niter);
00118 void step(int iter);
00119 int boundary(Molecule *molecule);
00150 void injection();
00151 void interaction();
00152 void interaction(int icounter);
00158 Interaction interact(Molecule *a, Molecule *b);
00168 void init();
00169 void load(char *filename);
00170 void save(char *taskname);
00171 };
00172