hp2FEM  0.1
include/finiteelement/FiniteElement.h
00001 #ifndef _FINITEELEMENT_H_
00002 #define _FINITEELEMENT_H_
00003 // ---------------------------------------------
00004 // company   : 
00005 // user      : 
00006 // date      : 22 Mar 2015 17:22
00007 // file      : FiniteElement.h
00008 // markers   : Full
00009 // language  : C++
00010 // generator : Metamill 6.0
00011 // ---------------------------------------------
00012 
00013 //#UBLK-BEG-HEADERH
00014 //==============================================================
00015 // Description : 
00016 //--------------------------------------------------------------
00017 // Author      : Gilberto Luis
00018 // Created     : 17 Aug 2011
00019 //--------------------------------------------------------------
00020 // Change history : 
00021 //   17 Aug 2011 (Gilberto Luis) Initial version generated
00022 //
00023 //==============================================================
00024 //#UBLK-END-HEADERH
00025 
00026 /*=================================================================================================
00027 =                                                                                                 =
00028 =       Copyright 2010-2015  Marco Lucio Bittencourt / Fabiano Fernandes Bargos                       =
00029 =                        Gilberto Luis Valente / Jorge Luis Suzuki / Allan Patrick Cordeiro Dias  =
00030 =                                                                                                 =
00031 =       Licensed under the Apache License, Version 2.0 (the "License");                               =
00032 =       you may not use this file except in compliance with the License.                              =
00033 =       You may obtain a copy of the License at                                                       =
00034 =                                                                                                 =
00035 =               http://www.apache.org/licenses/LICENSE-2.0                                                =
00036 =                                                                                                 =
00037 =       Unless required by applicable law or agreed to in writing, software                           =
00038 =       distributed under the License is distributed on an "AS IS" BASIS,                             =
00039 =       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.                      =
00040 =       See the License for the specific language governing permissions and                           =
00041 =       limitations under the License.                                                                =
00042 =                                                                                                 =
00043 =================================================================================================*/
00044 
00045 
00046 #include <sys/time.h>
00047 #include <sys/resource.h>
00048 #include <iostream>
00049 #include <cmath>
00050 #include <string>
00051 #include <cstdio>
00052 #include "ds/DS_defs.h"
00053 #include "acdp/acdp.h"
00054 #include "ds/Vector.h"
00055 #include "ds/Matrix.h"
00056 #include "ds/OneIndexTable.h"
00057 #include "ds/TwoIndexTable.h"
00058 #include "enumerations/ElementShape_E.h"
00059 #include "enumerations/Entity_E.h"
00060 #include "enumerations/ProblemType_E.h"
00061 #include "enumerations/Kinematics_E.h"
00062 #include "enumerations/StrainMeasure_E.h"
00063 #include "enumerations/CalculationProcedure_E.h"
00064 #include "enumerations/MeshType_E.h"
00065 #include "enumerations/MappingType_E.h"
00066 #include "enumerations/MassStiffType_E.h"
00067 #include "enumerations/StiffnessType_E.h"
00068 #include "enumerations/FiniteFormulation_E.h"
00069 #include "enumerations/pMesh_E.h"
00070 #include "enumerations/GeometricProperty_E.h"
00071 #include "interpolation/shapefunctions/ShapeFunctions.h"
00072 #include "finiteelement/GradientMeasure.h"
00073 #include "finiteelement/FiniteElementAttributes_S.h"
00074 #include "fegroups/GeometricProperties.h"
00075 #include "fegroups/Mapping.h"
00076 #include "loadsets/LoadIntensity.h"
00077 #include "material/Material.h"
00078 #include "symbolicanalyzer/SymbolicParse.h"
00079 
00080 
00081 using namespace std;
00082 
00083 
00092 class FiniteElement
00093 {
00094 //#UBLK-BEG-CLASSDEF mm:079de445-f650-11df-817b-b59fee0c7729
00095 //#UBLK-END-CLASSDEF
00096 
00097  public:
00098 
00099    // METHOD=mm:551b4e59-f652-11df-817b-b59fee0c7729
00100    FiniteElement();
00101 
00102    // METHOD=mm:e9d066db-f64f-11df-817b-b59fee0c7729
00103    FiniteElement(FiniteElement& Instance, ElementShape_E ElementShape, ProblemType_E ProblemType, unsigned long MaxSolutionOrder, unsigned long Dim, unsigned long MappingOrder, CalculationProcedure_E CalculationProcedure = STANDARD, MeshType_E MeshType = NON_STRUCTURED, Kinematics_E Kinematics = INFINITE, StrainMeasure_E StrainMeasure = INFINITES, FiniteFormulation_E FiniteFormulation = INFINITESIMAL, pMesh_E pMeshDistribution = pUNIFORM, MappingType_E MappingType = ISOPARAMETRIC, MassStiffType_E MassType = CONSIST, StiffnessType_E StiffType = CONSISTENT, MaterialType_E MatType = HOOKE);
00104 
00105    // METHOD=mm:b853c175-0239-11e0-9699-fe1341938431
00106    FiniteElement(FiniteElement& Instance);
00107 
00108    // METHOD=mm:ae31cfbb-0239-11e0-9699-fe1341938431
00109    ~FiniteElement();
00110 
00111    // METHOD=mm:acd5a08b-557f-11e0-8a13-cd08645cc9e7
00112    FiniteElement& operator=(FiniteElement& Instance);
00113 
00114    // METHOD=mm:f2469a89-5580-11e0-8a13-cd08645cc9e7
00115    operator GradientMeasure&();
00116 
00117    // METHOD=mm:a693f451-5580-11e0-8a13-cd08645cc9e7
00118    operator ShapeFunctions&();
00119 
00120    // METHOD=mm:5f864c0f-02d6-11e0-89cb-b0660132333d
00121    void Print(FILE* File);
00122 
00123    // METHOD=mm:2681172b-856e-11e0-9373-ac70ba4510db
00124    FiniteElementAttributes_S& GetFiniteElementAttributes();
00125 
00126    // METHOD=mm:831bffd0-1fad-4380-8620-35e3841c76ba
00127    void SetFiniteElementAttributes(FiniteElementAttributes_S& FiniteElementAttributes);
00128 
00129    // METHOD=mm:936c0d78-84da-42eb-9b8c-256820d4e73a
00130    void SetFiniteElementAttributes(ElementShape_E ElementShape, ProblemType_E ProblemType, unsigned long MaxSolutionOrder, unsigned long Dim, CalculationProcedure_E CalculationProcedure, MeshType_E MeshType, Kinematics_E Kinematics, StrainMeasure_E StrainMeasure, FiniteFormulation_E FiniteFormulation, pMesh_E pMeshDistribution, MappingType_E MappingType, unsigned long MappingOrder, MassStiffType_E MassType, StiffnessType_E StiffType, MaterialType_E MatType);
00131 
00132    // METHOD=mm:ebe921ba-6d4f-4bf8-864c-5f2dedf93162
00133    unsigned long GetMaxNumberElemDOFs();
00134 
00135    // METHOD=mm:9fa48dd2-ac37-42c1-a51a-e917a0d2d35a
00136    unsigned long GetMaxNumberElemPDOFs();
00137 
00138    // METHOD=mm:e9d066dc-f64f-11df-817b-b59fee0c7729
00139    void GetMassMatrix(unsigned long ElementNumber, unsigned long ElementOrder, unsigned long NumElemCoordinates, double* ElementCoordinates, Mapping& ElementMapping, GeometricProperties& GeoProp, SymmetricMatrix& MassMatrix, double& ElementMeasure, double Density = 1);
00140 
00141    // METHOD=mm:87952c8e-77a3-4165-89b6-7ee3e103efa3
00142    void GetLocalMassMatrix(unsigned long ElementNumber, unsigned long ElementOrder, unsigned long NumElemCoordinates, double* ElementCoordinates, GeometricProperties& GeoProp, SymmetricMatrix& MassMatrix, double Density = 1);
00143 
00144    // METHOD=mm:e9d066df-f64f-11df-817b-b59fee0c7729
00145    void GetLinearStiffnessMatrix(unsigned long ElementNumber, unsigned long ElementOrder, Mapping& ElementMapping, GeometricProperties& GeoProp, Material& Mater, unsigned long NumElemCoordinates, double* ElementCoordinates, SymmetricMatrix& StiffnessMatrix, double* Fe = NULL);
00146 
00147    // METHOD=mm:88e096aa-83da-4a6a-9a05-59e5a3f6abb1
00148    void GetTangentStiffnessMatrix(unsigned long ElementNumber, unsigned long ElementOrder, unsigned long NumElemCoordinates, double* ElementCoordinatesi, double* ElementCoordinatesc, Mapping& ElementMap, GeometricProperties& GeoProp, Material& Mater, SymmetricMatrix& StiffnessMatrix, Vector& InternalForce);
00149 
00150    // METHOD=mm:db653021-34a9-47b9-bf7d-caf5ed011cfa
00151    void GetDTangentStiffnessMatrix(unsigned long ElementNumber, unsigned long ElementOrder, unsigned long NumElemCoordinates, double* ElementCoordinatesi, double* ElementCoordinatesc, Mapping& ElementMap, GeometricProperties& GeoProp, Material& Mater, SymmetricMatrix& StiffnessMatrix, Vector& InternalForce, Vector& Damage);
00152 
00153    // METHOD=mm:3645245f-f26d-4425-8c13-71165655399f
00154    void GetQITangentStiffnessMatrix(unsigned long ElementNumber, unsigned long DisplacementOrder, unsigned long NumElemCoordinates, double* ElementCoordinatesi, double* ElementCoordinatesc, Mapping& ElementMap, GeometricProperties& GeoProp, Material& Mater, SymmetricMatrix& StiffnessMatrix, Vector& InternalForce);
00155 
00156    // METHOD=mm:f4680acc-b012-433a-a7ee-30c7d08b0924
00157    void GetDQITangentStiffnessMatrix(unsigned long ElementNumber, unsigned long DisplacementOrder, unsigned long NumElemCoordinates, double* ElementCoordinatesi, double* ElementCoordinatesc, Mapping& ElementMap, GeometricProperties& GeoProp, Material& Mater, SymmetricMatrix& StiffnessMatrix, Vector& InternalForce, Vector& Damage);
00158 
00159    // METHOD=mm:4a5abc90-1f76-472c-af5d-219d1b19414a
00160    void GetPbar(unsigned long NumIntPoints, double kappa, double* Jacobi, double* detJi, double* Jacobc, Vector& pbar);
00161 
00162    // METHOD=mm:416ac79d-9cd1-4758-b63f-75a21926b1d0
00163    void GetPproj(unsigned long ElemNum, double kappa, unsigned long DisplacementOrder, unsigned long PressureOrder, unsigned long NumElemCoords, double* ElemCoords, double* ElemCoords1, double* ShapeFunctions, unsigned long NumberSFU, unsigned long NumberSFP, double* Weights, unsigned long NumIntPoints, double* Jacobi, double* detJi, double* Jacobc);
00164 
00165    // METHOD=mm:e9d066de-f64f-11df-817b-b59fee0c7729
00166    void GetInternalForceVector(unsigned long ElementNumber, unsigned long ElementOrder, unsigned long NumElemCoords, double* ElementCoordinates, Mapping& ElementMapping, GeometricProperties& GeoProp, Material& Mater, double* Ue, double* Fe);
00167 
00168    // METHOD=mm:e9d066e3-f64f-11df-817b-b59fee0c7729
00169    void GetEdgeLoad(unsigned long ElementNumber, unsigned long ElementOrder, LoadIntensity& Load, Mapping& ElementMapping, unsigned long NumElemCoords, double* ElementCoordinates, unsigned long LocalEdge, double* Fe);
00170 
00171    // METHOD=mm:4c8346c3-f66b-11df-8531-ea83aef40aa3
00172    void GetFaceLoad(unsigned long ElementNumber, unsigned long ElementOrder, LoadIntensity& Load, unsigned long NumElemCoords, double* ElementCoordinates, Mapping& ElementMapping, unsigned long LocalFace, double* Fe);
00173 
00174    // METHOD=mm:e9d066e2-f64f-11df-817b-b59fee0c7729
00175    void GetBodyLoadVector(unsigned long ElementNumber, unsigned long ElementOrder, LoadIntensity& Load, unsigned long NumElemCoordinates, double* ElementCoordinates, Mapping& ElementMapping, double* Fe, double t = 0);
00176 
00177    // METHOD=mm:768818e7-f66a-11df-8531-ea83aef40aa3
00178    void GetEdgePressure(unsigned long ElementNumber, unsigned long ElementOrder, LoadIntensity& Load, unsigned long NumElemCoords, double* ElementCoordinates, Mapping& ElementMapping, double* Fe);
00179 
00180    // METHOD=mm:cf0be7b7-f66b-11df-8531-ea83aef40aa3
00181    void GetFacePressure(unsigned long ElementNumber, unsigned long ElementOrder, LoadIntensity& Load, unsigned long NumElemCoords, double* ElementCoordinates, Mapping& ElementMapping, double* Fe);
00182 
00183    // METHOD=mm:05953d1c-f66b-11df-8531-ea83aef40aa3
00184    void GetEdgePressureStiffnessMatrix(unsigned long ElementNumber, unsigned long ElementOrder, unsigned long NumberEdgeNodes, LoadIntensity& Load, unsigned long NumElemCoords, double* ElementCoordinates, Mapping& ElementMapping, SymmetricMatrix& Ke, double* Fe);
00185 
00186    // METHOD=mm:04184f95-f66c-11df-8531-ea83aef40aa3
00187    void GetFacePressureStiffnessMatrix(unsigned long ElementNumber, unsigned long ElementOrder, unsigned long NumberFaceNodes, LoadIntensity& Load, unsigned long NumElemCoords, double* ElementCoordinates, Mapping& ElementMapping, SymmetricMatrix& Ke, double* Fe);
00188 
00189    // METHOD=mm:6e8509ca-cce2-11e0-8c35-faf3955cbabc
00190    void Run1DLocalMatrices(BuiltInArray<unsigned long>& ElementOrder);
00191 
00192    // METHOD=mm:e9d0677a-f64f-11df-817b-b59fee0c7729
00193    double* Get1DLocalMassMatrix(unsigned long ElementOrder, unsigned long IntegOrder, unsigned long& TotalNumberSF, unsigned long& MatrixOrder, unsigned long& NumberIP);
00194 
00195    // METHOD=mm:e9d0677b-f64f-11df-817b-b59fee0c7729
00196    double* Get1DLocalStiffnessMatrix(unsigned long ElementOrder, unsigned long IntegOrder, unsigned long& TotalNumberSF, unsigned long& MatrixOrder, unsigned long& NumberIP);
00197 
00198    // METHOD=mm:e9d0677c-f64f-11df-817b-b59fee0c7729
00199    double* Get1DLocalMixedMatrix(unsigned long ElementOrder, unsigned long IntegOrder, unsigned long& TotalNumberSF, unsigned long& MatrixOrder, unsigned long& NumberIP);
00200 
00201    // METHOD=mm:1fe72d7d-8882-4e38-a8f3-ac1ee896dee4
00202    double* Interpolation(Vector& UeSol, unsigned long CoefOrder, unsigned long PosOrder, unsigned long& UePosSize);
00203 
00204 
00205  protected:
00206 
00207    // METHOD=mm:101ea912-60e4-4451-9db0-fab596c9ac36
00208    void Run1DLocalMatrices_copy();
00209 
00210 
00214    // attr=mm:727c798d-8567-11e0-9373-ac70ba4510db
00215    FiniteElementAttributes_S FEAtr;
00216 
00220    // attr=mm:4aac6a99-f651-11df-817b-b59fee0c7729
00221    TwoIndexTable<double> Local1DMassMatrix;
00222 
00226    // attr=mm:5b5cee9f-f651-11df-817b-b59fee0c7729
00227    TwoIndexTable<double> Local1DStiffMatrix;
00228 
00232    // attr=mm:85aeafcb-f651-11df-817b-b59fee0c7729
00233    TwoIndexTable<double> Local1DMixedMatrix;
00234 
00238    // attr=mm:2309d179-f652-11df-817b-b59fee0c7729
00239    GradientMeasure GM;
00240 
00244    // attr=mm:5a2f452f-3b9f-11e0-8f62-9cadaf298b92
00245    ShapeFunctions SF;
00246 
00250    // attr=mm:9926e099-43f2-40d1-8504-0146b3e38115
00251    Matrix F;
00252 
00256    // attr=mm:b0ee1b95-5d42-4bfb-8a80-cf123d2403e1
00257    Matrix gradU;
00258 
00262    // attr=mm:47b6f2a9-9df0-41ab-98c8-96d53a371c16
00263    SymmetricMatrix S;
00264 
00268    // attr=mm:fce116df-c117-482a-ab06-fb492deea131
00269    Vector Sv;
00270 
00274    // attr=mm:8c1e525c-c4b4-42c7-b3ce-eb2088520f33
00275    SymmetricMatrix E;
00276 
00280    // attr=mm:750f2110-2512-47cd-8aaf-6892e795941c
00281    Vector Ev;
00282 
00286    // attr=mm:3768f20d-4fe0-4f02-be6b-820144c73492
00287    SymmetricMatrix DMatrix;
00288 
00292    // attr=mm:8eacdd73-8e1d-11e0-9278-b12ff911d20a
00293    Matrix BMatrix;
00294 
00298    // attr=mm:9ded21d3-119e-4a9f-893c-378260c65b0e
00299    Matrix NLBMatrix;
00300 
00304    // attr=mm:d2d553b8-6aa6-4584-b397-c0b75f470d3c
00305    Matrix ISBMatrix;
00306 
00310    // attr=mm:3976ccd9-d789-405e-9cbe-5c98071b33c6
00311    Vector dJdE;
00312 
00317    // attr=mm:a0bf27a4-46f1-47f6-9039-a93fdc1b7450
00318    Vector GVector;
00319 
00323    // attr=mm:eb86eaae-abd1-442f-b22e-47ceb3c12ecf
00324    Vector AuxSF;
00325 
00329    // attr=mm:95de9b8e-d111-406c-8b94-09f630b1b078
00330    Vector DispP;
00331 
00335    // attr=mm:014441ae-e8f7-45f6-abb1-27e7da050564
00336    Vector ProjP;
00337 
00341    // attr=mm:0dc8dfa5-b322-4f6c-ac1a-a2c1e1b8a598
00342    Vector Pcoefs;
00343 
00347    // attr=mm:a027aecf-50c7-4890-99f1-9a66e34dbb86
00348    Vector Auxv;
00349 
00353    // attr=mm:8f456f11-8e1d-11e0-9278-b12ff911d20a
00354    SymmetricMatrix Ke;
00355 
00359    // attr=mm:caaa3372-709a-444f-af09-a7954fdbfee0
00360    SymmetricMatrix Kteaux;
00361 
00365    // attr=mm:92d16e69-bca3-11e0-8f79-b28c8a2c6811
00366    SymmetricMatrix Me;
00367 
00371    // attr=mm:1437a1c7-a677-49dc-92de-bca516d86f5b
00372    SymmetricMatrix Meaux;
00373 
00377    // attr=mm:37e95907-9369-11e0-9502-bbd3be26df5e
00378    SymmetricMatrix Kte;
00379 
00383    // attr=mm:0e1a1fd3-5758-4524-9c06-148f4017bd48
00384    Matrix Kp;
00385 
00389    // attr=mm:7d5aa117-4095-4003-abcb-342d819f5984
00390    Matrix Kpaux;
00391 
00395    // attr=mm:291434b7-ddd2-466d-a572-73a4ead2f461
00396    Matrix Kpaux1;
00397 
00401    // attr=mm:ce227a25-6cf5-4f0d-9e60-de3a918a2e6c
00402    Vector Re;
00403 
00407    // attr=mm:cd4d0ab8-433b-4cfd-91ec-5b2330deacfb
00408    Vector Rhs;
00409 
00413    // attr=mm:4adbf07f-dc31-4788-9041-0a6edb848531
00414    Vector UePos;
00415 
00419    // attr=mm:c391490d-cdb4-11e0-83dd-d9f41665dfa4
00420    OneIndexTable<double> Mpq;
00421 
00425    // attr=mm:8a59eebd-cdb6-11e0-83dd-d9f41665dfa4
00426    OneIndexTable<double> Kpq;
00427 
00431    // attr=mm:8a59f6b5-cdb6-11e0-83dd-d9f41665dfa4
00432    OneIndexTable<double> Dpq;
00433 
00437    // attr=mm:972a4c94-ed01-41ff-a6fa-8295f110e802
00438    BuiltInArray<long> ElementOrderSets;
00439 
00443    // attr=mm:d7cf80fc-1eda-455d-8a15-f176379810f1
00444    BuiltInArray<unsigned long> SFIncid;
00445 
00446 
00447  private:
00448 
00449 //#UBLK-BEG-CLASSMEMB mm:079de445-f650-11df-817b-b59fee0c7729
00450 //#UBLK-END-CLASSMEMB
00451 };
00452 
00453 //#UBLK-BEG-GLOBALH
00454 //*** Removed methods: 18 Aug 2011 11:44
00455 //---
00456 //uuid=mm:b6b0ff63-8c7c-11e0-83b2-eb81abfc0587
00457 //   operator NumericalIntegration&();
00458 
00459 //*** Removed methods: 23 Aug 2011 15:19
00460 //---
00461 //uuid=mm:e9d0677e-f64f-11df-817b-b59fee0c7729
00462 //   void Read(FILE* DEFFile, ElementShape_E ElementShape, ProblemType_E ProblemType, unsigned short NumberDOFsNode, unsigned short MaxSolutionOrder, CalculationProcedure_E CalculationProcedure = STANDARD, MeshType_E MeshType = pUNIFORM, Kinematics_E Kinematics = INFINITESIMAL, StrainMeasure_E StrainMeasure = INFINITESIMAL, FiniteFormulation_E FiniteFormulation = INFINITESIMAL, MassStiffType_E MassType = CONSISTENT, StiffnessType_E StiffnessType = CONSISTENT);
00463 
00464 //*** Removed methods: 30 Nov 2012 15:36
00465 //---
00466 //uuid=mm:2681218f-856e-11e0-9373-ac70ba4510db
00467 //   void SetFiniteElementAttributes(FiniteElementAttributes_S& FiniteElementAttributes);
00468 //---
00469 //uuid=mm:f422f52f-856c-11e0-9373-ac70ba4510db
00470 //   void SetFiniteElementAttributes(ElementShape_E ElementShape, ProblemType_E ProblemType, unsigned long MaxSolutionOrder, unsigned long Dim, CalculationProcedure_E CalculationProcedure, MeshType_E MeshType, Kinematics_E Kinematics, StrainMeasure_E StrainMeasure, FiniteFormulation_E FiniteFormulation, pMesh_E pMeshDistribution, MassStiffType_E MassType, StiffnessType_E StiffType);
00471 //---
00472 //uuid=mm:dbb9156b-3df5-4002-85eb-c7ebc322686a
00473 //   void GetLocalMassMatrix(unsigned long ElementNumber, unsigned long ElementOrder, unsigned long NumElemCoordinates, double* ElementCoordinates, GeometricProperties& GeoProp, SymmetricMatrix& MassMatrix, double Density = 1);
00474 
00475 //*** Removed methods: 13 May 2014 16:57
00476 //---
00477 //uuid=mm:f06af471-f667-11df-8531-ea83aef40aa3
00478 //   void GetTangentStiffnessMatrix_copy(unsigned long ElementNumber, unsigned long ElementOrder, unsigned long NumElemCoordinates, double* ElementCoordinatesi, double* ElementCoordinatesc, Mapping& ElementMap, GeometricProperties& GeoProp, Material& Mater, SymmetricMatrix& StiffnessMatrix, Vector& InternalForce);
00479 //---
00480 //uuid=mm:b389dcfe-973e-41c6-aa43-564e50956b72
00481 //   void GetQITangentStiffnessMatrix_copy(unsigned long ElementNumber, unsigned long ElementOrder, unsigned long NumElemCoordinates, double* ElementCoordinatesi, double* ElementCoordinatesc, Mapping& ElementMap, GeometricProperties& GeoProp, Material& Mater, SymmetricMatrix& StiffnessMatrix, Vector& InternalForce);
00482 
00483 //#UBLK-END-GLOBALH
00484 
00485 
00486 #endif // _FINITEELEMENT_H_
 All Classes Files Functions Variables Typedefs Friends Defines