![]() |
Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
00001 /**
00002 * MOAB, a Mesh-Oriented datABase, is a software component for creating,
00003 * storing and accessing finite element mesh data.
00004 *
00005 * Copyright 2004 Sandia Corporation. Under the terms of Contract
00006 * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
00007 * retains certain rights in this software.
00008 *
00009 * This library is free software; you can redistribute it and/or
00010 * modify it under the terms of the GNU Lesser General Public
00011 * License as published by the Free Software Foundation; either
00012 * version 2.1 of the License, or (at your option) any later version.
00013 *
00014 */
00015
00016 //-------------------------------------------------------------------------
00017 // Filename : ReadCGM.hpp
00018 //
00019 // Purpose : .step and .brep and .facet file reader
00020 //
00021 // Special Notes : Lots of code taken from cgm2moab implementation
00022 //
00023 // Creator : Jane Hu
00024 //
00025 // Date : 3/09
00026 //
00027 //-------------------------------------------------------------------------
00028
00029 #ifndef READCGM_HPP
00030 #define READCGM_HPP
00031
00032 #include "moab/MOABConfig.h"
00033 #ifndef MOAB_HAVE_CGM
00034 #error "ReadCGM.hpp isn't supposed to be included without building CGM"
00035 #endif
00036
00037 #include
00038 #include "moab/ReaderIface.hpp"
00039 #include "RefEntityName.hpp"
00040
00041 namespace moab
00042 {
00043
00044 class ReadUtilIface;
00045 class GeomTopoTool;
00046
00047 class ReadCGM : public ReaderIface
00048 {
00049
00050 public:
00051 static ReaderIface* factory( Interface* );
00052
00053 void tokenize( const std::string& str, std::vector< std::string >& tokens, const char* delimiters );
00054
00055 //! load a CGM file
00056 // Supported FileOptions:
00057 // * FACET_NORMAL_TOLERANCE= (default: 5)
00058 // * FACET_DISTANCE_TOLERANCE= (default: 0.001)
00059 // * MAX_FACET_EDGE_LENGTH= (default: 0.0)
00060 // * CGM_ATTRIBS= (default: no)
00061 ErrorCode load_file( const char* file_name,
00062 const EntityHandle* file_set,
00063 const FileOptions& opts,
00064 const SubsetList* subset_list = 0,
00065 const Tag* file_id_tag = 0 );
00066
00067 ErrorCode read_tag_values( const char* file_name,
00068 const char* tag_name,
00069 const FileOptions& opts,
00070 std::vector< int >& tag_values_out,
00071 const SubsetList* subset_list = 0 );
00072
00073 //! Constructor
00074 ReadCGM( Interface* impl = NULL );
00075
00076 //! Destructor
00077 virtual ~ReadCGM();
00078
00079 // access private vars
00080 int get_failed_curve_count();
00081 int get_failed_surface_count();
00082
00083 private:
00084 ErrorCode set_options( const FileOptions& opts,
00085 int& norm_tol,
00086 double& faceting_tol,
00087 double& len_tol,
00088 bool& act_att,
00089 bool& verbose_warnings,
00090 bool& fatal_on_curves );
00091
00092 ErrorCode create_entity_sets( std::map< RefEntity*, EntityHandle > ( &entmap )[5] );
00093
00094 ErrorCode create_topology( std::map< RefEntity*, EntityHandle > ( &entitymap )[5] );
00095
00096 ErrorCode store_surface_senses( std::map< RefEntity*, EntityHandle >& surface_map,
00097 std::map< RefEntity*, EntityHandle >& volume_map );
00098
00099 ErrorCode store_curve_senses( std::map< RefEntity*, EntityHandle >& curve_map,
00100 std::map< RefEntity*, EntityHandle >& surface_map );
00101
00102 ErrorCode store_groups( std::map< RefEntity*, EntityHandle > ( &entitymap )[5] );
00103
00104 ErrorCode create_group_entsets( std::map< RefEntity*, EntityHandle >& group_map );
00105
00106 ErrorCode store_group_content( std::map< RefEntity*, EntityHandle > ( &entitymap )[5] );
00107
00108 void set_cgm_attributes( bool const act_attributes, bool const verbose );
00109
00110 ErrorCode create_vertices( std::map< RefEntity*, EntityHandle >& vertex_map );
00111
00112 ErrorCode create_curve_facets( std::map< RefEntity*, EntityHandle >& curve_map,
00113 std::map< RefEntity*, EntityHandle >& vertex_map,
00114 int norm_tol,
00115 double faceting_tol,
00116 bool verbose_warn = false,
00117 bool fatal_on_curves = false );
00118
00119 ErrorCode create_surface_facets( std::map< RefEntity*, EntityHandle >& surface_map,
00120 std::map< RefEntity*, EntityHandle >& vertex_map,
00121 int norm_tol,
00122 double facet_tol,
00123 double length_tol );
00124 /**
00125 * Dumps the failed faceting information to screen
00126 */
00127 void dump_fail_counts();
00128
00129 ReadUtilIface* readUtilIface;
00130
00131 GeomTopoTool* myGeomTool;
00132
00133 const char* get_geom_file_type( const char* filename );
00134 const char* get_geom_fptr_type( FILE* file );
00135
00136 int is_cubit_file( FILE* file );
00137 int is_step_file( FILE* file );
00138 int is_iges_file( FILE* file );
00139 int is_occ_brep_file( FILE* file );
00140 int is_facet_file( FILE* file );
00141
00142 //------------member variables ------------//
00143
00144 //! interface instance
00145 Interface* mdbImpl;
00146
00147 Tag geom_tag, id_tag, name_tag, category_tag, faceting_tol_tag, geometry_resabs_tag;
00148
00149 int failed_curve_count; // the number of curves that failed to facet
00150 std::vector< int > failed_curves; // the curve ids of the curves that failed to facet
00151
00152 int failed_surface_count; // the number of surfaces that have 0 facets
00153 std::vector< int > failed_surfaces; // the surface ids of the surfaces that have 0 facets
00154 };
00155
00156 } // namespace moab
00157
00158 #endif