MeshKit
1.0
|
00001 //-----------------------------------C++-------------------------------------// 00002 // File: src/algs/TFIMapping.hpp 00003 // Wednesday February 11 10:50 2011 00004 // Brief: TFIMapping class definition: generate the all-quad mesh by 00005 // TFI mapping. Before using this class, four edges should have already 00006 // been meshed by EdgeMesher 00007 //---------------------------------------------------------------------------// 00008 00009 00010 #ifndef MESHKIT_TFIMAPPING_HPP 00011 #define MESHKIT_TFIMAPPING_HPP 00012 00013 #include <stdlib.h> 00014 #include <stdio.h> 00015 #include <assert.h> 00016 #include <string> 00017 #include <iostream> 00018 #include <fstream> 00019 #include <string.h> 00020 #include <limits.h> 00021 00022 #include <iGeom.h> 00023 #include "Global.hpp" 00024 #include "meshkit/MKCore.hpp" 00025 #include "meshkit/SizingFunction.hpp" 00026 #include "moab/ReadUtilIface.hpp" 00027 #include <iMesh.h> 00028 #include <set> 00029 #include <iRel.h> 00030 #include <vector> 00031 00032 #include "meshkit/MeshScheme.hpp" 00033 00034 using namespace std; 00035 00036 namespace MeshKit { 00037 //===========================================================================// 00045 //===========================================================================// 00046 class TFIMapping: public MeshScheme { 00047 public: 00048 00049 TFIMapping(MKCore *mk_core, const MEntVector &me_vec); 00050 ~TFIMapping(); 00051 00052 virtual void setup_this(); 00053 virtual void execute_this(); 00054 00056 static const char* name() 00057 { 00058 return "TFIMapping"; 00059 } 00060 00065 static bool can_mesh(iBase_EntityType dim) 00066 { 00067 return iBase_FACE == dim; 00068 } 00069 00076 static bool can_mesh(ModelEnt *me) 00077 { 00078 return canmesh_region(me); 00079 } 00080 00084 static const moab::EntityType* output_types(); 00085 00089 virtual const moab::EntityType* mesh_types_arr() const 00090 { 00091 return output_types(); 00092 } 00093 void skip_improve() 00094 { 00095 _shapeImprove = false;// by default it is true, but sometimes we need to skip it 00096 } 00097 00098 private: 00099 00100 bool _shapeImprove; 00101 //implement the transfinite interpolation between (pt_0s, pt_1s) and (pt_r0, pt_r1) 00102 void parametricTFI3D(double *pts, double r, double s, double pt_0s[3], double pt_1s[3], double pt_r0[3], double pt_r1[3]); 00103 00104 //generate the mesh on the linking surface 00105 int SurfMapping(ModelEnt *ent); 00106 00107 //generate the mesh on the cylinder-like linking surface 00108 int cylinderSurfMapping(ModelEnt *ent); 00109 00110 // transform from source line to target line, such that 00111 // target= A * ( source - 2*sc + tc) + sc 00112 void computeTransformation(Vector3D & A, Vector3D & B, Vector3D & C, Vector3D & D, 00113 Matrix3D & transMatrix); 00114 00115 void SurfImprove(iBase_EntityHandle surface, iBase_EntitySetHandle surfMesh, iBase_EntityType entity_type); 00116 00117 //smooth the quadrilateral mesh on the linking surface 00118 void SmoothWinslow(std::vector<iBase_EntityHandle> &List_i, std::vector<iBase_EntityHandle> &List_ii, std::vector< 00119 iBase_EntityHandle> &List_j, std::vector<iBase_EntityHandle> &List_jj, std::vector<iBase_EntityHandle> &InteriorNodes, 00120 std::vector<iBase_EntityHandle> &quads, iBase_TagHandle &taghandle, ModelEnt *ent); 00121 00122 }; 00123 00124 } 00125 00126 #endif 00127