ShapeFunction.hpp

00001 // This file is part of the imaging2 class library.
00002 //
00003 // University of Innsbruck, Infmath Imaging, 2009.
00004 // http://infmath.uibk.ac.at
00005 //
00006 // All rights reserved.
00007 
00008 
00009 #ifndef SHAPEFUNCTION_H
00010 #define SHAPEFUNCTION_H
00011 
00012 #include <core/imaging2.hpp>
00013 
00014 
00015 namespace imaging
00016 {
00024   template<size_t N_NODES, size_t N_FACE_NODES, size_t N>
00025   class ShapeFunction
00026   {
00027   public:
00029     static const size_t n_element_nodes = N_NODES;
00030     
00032     static const size_t n_shape_face_nodes = N_FACE_NODES;
00033     
00035     static size_t face_node(size_t face, size_t node);
00036   
00038     float_t value(size_t node_index, const ublas::fixed_vector<float_t, N> & in) const;
00039     
00041     ublas::fixed_vector<float_t, N> & gradient(size_t node_index, const ublas::fixed_vector<float_t, N> & in, ublas::fixed_vector<float_t, N> & out) const;
00042   };
00043 
00049   class Bilinear2dShapeFunction : public ShapeFunction<4, 2, 2>
00050   {
00051   public:
00052     static size_t face_node(size_t face, size_t node);
00053     
00055     float_t value(size_t node, const ublas::fixed_vector<float_t, 2> & in) const;
00056 
00058     ublas::fixed_vector<float_t, 2> & gradient(size_t node_index, const ublas::fixed_vector<float_t, 2> & in, ublas::fixed_vector<float_t, 2> & out) const;
00059   };
00060   
00061 
00062 class Trilinear3dShapeFunction : public ShapeFunction<8, 4, 3>
00063   {
00064   public:
00065     static size_t face_node(size_t face, size_t node);
00066     
00068     float_t value(size_t node, const ublas::fixed_vector<float_t, 3> & in) const;
00069 
00071     ublas::fixed_vector<float_t, 3> & gradient(size_t node_index, const ublas::fixed_vector<float_t, 3> & in, ublas::fixed_vector<float_t, 3> & out) const;
00072   };
00073 
00074 
00080   class Linear2dShapeFunction : public ShapeFunction<3, 2, 2>
00081   {
00082   public:
00083     static size_t face_node(size_t face, size_t node);
00084     
00086     float_t value(size_t node_index, const ublas::fixed_vector<float_t, 2> & in) const;
00087 
00088 
00090     ublas::fixed_vector<float_t, 2> & gradient(size_t node_index, const ublas::fixed_vector<float_t, 2> & in, ublas::fixed_vector<float_t, 2> & out) const;
00091 
00092   };
00093   
00099   class Linear3dShapeFunction : public ShapeFunction<4, 3, 3>
00100   {
00101   public:
00102     static size_t face_node(size_t face, size_t node);
00104     float_t value(size_t node_index, const ublas::fixed_vector<float_t, 3> & in) const;
00105 
00107     ublas::fixed_vector<float_t, 3> & gradient(size_t node_index, const ublas::fixed_vector<float_t, 3> & in, ublas::fixed_vector<float_t, 3> & out) const;
00108 
00109   };
00110 
00111 
00117   class Linear1dShapeFunction : public ShapeFunction<2, 1, 1>
00118   {
00119   public:
00120     static size_t face_node(size_t face, size_t node);
00121     
00123     float_t value(size_t node, const ublas::fixed_vector<float_t, 1> & in) const;
00124 
00125 
00127     ublas::fixed_vector<float_t, 1> & gradient(size_t node, const ublas::fixed_vector<float_t, 1> & in, ublas::fixed_vector<float_t, 1> & out) const;
00128   };
00129 
00130 }
00131 
00132 
00133 #endif

Generated on Tue Feb 10 10:01:30 2009 for imaging2 by  doxygen 1.5.5