00001 #ifndef WEKTOR_H_
00002 #define WEKTOR_H_
00003
00004 #include <string>
00005 #include <cstring>
00006 #include <fstream>
00007 #include <cmath>
00008 #include <iostream>
00009
00010
00011 using std::string;
00012 using std::ifstream;
00013 using std::ofstream;
00014 using std::endl;
00015 using std::cout;
00016
00017
00018
00019 class StringList{
00020
00021 int iter,grow,max;
00022
00023 string *Lista;
00024
00025 public:
00026
00027
00028 StringList(int grow1,int max1){iter=0;grow=grow1;max=max1;Lista = new string[max];}
00029 StringList(){iter=0;max=10;grow=5;Lista = new string[max];}
00030
00031 void setElement(string &a);
00032 int setElementUniqatReturnPosition_plus1(string &a){for(int i=0;i<iter;i++){if(a == Lista[i]){return i+1;}}setElement(a);return iter;}
00033 int setElementUniqatReturnPosition(string &a){for(int i=0;i<iter;i++){if(a == Lista[i]){return i;}}setElement(a);return iter-1;}
00034
00035 string& getElement(int ktory){return Lista[ktory];}
00036 string& getLastElement(){return Lista[iter-1];}
00037 string& getLastElement(int ktory_od_konca){return Lista[iter-(ktory_od_konca+1)];}
00038 void czysc(int grow1,int max1){grow=grow1;max=max1; if(Lista!=NULL){delete []Lista; Lista = new string[max];iter=0;}}
00039 void ustawIter(int iter1){iter = iter1;}
00040 void usunElement(const int &ktory){Lista[ktory]=Lista[--iter];}
00041 ~StringList(){if(Lista!=NULL){delete []Lista;Lista = NULL;}}
00042
00043 };
00044
00045
00047
00050
00052
00053
00054 class IntList{
00055
00056 int iter,grow,max;
00057
00058 int *Lista;
00059 public:
00060
00061 IntList(int grow1,int max1){iter=0;grow=grow1;max=max1;Lista = new int[max];}
00062 IntList(){iter=0;max=10;grow=5;Lista = new int[max];}
00063
00064 int getIter(){return iter;}
00065 int getM(){return max;}
00066 void setGrow(int grow1){if(grow>1){grow=grow1;}}
00067
00068 int funPodWarunki(const int &a1,const int &a2,int &war);
00069
00070 int getElementKey(const int key){for(int i=0;i<iter;i+=2){if(Lista[i]==key){return Lista[i+1];}}return -10;}
00071 int getElement2Kay(const int &key1,const int &key2);
00072 int uniqatPozycja(const int &jaki){for(int i=0;i<iter;++i){if(Lista[i]==jaki){return i;}}return (-1);}
00073
00074 void setElement(const int &a);
00075 bool setElementUniqat(const int &a){for(int i=0;i<iter;i++){if(a == Lista[i]){return false;}}setElement(a);return true;}
00076 bool setElementUniqatOddNumbers(const int &a){for(int i=1;i<iter;i+=2){if(a == Lista[i]){return false;}}setElement(a);return true;}
00077 bool setElementUniqatEvenNumbers(const int &a){for(int i=0;i<iter;i+=2){if(a == Lista[i]){return false;}}setElement(a);return true;}
00078 void podmienElement(const int &ktory,const int &a){if(ktory<iter)Lista[ktory]=a;}
00079 int getElement(int ktory){return Lista[ktory];}
00080 int getLastElement(){return Lista[iter-1];}
00081 void czysc(int grow1,int max1){grow=grow1;max=max1; if(Lista!=NULL){delete []Lista; Lista = new int[max];iter=0;}}
00082 void ustawIter(int iter1){iter = iter1;}
00083 void usunElement(const int &ktory){Lista[ktory]=Lista[--iter];}
00084 void zamienMiejscami(const int poz_a,const int poz_b){int temp =Lista[poz_b]; Lista[poz_b] = Lista[poz_a];Lista[poz_b] = temp;}
00085 ~IntList(){if(Lista!=NULL){delete []Lista;Lista = NULL;}}
00086
00087 bool sprawdzElement(const int &jaki);
00088
00089 bool sprCzyJestEleWList(const int &jaki);
00090 bool sprawdzCzyJest(const int &jaki){for(int i=0;i<iter;++i){if(Lista[i]==jaki){return true;}}return false;}
00091
00092 void zapisDoPliku(const char *nazwa);
00093 void wczytajZPliku(const char *nazwa);
00094 void zamienIntListy(IntList &a);
00095 void zamienWyzerujIntListy(IntList &a,int grow,int max);
00096 void operator=(IntList &a);
00097 void losowyZmianaMiejsca();
00098 void dodajIntList(IntList &a);
00099 void sortowanie();
00100
00101 };
00102
00104
00106
00107 class DoubleList{
00108
00109 int iter,grow,max;
00110
00111 double *Lista;
00112 public:
00113
00114 DoubleList(int grow1,int max1){iter=0;grow=grow1;max=max1;Lista = new double[max];}
00115 DoubleList(){iter=0;max=10;grow=2;Lista = new double[max];}
00116
00117 int getIter(){return iter;}
00118 void setGrow(int grow1){if(grow>1){grow=grow1;}}
00119
00120 void setElement(const double &a);
00121 void podmienElement(const int &ktory,const double &a){if(ktory<iter)Lista[ktory]=a;}
00122 double getElement(int ktory){return Lista[ktory];}
00123 double getLastElement(){return Lista[iter-1];}
00124 void czysc(const int &grow1,const int &max1){grow=grow1;max=max1; if(Lista!=NULL){delete []Lista; Lista = new double[max];iter=0;}}
00125 void ustawIter(int iter1){iter = iter1;}
00126 void podzielPrzezL(const double &a){for(int i=0;i<iter;i++){Lista[i]/=a;}}
00127 double getSrednia();
00128 double getSuma();
00129
00130
00131 ~DoubleList(){if(Lista!=NULL){delete []Lista;Lista = NULL;}}
00132 };
00133
00134
00136
00138
00139 class Punkt{
00140
00141 char granica;
00142 double x,y,z;
00143 double vx,vy,vz;
00144
00145 public:
00146
00147
00148
00149
00150
00151 Punkt(){;}
00152 Punkt(double x1,double y1,double z1){x=x1;y=y1;z=z1;granica='a';}
00153
00154 void setPunktG(const double &x1,const double &y1,const double &z1){x=x1;y=y1;z=z1;}
00155 void setPunkt(Punkt a){x=a.getX();y=a.getY();z=a.getZ();granica = a.getGranica();}
00156 void setPunkt(const double &x1,const double &y1,const double &z1){x=x1;y=y1;z=z1;granica='a';}
00157 void setPunkt(const double &x1,const double &y1,const double &z1,const char &g){x=x1;y=y1;z=z1;granica=g;}
00158 void setX(const double &x1){x=x1;}
00159 void setY(const double &y1){y=y1;}
00160 void setZ(const double &z1){z=z1;}
00161 void setXYZ(const double &x1,const double &y1,const double &z1){x=x1;y=y1;z=z1;}
00162
00163
00164 void setGranica(const char &a){granica=a;}
00165 void przesunPunkt(double xX,double yY,double zZ){x+=xX;y+=yY;z+=zZ;}
00166
00167 char getGranica(){return granica;}
00168 double getX(){return x;}
00169 double getY(){return y;}
00170 double getZ(){return z;}
00171 void setVecNorm(double v1,double v2,double v3){vx=v1;vy=v2;vz=v3;}
00172 void getVecNorm(double *tab){tab[0]=vx;tab[1]=vy;tab[2]=vz;}
00173
00174 float odlegloscPunktu(Punkt &a1);
00175 float odlegloscPunktuSqrt(Punkt &a1){
00176 return sqrt((x-a1.x)*(x-a1.x))+((y-a1.y)*(y-a1.y))+((z-a1.z)*(z-a1.z));
00177 }
00178
00179
00180 float odlegloscPunktu(const double &x1,const double &y1,const double &z1){return (x-x1)*(x-x1)+(y-y1)*(y-y1)+(z-z1)*(z-z1);}
00181 float odlegloscPunktuSqrt(const double &x1,const double &y1,const double &z1){return sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1)+(z-z1)*(z-z1));}
00182
00183 Punkt & operator*(const double &liczba){x*=liczba;y*=liczba;z*=liczba; return *this;}
00184 void operator=(Punkt &a){x=a.getX();y=a.getY();z=a.getZ();granica = a.getGranica();}
00185
00186
00187 bool operator==(Punkt &a)const{return (x==a.getX()&&y==a.getY()&&z==a.getZ()) ;}
00188 bool operator!=(Punkt &a)const{return !(*this==a);}
00189
00190
00191
00192 };
00193
00194
00196
00198
00199 class Element{
00200
00201
00202 int rodzajZiarna,temp;
00203 char f_Fluid;
00204 int punkty[4];
00205 int elementy[4];
00206 double Sx,Sy,Sz;
00207 float R,StosR_r;
00208 double Ax,Ay,Az;
00209 double uk_val[1];
00210
00211
00212
00213 public:
00214
00215 Element(){rodzajZiarna=-1;elementy[0]=-1;elementy[1]=-1;elementy[2]=-1;elementy[3]=-1;Ax=-1;Ay=-1;Az=-1;Sx=-1;Sy=-1;Sz=-1;R=-1;StosR_r=999999;punkty[0]=-1;punkty[1]=-1;punkty[2]=-1;punkty[3]=-1;}
00216 Element(int p1,int p2,int p3,int p4){punkty[0]=p1;punkty[1]=p2;punkty[2]=p3;punkty[3]=p4;elementy[0]=-1;elementy[1]=-1;elementy[2]=-1;elementy[3]=-1;rodzajZiarna=-1;Ax=-1;Ay=-1;Az=-1;Sx=-1;Sy=-1;Sz=-1;R=-1;StosR_r=999999;}
00217 Element(int p1,int p2,int p3,int p4,double Sx1,double Sy1,double Sz1,float R1,double Ax1,double Ay1,double Az1){punkty[0]=p1;punkty[1]=p2;punkty[2]=p3;punkty[3]=p4;Sx=Sx1;Sy=Sy1;Sz=Sz1;R=R1;elementy[0]=-1;elementy[1]=-1;elementy[2]=-1;elementy[3]=-1;Ax=Ax1;Ay=Ay1;Az=Az1;rodzajZiarna=-1;StosR_r=999999;}
00218
00219 void ustawTempnaZiarna(){temp=rodzajZiarna;}
00220
00221 void setTemp(int temp1){temp=temp1;}
00222 int getTemp(){return temp;}
00223
00224 void get_uk_val(int id_gauss,double *uk){id_gauss*=3;uk[0]=uk_val[id_gauss+0];uk[1]=uk_val[id_gauss+1];uk[2]=uk_val[id_gauss+2];}
00225 void set_uk_val(int id_gauss,double *uk){id_gauss*=3;uk_val[id_gauss+0]=uk[0];uk_val[id_gauss+1]=uk[1];uk_val[id_gauss+2]=uk[2];}
00226 void set_uk_val_zero(){for(int i=0;i<12;++i){uk_val[i]=0;}}
00227 void setElement(int p1,int p2,int p3,int p4){punkty[0]=p1;punkty[1]=p2;punkty[2]=p3;punkty[3]=p4;elementy[0]=-1;elementy[1]=-1;elementy[2]=-1;elementy[3]=-1;}
00228 void setElement(int p1,int p2,int p3,int p4,int rodzZ){punkty[0]=p1;punkty[1]=p2;punkty[2]=p3;punkty[3]=p4;elementy[0]=-1;elementy[1]=-1;elementy[2]=-1;elementy[3]=-1;rodzajZiarna=rodzZ;}
00229 void setElement(int p1,int p2,int p3,int p4,double Sx1,double Sy1,double Sz1,float R1,double Ax1,double Ay1,double Az1);
00230 void setElement(int p1,int p2,int p3,int p4,double Sx1,double Sy1,double Sz1,float R1,double Ax1,double Ay1,double Az1,float StosunekR_r);
00231
00232 void setPSO(double Sx1,double Sy1,double Sz1,float R1){Sx=Sx1;Sy=Sy1;Sz=Sz1;R=R1;}
00233 void setSSE(double Ax1,double Ay1,double Az1){Ax=Ax1;Ay=Ay1;Az=Az1;}
00234 void setElementySasiad(int e1,int e2,int e3,int e4){elementy[0]=e1;elementy[1]=e2;elementy[2]=e3;elementy[3]=e4;}
00235
00236 void setRodzajZiarna(int a){rodzajZiarna= a;}
00237 int getRodzajZiarna(){return rodzajZiarna;}
00238
00239 float getStosunekR_r(){return StosR_r;}
00240 void setStosunekR_r(float s){StosR_r=s;}
00241 void setFluid(char a){f_Fluid = a;}
00242 int isFluid(){if(f_Fluid=='f'){return 1;}return 0;}
00243
00244 int getP1(){return punkty[0];}
00245 int getP2(){return punkty[1];}
00246 int getP3(){return punkty[2];}
00247 int getP4(){return punkty[3];}
00248
00249
00250
00251
00252
00253
00254
00255 int getP(int ktory){return punkty[ktory];}
00256 int* getPunkty(){return punkty;}
00257
00258 int getE1(){return elementy[0];}
00259 int getE2(){return elementy[1];}
00260 int getE3(){return elementy[2];}
00261 int getE4(){return elementy[3];}
00262 int getE(int ktory){return elementy[ktory];}
00263
00264 void setE1(int e){elementy[0]=e;}
00265 void setE2(int e){elementy[1]=e;}
00266 void setE3(int e){elementy[2]=e;}
00267 void setE4(int e){elementy[3]=e;}
00268 void setE(int e,int ktory){elementy[ktory]=e;}
00269
00270
00271 void setP1(int p){punkty[0]=p;}
00272 void setP2(int p){punkty[1]=p;}
00273 void setP3(int p){punkty[2]=p;}
00274 void setP4(int p){punkty[3]=p;}
00275
00276 void setAx(double Ax1){Ax=Ax1;}
00277 void setAy(double Ay1){Ay=Ay1;}
00278 void setAz(double Az1){Az=Az1;}
00279
00280 int* getElementy(){return elementy;}
00281
00282 double getSx(){return Sx;}
00283 double getSy(){return Sy;}
00284 double getSz(){return Sz;}
00285
00286 float getR(){return R;}
00287 double getAx(){return Ax;}
00288 double getAy(){return Ay;}
00289 double getAz(){return Az;}
00290
00291 bool podmienPunkt(const int &ktoryNr,const int &);
00292 int getNumerSciany(int p1,int p2,int p3);
00293 bool sprawdzSciane(int numerS,int p1,int p2,int p3);
00294 bool sprawdzCzyJestTakiPunkt(int nrPunktu);
00295 void getNumeryElSciany(int ktoraSciana,int punk[3]);
00296 void getNumeryElSciany(char ktoraSciana,int punk[3]);
00297
00298 };
00299
00300
00302
00304
00305 class Pryzm{
00306
00307
00308 int rodzajZiarna;
00309 int punkty[6];
00310
00311 public:
00312
00313 Pryzm(){rodzajZiarna=-1;;}
00314 Pryzm(int p1,int p2,int p3,int p4,int p5,int p6){punkty[0]=p1;punkty[1]=p2;punkty[2]=p3;punkty[3]=p4;punkty[4]=p5;punkty[5]=p6;}
00315
00316
00317 void setElement(int p1,int p2,int p3,int p4,int p5,int p6){punkty[0]=p1;punkty[1]=p2;punkty[2]=p3;punkty[3]=p4;punkty[4]=p5;punkty[5]=p6;}
00318
00319
00320 void setRodzajZiarna(int a){rodzajZiarna= a;}
00321 int getRodzajZiarna(){return rodzajZiarna;}
00322
00323 int getP1(){return punkty[0];}
00324 int getP2(){return punkty[1];}
00325 int getP3(){return punkty[2];}
00326 int getP4(){return punkty[3];}
00327 int getP5(){return punkty[4];}
00328 int getP6(){return punkty[5];}
00329 int* getPunkty(){return punkty;}
00330
00331
00332
00333 void setP1(int p){punkty[0]=p;}
00334 void setP2(int p){punkty[1]=p;}
00335 void setP3(int p){punkty[2]=p;}
00336 void setP4(int p){punkty[3]=p;}
00337 void setP5(int p){punkty[4]=p;}
00338 void setP6(int p){punkty[5]=p;}
00339
00340
00341 bool podmienPunkt(const int &ktoryNr,const int &nowyNumer);
00342
00343 };
00344
00345
00347
00349
00350 class PunktList{
00351
00352 int iter,grow,max;
00353
00354 Punkt *Lista;
00355 public:
00356
00357 PunktList(int grow1,int max1){iter=0;grow=grow1;max=max1;Lista = new Punkt[max+1];}
00358 PunktList(){iter=0;max=10;grow=5;Lista = new Punkt[max+1];}
00359
00360 int getIter(){return iter;}
00361 void setGrow(int grow1){if(grow>1){grow=grow1;}}
00362
00363 void setElement(const double &x1,const double &y1,const double &z1);
00364 void setElement(const double &x1,const double &y1,const double &z1,const char &g);
00365 bool setElementUniqat(const double &x1,const double &y1,const double &z1,const char &g);
00366 void setElement(Punkt &a);
00367 void zamianaMiejsc(const int &a,const int &b){Lista[iter] = Lista[b];Lista[b]=Lista[a];Lista[a]=Lista[iter];}
00368
00369 void podmienElement(int ktory,Punkt &a){if(ktory<iter){Lista[ktory].setPunkt(a.getX(),a.getY(),a.getZ());}}
00370 void podmienElement(int ktory,const double &x1,const double &y1,const double &z1){if(ktory<iter){Lista[ktory].setPunkt(x1,y1,z1);}}
00371
00372 Punkt &getElement(int ktory){return Lista[ktory];}
00373 Punkt &getLastElement(){return Lista[iter-1];}
00374 Punkt &getLastElement(int odKonca){return Lista[iter-(1+odKonca)];}
00375 void zmianaKolejnosci();
00376 void losowyZmianaMiejsca();
00377
00378 void czysc(int grow1,int max1){grow=grow1;max=max1; if(Lista!=NULL){delete []Lista; Lista = new Punkt[max];iter=0;}}
00379 void ustawIter(int iter1){iter = iter1;}
00380 void zmienIterO(int iter1){iter += iter1;}
00381 void usunElement(int ktory){Lista[ktory]=Lista[--iter];}
00382 PunktList & operator*(const double &liczba){for(int i=0;i<iter;i++){Lista[i]=Lista[i]*liczba;} return *this;}
00383
00384 void zapisDoPliku(const char *nazwa);
00385 void wczytajZPliku(const char *nazwa,bool tylkoGranica);
00386 void wczytajZPlikuPrzerob(const char *nazwa);
00387
00388 void copyPunktList(PunktList &a);
00389 bool porownajPunkty(int p1,int p2){if (Lista[p1]==Lista[p2]){return true;}else{return false;};}
00390
00391 ~PunktList(){if(Lista!=NULL){delete []Lista;Lista = NULL;}}
00392 };
00393
00394
00395
00397
00399
00400 class ElementList{
00401
00402 int iter,grow,max;
00403 Element *Lista;
00404
00405 public:
00406
00407
00408
00409 ElementList(int grow1,int max1){iter=0;grow=grow1;max=max1;Lista = new Element[max];}
00410 ElementList(){iter=0;max=10;grow=2;Lista = new Element[max];}
00411
00412 int getIter(){return iter;}
00413 void setGrow(int grow1){if(grow>1){grow=grow1;}}
00414
00415 void setElement(const int &p1,const int &p2,const int &p3,const int &p4);
00416 void setElement(const int &p1,const int &p2,const int &p3,const int &p4,const int &rodzZ);
00417 void setElement(const int &p1,const int &p2,const int &p3,const int &p4,const double &Sx1,const double &Sy1,const double &Sz1,const float &R1,const double &Ax1,const double &Ay1,const double &Az1);
00418 void setElement(const int &p1,const int &p2,const int &p3,const int &p4,const double &Sx1,const double &Sy1,const double &Sz1,const float &R1,const double &Ax1,const double &Ay1,const double &Az1,const float &R_r);
00419 void setElement(Element &a);
00420
00421 void podmienElement(int ktory,Element a){if(ktory<iter)Lista[ktory] = a;}
00422 void podmienElement(int ktory,int p1,int p2,int p3,int p4){if(ktory<iter){Lista[ktory].setElement(p1,p2,p3,p4);}}
00423 void podmienElement(int ktory,int p1,int p2,int p3,int p4,double sx,double sy,double sz,float r,double Ax1,double Ay1,double Az1){if(ktory<iter)Lista[ktory].setElement(p1,p2,p3,p4,sx,sy,sz,r,Ax1,Ay1,Az1);}
00424 void podmienElement(int ktory,int na){if(ktory<iter)Lista[ktory] = Lista[na];}
00425
00426 Element& getElement(int ktory){return Lista[ktory];}
00427 Element& getLastElement(){return Lista[iter-1];}
00428 Element& getLastElement(int odKonca){return Lista[iter-(1+odKonca)];}
00429
00430 void czysc(int grow1,int max1){grow=grow1;max=max1;; delete []Lista; Lista = new Element[max];iter=0;}
00431 void ustaw_ukval_zero(){for(int i=0;i<iter;i++){Lista[i].set_uk_val_zero();}}
00432 void ustawIter(int iter1){iter = iter1;}
00433 void zmienIterO(int iter1){iter += iter1;}
00434 void deleteElement(int ktory){Lista[ktory]=Lista[--iter];}
00435 void deleteElementPodmienS(int ktory);
00436
00437
00438 void usunElementyZaz( IntList &nrZazZiaren);
00439 void usunElementyNieZaz( IntList &nrZazZiaren);
00440 void ustawGraniceElementowZaz( IntList &nrZazZiaren);
00441 void ustawGraniceElementowNieZaz( IntList &nrZazZiaren);
00442 void podmienPunktWElementach(const int &staryNumer,const int &nowyNumer,IntList &elementy);
00443 void ustawSasiadow(const int &numerStary,const int &numerNowy);
00444
00445
00446 int getNumerSasSacianE1(int nrE);
00447 int getNumerSasSacianE2(int nrE);
00448 int getNumerSasSacianE3(int nrE);
00449 int getNumerSasSacianE4(int nrE);
00450 int getNumerSasSacianWybor(int nrE,int nrS);
00451
00452 void ustawTempnaZiarna();
00453 void ustawTempZtabB(int *tabBlock,int dl_tab);
00454
00455 ~ElementList(){if(Lista!=NULL){delete []Lista;Lista = NULL;}}
00456
00457 };
00458
00459
00461
00463
00464 class PryzmList{
00465
00466 int iter,grow,max;
00467 Pryzm *Lista;
00468
00469 public:
00470
00471
00472
00473 PryzmList(int grow1,int max1){iter=0;grow=grow1;max=max1;Lista = new Pryzm[max];}
00474 PryzmList(){iter=0;max=10;grow=2;Lista = new Pryzm[max];}
00475
00476 int getIter(){return iter;}
00477 void setGrow(int grow1){if(grow>1){grow=grow1;}}
00478
00479 void setElement(const int &p1,const int &p2,const int &p3,const int &p4,const int &p5,const int &p6);
00480 void setElement(Pryzm &a);
00481
00482 void podmienElement(int ktory,Pryzm a){if(ktory<iter)Lista[ktory] = a;}
00483 void podmienElement(int ktory,int p1,int p2,int p3,int p4,int p5,int p6){if(ktory<iter){Lista[ktory].setElement(p1,p2,p3,p4,p5,p6);}}
00484 void podmienElement(int ktory,int na){if(ktory<iter)Lista[ktory] = Lista[na];}
00485
00486 Pryzm& getElement(int ktory){return Lista[ktory];}
00487 Pryzm& getLastElement(){return Lista[iter-1];}
00488 Pryzm& getLastElement(int odKonca){return Lista[iter-(1+odKonca)];}
00489
00490 void czysc(int grow1,int max1){grow=grow1;max=max1;; delete []Lista; Lista = new Pryzm[max];iter=0;}
00491 void ustawIter(int iter1){iter = iter1;}
00492 void zmienIterO(int iter1){iter += iter1;}
00493 void deleteElement(int ktory){Lista[ktory]=Lista[--iter];}
00494
00495
00496
00497 ~PryzmList(){if(Lista!=NULL){delete []Lista;Lista = NULL;}}
00498
00499
00500 };
00501
00502
00503
00504
00505
00507
00509
00510 class Face{
00511
00512 char faceInEl;
00513 int inEl;
00514 int e1,e2,e3;
00515 int bc;
00516
00517 public:
00518
00519 Face(){;}
00520 Face(const int &ed1,const int &ed2,const int &ed3,const char &faceInEl1,const int &inEl1){e1=ed1;e2=ed2;e3=ed3;faceInEl=faceInEl1;inEl=inEl1;}
00521
00522 void setFace(const Face &a){e1=a.e1;e2=a.e2;e3=a.e3;faceInEl = a.faceInEl;inEl=a.inEl;bc=0;}
00523 void setFace(const int &ed1,const int &ed2,const int &ed3,const char &faceInEl1,const int &inEl1){e1=ed1;e2=ed2;e3=ed3;faceInEl=faceInEl1;inEl=inEl1;bc=0;}
00524 void setFace(const int &ed1,const int &ed2,const int &ed3,const char &faceInEl1,const int &inEl1,const int &bc1){e1=ed1;e2=ed2;e3=ed3;faceInEl=faceInEl1;inEl=inEl1;bc=bc1;}
00525
00526 void setFaceAndEl(const char &a,const int &e){faceInEl=a;inEl=e;}
00527 void setE1(const int &ed1){e1=ed1;}
00528 void setE2(const int &ed2){e2=ed2;}
00529 void setE3(const int &ed3){e3=ed3;}
00530 void setInEl(const int &e){inEl=e;}
00531 void setAllE(const int &ed1,const int &ed2,const int &ed3){e1=ed1;e2=ed2;e3=ed3;}
00532 void setFaceInEl(const char &a){faceInEl=a;}
00533 void setBC(int bc1){bc=bc1;}
00534
00535 char getFaceInEl(){return faceInEl;}
00536 int getEd1(){return e1;}
00537 int getEd2(){return e2;}
00538 int getEd3(){return e3;}
00539 int getInEl(){return inEl;}
00540 int getBC(){return bc;}
00541
00542
00543 void operator=(const Face &a){e1=a.e1;e2=a.e2;e3=a.e3;faceInEl = a.faceInEl;inEl=a.inEl;bc=a.bc;}
00544 bool operator==(const Face &a)const{return (e1==a.e1&&e2==a.e2&&e3==a.e3&&faceInEl==a.faceInEl&&inEl==a.inEl) ;}
00545 bool operator!=(const Face &a)const{return !(*this==a);}
00546
00547 };
00548
00549
00550
00552
00554
00555 class FaceList{
00556
00557 int iter,grow,max;
00558 Face *Lista;
00559
00560 public:
00561
00562 FaceList(int grow1,int max1){iter=0;grow=grow1;max=max1;Lista = new Face[max];}
00563 FaceList(){iter=0;max=10;grow=2;Lista = new Face[max];}
00564
00565 int getIter(){return iter;}
00566 void setGrow(int grow1){if(grow>1){grow=grow1;}}
00567
00568
00569 void setElement(const int &ed1,const int &ed2,const int &ed3,const char &faceInEl1,const int &el);
00570 void setElement(const int &ed1,const int &ed2,const int &ed3,const char &faceInEl1,const int &el,const int &bc);
00571 void setElement(Face &a);
00572
00573 void podmienElement(int ktory,Face a){if(ktory<iter)Lista[ktory] = a;}
00574 void podmienElement(int ktory,const int &ed1,const int &ed2,const int &ed3,const char &faceInEl1,const int &el){if(ktory<iter){Lista[ktory].setFace(ed1,ed2,ed3,faceInEl1,el);}}
00575 void podmienElement(int ktory,int na){if(ktory<iter)Lista[ktory] = Lista[na];}
00576
00577 Face& getElement(int ktory){return Lista[ktory];}
00578 Face& getLastElement(){return Lista[iter-1];}
00579 Face& getLastElement(int odKonca){return Lista[iter-(1+odKonca)];}
00580
00581 void czysc(int grow1,int max1){grow=grow1;max=max1;; delete []Lista; Lista = new Face[max];iter=0;}
00582 void ustawIter(int iter1){iter = iter1;}
00583 void zmienIterO(int iter1){iter += iter1;}
00584 void deleteElement(int ktory){Lista[ktory]=Lista[--iter];}
00585
00586
00587
00588 ~FaceList(){if(Lista!=NULL){delete []Lista;Lista = NULL;}}
00589
00590
00591 };
00592
00593
00594
00595
00596
00598
00600
00601 class Edge{
00602
00603 int p1,p2,el;
00604
00605 public:
00606
00607 Edge(){;}
00608 Edge(const int &pun1,const int &pun2){p1=pun1;p2=pun2;}
00609
00610 void setEdge(const Edge &a){p1=a.p1;p2=a.p2;el=a.el;}
00611 void setEdge(const int &pun1,const int &pun2,const int &el1){p1=pun1;p2=pun2;el=el1;}
00612
00613 void setP1(const int &pun1){p1=pun1;}
00614 void setP2(const int &pun2){p2=pun2;}
00615 void setEl(const int &el1){el=el1;}
00616
00617 int getP1(){return p1;}
00618 int getP2(){return p2;}
00619 int getEl(){return el;}
00620
00621 void operator=(const Edge &a){p1=a.p1;p2=a.p2;el=a.el;}
00622 bool operator==(const Edge &a)const{return (p1==a.p1&&p2==a.p2&&el==a.el);}
00623 bool operator!=(const Edge &a)const{return !(*this==a);}
00624
00625 };
00626
00627
00629
00631
00632 class EdgeList{
00633
00634 int iter,grow,max;
00635 Edge *Lista;
00636
00637 public:
00638
00639 EdgeList(int grow1,int max1){iter=0;grow=grow1;max=max1;Lista = new Edge[max];}
00640 EdgeList(){iter=0;max=10;grow=2;Lista = new Edge[max];}
00641
00642 int getIter(){return iter;}
00643 void setGrow(int grow1){if(grow>1){grow=grow1;}}
00644
00645 void setElement(const int &p1,const int &p2,const int &el1);
00646 void setElement(Edge &a);
00647
00648 void podmienElement(int ktory,Edge a){if(ktory<iter)Lista[ktory] = a;}
00649 void podmienElement(int ktory,const int &p1,const int &p2,const int &el1){if(ktory<iter){Lista[ktory].setEdge(p1,p2,el1);}}
00650 void podmienElement(int ktory,int na){if(ktory<iter)Lista[ktory] = Lista[na];}
00651
00652 Edge& getElement(int ktory){return Lista[ktory];}
00653 Edge& getLastElement(){return Lista[iter-1];}
00654 Edge& getLastElement(int odKonca){return Lista[iter-(1+odKonca)];}
00655
00656 void czysc(int grow1,int max1){grow=grow1;max=max1;; delete []Lista; Lista = new Edge[max];iter=0;}
00657 void ustawIter(int iter1){iter = iter1;}
00658 void zmienIterO(int iter1){iter += iter1;}
00659 void deleteElement(int ktory){Lista[ktory]=Lista[--iter];}
00660
00661
00662
00663 ~EdgeList(){if(Lista!=NULL){delete []Lista;Lista = NULL;}}
00664
00665
00666 };
00667
00668
00669
00671
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700 class test{
00701
00702 public:
00703 IntList punkty;
00704
00705 void rysuj();
00706 void zaladujP(int ile);
00707 test(){punkty.setGrow(15000);;}
00708
00709 };
00710
00711
00712
00713
00714 #endif // WEKTOR_H_