00001 // ------------------------------------------------------------------------- 00002 // shape.h - Definition of the base shape class. 00003 // ------------------------------------------------------------------------- 00004 // Description: 00005 // 00006 // There are many operations in a FE program which are common to different 00007 // types of elements, such as the computation of shape functions, of shape 00008 // derivatives, and of the Jacobian matrix. In FEMOOP, these tasks are 00009 // performed by the cShape class. 00010 // 00011 // Note that this class is only for procedures which vary between different 00012 // shapes of elements. Specifically, material models ([C] matrices) may be 00013 // common among a number of different elements and have their own methods. 00014 // 00015 // cShape is an abstract class (has pure virtual methods) defining the 00016 // generic behavior (interface) of the different FE shapes. The shapes 00017 // supported by the current implementation is indicated in the definition 00018 // of eShapeType. A simplified scheme of the class hierarchy is: 00019 // 00020 // cShape 00021 // | 00022 // |-- cLine2D => LINE2, LINE3, LINE4 00023 // | | 00024 // | |-- cLine3D => LINE2_3D, LINE3_3D, LINE4_3D 00025 // | | 00026 // | |-- cLine2DDeg => LINE2_DEG, LINE3_DEG, LINE4_DEG 00027 // | 00028 // |-- cPlaneShape => TRIA3, TRIA6, TRIA10, QUAD4, QUAD8, QUAD9, ... 00029 // | | 00030 // | |-- cCurveShape => TRIA3_CRV, TRIA6_CRV, QUAD4_CRV, QUAD8_CRV 00031 // | | 00032 // | |-- cCurveShapeDeg => QUAD4_DEG, QUAD8_DEG, QUAD9_DEG, ... 00033 // | 00034 // |-- cSolidShape => BRICK8, BRICK20, TETR4, TETR10, WEDGE6, WEDGE15 00035 // 00036 // The lower classes of this hierarchy implements the specific methods of 00037 // each shape, such as the computation of the shape/map functions (and 00038 // derivatives), while the upper classes implements the methods which are 00039 // independent from the shape connectivity/interpolation, such as the 00040 // computation of the Jacobian matrix and of the shape/map derivatives 00041 // w.r.t. the cartesian coordinates. 00042 // 00043 // The classes cPlaneShape and cSolidShape were designed for use in the 00044 // computation of the stiffness matrix of (iso/sub)parametric elements. 00045 // The class cLine2DDeg was designed to deal with axisymmetric shell 00046 // elements and the class cCurveShapeDeg to deal with free-form shells. 00047 // 00048 // On the other hand, the classes cLine2D/cLine3D were designed for use in 00049 // computation of equivalent loads applied on the edges of plane/solid 00050 // elements, while the class cCurveShape was designed for use in the case 00051 // of loads applied on the faces solid elements. 00052 // 00053 // Both cCurveShape and cCurveShapeDeg represents two-dimensional shapes 00054 // located in the three-dimensional space. 00055 // 00056 // It should be noticed that the multiple inheritance is used to allow the 00057 // curves and degenerated shapes inherit the connectivity related methods 00058 // from the basic shapes (TRIA3, TRIA6, QUAD4, ...) and the other methods 00059 // (Jacobian, DerivXYZ, ...) from cCurveShape/cCurveShapeDeg. 00060 // 00061 // ------------------------------------------------------------------------- 00062 // Public methods: 00063 // ------------------------------------------------------------------------- 00064 // 00065 // cShape *ShpNew( eShapeType type ) 00066 // 00067 // type - shape type ( in ) 00068 // 00069 // Create a shape object of the given type. 00070 // 00071 // ------------------------------------------------------------------------- 00072 // 00073 // int NumMapNodes( void ) 00074 // 00075 // Returns the number of nodes in element shape used to interpolate (map) 00076 // its geometry. 00077 // 00078 // ------------------------------------------------------------------------- 00079 // 00080 // int NumShpNodes( void ) 00081 // 00082 // Returns the number of nodes used by shape interpolation functions. 00083 // 00084 // ------------------------------------------------------------------------- 00085 // 00086 // int NumPolTerms( void ) 00087 // 00088 // Returns the number of polynomial terms used in SPR method. 00089 // 00090 // ------------------------------------------------------------------------- 00091 // 00092 // void GetShapeType( ShapeType *s_type ) 00093 // 00094 // s_type - type of given element shape ( out ) 00095 // 00096 // This routine attempts to determine the type of the given 00097 // element shape. 00098 // 00099 // ------------------------------------------------------------------------- 00100 // 00101 // void GetDomain( eShapeType *type, int *num_nodes, int *connect ) 00102 // 00103 // type - returned domain shape type ( out ) 00104 // num_nodes - number domain nodes ( out ) 00105 // connect - domain connectivity ( out ) 00106 // 00107 // Gets shape type, no. of nodes, and connectivity of given shape. 00108 // 00109 // ------------------------------------------------------------------------- 00110 // 00111 // void IntDomainType( eDomainType *domain ) 00112 // 00113 // domain - returned integration domain type ( out ) 00114 // 00115 // Returns the integration domain type which is consistent with 00116 // this element shape. 00117 // 00118 // ------------------------------------------------------------------------- 00119 // 00120 // void NodalCoord( NodeCoord *coord ) 00121 // 00122 // coords - Cartesian coordinates of its nodes ( out ) 00123 // 00124 // Returns shape nodal coordinates. 00125 // 00126 // ------------------------------------------------------------------------- 00127 // 00128 // void MaxSizes( double *dx, double *dy, double *dz ) 00129 // 00130 // dx - length in x axis ( out ) 00131 // dy - length in y axis ( out ) 00132 // dz - length in z axis ( out ) 00133 // 00134 // Returns the bounding box of the element. 00135 // 00136 // ------------------------------------------------------------------------- 00137 // 00138 // int GetShpNodeIdx( int id ) 00139 // 00140 // id - node identifier ( in ) 00141 // 00142 // Returns the local index of a given node. If the node doesn't belongs to 00143 // element then it returns (-1). 00144 // 00145 // ------------------------------------------------------------------------- 00146 // 00147 // int VerShpNode( int id ) 00148 // 00149 // id - node identifier ( in ) 00150 // 00151 // Returns (1) if the node belongs to the element and (0) otherwise. 00152 // 00153 // ------------------------------------------------------------------------- 00154 // 00155 // void Make( int *connect ) 00156 // 00157 // connect - connectivity of the given element ( in ) 00158 // 00159 // Makes an element shape of given connectivity. 00160 // 00161 // ------------------------------------------------------------------------- 00162 // 00163 // void RecoverPatchNodes( cNode *PatchNode, 00164 // int *iNumRecNodes, 00165 // int *vRecNodes ) 00166 // 00167 // PacthNode - given patch node ( in ) 00168 // iNumRecNodes - number of recovery nodes ( in/out ) 00169 // vRecNodes - vector of recovery nodes ( in/out ) 00170 // 00171 // Adds the nodes of this shape that belongs to the patch of the given 00172 // PatchNode to the vector of recovery nodes. 00173 // 00174 // ------------------------------------------------------------------------- 00175 // 00176 // Here follows a generic description of the virtual methods: 00177 // 00178 // ------------------------------ methods ---------------------------------- 00179 // 00180 // Read - read the shape connectivity 00181 // Connectivity - returns the shape connectivity 00182 // GetDimShape - returns the shape dimension (1 = line,2 = plane/surface 00183 // or 3 = solid). 00184 // GetMapOrder - returns the order (1,2 or 3) of the geometry 00185 // interpolation. 00186 // ShapeFunc - returns the shape interpolation functions 00187 // evaluated at a given point in local coordinates. 00188 // MapFunc - returns the geometric interpolation functions 00189 // evaluated at a given point in local coordinates. 00190 // NMatrix - mounts the shape function matrix, given (from outside) 00191 // the number of dof's per node. 00192 // DerivMapRST - returns the derivatives of interpolation functions 00193 // at geometric nodes in local coordinate system. 00194 // DerivShpRST - returns the derivatives of interpolation functions 00195 // at shape nodes in local coordinate system. 00196 // GetEdge - get shape type, no. of nodes, and connectivity of an 00197 // edge of given shape for a given pair of corner nodes. 00198 // GetFace - get shape type, no. of nodes, and connectivity of a 00199 // face of given shape for a given pair of corner nodes and 00200 // a third node defining the face normal direction. 00201 // PolFunc - returns the polynomial functions (used in SPR method) 00202 // evaluated at a given point in cartesian coordinates. 00203 // VerCorNode - returns (TRUE) if the given node is a corner node of 00204 // this shape and (FALSE) otherwise. 00205 // VerEdgeNode - returns (TRUE) if the given node is an edge node of 00206 // the given corner node and (FALSE) otherwise. 00207 // Jacobian - returns the Jacobian matrix, its inverse and its 00208 // determinant. 00209 // DerivXYZ - returns the derivatives of interpolation functions 00210 // at shape nodes in global coordinate system. 00211 // LocalSys - get rotation matrix of local system w.r.t. global axes 00212 // at a given point given by its parametric coordinates. 00213 // GetTangent - evaluates the tangent vector(s) in a given point. 00214 // Returns tangent vector(s) and their moduli. 00215 // DsaDerivXYZ - returns the sensitivities of the derivatives of 00216 // interpolation functions at shape nodes in global 00217 // coordinate system (dNi,x; dNi,y; dNi,z) 00218 // VerifyQtP - returns 1 if the element is a Quarter-Point element 00219 // (fracture mechanics), zero otherwise. 00220 // 00221 // ------------------------------------------------------------------------- 00222 // 00223 // $Author: evandro $ 00224 // $Revision: 1.3 $ 00225 // $Date: 1999/04/12 14:58:25 $ 00226 // $State: Exp $ 00227 // 00228 // ------------------------------------------------------------------------- 00229 00230 #ifndef _SHAPE_H 00231 #define _SHAPE_H 00232 00233 #include "gbldefs.h" 00234 #include "intpt.h" 00235 00236 // ------------------------------------------------------------------------ 00237 // Forward declarations: 00238 // 00239 class cNode; 00240 00241 // ------------------------------------------------------------------------ 00242 // (Finite) Element Shape types: 00243 // 00244 typedef enum _shapetype 00245 { 00246 UNDEFINED = -1, 00247 LINE2, // 2-noded line (XY plane) 00248 LINE3, // 3-noded line (XY plane) 00249 LINE4, // 4-noded line (XY plane) 00250 HERMITE, // 2-noded hermitian beam 00251 HERMITE_PLANE, // 2-noded in-plane hermitian interpolation 00252 TRIA3, // 3-noded triangle 00253 TRIA6, // 6-noded triangle 00254 TRIA10, // 10-noded triangle 00255 QUAD4, // 4-noded quadrilateral 00256 QUAD5, // 5-noded quadrilateral 00257 QUAD6, // 6-noded quadrilateral subparametric 00258 QUAD6B, // 6-noded quadrilateral isoparametric 00259 QUAD8, // 8-noded quadrilateral 00260 QUAD9, // 9-noded Lagrangean quadrilateral 00261 QUAD9H, // 9-noded hierarchical serendipity quadrilateral 00262 QUADS, // Gerenal Serendipity quadratic quadrilateral 00263 QUAD12, // 12-noded Serendipity cubic quadrilateral 00264 QUAD13, // 13-noded Serendipity cubic quadrilateral 00265 QUAD16, // 16-noded Lagrangean cubic quadrilateral 00266 INFINITE, // 4-noded Lagrangean infinite 00267 INFL4, // 4-noded Lagrangean infinite 00268 INFS3, // 3-noded Serendipity infinite 00269 INFS5, // 5-noded Serendipity infinite 00270 BRICK8, // 8-noded brick 00271 BRICK20, // 20-noded brick 00272 TETR4, // 4-noded tetrahedron 00273 TETR10, // 10-noded tetrahedron 00274 WEDGE6, // 6-noded wedge 00275 WEDGE15, // 15-noded Serendipity wedge 00276 BAR, // 2-node line shape for beam and truss 00277 LINE2_3D, // 2-noded line (solid edge used by Lec) 00278 LINE3_3D, // 3-noded line (solid edge used by Lec) 00279 LINE4_3D, // 4-noded line (solid edge used by Lec) 00280 TRIA3_CRV, // 3-noded triangle (solid face used by Lec) 00281 TRIA6_CRV, // 6-noded triangle (solid face used by Lec) 00282 QUAD4_CRV, // 4-noded quadrilateral (solid face used by Lec) 00283 QUAD8_CRV, // 8-noded quadrilateral (solid face used by Lec) 00284 LINE2_DEG, // degenerated 2-node line shape ( shells ) 00285 LINE3_DEG, // degenerated 3-node line shape 00286 LINE4_DEG, // degenerated 4-node line shape 00287 QUAD4_DEG, // degenerated 4-node curved area shape 00288 QUAD8_DEG, // degenerated 8-node curved area shape 00289 QUAD9_DEG, // degenerated 9-node curved area shape 00290 QUAD9H_DEG, // degenerated 9-node hierarchical curved area shape 00291 QUAD12_DEG, // degenerated 12-node curved area shape 00292 QUAD16_DEG // degenerated 16-node curved area shape 00293 00294 } eShapeType; 00295 00296 // ------------------------------------------------------------------------- 00297 // Base (Finite) Element Shape class: 00298 // 00299 class cShape 00300 { 00301 protected: 00302 static double _J[3][3]; // Jacobian matrix 00303 static double _iJ[3][3]; // Inverse of Jacobian matrix 00304 static double _dJ[3][3]; // Sensitivity of Jacobian matrix 00305 static double _L[3][3]; // [L] = [iJ]*[dJ] 00306 00307 protected: 00308 eShapeType _eType; // Shape type 00309 eDomainType _eDomainType; // Integration domain type 00310 int _iNumShpNodes; // Number of Shape Nodes 00311 int _iNumMapNodes; // Number of Map Nodes 00312 int _iNumPolTerms; // Number of Complete Polynomial Terms 00313 int _iNumSupPolTerms; // N. of Superior Polynomial Terms 00314 int *_aiNode; // Element node indices 00315 cNode **_apcNode; // Element node pointers 00316 public: 00317 static cShape *ShpNew ( eShapeType ); 00318 cShape ( void ); 00319 virtual ~cShape ( void ); 00320 int NumMapNodes ( void ) { return _iNumMapNodes; } 00321 int NumShpNodes ( void ) { return _iNumShpNodes; } 00322 int NumPolTerms ( void ) { return _iNumPolTerms; } 00323 int NumSupPolTerms ( void ) { return _iNumSupPolTerms; } 00324 int GetConnId ( int k ){ return _aiNode[k]; } 00325 cNode *GetConnNode ( int k ){ return _apcNode[k]; } 00326 void GetShapeType ( eShapeType * ); 00327 void GetDomain ( eShapeType *, int *, int * ); 00328 void IntDomainType ( eDomainType * ); 00329 void NodalCoord ( sNodeCoord * ); 00330 void MaxSizes ( double *, double *, double * ); 00331 int GetShpNodeIdx ( int ); 00332 int VerShpNode ( int ); 00333 void Make ( int * ); 00334 void RecoverPatchNodes ( cNode *, int *, int * ); 00335 virtual int Read ( void ); 00336 virtual void Connectivity ( int * ); 00337 virtual void Connectivity ( cNode ** ); 00338 virtual void NMatrix ( int, sNatCoord *, double *, double *, 00339 sDerivNat *, double, double **); 00340 virtual int GetDimShape ( void )=0; 00341 virtual int GetMapOrder ( void )=0; 00342 virtual void Jacobian ( sNatCoord *, sNodeCoord *, double *, 00343 sDerivNat *, double *, double *, 00344 double **, double ** ){ } 00345 virtual void Jacobian ( sDerivNat *, double *, sNodeCoord *, 00346 double *, double **, double ** ) = 0; 00347 virtual void DerivXYZ ( double **,sDerivNat *,sDerivCart * )=0; 00348 virtual void LocalSys ( sDerivNat *, sNodeCoord *, double**)=0; 00349 virtual void MapFunc ( sNatCoord *, double * )=0; 00350 virtual void ShapeFunc ( sNatCoord *, double * )=0; 00351 virtual void DerivMapRST ( sNatCoord *, sDerivNat * )=0; 00352 virtual void DerivShpRST ( sNatCoord *, sDerivNat * )=0; 00353 virtual int GetEdge ( int *, eShapeType *, int *, int * )=0; 00354 virtual int GetFace ( int *, eShapeType *, int *, int * )=0; 00355 virtual void GetNatCoordMapNode ( sNatCoord * )=0; 00356 virtual void PolFunc ( sNodeCoord *, double * ) { } 00357 virtual void DerivPolFunc ( sNodeCoord *, sDerivCart * ) { } 00358 virtual void SupPolFunc ( sNodeCoord *, double * ) { } 00359 virtual void DerivSupPolFunc ( sNodeCoord *, sDerivCart * ) { } 00360 virtual int VerCorNode ( int ) { return 0; } 00361 virtual int VerEdgeNode ( int, int ) { return 0; } 00362 virtual int VerifyQtP ( void ) { return 0; } 00363 virtual void GetTangent ( sNodeCoord *, sDerivNat *, sVector *, 00364 double *) { } 00365 00366 virtual void DsaDerivXYZ ( sNodeCoord *, sDerivNat *, sDerivNat *, 00367 double *, sDerivCart *, sNodeCoord *, 00368 double *, sDerivCart *) { } 00369 }; 00370 00371 // ------------------------------------------------------------------------- 00372 // Mathematical functions: 00373 // 00374 void ShpMatZero(int n, double A[3][3]); 00375 int ShpMatInv (int n, double A[3][3], double B[3][3], double *det); 00376 void ShpMatMult(int n, double A[3][3], double B[3][3], double C[3][3]); 00377 00378 #endif