MeshKit  1.0
AssyMesher.hpp
Go to the documentation of this file.
00001 #ifndef MESHKIT_ASSYMESHER_HPP
00002 #define MESHKIT_ASSYMESHER_HPP
00003 
00004 #include <cassert>
00005 #include <string>
00006 #include <vector>
00007 #include <set>
00008 #include <iomanip>
00009 
00010 #include "meshkit/Types.hpp"
00011 #include "meshkit/Error.hpp"
00012 #include "meshkit/MeshScheme.hpp"
00013 #include "meshkit/ModelEnt.hpp"
00014 
00015 #include "meshkit/LocalTag.hpp"
00016 #include "meshkit/Matrix.hpp"
00017 
00018 #include "meshkit/iMesh.hpp"
00019 #include "meshkit/iGeom.hpp"
00020 #include "meshkit/mstream.hpp"
00021 
00022 #include "meshkit/SimpleArray.hpp"
00023 
00024 #include "meshkit/vectortemplate.hpp"
00025 #include "meshkit/matrixtemplate.hpp"
00026 #include "meshkit/pincell.hpp"
00027 #include "meshkit/parser.hpp"
00028 #include "meshkit/clock.hpp"
00029 
00030 namespace MeshKit {
00031 #define DEFAULT_TEST_AM  "assygen_default"
00032 
00033 
00034 class MKCore;
00035 
00036 class AssyMesher : public MeshScheme
00037 {
00038 public:
00039   /* \brief Constructor
00040    *
00041    * Create a new AssyMesher instance
00042    * \param impl the iGeom instance handle for the Geom
00043    */
00044   AssyMesher(MKCore *mkcore, const MEntVector &me_vec);
00045 
00046   /* \brief Destructor
00047    */
00048   virtual ~AssyMesher();
00049 
00051   static const char* name();
00052 
00057   static bool can_mesh(iBase_EntityType dim);
00058 
00065   static bool can_mesh(ModelEnt *me);
00066 
00070   static const moab::EntityType* output_types();
00071 
00075   virtual const moab::EntityType* mesh_types_arr() const;
00076 
00080   virtual bool add_modelent(ModelEnt *model_ent);
00081 
00083   virtual void setup_this();
00084 
00086   virtual void execute_this();
00087 
00091   void PrepareIO (int argc, char *argv[], std::string TestDir);
00092 
00096   void ReadPinCellData( int i);
00097 
00098 
00099 private:
00101   iGeom *igeom;
00102 
00104   iMesh *imesh;
00105 
00107   moab::Interface *mb;
00108 
00109   // igeom related
00110   std::vector<iBase_EntityHandle> assms, in_pins;
00111 
00112   // number of sides in the geometry
00113   int m_nSides;
00114 
00115   // !! file Input
00116   std::ifstream m_FileInput, m_FileCommon;
00117   mstream m_LogFile;
00118   std::string szInputString;
00119   std::string szComment;
00120   int MAXCHARS;
00121   bool have_common;
00122 
00123   // ! variables to parse
00124   std::string m_InputFile, m_szCommonFile, m_GeomFile, m_MeshFile, m_OutFile, m_LogName, m_MeshType;
00125   std::string m_Card;
00126 
00127   // ! error handlers
00128   enum ErrorStates {PINCELLS, INVALIDINPUT, EMAT, EGEOMTYPE, EGEOMENGINE, ENEGATIVE, EALIAS, EPIN};
00129   void IOErrorHandler (ErrorStates) const;
00130 
00131 
00133   // matrix for holding pincell arrangement
00134   CMatrix<std::string> m_Assembly;
00135 
00136   // matrix for holding verts coordinates used in tet-meshing
00137   CMatrix<double> m_dMTopSurfCoords;
00138 
00139   // vector for duct specification
00140   CMatrix<double> m_dMAssmPitch, m_dMAssmPitchX, m_dMAssmPitchY, m_dMXYAssm, m_dMZAssm;
00141 
00142   // vector for material names
00143   CVector<std::string> m_szAssmMat, m_szAssmMatAlias;
00144   CMatrix<std::string> m_szMMAlias;
00145 
00146   // vector holding a pincell
00147   CVector<CPincell> m_Pincell;
00148 
00149   // string for geomtype, engine, meshtype
00150   std::string m_szEngine;
00151   std::string m_szGeomType;
00152   std::string m_szMeshType;
00153   std::string m_szSideset;
00154 
00155   // integers for vectors sizes, err etc
00156   int m_nAssemblyMat, m_nDimensions, m_nPincells, m_nLineNumber, m_nPlanar,
00157     m_nNeumannSetId, m_nMaterialSetId, m_nDuct, m_nDuctNum, m_nJouFlag;
00158 
00159   // doubles for pincell pitch, pi and mesh sizes resp.
00160   double m_dPitch, pi, m_dRadialSize, m_dAxialSize, m_dTetMeshSize, m_dMergeTol;
00161 
00162   // variable for storing material names
00163   std::set<std::string> allMtrlsSet;
00164 
00165 
00166   std::vector<iGeom::EntityHandle>* selectByMaterialsAndNameSuffix(
00167       std::vector<iGeom::EntityHandle> const &geoEntVec,
00168       std::set<std::string> const &matFilter, const char* suffix) const;
00169 
00170    void createMaterialNeumannSets(std::set <std::string> const &matFilter);
00171    void createMaterialNeumannSets();
00172 
00173 
00174 };
00175 
00176 inline const char* AssyMesher::name()
00177 {
00178   return "AssyMesher";
00179 }
00180 
00181 inline bool AssyMesher::can_mesh(iBase_EntityType)
00182 {
00183   // Given just a dimension, AssyMesher can't do anything since it doesn't know
00184   // what to copy.
00185   return false;
00186 }
00187 
00188 inline bool AssyMesher::can_mesh(ModelEnt *)
00189 {
00190   return true;
00191 }
00192 
00193 inline const moab::EntityType* AssyMesher::mesh_types_arr() const
00194 {
00195   return output_types();
00196 }
00197 
00198 } // namespace MeshKit
00199 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines