00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef OPCONV_H_
00024 #define OPCONV_H_
00025
00026
00027
00028
00030
00032
00033
00034
00036
00037
00038
00039
00040
00041 template<class A, class DiffOp>
00042 class DVarDiff_25S_Op_convar {
00043 Variable v_;
00044 A a_;
00045 double *Stencil;
00046
00047 public:
00048
00049 DVarDiff_25S_Op_convar(const Cell_Variable& a, const Variable& v)
00050 : v_(v), a_(a) {
00051 DiffOp opp;
00052 if(opp.typ_u()==Poisson_type ||
00053 opp.typ_v()==Poisson_type)
00054 Stencil = v.Give_grid()->Give_Loc_stencil_Poisson();
00055 else {
00056 Stencil = v.Give_grid()->Give_Loc_stencil(opp.typ_u(),opp.typ_v());
00057 }
00058 }
00059 double Give_interior(const P_interior* it_i, const Grid* grid, double h_mesh,
00060 int lev, double_stencils_in) const {
00061 return Give_interior_here(it_i,grid,h_mesh,lev, double_stencils_out);
00062 }
00063 double Give_interior_coarse(const P_interior* it_i, const Grid* grid,
00064 double h_mesh,
00065 int lev, double_stencils_in) const {
00066 return Give_interior_here(it_i,grid,h_mesh,lev, double_stencils_out);
00067 }
00068 double Give_interior_here(const P_interior* it_i, const Grid* gr,
00069 double h_mesh,
00070 int l, double_stencils_in) const {
00071 return DiffOp::stencil(LuN[v_.Number_variable()],
00072 LuW[v_.Number_variable()],
00073 LuM[v_.Number_variable()],
00074 LuE[v_.Number_variable()],
00075 LuS[v_.Number_variable()],
00076 LuT[v_.Number_variable()],
00077 LuD[v_.Number_variable()],
00078 LuND[v_.Number_variable()],
00079 LuWN[v_.Number_variable()],
00080 LuWT[v_.Number_variable()],
00081 LuED[v_.Number_variable()],
00082 LuST[v_.Number_variable()],
00083 LuES[v_.Number_variable()],
00084 LuEST[v_.Number_variable()],
00085 LuWND[v_.Number_variable()],
00086 LuCell_WSD[a_.Number_cell_variable()],
00087 LuCell_WST[a_.Number_cell_variable()],
00088 LuCell_WND[a_.Number_cell_variable()],
00089 LuCell_WNT[a_.Number_cell_variable()],
00090 LuCell_ESD[a_.Number_cell_variable()],
00091 LuCell_EST[a_.Number_cell_variable()],
00092 LuCell_END[a_.Number_cell_variable()],
00093 LuCell_ENT[a_.Number_cell_variable()],
00094 h_mesh);
00095
00096 };
00097 double Give_nearb(const P_nearb* it_n, const Grid* gr, double h_mesh, int l,
00098 const Nearb_Ablage* nearb_ablage) const {
00099 static int i;
00100 static BoCeData* bocedata;
00101 static Celltype cetyp;
00102 static double sum;
00103 static int num_v;
00104 dir_sons dir_v;
00105
00106 sum = 0.0;
00107 for(i=0;i<8;++i) {
00108 dir_v = opposite3D((dir_sons)i);
00109
00110 cetyp = nearb_ablage->Give_Celltyp((dir_sons)i);
00111 if(cetyp==fine_bo_cell) {
00112 bocedata = nearb_ablage->Give_BoData((dir_sons)i);
00113
00114 for(num_v=0;(!(bocedata->corner(num_v)==dir_v)) ||
00115 bocedata->edge_point(num_v);) { ++num_v; }
00116
00117 sum = sum + DiffOp::F_bo_cell(bocedata,num_v,v_.Number_variable(),
00118 a_.Number_cell_variable());
00119 }
00120 else if(cetyp==int_cell) {
00121 sum = sum +
00122 F_reg_cell(nearb_ablage->Give_u_Recell((dir_sons)i),
00123 v_.Number_variable(),
00124 dir_v,h_mesh,Stencil)
00125 * gr->Give_cell_variable(
00126 it_n->Ind().next(
00127 (dir_sons)i,l+1))[a_.Number_cell_variable()];
00128 }
00129 }
00130 return sum;
00131 };
00132 double F_reg_cell(double*const * u_Recell, int num_var,
00133 dir_sons dir_v,
00134 double h_mesh, double* sten) const {
00135 static int i;
00136 static double sum;
00137 sum = 0.0;
00138 for(i=0;i<8;++i) sum = sum + sten[dir_v+8*i] * u_Recell[i][num_var];
00139 return sum * DiffOp::Factor_reg_cell(h_mesh);
00140 }
00141 double Give_cellpoi(const P_cellpoi* it_cf, const Grid* gr,
00142 const BoCeData* bocedata) const {
00143
00144 return DiffOp::F_bo_cell(bocedata,bocedata->Give_number_points(),
00145 v_.Number_variable(),a_.Number_cell_variable());
00146 };
00147 double Give_Bo2p(const P_Bo2p* it_b, const Grid* gr,int l) const {
00148 static int i;
00149 static BoCeData* bocedata;
00150 static double sum;
00151 static int num_v;
00152 dir_sons dir_v;
00153 bool stop;
00154
00155 sum = 0.0;
00156 for(i=0;i<8;++i) {
00157 dir_v = opposite3D((dir_sons)i);
00158
00159 bocedata = it_b->Give_BoData((dir_sons)i);
00160 if(bocedata!=NULL) {
00161
00162 stop = false;
00163 for(num_v=0;!stop && bocedata->Give_number_points() > num_v;) {
00164 stop = bocedata->corner(num_v) == dir_v &&
00165 bocedata->edge_dir(num_v) == it_b->d() &&
00166 bocedata->edge_point(num_v);
00167 if(!stop) ++num_v;
00168 }
00169
00170 if(bocedata->Give_number_points() > num_v) {
00171
00172 sum = sum +
00173 DiffOp::F_bo_cell(bocedata,num_v,v_.Number_variable(),
00174 a_.Number_cell_variable());
00175 }
00176 }
00177 }
00178 return sum;
00179 };
00180
00181 int Sice_stencil() const { return 25; }
00182
00183
00184 int Level() const { return (v_).Level(); }
00185 Dominace_label Dominant_lev() const { return not_dominant; }
00186 Dominace_label Dominant_poi() const { return not_dominant; }
00187 bool run_interior() const { return (v_).run_interior(); }
00188 bool run_nearb() const { return (v_).run_nearb(); }
00189 int run_boundary() const { return (v_).run_boundary(); }
00190
00191
00192 int ops_interior() const { return DiffOp::ops_interior(); }
00193
00194
00195 void Active_Sim_Level( int lev) const { };
00196 void Active_Sim_interior(bool run) const { };
00197 void Active_Sim_nearb(bool run) const { };
00198 void Active_Sim_boundary( int run) const { };
00199 void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00200 int level, type_of_update typ) const { };
00201
00202
00203 void Put_grid_rbo(const Grid* gr, int r_bo) const {};
00204
00205
00206
00207
00208
00209 Differential_op_typ Abstract_differential_operator() const
00210 { return abstract_with_var; }
00211 int Give_number_var_of_abstract_op() const { return v_.Number_variable(); }
00212
00213
00214
00215 double Give_interior_sten_element(Index3D I, double meshsize,
00216 int stelle,
00217 const Grid* grid, int level) const {
00218 return
00219 grid->Give_cell_variable(I)[a_.Number_cell_variable()]
00220 * Stencil[stelle] * DiffOp::Factor_reg_cell(meshsize);
00221 }
00222 double Give_boundary_sten_element(const Grid* grid, BoCeData* b_cell,
00223 double* u_ablage, int num_v) const {
00224 return DiffOp::Local_matrix_bo_cell(b_cell,u_ablage,num_v,
00225 a_.Number_cell_variable());
00226 }
00227
00228 void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar)
00229 const {
00230 evpar->Variable_contained_in_expression(v_.Number_variable());
00231 evpar->Variable_contained_in_expression(a_.Number_cell_variable());
00232 }
00233 bool GS_type(int var_number_left, int dim) const {
00234 if(var_number_left<=v_.Number_variable() &&
00235 var_number_left+dim>=v_.Number_variable())
00236 return true;
00237 return false;
00238 };
00239
00240
00241 void clean() const { };
00242 };
00243
00244
00245
00246
00247
00248
00249 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, laplace_FE_cell_variable> >
00250 Laplace_FE_var(Cell_Variable a, Variable v);
00251
00252 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, dxdx_FE_cell_variable> >
00253 DxDx_FE_var(Cell_Variable a, Variable v);
00254
00255 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, dydy_FE_cell_variable> >
00256 DyDy_FE_var(Cell_Variable a, Variable v);
00257
00258 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, dzdz_FE_cell_variable> >
00259 DzDz_FE_var(Cell_Variable a, Variable v);
00260
00261 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, helm_FE_cell_variable> >
00262 Helm_FE_var(Cell_Variable a, Variable v);
00263
00264
00266
00268
00269 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, dxdy_FE_cell_variable> >
00270 DxDy_FE_var(Cell_Variable a, Variable v);
00271
00272 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, dydx_FE_cell_variable> >
00273 DyDx_FE_var(Cell_Variable a, Variable v);
00274
00275 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, dxdz_FE_cell_variable> >
00276 DxDz_FE_var(Cell_Variable a, Variable v);
00277
00278 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, dzdx_FE_cell_variable> >
00279 DzDx_FE_var(Cell_Variable a, Variable v);
00280
00281 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, dydz_FE_cell_variable> >
00282 DyDz_FE_var(Cell_Variable a, Variable v);
00283
00284 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, dzdy_FE_cell_variable> >
00285 DzDy_FE_var(Cell_Variable a, Variable v);
00286
00287 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, dxhelm_FE_cell_variable> >
00288 DX_FE_var(Cell_Variable a, Variable v);
00289
00290 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, dyhelm_FE_cell_variable> >
00291 DY_FE_var(Cell_Variable a, Variable v);
00292
00293 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, dzhelm_FE_cell_variable> >
00294 DZ_FE_var(Cell_Variable a, Variable v);
00295
00296 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, helmdx_FE_cell_variable> >
00297 DX_FE_var_t(Cell_Variable a, Variable v);
00298
00299 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, helmdy_FE_cell_variable> >
00300 DY_FE_var_t(Cell_Variable a, Variable v);
00301
00302 DExpr<DVarDiff_25S_Op_convar<Cell_Variable, helmdz_FE_cell_variable> >
00303 DZ_FE_var_t(Cell_Variable a, Variable v);
00304
00305
00307
00309
00310
00311
00312
00313
00314
00316
00317
00318
00319 template<class A, class DiffOp>
00320 class DiagonalDiff_Op_convar {
00321 private:
00322 Grid* grid;
00323 A a_;
00324 Storage_for_one_Stencil* OS;
00325 public:
00326 DiagonalDiff_Op_convar(const Cell_Variable& a)
00327 : a_(a) {
00328 OS = new Storage_for_one_Stencil;
00329 }
00330 double Give_interior(const P_interior* it_i, const Grid* grid, double h_mesh,
00331 int lev, double_stencils_in) const {
00332 return Give_interior_here(it_i,grid,h_mesh,lev, double_stencils_out);
00333 }
00334 double Give_interior_coarse(const P_interior* it_i, const Grid* grid,
00335 double h_mesh,
00336 int lev, double_stencils_in) const {
00337 return Give_interior_here(it_i,grid,h_mesh,lev, double_stencils_out);
00338 }
00339 double Give_interior_here(const P_interior* it_i, const Grid* gr,
00340 double h_mesh,
00341 int l, double_stencils_in) const {
00342 return DiffOp::diag_stencil(h_mesh,
00343 LuCell_WSD[a_.Number_cell_variable()],
00344 LuCell_WST[a_.Number_cell_variable()],
00345 LuCell_WND[a_.Number_cell_variable()],
00346 LuCell_WNT[a_.Number_cell_variable()],
00347 LuCell_ESD[a_.Number_cell_variable()],
00348 LuCell_EST[a_.Number_cell_variable()],
00349 LuCell_END[a_.Number_cell_variable()],
00350 LuCell_ENT[a_.Number_cell_variable()]);
00351 };
00352 double Give_nearb(const P_nearb* it_n, const Grid* gr, double h_mesh, int l,
00353 const Nearb_Ablage* nearb_ablage) const {
00354 static int i;
00355 static BoCeData* bocedata;
00356 static double sum;
00357 static Celltype cetyp;
00358 static int num_v;
00359 dir_sons dir_v;
00360
00361 sum = 0.0;
00362 for(i=0;i<8;++i) {
00363 dir_v = opposite3D((dir_sons)i);
00364 cetyp = nearb_ablage->Give_Celltyp((dir_sons)i);
00365 if(cetyp==fine_bo_cell) {
00366
00367 bocedata = nearb_ablage->Give_BoData((dir_sons)i);
00368
00369 for(num_v=0;(!(bocedata->corner(num_v)==dir_v)) ||
00370 bocedata->edge_point(num_v);) { ++num_v; }
00371
00372 sum = sum + DiffOp::diag_F_bo_cell(bocedata,num_v,
00373 a_.Number_cell_variable());
00374 }
00375 else if(cetyp==int_cell) {
00376 sum = sum +
00377 diag_F_reg_cell(dir_v,h_mesh,OS->Stencil)
00378 * gr->Give_cell_variable(
00379 it_n->Ind().next(
00380 (dir_sons)i,l+1))[a_.Number_cell_variable()];
00381 }
00382 }
00383 return sum;
00384 };
00385 static inline double diag_F_reg_cell(dir_sons dir_v,
00386 double h_mesh, double* sten) {
00387 return sten[dir_v*9] * DiffOp::Factor_reg_cell(h_mesh);
00388 }
00389 double Give_cellpoi(const P_cellpoi* it_cf, const Grid* gr,
00390 const BoCeData* bocedata) const {
00391
00392
00393 return DiffOp::diag_F_bo_cell(bocedata,bocedata->Give_number_points(),
00394 a_.Number_cell_variable());
00395 };
00396 double Give_Bo2p(const P_Bo2p* it_b, const Grid* gr,int l) const {
00397 static int i;
00398 static BoCeData* bocedata;
00399 static double sum;
00400 static int num_v;
00401 dir_sons dir_v;
00402 bool stop;
00403
00404 sum = 0.0;
00405 for(i=0;i<8;++i) {
00406 dir_v = opposite3D((dir_sons)i);
00407
00408 bocedata = it_b->Give_BoData((dir_sons)i);
00409 if(bocedata!=NULL) {
00410
00411 stop = false;
00412 for(num_v=0;!stop && bocedata->Give_number_points() > num_v;) {
00413 stop = bocedata->corner(num_v) == dir_v &&
00414 bocedata->edge_dir(num_v) == it_b->d() &&
00415 bocedata->edge_point(num_v);
00416 if(!stop) ++num_v;
00417 }
00418
00419 if(bocedata->Give_number_points() > num_v) {
00420
00421 sum = sum +
00422 DiffOp::diag_F_bo_cell(bocedata,num_v,a_.Number_cell_variable());
00423 }
00424 }
00425 }
00426 return sum;
00427 };
00428
00429 int Sice_stencil() const { return 25; }
00430
00431
00432 int Level() const { return 0; }
00433 Dominace_label Dominant_lev() const { return anti_dominant; }
00434 Dominace_label Dominant_poi() const { return anti_dominant; }
00435 bool run_interior() const { return true; }
00436 bool run_nearb() const { return true; }
00437 int run_boundary() const { return true; }
00438
00439
00440 int ops_interior() const { return DiffOp::ops_diag_interior(); }
00441
00442
00443 void Active_Sim_Level( int lev) const { };
00444 void Active_Sim_interior(bool run) const { };
00445 void Active_Sim_nearb(bool run) const { };
00446 void Active_Sim_boundary( int run) const { };
00447 void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00448 int level, type_of_update typ) const { };
00449
00450
00451 void Put_grid_rbo(Grid* gr, int r_bo) const {
00452 DiffOp opp;
00453 if(opp.typ_u()==Poisson_type ||
00454 opp.typ_v()==Poisson_type)
00455 OS->Stencil = gr->Give_Loc_stencil_Poisson();
00456 else {
00457 OS->Stencil = gr->Give_Loc_stencil(opp.typ_u(),opp.typ_v());
00458 }
00459 };
00460
00461 Differential_op_typ Abstract_differential_operator() const
00462 { return abstract_diag; }
00463 int Give_number_var_of_abstract_op() const { return -1; }
00464
00465 void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar)
00466 const {
00467 evpar->Variable_contained_in_expression(a_.Number_cell_variable());
00468 }
00469 bool GS_type(int var_number_left, int dim) const {
00470 return false;
00471 };
00472
00473 void clean() const { delete(OS); };
00474 };
00475
00476
00477
00478
00479
00480 DExpr<DiagonalDiff_Op_convar<Cell_Variable, laplace_FE_cell_variable> >
00481 Diag_Laplace_FE_var(Cell_Variable a);
00482
00483
00484 DExpr<DiagonalDiff_Op_convar<Cell_Variable, dxdx_FE_cell_variable> >
00485 Diag_DxDx_FE_var(Cell_Variable a);
00486
00487
00488 DExpr<DiagonalDiff_Op_convar<Cell_Variable, dydy_FE_cell_variable> >
00489 Diag_DyDy_FE_var(Cell_Variable a);
00490
00491
00492 DExpr<DiagonalDiff_Op_convar<Cell_Variable, dzdz_FE_cell_variable> >
00493 Diag_DzDz_FE_var(Cell_Variable a);
00494
00495
00496 DExpr<DiagonalDiff_Op_convar<Cell_Variable, helm_FE_cell_variable> >
00497 Diag_Helm_FE_var(Cell_Variable a);
00498
00499
00501
00503
00504
00505 DExpr<DiagonalDiff_Op_convar<Cell_Variable, dxdy_FE_cell_variable> >
00506 Diag_DxDy_FE_var(Cell_Variable a);
00507
00508
00509 DExpr<DiagonalDiff_Op_convar<Cell_Variable, dydx_FE_cell_variable> >
00510 Diag_DyDx_FE_var(Cell_Variable a);
00511
00512
00513 DExpr<DiagonalDiff_Op_convar<Cell_Variable, dxdz_FE_cell_variable> >
00514 Diag_DxDz_FE_var(Cell_Variable a);
00515
00516
00517 DExpr<DiagonalDiff_Op_convar<Cell_Variable, dzdx_FE_cell_variable> >
00518 Diag_DzDx_FE_var(Cell_Variable a);
00519
00520
00521 DExpr<DiagonalDiff_Op_convar<Cell_Variable, dydz_FE_cell_variable> >
00522 Diag_DyDz_FE_var(Cell_Variable a);
00523
00524
00525 DExpr<DiagonalDiff_Op_convar<Cell_Variable, dzdy_FE_cell_variable> >
00526 Diag_DzDy_FE_var(Cell_Variable a);
00527
00528
00529 DExpr<DiagonalDiff_Op_convar<Cell_Variable, dxhelm_FE_cell_variable> >
00530 Diag_DX_FE_var(Cell_Variable a);
00531
00532
00533 DExpr<DiagonalDiff_Op_convar<Cell_Variable, dyhelm_FE_cell_variable> >
00534 Diag_DY_FE_var(Cell_Variable a);
00535
00536
00537 DExpr<DiagonalDiff_Op_convar<Cell_Variable, dzhelm_FE_cell_variable> >
00538 Diag_DZ_FE_var(Cell_Variable a);
00539
00540
00541 DExpr<DiagonalDiff_Op_convar<Cell_Variable, helmdx_FE_cell_variable> >
00542 Diag_DX_FE_var_t(Cell_Variable a);
00543
00544
00545 DExpr<DiagonalDiff_Op_convar<Cell_Variable, helmdy_FE_cell_variable> >
00546 Diag_DY_FE_var_t(Cell_Variable a);
00547
00548
00549 DExpr<DiagonalDiff_Op_convar<Cell_Variable, helmdz_FE_cell_variable> >
00550 Diag_DZ_FE_var_t(Cell_Variable a);
00551
00552
00553
00555
00557
00558
00559
00560
00561
00562
00563 #endif
00564
00565
00566
00567