MeshKit
1.0
|
00001 #ifndef MESHKIT_PostBL_HPP 00002 #define MESHKIT_PostBL_HPP 00003 00004 #include <cassert> 00005 #include <string> 00006 #include <vector> 00007 #include <set> 00008 #include <math.h> 00009 #include <iomanip> 00010 00011 #include "meshkit/Types.hpp" 00012 #include "meshkit/Error.hpp" 00013 #include "meshkit/MeshScheme.hpp" 00014 #include "meshkit/ModelEnt.hpp" 00015 #include "meshkit/MKCore.hpp" 00016 #include "meshkit/SizingFunction.hpp" 00017 #include "meshkit/RegisterMeshOp.hpp" 00018 00019 #include "meshkit/LocalSet.hpp" 00020 #include "meshkit/LocalTag.hpp" 00021 #include "meshkit/Matrix.hpp" 00022 00023 #include "meshkit/iMesh.hpp" 00024 #include "meshkit/iGeom.hpp" 00025 #include "MBCN.h" 00026 00027 #include "meshkit/SimpleArray.hpp" 00028 #include "meshkit/parser.hpp" 00029 #include "meshkit/clock.hpp" 00030 #include "meshkit/mstream.hpp" 00031 00032 #include "MBiMesh.hpp" 00033 #include "moab/Interface.hpp" 00034 #include "moab/Range.hpp" 00035 #include "moab/CartVect.hpp" 00036 00037 00038 #include "moab/Skinner.hpp" 00039 #include "moab/AdaptiveKDTree.hpp" 00040 #include "moab/Matrix3.hpp" 00041 #include "moab/verdict/VerdictWrapper.hpp" 00042 #include "moab/ReadUtilIface.hpp" 00043 00044 00063 namespace MeshKit { 00064 00065 #define DEFAULT_TEST_POSTBL "test_postbl.inp" 00066 00067 class MKCore; 00068 00069 class PostBL : public MeshScheme 00070 { 00071 public: 00072 /* \brief Constructor 00073 * 00074 * Create a new PostBL instance 00075 * \param impl the iGeom instance handle for the Geom 00076 */ 00077 PostBL(MKCore *mk, const MEntVector &me_vec); 00078 00079 /* \brief Destructor 00080 */ 00081 virtual ~PostBL(); 00082 00084 static const char* name(); 00085 00090 static bool can_mesh(iBase_EntityType dim); 00091 00098 static bool can_mesh(ModelEnt *me); 00099 00103 static const moab::EntityType* output_types(); 00104 00108 virtual const moab::EntityType* mesh_types_arr() const; 00109 00113 virtual bool add_modelent(ModelEnt *model_ent); 00114 00116 virtual void setup_this(); 00117 00119 virtual void execute_this(); 00120 00121 00124 void Algo2 (); 00125 00130 void PrepareIO (int argc, char *argv[], std::string TestDir); 00131 00136 void get_normal_quad (std::vector<moab::EntityHandle>conn, moab::CartVect &v) ; 00137 00142 void get_normal_edge (std::vector<moab::EntityHandle>conn, moab::CartVect AB, moab::CartVect &v); 00143 00149 void get_det_jacobian (std::vector<moab::EntityHandle> conn, int offset, double &detJ); 00150 00156 void find_min_edge_length (moab::Range, moab::EntityHandle, moab::Range, double &e_len); 00157 00160 int push_bulk_mesh(VerdictWrapper vw); 00161 00164 int compute_normals(); 00165 00168 int create_bl_elements(VerdictWrapper vw); 00169 00170 private: 00172 iGeom *igeom; 00173 00175 iMesh *imesh; 00176 00178 moab::Interface *mb; 00179 moab::Tag GDTag, GIDTag, NTag, MTag, STag, FTag, MNTag, MatIDTag, BLNodeIDTag; 00180 std::vector<moab::EntityHandle> old_hex, new_vert, conn, qconn, tri_conn, tet_conn; 00181 std::vector<moab::EntityHandle> adj_qconn, 00182 old_hex_conn, adj_hex_nodes1; 00183 moab::CartVect surf_normal; 00184 moab::Range quads, nodes,edges, fixmat_ents; 00185 double coords_new_quad[3]; 00186 double coords_old_quad[3]; 00187 moab::EntityHandle hex, hex1, hex2; 00188 moab::Range::iterator mset_it, set_it; 00189 moab::EntityHandle mthis_set, geom_set; 00190 moab::Range sets, n_sets, m_sets; 00191 00192 00193 // ! parser related 00194 bool debug, hybrid, check_bl_edge_length; 00195 // !! file Input 00196 std::ifstream m_FileInput; 00197 mstream m_LogFile; 00198 std::string szInputString; 00199 std::string szComment; 00200 int MAXCHARS, m_nLineNumber; 00201 // all_bl is the vector storing the number of materials a particular boundary layer node is attached to 00202 std::vector<int> blmaterial_id, all_bl; 00203 00204 // ! variables to parse 00205 std::string m_InputFile, m_MeshFile, m_OutFile, m_LogName, m_MeshType; 00206 int m_SurfId, m_NeumannSet, m_Material, m_HConn, hex27; 00207 double m_Thickness, m_MinEdgeLength; 00208 int m_Intervals, m_JacCalls, tri_sch, fixmat; 00209 double m_Bias, m_JLo, m_JHi; 00210 // ! variable for hex and tet meshes 00211 int m_Conn, m_BElemNodes; 00212 int m_GD, m_BLDim; 00213 std::string m_Card; 00214 int err; 00215 00216 // ! error handlers 00217 enum ErrorStates { INVALIDINPUT}; 00218 void IOErrorHandler (ErrorStates) const; 00219 }; 00220 00221 inline const char* PostBL::name() 00222 { 00223 return "PostBL"; 00224 } 00225 00226 inline bool PostBL::can_mesh(iBase_EntityType) 00227 { 00228 return false; 00229 } 00230 00231 inline bool PostBL::can_mesh(ModelEnt *) 00232 { 00233 return true; 00234 } 00235 00236 inline const moab::EntityType* PostBL::mesh_types_arr() const 00237 { 00238 return output_types(); 00239 } 00240 00241 } // namespace MeshKit 00242 #endif