![]() |
00001 // Copyright (C) 2003 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 #ifndef __FUNCTION_H 00005 #define __FUNCTION_H 00006 00007 #include <dolfin/Variable.h> 00008 #include <dolfin/ElementFunction.h> 00009 #include <dolfin/FunctionPointer.h> 00010 #include <dolfin/NewArray.h> 00011 00012 namespace dolfin { 00013 00014 class Cell; 00015 class Mesh; 00016 class Vector; 00017 class ElementData; 00018 class NewPDE; 00019 class GenericFunction; 00020 00024 00025 // FIXME: Needs to be redesigned. Which types do we need, and how 00026 // FIXME: are they related? 00027 00028 class Function : public Variable { 00029 public: 00030 00032 Function(); 00033 00035 Function(Mesh& mesh, dolfin::Vector& x, int dim = 0, int size = 1); 00036 00038 Function(const char* name, int dim = 0, int size = 1); 00039 00041 Function(function fp); 00042 00044 Function(unsigned int N); 00045 00047 ~Function(); 00048 00050 void init(Mesh& mesh, dolfin::Vector& x, int dim = 0, int size = 1); 00051 00053 void init(const char* name, int dim = 0, int size = 1); 00054 00056 void init(function fp); 00057 00059 void init(unsigned int N); 00060 00062 real operator() (const Node& n, real t = 0.0) const; 00063 real operator() (const Node& n, real t = 0.0); 00064 00066 real operator() (const Point& p, real t = 0.0) const; 00067 real operator() (const Point& p, real t = 0.0); 00068 00070 real operator() (real x, real y, real z, real t) const; 00071 real operator() (real x, real y, real z, real t); 00072 00074 real operator() (unsigned int i, real t) const; 00075 real operator() (unsigned int i, real t); 00076 00078 real abs(const Node& n, real t = 0.0); 00079 real abs(const Point& p, real t = 0.0); 00080 real abs(real x, real y, real z, real t); 00081 real abs(unsigned int i, real t); 00082 00083 // Update function to given time 00084 void update(real t); 00085 00086 // Return current time 00087 real time() const; 00088 00089 // FIXME: Special member functions below: Should they be removed? 00090 //--------------------------------------------------------------- 00091 00092 // Get mesh 00093 Mesh& mesh() const; 00094 00095 // Get element data 00096 ElementData& elmdata(); 00097 00098 // Update values of element function 00099 void update(FunctionSpace::ElementFunction& v, 00100 const FiniteElement& element, const Cell& cell, real t) const; 00101 00102 // Update local function (restriction to given cell) 00103 void update(NewArray<real>& w, const Cell& cell, const NewPDE& pde) const; 00104 00105 // Vector function 00106 class Vector { 00107 public: 00108 00109 Vector(Mesh& mesh, dolfin::Vector& x, int size = 3); 00110 Vector(const char* name, int size = 3); 00111 ~Vector(); 00112 00113 int size() const; 00114 00115 Function& operator() (int i); 00116 00117 private: 00118 00119 Function** f; 00120 int _size; 00121 00122 }; 00123 00124 private: 00125 00126 // Function 00127 GenericFunction* f; 00128 00129 }; 00130 00131 } 00132 00133 #endif
Documentation automatically generated with Doxygen on 10 Sep 2004.