TAPs 0.7.7.3
TAPsFEMHexahedron.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsFEMHexahedron.hpp
00003 ******************************************************************************/
00009 /******************************************************************************
00010 SUKITTI PUNAK   (12/30/2009)
00011 UPDATE          (07/01/2010)
00012 ******************************************************************************/
00013 #ifndef TAPs_FEM_HEXAHEDRON_HPP
00014 #define TAPs_FEM_HEXAHEDRON_HPP
00015 
00016 #include "TAPsFEMElement.hpp"
00017 
00018 //  Node Numbering Convention
00019 //
00020 //       7---------------6        ^ z / zeta
00021 //      /|              /|        |
00022 //     / |             / |        |    / y / eta
00023 //    /  |            /  |        |   /
00024 //   /   |           /   |        |  /
00025 //  4---------------5    |        | /
00026 //  |    |          |    |        |/          x / xi
00027 //  |    3----------|----2        +------------->
00028 //  |   /           |   /
00029 //  |  /            |  /
00030 //  | /             | /
00031 //  |/              |/
00032 //  0---------------1
00033 
00034 BEGIN_NAMESPACE_TAPs__FEM
00035 //=============================================================================
00036 // Forward declaration
00037 template <typename T> class MeshHexahedra;
00038 
00039 template <typename T>
00040 class Hexahedron : public Element<T> {
00041 //=============================================================================
00042     friend  class MeshHexahedra<T>;
00043 public:
00044     // Member Functions -------------------------------------------------------
00046     friend std::ostream & operator<< ( std::ostream &output, Hexahedron<T> const &obj )
00047     {
00048         output << obj.StrInfo();
00049         return output;
00050     }
00051     //-------------------------------------------------------------------------
00053     Hexahedron ( 
00054         std::vector< Vector3<T> > * deformedNodes,      
00055         std::vector< Vector3<T> > * undeformedNodes,    
00056         T YoungModulus,     
00057         T PoissionRatio,    
00058         unsigned int globalNode0,   
00059         unsigned int globalNode1,   
00060         unsigned int globalNode2,   
00061         unsigned int globalNode3,   
00062         unsigned int globalNode4,   
00063         unsigned int globalNode5,   
00064         unsigned int globalNode6,   
00065         unsigned int globalNode7    
00066     );
00068     //Hexahedron ( Hexahedron<T> const &orig );
00070     virtual ~Hexahedron ();
00071     //-------------------------------------------------------------------------
00073     virtual std::string StrInfo () const;
00074     //-------------------------------------------------------------------------
00076     //Hexahedron<T> & operator= ( Hexahedron<T> const &orig );
00077 
00078     //-------------------------------------------------------------------------
00079     // Get/Set Functions
00080 
00082     inline Matrix3x3<T> const & GetStiffnessMatrix ( unsigned int n, unsigned int m ) const;
00083 
00084     //-------------------------------------------------------------------------
00085     // Operations
00086 
00088     virtual inline Vector3<T> * const DeformedNode ( unsigned int i );
00089 
00091     virtual inline Vector3<T> * const UndeformedNode ( unsigned int i );
00092 
00094     inline Vector3<T> ComputeDeformedPositionBasedOnCoordinates ( T xi, T eta, T zeta );
00095 
00097     inline Vector3<T> ComputeUndeformedPositionBasedOnCoordinates ( T xi, T eta, T zeta );
00098 
00106     int EstimateParametricCoords ( 
00107         T x, T y, T z,          
00108         T &xi, T &eta, T &zeta  
00109     );
00110 
00111     //---------------------------------------------------------------
00112     // Inherited from FEMElement class
00113     //---------------------------------------------------------------
00115     inline void SetNode ( unsigned int i, unsigned int globalNodeNumber );
00116 
00118     //inline virtual void ResetToDeformedState ();
00119 
00121     inline virtual void ResetToUndeformedState ();
00122 
00124     inline virtual T    CalDeformedVolume () const;
00125 
00127     inline virtual T    CalUndeformedVolume ();
00128 
00130     virtual void UpdateStrainDisplacementMatrixElements ();
00131 
00133     virtual void UpdateStiffnessMatrixElements ();
00134 
00136     inline unsigned int GetGlobalNodeNumberFromLocalNode ( unsigned int i ) const
00137     {
00138         assert( 0 <= i && i <= 7 );
00139         return ids[i];
00140     }
00141     //---------------------------------------------------------------
00142 
00143 
00144     //---------------------------------------------------------------
00145     // Static Member Functions
00146 
00148     static inline void InterpolateShapeFunctions (
00149         T xi,           
00150         T eta,          
00151         T zeta,         
00152         T weights[8]    
00153     );
00154 
00156     static inline void InterpolateShapeFunctionDerivatives (
00157         T xi,           
00158         T eta,          
00159         T zeta,         
00160         T derivs[24]    
00161     );
00162 
00163     //-------------------------------------------
00164     // 1-point Gauss quadrature rule
00166     static void UpdateShapeFnsPartialDerivatives_1PtGuassRule ();
00167     //-------------------------------------------
00168     // 2-point Gauss quadrature rule
00170     static void UpdateShapeFnsPartialDerivatives_2PtGuassRule ();
00171 
00172     //-------------------------------------------------------------------------
00173     // Data Members -----------------------------------------------------------
00174 //=============================================================================
00175 protected:
00176     // Member Functions -------------------------------------------------------
00177 
00178     // Data Members -----------------------------------------------------------
00179 
00180     unsigned int    ids[8]; 
00181 
00182     // Element's properties
00183     //T b[8];   //!< element of strain-displacement matrix (B) with is partial diff by x
00184     //T c[8];   //!< element of strain-displacement matrix (B) with is partial diff by y
00185     //T d[8];   //!< element of strain-displacement matrix (B) with is partial diff by z
00186 
00187     // Stiffness matrix
00188     // The hexahedron stiffness matrix is a 24x24 matrix which can be broken into 8x8 of 3x3 matrices
00189     Matrix3x3<T>    Ke[8][8];   
00190 
00191 //=============================================================================
00192 private:
00193     // Member Functions -------------------------------------------------------
00194 
00195     static void CalAndStoreShapeFnsPartialDerivatives ( T store[], int ptNumber, T xi, T eta, T zeta );
00196 
00198     inline Matrix3x3<T> CalJacobian ( 
00199         T GaussStore[],     
00200         int GaussPtNumber   
00201     );
00202 
00204     virtual void UpdateStiffnessMatrixElements_1PtGauss ();
00205 
00207     virtual void UpdateStiffnessMatrixElements_2PtGauss ();
00208 
00209 
00210     // Data Members -----------------------------------------------------------
00211 
00212     static bool g_Is1PtGaussPointInit;  
00213     static bool g_Is2PtGaussPointInit;  
00214     //-------------------------------------------
00215     // 1-point Gauss quadrature rule
00216     static T g_1PtGauss_Der[8*3];   
00217     //Matrix3x3<T>  m_1ptGauss_JMatrices[1];    //!< Jacobian matrices for 1-point Gauss quadrature rule
00218     //-------------------------------------------
00219     // 2-point Gauss quadrature rule --> 8 pts for 3D
00220     static T g_2PtGauss_Der[8*3*8]; 
00221     //Matrix3x3<T>  m_2ptGauss_JMatrices[8];    //!< Jacobian matrices for 1-point Gauss quadrature rule
00222 
00223     // For finding an approximated parametric coordinates from a global coordinates
00224     static const int MAX_ITERATION; 
00225     static const T ERROR_THRESHOLD; 
00226     static const T NEG_BOUND;       
00227     static const T POS_BOUND;   
00228     static const T DIVERGENCE_THRESHOLD;    
00229 
00230 //=============================================================================
00231 
00232 #if defined(__gl_h_) || defined(__GL_H__)
00233 public:
00235     virtual void Draw ();
00236 
00238     virtual void DrawUndeformedMesh ();
00239 
00241     virtual void DrawDeformedMesh ();
00242 #endif
00243 
00244 //=============================================================================
00245 }; // END CLASS Hexahedron
00246 //=============================================================================
00247 END_NAMESPACE_TAPs__FEM
00248 //-----------------------------------------------------------------------------
00250 #include "TAPsFEMHexahedron.cpp"
00251 
00253 // Include definition if TAPs_USE_EXPORT is not defined
00254 //#if !defined( TAPs_USE_EXPORT )
00255 //  #include "TAPsFEMHexahedron.cpp"
00256 //#endif
00257 //-----------------------------------------------------------------------------
00258 #endif
00259 //34567890123456789012345678901234567890123456789012345678901234567890123456789
00260 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines