MOAB: Mesh Oriented datABase
(version 5.2.1)
|
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 : WriteTEMPLATE.hpp 00018 // 00019 // Purpose : ExodusII writer 00020 // 00021 // Special Notes : Lots of code taken from verde implementation 00022 // 00023 // Creator : Corey Ernst 00024 // 00025 // Date : 8/02 00026 // 00027 // Owner : Corey Ernst 00028 //------------------------------------------------------------------------- 00029 00030 #ifndef WRITEANS_HPP 00031 #define WRITEANS_HPP 00032 00033 #ifndef IS_BUILDING_MB 00034 #error "WriteAns.hpp isn't supposed to be included into an application" 00035 #endif 00036 00037 #include <string> 00038 00039 #include "moab/Forward.hpp" 00040 #include "moab/Range.hpp" 00041 #include "moab/ExoIIInterface.hpp" 00042 #include "moab/WriterIface.hpp" 00043 00044 namespace moab 00045 { 00046 00047 class WriteUtilIface; 00048 00049 class WriteAns : public WriterIface 00050 { 00051 00052 public: 00053 //! Constructor 00054 WriteAns( Interface* impl ); 00055 00056 //! Destructor 00057 virtual ~WriteAns(); 00058 00059 static WriterIface* factory( Interface* ); 00060 00061 //! writes out a file 00062 ErrorCode write_file( const char* file_name, const bool overwrite, const FileOptions& opts, 00063 const EntityHandle* output_list, const int num_sets, 00064 const std::vector< std::string >& qa_list, const Tag* tag_list = NULL, int num_tags = 0, 00065 int export_dimension = 3 ); 00066 00067 //! struct used to hold data for each block to be output; used by 00068 //! initialize_file to initialize the file header for increased speed 00069 struct MaterialSetData 00070 { 00071 int id; 00072 int number_elements; 00073 int number_nodes_per_element; 00074 int number_attributes; 00075 ExoIIElementType element_type; 00076 EntityType moab_type; 00077 Range* elements; 00078 }; 00079 00080 //! struct used to hold data for each nodeset to be output; used by 00081 //! initialize_file to initialize the file header for increased speed 00082 struct DirichletSetData 00083 { 00084 int id; 00085 int number_nodes; 00086 std::vector< EntityHandle > nodes; 00087 std::vector< double > node_dist_factors; 00088 }; 00089 00090 //! struct used to hold data for each sideset to be output; used by 00091 //! initialize_file to initialize the file header for increased speed 00092 struct NeumannSetData 00093 { 00094 int id; 00095 int number_elements; 00096 std::vector< EntityHandle > elements; 00097 std::vector< int > side_numbers; 00098 EntityHandle mesh_set_handle; 00099 }; 00100 00101 protected: 00102 //! number of dimensions in this file 00103 // int number_dimensions(); 00104 00105 //! open a file for writing 00106 // ErrorCode open_file(const char *filename); 00107 00108 //! contains the general information about a mesh 00109 class MeshInfo 00110 { 00111 public: 00112 unsigned int num_dim; 00113 unsigned int num_nodes; 00114 unsigned int num_elements; 00115 unsigned int num_matsets; 00116 unsigned int num_dirsets; 00117 unsigned int num_neusets; 00118 Range nodes; 00119 00120 MeshInfo() 00121 : num_dim( 0 ), num_nodes( 0 ), num_elements( 0 ), num_matsets( 0 ), num_dirsets( 0 ), num_neusets( 0 ) 00122 { 00123 } 00124 }; 00125 00126 private: 00127 //! interface instance 00128 Interface* mbImpl; 00129 // WriteUtilIface* mWriteIface; 00130 00131 //! file name 00132 std::string fileName; 00133 00134 //! Meshset Handle for the mesh that is currently being read 00135 EntityHandle mCurrentMeshHandle; 00136 00137 //! Cached tags for reading. Note that all these tags are defined when the 00138 //! core is initialized. 00139 Tag mMaterialSetTag; 00140 Tag mDirichletSetTag; 00141 Tag mNeumannSetTag; 00142 Tag mGlobalIdTag; 00143 Tag mMatSetIdTag; 00144 00145 ErrorCode write_nodes( const int num_nodes, const Range& nodes, const int dimension, const char* file_name ); 00146 }; 00147 00148 } // namespace moab 00149 00150 #endif