![]() |
00001 // Copyright (C) 2002 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 #ifndef __FUNCTION_SPACE_H 00005 #define __FUNCTION_SPACE_H 00006 00007 #include <dolfin/Cell.h> 00008 #include <dolfin/Array.h> 00009 #include <dolfin/shapefunctions.h> 00010 00011 namespace dolfin { 00012 00013 class ExpressionFunction; 00014 class FiniteElement; 00015 class Map; 00016 00017 class FunctionSpace { 00018 public: 00019 00020 FunctionSpace(int dim); 00021 virtual ~FunctionSpace(); 00022 00023 // Forward declarations of nested classes 00024 class ShapeFunction; 00025 class ElementFunction; 00026 class Product; 00027 00028 // Addition of new shape functions 00029 void add(ShapeFunction v); 00030 00031 void add(ShapeFunction v, ElementFunction ddx); 00032 void add(ShapeFunction v, ElementFunction ddx, ElementFunction ddy); 00033 void add(ShapeFunction v, ElementFunction ddx, ElementFunction ddy, ElementFunction ddz); 00034 void add(ShapeFunction v, ElementFunction ddx, ElementFunction ddy, ElementFunction ddz, ElementFunction ddt); 00035 00036 void add(ShapeFunction v, real ddx); 00037 void add(ShapeFunction v, real ddx, real ddy); 00038 void add(ShapeFunction v, real ddx, real ddy, real ddz); 00039 void add(ShapeFunction v, real ddx, real ddy, real ddz, real ddt); 00040 00041 // Dimension (number of shape functions) 00042 int dim() const; 00043 00044 // Map from local to global degrees of freedom 00045 virtual int dof(int i, const Cell& cell) const = 0; 00046 00047 // Evaluation of local degree of freedom 00048 virtual real dof(int i, const Cell& cell, const ExpressionFunction& f, real t) const = 0; 00049 00050 // Update with current map 00051 void update(const Map& map); 00052 00053 // Iterator for shape functions in the function space 00054 class Iterator { 00055 public: 00056 00057 Iterator(const FunctionSpace &functionSpace); 00058 00059 int dof(const Cell& cell) const; 00060 real dof(const Cell& cell, const ExpressionFunction& f, real t) const; 00061 00062 int index() const; 00063 bool end() const; 00064 void operator++(); 00065 ShapeFunction* pointer() const; 00066 ShapeFunction& operator*() const; 00067 ShapeFunction* operator->() const; 00068 00069 private: 00070 00071 const FunctionSpace *V; 00072 Array<ShapeFunction>::Iterator v; 00073 00074 }; 00075 00076 // Friends 00077 friend class Iterator; 00078 friend class FiniteElement; 00079 00080 // Vector function space 00081 class Vector { 00082 public: 00083 00084 Vector(int size = 3); 00085 Vector(const Vector& v); 00086 //Vector(const FunctionSpace& v0, const FunctionSpace& v1, const FunctionSpace& v2); 00087 ~Vector(); 00088 00089 int size() const; 00090 00091 FunctionSpace& operator() (int i); 00092 00093 private: 00094 FunctionSpace** v; 00095 int _size; 00096 }; 00097 00098 protected: 00099 00100 int _dim; // Dimension (number of shape functions) 00101 Array<ShapeFunction> v; // Shape functions 00102 00103 }; 00104 00105 } 00106 00107 #endif 00108
Documentation automatically generated with Doxygen on 10 Sep 2004.