00001 #ifndef ADAPTIVITYT_H 00002 #define ADAPTIVITYT_H 00003 00004 #include "xfile.h" 00005 #include "vector.h" 00006 #include "timecontr.h" 00007 #include "gtopology.h" 00008 00009 class adaptivityt 00010 { 00011 private: 00012 /// characteristics of the problem 00013 long dim; /// dimension 00014 long ord; /// base functions order 00015 long ncomp; /// number of refined components [stress or strain in mefel] 00016 long nn; /// number of nodes 00017 long ne; /// number of elements 00018 long ntm; /// number of transported matters 00019 00020 00021 /// type of error smoothing ; 1 = spr_smoothing , 2 = z2_smoothing 00022 long tad; 00023 00024 /// accuracy 00025 double adapt_accuracy; 00026 00027 /// max enlargement, reduction 00028 double enlarg; // > 1.0 00029 double reduct; // < 1.0 00030 00031 /// sum of printing flags: 00032 /// 1 - print stdout - printing of solving information on standard output 00033 /// 2 - print bgm - printing of file.bgm necessary for new mesh generation by T3d generator, file contains required element sizes on points(of old mesh) 00034 /// 4 - print 00035 /// 8 - print 00036 /// 16 - print test - printing of file.test for testing 00037 long printflags; 00038 00039 /// sum of other flags: 00040 /// 1 - linear (0) X nonlinear(1) compute_refsizel 00041 /// 2 - spr compute with strain(0) X stress(1) 00042 /// 4 - (strain X stress) is own(0) X another(2) 00043 /// 8 - zienkiewiczuv zpusob nelin pocitani(8) X ostatni(0) 00044 /// 2 - strain is own(0) X another(1) 00045 /// 4 - stress is own(0) X another(2) 00046 //long otherflags; 00047 00048 /// correction 00049 double corr; 00050 00051 /// decomposed input file name 00052 char *path; 00053 char *filename; 00054 char *suffix; 00055 00056 /// internal adaptive loop 00057 bool interadaloop; 00058 /// step in adaptive loop 00059 long step; 00060 00061 /// second suffix of enter file, it contains actual number of iteration 00062 int niwidth; 00063 char *ni; 00064 00065 00066 /// *** COMPUTED VALUES IN ARRAYS *** 00067 /// array of refined derivatives (gradients of fluxes) in nodes, dimension [nn, ncomp] 00068 vector *refined_ders_in_nodes; 00069 00070 /// percentual error at elements, dimension [ntm, ne] 00071 vector *elem_error_pct; 00072 /// relative new/refined size of elements [only for better visualization], dimension [ntm, ne] 00073 vector *refsizelrel; 00074 /// absolute new/refined size of elements, dimension [ntm, ne] 00075 vector *refsizelabs; 00076 00077 00078 /// *** BACK UP FOR INTERNAL LOOP *** 00079 double *r; /// unknowns in ALL nodes of global problem; values in array are stored (r[node_1][x] ... r[node_nn][x] , r[node_1][y] ... r[node_nn][y]) 00080 double *rdr; /// derivatives of unknowns in --""-- ; --""-- 00081 public: 00082 timecontr *tctrl; /// time controler 00083 public: 00084 long istep; /// istep 00085 00086 public: 00087 /// answer of this class ; 1(0) == remeshing is (is not) recommended 00088 long answer; 00089 00090 private: 00091 void set_step (long s); 00092 00093 00094 public: 00095 //long give_adaptflag (void) const { return printflags; } 00096 int give_dim (void) const { return dim; } 00097 int give_ntm (void) const { return ntm; } 00098 int give_niwidth (void) const { return niwidth; } 00099 int give_step (void) const { return step; } 00100 const char* give_filename (void) const { return filename; } 00101 const char* give_ni (void) const { return ni; } 00102 const double* give_r (void) const { return r; } 00103 const double* give_rdr (void) const { return rdr; } 00104 00105 public: 00106 /// CONSTRUCTOR 00107 adaptivityt (void); 00108 /// DESTRUCTOR 00109 ~adaptivityt (void); 00110 00111 /// read values from input file 00112 void readinit (XFILE *in); 00113 /// print values to input file 00114 void printinit (FILE *out); 00115 /// intialize atributes 00116 void initialize (long s); 00117 00118 /// main function 00119 long run (long of, bool ial); 00120 00121 private: 00122 /// 00123 void prepare_ni (void); 00124 /// check consistency 00125 void check_consistency (void) const; 00126 00127 /// average derivatives to nodes 00128 void spr (int mattid); 00129 /// compute error... 00130 void compute_error (int mattid); 00131 00132 /// 00133 void compute_refsizel_lin (int mattid, const double *sizel, const double *ei2, double e2, double u2); 00134 00135 /// 00136 void print_addat_vtk () const; 00137 00138 00139 // *** STATE DATA *** 00140 public: 00141 void statedata_backup (void); 00142 void statedata_transfer (adaptivityt *Adat_old, gtopology *Gtt_old); 00143 void statedata_restore (void); 00144 }; 00145 00146 #endif