00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifdef COMP_GNUOLD
00024 #include <iostream.h>
00025 #include <fstream.h>
00026 #include <time.h>
00027 #include <math.h>
00028 #else
00029 #include <iostream>
00030 #include <fstream>
00031 #include <ctime>
00032 #include <cmath>
00033 #endif
00034
00035
00036
00037 #include "../parser.h"
00038
00039
00040 #include "../paramete.h"
00041 #include "../abbrevi.h"
00042 #include "../math_lib/math_lib.h"
00043
00044
00045 #include "../basic/basic.h"
00046
00047
00048 #include "../domain/domain.h"
00049
00050
00051 #include "../formulas/boundy.h"
00052 #include "../formulas/loc_sten.h"
00053 #include "../formulas/diffop.h"
00054 #include "../formulas/diffopc.h"
00055 #include "../formulas/diffopv.h"
00056
00057
00058 #include "../grid/gpar.h"
00059 #include "../grid/parallel.h"
00060 #include "../grid/mgcoeff.h"
00061 #include "../grid/sto_man.h"
00062 #include "../grid/gridbase.h"
00063 #include "../grid/grid.h"
00064 #include "../grid/input.h"
00065
00066
00067
00068 #include "../evpar/evpar.h"
00069
00070
00071
00072 #include "variable.h"
00073 #include "opera.h"
00074 #include "operav.h"
00075 #include "sim.h"
00076 #include "extra.h"
00077 #include "res_op.h"
00078 #include "array.h"
00079
00080
00081
00082
00084
00085
00086
00088
00089
00090
00092
00093
00094 DWrapSim<DExprSimLit>
00095 operator== (Variable& a, double value)
00096 {
00097 typedef DWrapSim<DExprSimLit> ExprT;
00098 return ExprT(DExprSimLit(a,value));
00099 }
00100
00101
00102
00103 DWrapSim<DExprSimlocLit>
00104 operator== (const Local_var& a, double x)
00105 {
00106 typedef DWrapSim<DExprSimlocLit > ExprT;
00107 return ExprT(DExprSimlocLit(a,x));
00108 }
00109
00110
00111 DWrapSim<DExprSimloc<DExprVAR> >
00112 operator== (const Local_var& a, Variable& b)
00113 {
00114 typedef DWrapSim<DExprSimloc<DExprVAR> > ExprT;
00115 return ExprT(DExprSimloc<DExprVAR>(a,DExprVAR(b)));
00116 }
00117
00118
00119
00121
00122
00123 DExpr<DVar_Extra_Op>
00124 Extrapolate_near_boundary(Variable a)
00125 {
00126 return DExpr<DVar_Extra_Op>(DVar_Extra_Op(a));
00127 }
00128
00129
00130
00131 double DVar_Extra_Op::Give_at_Index(const Index3D I, const Grid* grid) const {
00132 int l;
00133 Index3D In, Inn, Innn;
00134 int i;
00135 Pointtype Ptypn, Ptypnn, Ptypnnn;
00136 double un, unn, unnn;
00137
00138 l = grid->Max_level();
00139
00140
00141
00142 for(i=0;i<8;++i) {
00143 In = I.next((dir_sons)i, l);
00144 Inn = In.next((dir_sons)i, l);
00145 Innn = Inn.next((dir_sons)i, l);
00146 if(grid->Point_in_domain(In) && grid->Point_in_domain(Inn)
00147 && grid->Point_in_domain(Innn)) {
00148 Ptypn = grid->Give_type(In);
00149 Ptypnn = grid->Give_type(Inn);
00150 Ptypnnn = grid->Give_type(Innn);
00151 if((interior == Ptypn || uniform <= Ptypn) &&
00152 (interior == Ptypnn || uniform <= Ptypnn) &&
00153 (interior == Ptypnnn || uniform <= Ptypnnn)) {
00154 un = grid->Give_variable(In,l)[v_.Number_variable()];
00155 unn = grid->Give_variable(Inn,l)[v_.Number_variable()];
00156 unnn = grid->Give_variable(Innn,l)[v_.Number_variable()];
00157
00158 return unnn - 3.0*unn + 3.0 * un;
00159 }
00160 }
00161 }
00162
00163 for(i=0;i<8;++i) {
00164 In = I.next((dir_sons)i, l);
00165 Inn = In.next((dir_sons)i, l);
00166 if(grid->Point_in_domain(In) && grid->Point_in_domain(Inn)) {
00167 Ptypn = grid->Give_type(In);
00168 Ptypnn = grid->Give_type(Inn);
00169 if((interior == Ptypn || uniform <= Ptypn) &&
00170 (interior == Ptypnn || uniform <= Ptypnn)) {
00171 un = grid->Give_variable(In,l)[v_.Number_variable()];
00172 unn = grid->Give_variable(Inn,l)[v_.Number_variable()];
00173
00174
00175
00176 return 2.0*un - unn;
00177 }
00178 }
00179 }
00180 return grid->Give_variable(I,l)[v_.Number_variable()];
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201 }
00202
00203
00204
00206
00207 Schleife For(Local_int& I, int begin, int end) {
00208 return Schleife(I.Give_pointer(),begin,end);
00209 }
00210
00211 SchleifeSum Sum(Local_int& I, int begin, int end) {
00212 return SchleifeSum(I.Give_pointer(),begin,end);
00213 }