MeshKit
1.0
|
00001 //-----------------------------------C++-------------------------------------// 00002 // File: src/algs/meshkit/AssyGen.hpp 00003 // 00004 // Brief: AssyGen class definition: 00005 // Creates reactor assembly geometry (ACIS or OCC format) and cubit mesh script as specified in a user defined input 00006 // class, AssyGen 00007 //---------------------------------------------------------------------------// 00008 00009 #ifndef MESHKIT_ASSYGEN_HPP 00010 #define MESHKIT_ASSYGEN_HPP 00011 00012 #include <cassert> 00013 #include <string> 00014 #include <vector> 00015 #include <set> 00016 00017 #include "meshkit/Types.hpp" 00018 #include "meshkit/Error.hpp" 00019 #include "meshkit/MeshScheme.hpp" 00020 #include "meshkit/ModelEnt.hpp" 00021 #include "meshkit/MKCore.hpp" 00022 #include "meshkit/SizingFunction.hpp" 00023 #include "meshkit/RegisterMeshOp.hpp" 00024 00025 #include "meshkit/LocalSet.hpp" 00026 #include "meshkit/LocalTag.hpp" 00027 #include "meshkit/Matrix.hpp" 00028 00029 #include "meshkit/iMesh.hpp" 00030 #include "meshkit/iGeom.hpp" 00031 #include "MBCN.h" 00032 00033 #include "meshkit/SimpleArray.hpp" 00034 00035 #include "meshkit/vectortemplate.hpp" 00036 #include "meshkit/matrixtemplate.hpp" 00037 #include "pincell.hpp" 00038 #include "meshkit/parser.hpp" 00039 #include "meshkit/clock.hpp" 00040 00041 00042 namespace MeshKit { 00043 00044 #define DEFAULT_TEST_FILE "assygen_default" 00045 #define TEST_FILE_NAME "assygen_default" 00046 00047 enum ErrorStates {PINCELLS, INVALIDINPUT, EMAT, EGEOMTYPE, EGEOMENGINE, ENEGATIVE, EALIAS, EPIN}; 00048 00049 class MKCore; 00050 00051 class AssyGen : public MeshScheme 00052 { 00053 public: 00054 /* \brief Constructor 00055 * 00056 * Create a new AssyGen instance 00057 * \param impl the iGeom instance handle for the Geom 00058 */ 00059 AssyGen(MKCore *mk, const MEntVector &me_vec); 00060 00061 /* \brief Destructor 00062 */ 00063 virtual ~AssyGen(); 00064 00065 enum ErrorStates {PINCELLS, INVALIDINPUT, EMAT, EGEOMTYPE, EGEOMENGINE, ENEGATIVE, EALIAS, EPIN}; 00066 00068 static const char* name(); 00069 00074 static bool can_mesh(iBase_EntityType dim); 00075 00082 static bool can_mesh(ModelEnt *me); 00083 00087 static const moab::EntityType* output_types(); 00088 00092 virtual const moab::EntityType* mesh_types_arr() const; 00093 00097 virtual bool add_modelent(ModelEnt *model_ent); 00098 00100 virtual void setup_this(); 00101 00103 virtual void execute_this(); 00104 00108 void PrepareIO (int argc, char *argv[], std::string TestDir); 00109 00113 void ReadInputPhase1 (); 00114 00118 void ReadAndCreate (); 00119 00123 void Name_Faces( const std::string sMatName, const iBase_EntityHandle body, 00124 iBase_TagHandle this_tag); 00125 00129 void Center_Assm( char&); 00130 00134 void Section_Assm ( char&, double&, const std::string); 00135 00139 void Rotate_Assm ( char&, double&); 00140 00144 void Move_Assm ( double&, double&, double&); 00145 00149 void Create_HexAssm( std::string &); 00150 00154 void Create_CartAssm( std::string &); 00155 00159 void CreateOuterCovering(); 00160 00164 void Imprint_Merge (); 00165 00169 void Subtract_Pins (); 00170 00174 void Create2DSurf(); 00175 00179 void ReadPinCellData( int i); 00180 00184 void CreatePinCell_Intersect( int i, double dX, 00185 double dY, double dZ); 00186 00190 void CreatePinCell( int i, double dX, 00191 double dY, double dZ); 00192 00196 void CreateCubitJournal(); 00197 00201 void ComputePinCentroid( int, CMatrix<std::string>, int, int, 00202 double&, double&, double&); 00203 00204 private: 00205 // iGeom Impl for calling geometry creation/manipulation operations 00206 iGeom *igeomImpl; 00207 00208 // number of sides in the geometry 00209 int m_nSides; 00210 00211 // file Input 00212 std::ifstream m_FileInput; 00213 00214 // journal file Output 00215 std::ofstream m_FileOutput, m_SchemesFile; 00216 00217 // string for file names 00218 std::string m_szFile, m_szInFile, m_szGeomFile,m_szJouFile, m_szSchFile; 00219 00220 // matrix for holding pincell arrangement 00221 CMatrix<std::string> m_Assembly; 00222 00223 // matrix for holding verts coordinates used in tet-meshing 00224 CMatrix<double> m_dMTopSurfCoords; 00225 00226 // vector for duct specification 00227 CMatrix<double> m_dMAssmPitch, m_dMAssmPitchX, m_dMAssmPitchY, m_dMXYAssm, m_dMZAssm; 00228 00229 // vector for material names 00230 CVector<std::string> m_szAssmMat, m_szAssmMatAlias; 00231 CMatrix<std::string> m_szMMAlias; 00232 00233 // vector holding a pincell 00234 CVector<CPincell> m_Pincell; 00235 00236 // string for geomtype, engine, meshtype 00237 std::string m_szEngine; 00238 std::string m_szGeomType; 00239 std::string m_szMeshType; 00240 std::string m_szSideset; 00241 00242 // integers for vectors sizes, err etc 00243 int m_nAssemblyMat, m_nDimensions, m_nPincells , m_nAssmVol, m_nPin, m_nPinX, m_nPinY, err, m_nLineNumber, m_nPlanar, 00244 m_nNeumannSetId, m_nMaterialSetId, m_nDuct, m_nDuctNum, m_nJouFlag; 00245 00246 // doubles for pincell pitch, pi and mesh sizes resp. 00247 double m_dPitch, pi, m_dRadialSize, m_dAxialSize, m_dTetMeshSize, m_dMergeTol; 00248 00249 // igeom related 00250 std::vector<iBase_EntityHandle> assms, in_pins; 00251 //iGeom_Instance geom; 00252 iBase_EntitySetHandle root_set; 00253 00254 00255 // error handlers 00256 void IOErrorHandler (ErrorStates) const; 00257 friend class CPincell; 00258 00259 // parsing related 00260 std::string szInputString; 00261 std::string szComment; 00262 int MAXCHARS; 00263 00264 }; 00265 00266 inline const char* AssyGen::name() 00267 { 00268 return "AssyGen"; 00269 } 00270 00271 inline bool AssyGen::can_mesh(iBase_EntityType) 00272 { 00273 return false; 00274 } 00275 00276 inline bool AssyGen::can_mesh(ModelEnt *) 00277 { 00278 return true; 00279 } 00280 00281 inline const moab::EntityType* AssyGen::mesh_types_arr() const 00282 { 00283 return output_types(); 00284 } 00285 00286 } // namespace MeshKit 00287 #endif