![]() |
00001 // Copyright (C) 2004 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 #ifndef __NEW_POISSON_H 00005 #define __NEW_POISSON_H 00006 00007 #include <dolfin/NewPDE.h> 00008 00009 namespace dolfin 00010 { 00011 00013 00014 class NewPoisson : public NewPDE 00015 { 00016 public: 00017 00018 NewPoisson(Function& f) : NewPDE(4, true, false), w0(4) 00019 { 00020 // Add functions 00021 add(w0, f); 00022 00023 // Using default (full) nonzero pattern 00024 } 00025 00026 unsigned int dim() const 00027 { 00028 return 1; 00029 } 00030 00031 unsigned int dof(unsigned int i, const Cell& cell) const 00032 { 00033 return cell.nodeID(i); 00034 } 00035 00036 const Point& coord(unsigned int i, const Cell& cell) const 00037 { 00038 return cell.node(i).coord(); 00039 } 00040 00041 void interiorElementMatrix(real** A) const 00042 { 00043 real tmp0 = det / 6.0; 00044 00045 real G00 = tmp0*(g00*g00 + g01*g01 + g02*g02); 00046 real G01 = tmp0*(g00*g10 + g01*g11 + g02*g12); 00047 real G02 = tmp0*(g00*g20 + g01*g21 + g02*g22); 00048 real G11 = tmp0*(g10*g10 + g11*g11 + g12*g12); 00049 real G12 = tmp0*(g10*g20 + g11*g21 + g12*g22); 00050 real G22 = tmp0*(g20*g20 + g21*g21 + g22*g22); 00051 00052 A[1][1] = G00; 00053 A[1][2] = G01; 00054 A[1][3] = G02; 00055 A[2][2] = G11; 00056 A[2][3] = G12; 00057 A[3][3] = G22; 00058 A[0][1] = - G00 - G01 - G02; 00059 A[0][2] = - G01 - G11 - G12; 00060 A[0][3] = - G02 - G12 - G22; 00061 A[0][0] = - A[0][1] - A[0][2] - A[0][3]; 00062 A[1][0] = A[0][1]; 00063 A[2][0] = A[0][2]; 00064 A[2][1] = G01; 00065 A[3][0] = A[0][3]; 00066 A[3][1] = A[1][3]; 00067 A[3][2] = A[2][3]; 00068 } 00069 00070 void interiorElementVector(NewArray<real>& b) const 00071 { 00072 real tmp0 = det / 120.0; 00073 00074 real G0 = tmp0*w0[0]; 00075 real G1 = tmp0*w0[1]; 00076 real G2 = tmp0*w0[2]; 00077 real G3 = tmp0*w0[3]; 00078 00079 real tmp1 = G0 + G1 + G2 + G3; 00080 00081 b[0] = tmp1 + G0; 00082 b[1] = tmp1 + G1; 00083 b[2] = tmp1 + G2; 00084 b[3] = tmp1 + G3; 00085 } 00086 00087 private: 00088 00089 NewArray<real> w0; 00090 00091 }; 00092 00093 } 00094 00095 #endif
![]()
Documentation automatically generated with Doxygen on 10 Sep 2004.