![]() |
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 : ReadNASTRAN.hpp
00018 //
00019 // Purpose : NASTRAN file reader
00020 //
00021 // Creator : Brandon Smith
00022 //
00023 // Date : 08/2009
00024 //
00025 //-------------------------------------------------------------------------
00026
00027 #ifndef READNASTRAN_HPP
00028 #define READNASTRAN_HPP
00029
00030 #ifndef IS_BUILDING_MB
00031 #error "ReadNASTRAN.hpp isn't supposed to be included into an application"
00032 #endif
00033
00034 #include
00035 #include
00036 #include
00037 #include
00038
00039 #include "moab/Interface.hpp"
00040 #include "moab/ReaderIface.hpp"
00041 #include "FileTokenizer.hpp"
00042 #include "moab/RangeMap.hpp"
00043
00044 namespace moab
00045 {
00046
00047 class ReadUtilIface;
00048
00049 class ReadNASTRAN : public ReaderIface
00050 {
00051
00052 public:
00053 // factory method
00054 static ReaderIface* factory( Interface* );
00055
00056 ErrorCode load_file( const char* file_name,
00057 const EntityHandle* file_set,
00058 const FileOptions& opts,
00059 const SubsetList* subset_list = 0,
00060 const Tag* file_id_tag = 0 );
00061 // constructor
00062 ReadNASTRAN( Interface* impl = NULL );
00063
00064 // destructor
00065 virtual ~ReadNASTRAN();
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 protected:
00074 private:
00075 // read mesh interface
00076 ReadUtilIface* readMeshIface;
00077
00078 // MOAB Interface
00079 Interface* MBI;
00080
00081 RangeMap< int, EntityHandle > nodeIdMap, elemIdMap;
00082
00083 enum line_format
00084 {
00085 SMALL_FIELD,
00086 LARGE_FIELD,
00087 FREE_FIELD
00088 };
00089
00090 ErrorCode determine_line_format( const std::string& line, line_format& format );
00091
00092 ErrorCode tokenize_line( const std::string& line, const line_format format, std::vector< std::string >& tokens );
00093
00094 ErrorCode determine_entity_type( const std::string& token, EntityType& type );
00095
00096 ErrorCode get_real( const std::string&, double& real );
00097
00098 ErrorCode read_node( const std::vector< std::string >& tokens,
00099 const bool debug,
00100 double* coord_arrays[3],
00101 int& node_id );
00102
00103 ErrorCode read_element( const std::vector< std::string >& tokens,
00104 std::vector< Range >& materials,
00105 const EntityType element_type,
00106 const bool debug );
00107
00108 ErrorCode create_materials( const std::vector< Range >& materials );
00109
00110 ErrorCode assign_ids( const Tag* file_id_tag );
00111 };
00112
00113 } // namespace moab
00114
00115 #endif