![]() |
00001 // Copyright (C) 2003 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 #ifndef __P1TRI_H 00005 #define __P1TRI_H 00006 00007 #include <dolfin/FunctionSpace.h> 00008 #include <dolfin/ShapeFunction.h> 00009 #include <dolfin/ExpressionFunction.h> 00010 00011 namespace dolfin { 00012 00013 class P1Tri : public FunctionSpace { 00014 public: 00015 00016 // Definition of the local function space 00017 P1Tri() : FunctionSpace(3) 00018 { 00019 // Define shape functions 00020 ShapeFunction v0(tri10); 00021 ShapeFunction v1(tri11); 00022 ShapeFunction v2(tri12); 00023 00024 // Add shape functions and specify derivatives 00025 add(v0, -1.0, -1.0); 00026 add(v1, 1.0, 0.0); 00027 add(v2, 0.0, 1.0); 00028 } 00029 00030 // Mapping from local to global degrees of freedom 00031 int dof(int i, const Cell& cell) const 00032 { 00033 return cell.nodeID(i); 00034 } 00035 00036 // Evalutation of degrees of freedom 00037 real dof(int i, const Cell& cell, const ExpressionFunction& f, real t) const 00038 { 00039 Point p = cell.coord(i); 00040 return f(p.x, p.y, p.z, t); 00041 } 00042 00043 }; 00044 00045 } 00046 00047 #endif
Documentation automatically generated with Doxygen on 10 Sep 2004.