Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

src/expde/formulas/loc_sten.h

Go to the documentation of this file.
00001 //    expde: expression templates for partial differential equations.
00002 //    Copyright (C) 2001  Christoph Pflaum
00003 //    This program is free software; you can redistribute it and/or modify
00004 //    it under the terms of the GNU General Public License as published by
00005 //    the Free Software Foundation; either version 2 of the License, or
00006 //    (at your option) any later version.
00007 //
00008 //    This program is distributed in the hope that it will be useful,
00009 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //    GNU General Public License for more details.
00012 //
00013 //                 SEE  Notice1.doc made by 
00014 //                 LAWRENCE LIVERMORE NATIONAL LABORATORY
00015 //
00016 
00017 // ------------------------------------------------------------
00018 //
00019 // loc_sten.h
00020 //
00021 // ------------------------------------------------------------
00022 
00023 #ifndef LOCSTEN_H_
00024 #define LOCSTEN_H_
00025      
00027 // Notation:
00028 // a(u,v) is stored in stencil[v+8*u]
00029 // where stencil is:
00030 //      double* stencil;
00031 // Here a(u,v) is evaluated only on a cell.
00032 // Therefore, it must be:
00033 //       0 <= v,u < 8 
00035 
00036 
00037 
00038 // This is a class which can calculate a local stencil
00039 // If a local stencil was calculated, then
00040 // this stencil is stored.
00041 // Therefore next time, this stencil does not have to be calculated again. 
00042 class Loc_stencil_container {
00043  public:
00044   Loc_stencil_container();
00045   double* Give_Loc_sten(diff_type typ_u, diff_type typ_v) const;
00046   double* Give_Loc_sten_Poisson() const { return sten_Poisson; };
00047  private:
00048   double*** sten;
00049   double* sten_Poisson;
00050   double* sten_sp;
00051 };
00052 
00053 void Restrict_local_stiffness_matrix(double*  Stencil_coarse,
00054                                      double** Stencils_fine,
00055                                      bool* corner_in_domain);
00056 void Restrict_local_stiffness_matrix(double*  Stencil_coarse,
00057                                      double** Stencils_fine,
00058                                      int* coarse_grid_functions);
00059 
00060 // used in mg_op.h
00061 class Restriction_stencil_container {
00062  public:
00063   Restriction_stencil_container();
00064   double Calc_trans_weight(dir_sons i, dir_sons j, dir_sons k);
00065  private:
00066   int reg_formula[5][5][5];
00067 };
00068 
00069 
00070 inline double Restriction_stencil_container::Calc_trans_weight(dir_sons i,
00071                                                                dir_sons j,
00072                                                                dir_sons k) {
00073   return reg_formula[2*(i&1) + (j&1) + (k&1)]
00074                     [2*((i>>1)&1) + ((j>>1)&1) + ((k>>1)&1)]
00075                     [2*((i>>2)&1) + ((j>>2)&1) + ((k>>2)&1)];
00076 }
00077 
00078 
00079 
00081    //  evaluation of a local stiffness matrix
00083 
00084 inline double Evaluate_lsm(double*const * u_Recell, int num_var,
00085                            dir_sons dir_v, double* sten) {
00086   static int i;
00087   static double sum;
00088   sum = 0.0;
00089   for(i=0;i<8;++i) sum = sum + sten[dir_v+8*i] * u_Recell[i][num_var];
00090   return sum;
00091 }
00092 
00093 
00094 //-------------------------------------------------------------------------
00095 // The following functions are not very important.
00096 // They are used only for the implementation of the code.
00097 void Set_coarse_function(double U[27], dir_sons v);
00098 void Set_coarse_function(int    U[27], dir_sons v); //multipiziert mit Faktor 2
00099 
00100 // Print 27-stencil using 64-local stencil
00101 void Print_27_stencil_of_local_matrix(double* sten);
00102 
00103 void Print_u_Recell(double*const * u_Recell, int num);
00104 
00105 // Print 64-local stencil
00106 void Print_Loc_stencil(double* sten);
00107 void Print_part_loc_stencil(double* sten); // used by Print_Loc_stencil
00108 
00109 void Print_Factor(diff_type typ_u, diff_type typ_v);
00110 void Print_Factor_Poisson();
00111 
00112 void Print_27_stencil(double Sten27[27]);
00113 void Print_27_stencil(diff_type typ_u, diff_type typ_v);
00114 void Print_27_stencil_var(diff_type typ_u, diff_type typ_v);
00115 void Print_27_stencil_formula_var(diff_type typ_u, diff_type typ_v);
00116 void Print_27_stencil_Poisson();
00117 void Print_27_stencil_Poisson_var();
00118 
00119 void Calc_Loc_stencil(double* sten, diff_type typ_u, diff_type typ_v);
00120 double Test_evaluation_of_lsm(double* sten, dir_sons dir_v,
00121                               bool* corner_in_domain);
00122 double Test_evaluation_of_lsm(double* sten, dir_sons dir_v);
00123 double Test_evaluation_of_lsm(double* sten, dir_sons dir_v, double* UU);
00124 
00125 void Print_restriction_formula();
00126 
00127 #endif
00128     

Generated on Fri Nov 2 01:25:58 2007 for IPPL by doxygen 1.3.5