Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

ShapeFunction.h

Go to the documentation of this file.
00001 // Copyright (C) 2003 Johan Hoffman and Anders Logg.
00002 // Licensed under the GNU GPL Version 2.
00003 
00004 #ifndef __SHAPE_FUNCTION_H
00005 #define __SHAPE_FUNCTION_H
00006 
00007 #include <dolfin/dolfin_log.h>
00008 #include <dolfin/constants.h>
00009 #include <dolfin/FunctionPointer.h>
00010 #include <dolfin/Point.h>
00011 #include <dolfin/FunctionSpace.h>
00012 #include <dolfin/Integral.h>
00013 
00014 namespace dolfin {
00015 
00016   class FunctionSpace::Product;
00017   class FunctionSpace::ElementFunction;
00018   
00019   class FunctionSpace::ShapeFunction {
00020   public:
00021     
00022     // Empty constructor for v = 0
00023     ShapeFunction();
00024     
00025     // Constructor for v = 1
00026     ShapeFunction(int id, int component);
00027     
00028     // Initialisation
00029     ShapeFunction(function f);
00030     ShapeFunction(const ShapeFunction &v);
00031     
00032     // Specification of derivatives
00033     void set(ElementFunction ddX, ElementFunction ddY, ElementFunction ddZ, ElementFunction ddT);
00034     
00035     // Get id
00036     int id() const;
00037 
00038     // Get component number
00039     int component() const;
00040     
00041     // True if equal to zero
00042     bool zero() const;
00043     
00044     // True if equal to unity
00045     bool one() const;
00046     
00047     // Derivatives
00048     const ElementFunction& ddx() const;
00049     const ElementFunction& ddy() const;
00050     const ElementFunction& ddz() const;
00051     const ElementFunction& ddt() const;
00052     
00053     const ElementFunction& ddX() const;
00054     const ElementFunction& ddY() const;
00055     const ElementFunction& ddZ() const;
00056     const ElementFunction& ddT() const;
00057     
00058     // Update
00059     void update(const Map& map);
00060     
00061     //--- Operators ---
00062     
00063     // Evaluation
00064     real operator() (real x, real y, real z, real t) const;
00065     real operator() (Point p) const;
00066     
00067     // Assignment
00068     ShapeFunction& operator= (const ShapeFunction &v);
00069     
00070     // Addition
00071     ElementFunction operator+ (const ShapeFunction   &v) const;
00072     ElementFunction operator+ (const Product         &v) const;
00073     ElementFunction operator+ (const ElementFunction &v) const;
00074     
00075     // Subtraction
00076     ElementFunction operator- (const ShapeFunction   &v) const;
00077     ElementFunction operator- (const Product         &v) const;
00078     ElementFunction operator- (const ElementFunction &v) const;
00079     
00080     // Multiplication
00081     ElementFunction operator* (const real a)             const;
00082     Product         operator* (const ShapeFunction   &v) const;
00083     Product         operator* (const Product         &v) const;
00084     ElementFunction operator* (const ElementFunction &v) const;
00085     
00086     // Integration
00087     real operator* (Integral::Measure &dm) const;
00088     
00089     // Needed for ShortList
00090     void operator= (int zero);
00091     bool operator! () const;
00092     
00093     // Output
00094     friend LogStream& operator<<(LogStream& stream, const ShapeFunction &v);
00095     
00096     // Vector shape function
00097     class Vector {
00098     public:
00099       
00100       Vector(int size);
00101       Vector(const Vector& v);
00102       //Vector(const ShapeFunction& v0, const ShapeFunction& v1, const ShapeFunction& v2);
00103       ~Vector();
00104       
00105       int size() const;
00106       
00107       ShapeFunction& operator() (int i);
00108       
00109     private:
00110       ShapeFunction* v;
00111       int _size;
00112     };
00113 
00114 
00115   private:
00116     
00117     int _id;
00118     int _component;
00119     
00120   };
00121   
00122   FunctionSpace::ElementFunction operator* (real a, const FunctionSpace::ShapeFunction &v);
00123   
00124 }
00125 
00126 #endif


Documentation automatically generated with Doxygen on 10 Sep 2004.