00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef EVPAR_H_
00024 #define EVPAR_H_
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 inline dir_sons reordering_formula(dir_sons d) {
00060 if(d==ENTd) return (dir_sons)0;
00061 if(d==WNTd) return (dir_sons)1;
00062 if(d==WSTd) return (dir_sons)2;
00063 if(d==WSDd) return (dir_sons)3;
00064
00065 if(d==WNDd) return (dir_sons)4;
00066 if(d==ENDd) return (dir_sons)5;
00067 if(d==ESDd) return (dir_sons)6;
00068
00069 return (dir_sons)7;
00070 }
00071
00072 inline dir_sons reordering_boundary_formula(Index3D I, dir_3D d, Index3D my_index) {
00073 bool fine_x, fine_y, fine_z;
00074 fine_x = my_index.I_x() <= I.I_x();
00075 fine_y = my_index.I_y() <= I.I_y();
00076 fine_z = my_index.I_z() <= I.I_z();
00077
00078 if(fine_x && fine_y && fine_z) return (dir_sons)0;
00079
00080 if(fine_y && fine_z) {
00081 if(d!=Wdir && d!=Edir)
00082 return (dir_sons)1;
00083 else return (dir_sons)0;
00084 }
00085 if(fine_x && fine_y) {
00086 if(d!=Ddir && d!=Tdir)
00087 return (dir_sons)5;
00088 else return (dir_sons)0;
00089 }
00090
00091 if(fine_x && fine_z) {
00092 if(d!=Sdir && d!=Ndir)
00093 return (dir_sons)7;
00094 else return (dir_sons)0;
00095 }
00096
00097 if(fine_x) {
00098 if(d==Wdir || d==Edir)
00099 return (dir_sons)6;
00100 else return (dir_sons)0;
00101 }
00102 if(fine_y) {
00103 if(d==Ndir || d==Sdir)
00104 return (dir_sons)4;
00105 else return (dir_sons)0;
00106 }
00107 if(fine_z) {
00108 if(d==Ddir || d==Tdir)
00109 return (dir_sons)2;
00110 else return (dir_sons)0;
00111 }
00112
00113 return (dir_sons)3;
00114 }
00115
00116 enum evaluation_typ {
00117 stop_evaluation,
00118 interior_1_evaluation_fine,
00119 interior_15_evaluation_fine,
00120 interior_17_evaluation_fine,
00121 interior_25_evaluation_fine,
00122 interior_1_evaluation_coarse,
00123 interior_15_evaluation_coarse,
00124 interior_17_evaluation_coarse,
00125 interior_25_evaluation_coarse,
00126 nearb_1_evaluation,
00127 nearb_15_evaluation,
00128 nearb_17_evaluation,
00129 cellf_1_evaluation,
00130 cellf_large_evaluation,
00131 boundary_evaluation_all,
00132 boundary_evaluation_subset,
00133 exteri_1_evaluation_subset,
00134 exteri_15_evaluation_subset,
00135 exteri_17_evaluation_subset
00136 };
00137
00138
00139
00140
00141
00142
00143 class Run_type_object {
00144 public:
00145 int r_boundary;
00146 bool r_interior;
00147 bool r_nearb;
00148 };
00149
00150
00151
00152
00153
00154
00155
00156
00157 class Evaluation_Parallelization_object {
00158 private:
00159 Grid *grid;
00160 Run_type_object run_object;
00161 int level;
00162 int max_level;
00163 int size_stencil;
00164 int number_ops;
00165
00166 P_interior* interior_pointer;
00167 P_nearb* nearb_pointer;
00168 P_Bo2p* Bo2p_pointer;
00169 P_cellpoi* cellpoi_pointer;
00170
00171 int status;
00172
00173
00174 int max_var;
00175 bool *array_vars;
00176 bool *array_vars_other;
00177
00178 bool other_is_fine;
00179 bool other_is_coarse;
00180
00181 bool update_ENT;
00182 bool update_WSD;
00183 bool update_other_bla;
00184
00185
00186 type_of_update left_update;
00187 int left_level;
00188
00189
00190 int *array_num;
00191 int anz_num;
00192 int *array_num_other;
00193 int anz_num_other;
00194
00195
00196 bool GS_expression;
00197 dir_3D Parallel_GS_formula[8];
00198
00199
00200
00201 type_of_update *storage_of_update_type;
00202 public:
00203
00204 Evaluation_Parallelization_object(Grid *g, int max_v);
00205
00206
00207 type_of_update Give_type_of_update(int number_variable, int level);
00208 void Set_type_of_update(int number_variable, int level, type_of_update type);
00209
00210
00211 type_of_update Give_left_update() { return left_update; }
00212 int Give_left_level() { return left_level; }
00213
00214
00215 int Give_anz_num() { return anz_num; };
00216 int *Give_array_num() { return array_num; };
00217
00218 void Start_evaluation_seriel(const Run_type_object rob, const int l,
00219 const int ss, const int num_ops);
00220 void StartA_evaluation(const Run_type_object rob, const int l,
00221 const int ss, const int num_ops);
00222
00223 void StartB_evaluation(const int number_variable, const bool GS_expr);
00224
00225 void StartA_varcon_evaluation(const int l);
00226 void StartB_varcon_evaluation();
00227 evaluation_typ Give_next_evaluation_typ();
00228
00229 void Variable_contained_in_expression(int num_variable);
00230 void Variable_contained_in_expression_other(int num_variable);
00231 void Other_is_coarse() { other_is_coarse =true; }
00232 void Other_is_fine() { other_is_fine =true; }
00233
00234 P_interior* Start_interior_pointer() { return interior_pointer; };
00235 P_nearb* Start_nearb_pointer() { return nearb_pointer; };
00236 P_Bo2p* Start_Bo2p_pointer() { return Bo2p_pointer; };
00237 P_cellpoi* Start_cellpoi_pointer() { return cellpoi_pointer; };
00238 };
00239
00240 inline void
00241 Evaluation_Parallelization_object::Variable_contained_in_expression(
00242 int num_variable) {
00243 if(developer_version) {
00244 if(num_variable<0)
00245 cout << " error 1 in ev_par::Variable_contained_in_expression! " << endl;
00246 if(num_variable>=max_var)
00247 cout << " error 1 in ev_par::Variable_contained_in_expression! " << endl;
00248 }
00249 array_vars[num_variable] = true;
00250 }
00251
00252 inline void
00253 Evaluation_Parallelization_object::Variable_contained_in_expression_other(
00254 int num_variable) {
00255 if(developer_version) {
00256 if(num_variable<0)
00257 cout << " error 1 in ev_par::Variable_contained_in_expression_other! "
00258 << endl;
00259 if(num_variable>=max_var)
00260 cout << " error 1 in ev_par::Variable_contained_in_expression_other! "
00261 << endl;
00262 }
00263 array_vars_other[num_variable] = true;
00264 }
00265
00266
00267 inline type_of_update Evaluation_Parallelization_object::Give_type_of_update(
00268 int number_variable,
00269 int level) {
00270 if(developer_version) {
00271 if(max_level*number_variable+level>max_level*(max_var+1))
00272 cout <<
00273 "error in Evaluation_Parallelization_object::Give_type_of_update!! "
00274 << endl;
00275 }
00276 return storage_of_update_type[max_level*number_variable+level-1];
00277 };
00278
00279 inline void Evaluation_Parallelization_object::Set_type_of_update(
00280 int number_variable,
00281 int level,
00282 type_of_update type) {
00283 if(developer_version) {
00284 if(max_level*number_variable+level>max_level*(max_var+1))
00285 cout <<
00286 "error in Evaluation_Parallelization_object::Set_type_of_update!! "
00287 << endl;
00288 }
00289 storage_of_update_type[max_level*number_variable+level-1] = type;
00290 }
00291
00292 #endif
00293