00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00042 #ifndef __EvalChristoffel_HPP
00043 #define __EvalChristoffel_HPP "Created 27.02.2001 21:42:27 by werner"
00044 
00045 #include <diffme/Tensor.hpp>
00046 #include <diffme/Variable.hpp>
00047 #include <diffme/Power.hpp>
00048 #include <vecal/Christoffel.hpp>
00049 
00050 namespace Traum
00051 {
00052         using namespace DiffMe;
00053         using VecAl::Christoffel;
00054 
00055 template <int i, int j, int k, template <int,int> class g>
00056 struct  EvalChristoffelElement
00057 {
00058         typedef g<i,j> g_ij;
00059         typedef typename Coordinate<g_ij>::result coord_t;
00060 
00061         enum { dims = coord_t::dims };
00062 
00063         typedef typename ChristoffelSymbols<i,j, g, k>::result Gk_ij;
00064 
00065         
00066 
00067 template <class dstvalue, class srcvalue>
00068 static  void eval(Context<srcvalue>&C, Christoffel<dims, dstvalue>&Gamma)
00069         {
00070                 Gamma(k,i,j) = Eval<Gk_ij>::eval(C);
00071         }
00072 };
00073 
00074 
00075 template <int I, int J, int K, template <int,int> class g, int dims>
00076 struct  EvalChristoffelIJK
00077 {
00078 
00079 template <class dstvalue, class srcvalue>
00080 static  void eval(Context<srcvalue>&C, Christoffel<dims, dstvalue>&Gamma)
00081         {
00082                 EvalChristoffelElement<I, J, K   ,g>::eval(C, Gamma);
00083                 EvalChristoffelIJK    <I, J, K-1 ,g, dims>::eval(C, Gamma);
00084         }
00085 };
00086 
00087 template <int I, int J, template <int,int> class g, int dims>
00088 struct  EvalChristoffelIJK<I,J, 0, g, dims>
00089 {
00090 
00091 template <class dstvalue, class srcvalue>
00092 static  void eval(Context<srcvalue>&C, Christoffel<dims, dstvalue>&Gamma)
00093         {
00094                 EvalChristoffelElement<I, J, 0   ,g>::eval(C, Gamma);
00095         }
00096 };
00097 
00098 
00099 template <int I, int J, template <int,int> class g, int dims>
00100 struct  EvalChristoffelIJ
00101 {
00102 
00103 template <class dstvalue, class srcvalue>
00104 static  void eval(Context<srcvalue>&C, Christoffel<dims, dstvalue>&Gamma)
00105         {
00106                 EvalChristoffelIJK<I, J  , dims-1, g, dims>::eval(C, Gamma);
00107                 EvalChristoffelIJ <I, J-1,         g, dims>::eval(C, Gamma);
00108         }
00109 };
00110 
00111 template <int I, template <int,int> class g, int dims>
00112 struct  EvalChristoffelIJ<I, 0, g, dims>
00113 {
00114 
00115 template <class dstvalue, class srcvalue>
00116 static  void eval(Context<srcvalue>&C, Christoffel<dims, dstvalue>&Gamma)
00117         {
00118                 EvalChristoffelIJK<I,0, dims-1, g, dims>::eval(C, Gamma);               
00119         }
00120 };
00121 
00122 
00123 
00124 
00125 template <int I, template <int,int> class g, int dims>
00126 struct  EvalChristoffelI
00127 {
00128 
00129 template <class dstvalue, class srcvalue>
00130 static  void eval(Context<srcvalue>&C, Christoffel<dims, dstvalue>&Gamma)
00131         {
00132                 EvalChristoffelIJ<I  , dims-1, g, dims>::eval(C, Gamma);
00133                 EvalChristoffelI <I-1,         g, dims>::eval(C, Gamma);
00134         }
00135 };
00136 
00137 template <template <int,int> class g, int dims>
00138 struct  EvalChristoffelI<0, g, dims>
00139 {
00140 
00141 template <class dstvalue, class srcvalue>
00142 static  void eval(Context<srcvalue>&C, Christoffel<dims, dstvalue>&Gamma)
00143         {
00144                 EvalChristoffelIJ<0, dims-1, g, dims>::eval(C, Gamma);          
00145         }
00146 };
00147 
00148 
00149 
00150 template <template <int,int> class g>
00151 struct  EvalChristoffel
00152 {
00153         typedef typename Coordinate<g<0,0> >::result coord_t;
00154         enum { dims = coord_t::dims };
00155 
00156 template <class dstvalue, class srcvalue>
00157 static  void eval(Context<srcvalue>&C, Christoffel<dims, dstvalue>&Gamma)
00158         {
00159                 EvalChristoffelI <dims-1, g, dims>::eval(C, Gamma);
00160         }
00161 };
00162 
00163 }  
00164 
00165 #endif 
00166 
00167