Transform.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 FEM_TRANSFORM_H
00010 #define FEM_TRANSFORM_H
00011 
00012 #include <fem/ShapeFunction.hpp>
00013 
00014 namespace imaging
00015 {
00027   template<size_t N_VERTICES, size_t N_FACES, size_t N>
00028   class Transform
00029   {
00030   protected:
00032     ublas::fixed_vector< ublas::fixed_vector<float_t, N>, N_VERTICES> _vertices;
00033 
00034   public:
00036     static const size_t n_element_vertices = N_VERTICES;
00037     
00039     static const size_t n_element_faces = N_FACES;
00040     
00042     static size_t face_vertex(size_t face_index, size_t face_vertex_index);
00043 
00045     void assign(size_t vertex_index, const ublas::fixed_vector<float_t, N> & vertex_coordinates)
00046     { _vertices(vertex_index) = vertex_coordinates; }
00047 
00049     ublas::fixed_vector<float_t, N> & value(const ublas::fixed_vector<float_t, N> & in, ublas::fixed_vector<float_t, N> & out) const;
00050     
00052     ublas::fixed_matrix<float_t, N, N> & derivative(const ublas::fixed_vector<float_t, N> & in, ublas::fixed_matrix<float_t, N, N> & out) const;
00053     
00055     ublas::fixed_matrix<float_t, N, N - 1> & boundary_derivative(size_t face_index, const ublas::fixed_vector<float_t, N - 1> & in, ublas::fixed_matrix<float_t, N, N - 1> & out) const;
00056     
00058     ublas::fixed_vector<float_t, N> & boundary_normal(size_t face_index, ublas::fixed_vector<float_t, N> & out) const;
00059     
00061     ublas::fixed_vector<float_t, N> & boundary2element(size_t face_index, const ublas::fixed_vector<float_t, N - 1> & in, ublas::fixed_vector<float_t, N> & out) const;
00062   };
00063 
00073   class Square2dTransform : public Transform<4, 4, 2>
00074   {
00075   
00076   public: 
00077     static size_t face_vertex(size_t face, size_t vertex);
00078 
00080     ublas::fixed_matrix<float_t, 2, 1> & boundary_derivative(size_t face, const ublas::fixed_vector<float_t, 1> & in, ublas::fixed_matrix<float_t, 2, 1> & out) const;
00081 
00083     ublas::fixed_vector<float_t, 2> & value(const ublas::fixed_vector<float_t, 2> & in, ublas::fixed_vector<float_t, 2> & out) const;
00084 
00086     ublas::fixed_matrix<float_t, 2, 2> & derivative(const ublas::fixed_vector<float_t, 2> & in, ublas::fixed_matrix<float_t, 2, 2> & out) const;
00087     
00089     ublas::fixed_vector<float_t, 2> & boundary2element(size_t face_index, const ublas::fixed_vector<float_t, 1> & in, ublas::fixed_vector<float_t, 2> & out) const;
00090     
00092     ublas::fixed_vector<float_t, 2> & boundary_normal(size_t face, ublas::fixed_vector<float_t, 2> & out) const;
00093   };
00094 
00104   class Triangle2dTransform : public Transform<3, 3, 2>
00105   {
00106     public:
00107     static size_t face_vertex(size_t face, size_t vertex);
00108 
00110     ublas::fixed_matrix<float_t, 2, 1> & boundary_derivative(size_t face, const ublas::fixed_vector<float_t, 1> & in, ublas::fixed_matrix<float_t, 2, 1> & out) const;
00111 
00113     ublas::fixed_vector<float_t, 2> & value(const ublas::fixed_vector<float_t, 2> & in, ublas::fixed_vector<float_t, 2> & out) const;
00114 
00116     ublas::fixed_matrix<float_t, 2, 2> & derivative(const ublas::fixed_vector<float_t, 2> & in, ublas::fixed_matrix<float_t, 2, 2> & out) const;
00117     
00119     ublas::fixed_vector<float_t, 2> & boundary2element(size_t face_index, const ublas::fixed_vector<float_t, 1> & in, ublas::fixed_vector<float_t, 2> & out) const;
00120     
00122     ublas::fixed_vector<float_t, 2> & boundary_normal(size_t face, ublas::fixed_vector<float_t, 2> & out) const;
00123   };
00124 
00134   class Tetrahedra3dTransform : public Transform<4, 4, 3>
00135   {
00136     static const size_t face_vertex_matrix[4][3];
00137     
00138     public:
00139     static size_t face_vertex(size_t face, size_t vertex);
00140 
00142     ublas::fixed_matrix<float_t, 3, 2> & boundary_derivative(size_t face, const ublas::fixed_vector<float_t, 2> & in, ublas::fixed_matrix<float_t, 3, 2> & out) const;
00143 
00145     ublas::fixed_vector<float_t, 3> & value(const ublas::fixed_vector<float_t, 3> & in, ublas::fixed_vector<float_t, 3> & out) const;
00146 
00148     ublas::fixed_matrix<float_t, 3, 3> & derivative(const ublas::fixed_vector<float_t, 3> & in, ublas::fixed_matrix<float_t, 3, 3> & out) const;
00149     
00151     ublas::fixed_vector<float_t, 3> & boundary2element(size_t face_index, const ublas::fixed_vector<float_t, 2> & in, ublas::fixed_vector<float_t, 3> & out) const;
00152     
00154     ublas::fixed_vector<float_t, 3> & boundary_normal(size_t face, ublas::fixed_vector<float_t, 3> & out) const;
00155   };
00156 
00157 
00168    class Cube3dTransform : public Transform<8, 6, 3>
00169   {
00170     static const size_t face_vertex_matrix[6][4];
00171     
00172     public:
00173     static size_t face_vertex(size_t face, size_t vertex);
00174 
00176     ublas::fixed_matrix<float_t, 3, 2> & boundary_derivative(size_t face, const ublas::fixed_vector<float_t, 2> & in, ublas::fixed_matrix<float_t, 3, 2> & out) const;
00177 
00179     ublas::fixed_vector<float_t, 3> & value(const ublas::fixed_vector<float_t, 3> & in, ublas::fixed_vector<float_t, 3> & out) const;
00180 
00182     ublas::fixed_matrix<float_t, 3, 3> & derivative(const ublas::fixed_vector<float_t, 3> & in, ublas::fixed_matrix<float_t, 3, 3> & out) const;
00183     
00185     ublas::fixed_vector<float_t, 3> & boundary2element(size_t face_index, const ublas::fixed_vector<float_t, 2> & in, ublas::fixed_vector<float_t, 3> & out) const;
00186     
00188     ublas::fixed_vector<float_t, 3> & boundary_normal(size_t face, ublas::fixed_vector<float_t, 3> & out) const;
00189   };
00190 
00191 
00201   class Interval1dTransform : public Transform<2, 2, 1>
00202   {
00203     public:
00204     static size_t face_vertex(size_t face, size_t vertex);
00205 
00207     ublas::fixed_matrix<float_t, 1, 0> & boundary_derivative(size_t face, const ublas::fixed_vector<float_t, 0> & in, ublas::fixed_matrix<float_t, 1, 0> & out) const;
00208 
00210     ublas::fixed_vector<float_t, 1> & value(const ublas::fixed_vector<float_t, 1> & in, ublas::fixed_vector<float_t, 1> & out) const;
00211 
00213     ublas::fixed_matrix<float_t, 1, 1> & derivative(const ublas::fixed_vector<float_t, 1> & in, ublas::fixed_matrix<float_t, 1, 1> & out) const;
00214     
00216     ublas::fixed_vector<float_t, 1> & boundary2element(size_t face_index, const ublas::fixed_vector<float_t, 0> & in, ublas::fixed_vector<float_t, 1> & out) const;
00217     
00219     ublas::fixed_vector<float_t, 1> & boundary_normal(size_t face, ublas::fixed_vector<float_t, 1> & out) const;
00220   };
00221 
00222 }
00223 
00224 #endif

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