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

Product.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 __PRODUCT_H
00005 #define __PRODUCT_H
00006 
00007 #include <dolfin/dolfin_log.h>
00008 #include <dolfin/constants.h>
00009 #include <dolfin/Point.h>
00010 #include <dolfin/FunctionSpace.h>
00011 #include <dolfin/Integral.h>
00012 
00013 namespace dolfin {
00014 
00015   class FunctionSpace::ShapeFunction;
00016   class FunctionSpace::ElementFunction;
00017   
00018   class FunctionSpace::Product {
00019   public:
00020          
00021     // Empty constructor for v = 1
00022     Product();
00023     
00024     // Initialisation
00025     Product(const ShapeFunction &v);
00026     Product(const Product       &v);
00027     
00028     // Constructors for v0 * v1
00029     Product(const ShapeFunction &v0, const ShapeFunction &v1);
00030     Product(const Product       &v0, const Product       &v1);
00031     Product(const ShapeFunction &v0, const Product       &v1);
00032     
00033     // Destructor
00034     ~Product();
00035     
00036     // Assignment (v0 * v1)
00037     void set(const ShapeFunction &v0, const ShapeFunction &v1);
00038     void set(const Product       &v0, const Product       &v1);
00039     void set(const ShapeFunction &v0, const Product       &v1);
00040     
00041     // Get id
00042     int* id() const;
00043     
00044     // True if equal to zero
00045     bool zero() const;
00046     
00047     // True if equal to unity
00048     bool one() const;
00049     
00050     // Get number of factors
00051     int size() const;
00052     
00053     //--- Operators ---
00054     
00055     // Evaluation
00056     real operator() (real x, real y, real z, real t) const;
00057     real operator() (Point p) const;
00058     
00059     // Assignment
00060     Product& operator= (const ShapeFunction &v);
00061     Product& operator= (const Product       &v);
00062     
00063     // Addition
00064     ElementFunction operator+ (const ShapeFunction   &v) const;
00065     ElementFunction operator+ (const Product         &v) const;
00066     ElementFunction operator+ (const ElementFunction &v) const;
00067     
00068     // Subtraction
00069     ElementFunction operator- (const ShapeFunction   &v) const;
00070     ElementFunction operator- (const Product         &v) const;
00071     ElementFunction operator- (const ElementFunction &v) const;
00072     
00073     // Multiplication
00074     ElementFunction operator* (real a)                   const;
00075     Product         operator* (const ShapeFunction   &v) const;
00076     Product         operator* (const Product         &v) const;
00077     ElementFunction operator* (const ElementFunction &v) const;
00078     
00079     // Integration
00080     real operator* (Integral::Measure &dm) const;
00081     
00082     // Derivatives
00083     ElementFunction ddx() const;
00084     ElementFunction ddy() const;
00085     ElementFunction ddz() const;
00086 
00087     // Set the number of factors
00088     void init(int size);
00089 
00090     // Output
00091     friend LogStream& operator<<(LogStream& stream, const Product &v);
00092     
00093   private:
00094     
00095     int n;    // Number of factors
00096     int *_id; // Shape function id:s
00097     
00098   };
00099   
00100   FunctionSpace::ElementFunction operator* (real a, const FunctionSpace::Product &v);
00101   
00102 }
00103 
00104 #endif


Documentation automatically generated with Doxygen on 10 Sep 2004.