SyFi
0.3
|
00001 // Copyright (C) 2006-2009 Kent-Andre Mardal and Simula Research Laboratory 00002 // 00003 // This file is part of SyFi. 00004 // 00005 // SyFi is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 2 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // SyFi is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with SyFi. If not, see <http://www.gnu.org/licenses/>. 00017 00018 #ifndef FE_IS_INCLUDED 00019 #define FE_IS_INCLUDED 00020 00021 #include <string> 00022 #include "Polygon.h" 00023 00024 namespace SyFi 00025 { 00026 00027 class FE 00028 { 00029 public: 00030 FE() {} 00031 virtual ~FE() {} 00032 00033 // Set polygonal domain 00034 virtual void set_polygon(Polygon& p) = 0; 00035 // Get polygonal domain 00036 virtual Polygon& get_polygon() = 0; 00037 00038 // precompute basis functions 00039 virtual void compute_basis_functions() = 0; 00040 // Number of basis functions/ degrees of freedom 00041 virtual unsigned int nbf() const = 0; 00042 // The i'th basis function 00043 virtual GiNaC::ex N(unsigned int i) = 0; 00044 // The i'th degree of freedom 00045 virtual GiNaC::ex dof(unsigned int i) = 0 ; 00046 virtual std::string str() = 0; 00047 }; 00048 00049 class StandardFE : public FE 00050 { 00051 protected: 00052 GiNaC::exvector Ns; 00053 GiNaC::exvector dofs; 00054 Polygon* p; 00055 unsigned int order; 00056 std::string description; 00057 00058 public: 00059 StandardFE(); 00060 StandardFE(Polygon& p, unsigned int order); 00061 virtual ~StandardFE(); 00062 00063 virtual void set_order(unsigned int order); 00064 virtual unsigned int get_order(); 00065 00066 virtual void set_polygon(Polygon& p); 00067 virtual Polygon& get_polygon(); 00068 00069 virtual void compute_basis_functions(); 00070 virtual unsigned int nbf() const; 00071 virtual GiNaC::ex N(unsigned int i); 00072 virtual GiNaC::ex dof(unsigned int i); 00073 virtual std::string str(); 00074 }; 00075 } 00076 #endif