MOAB: Mesh Oriented datABase  (version 5.4.1)
WriteAns.hpp
Go to the documentation of this file.
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,
00063                           const bool overwrite,
00064                           const FileOptions& opts,
00065                           const EntityHandle* output_list,
00066                           const int num_sets,
00067                           const std::vector< std::string >& qa_list,
00068                           const Tag* tag_list  = NULL,
00069                           int num_tags         = 0,
00070                           int export_dimension = 3 );
00071 
00072     //! struct used to hold data for each block to be output; used by
00073     //! initialize_file to initialize the file header for increased speed
00074     struct MaterialSetData
00075     {
00076         int id;
00077         int number_elements;
00078         int number_nodes_per_element;
00079         int number_attributes;
00080         ExoIIElementType element_type;
00081         EntityType moab_type;
00082         Range* elements;
00083     };
00084 
00085     //! struct used to hold data for each nodeset to be output; used by
00086     //! initialize_file to initialize the file header for increased speed
00087     struct DirichletSetData
00088     {
00089         int id;
00090         int number_nodes;
00091         std::vector< EntityHandle > nodes;
00092         std::vector< double > node_dist_factors;
00093     };
00094 
00095     //! struct used to hold data for each sideset to be output; used by
00096     //! initialize_file to initialize the file header for increased speed
00097     struct NeumannSetData
00098     {
00099         int id;
00100         int number_elements;
00101         std::vector< EntityHandle > elements;
00102         std::vector< int > side_numbers;
00103         EntityHandle mesh_set_handle;
00104     };
00105 
00106   protected:
00107     //! number of dimensions in this file
00108     // int number_dimensions();
00109 
00110     //! open a file for writing
00111     // ErrorCode open_file(const char *filename);
00112 
00113     //! contains the general information about a mesh
00114     class MeshInfo
00115     {
00116       public:
00117         unsigned int num_dim;
00118         unsigned int num_nodes;
00119         unsigned int num_elements;
00120         unsigned int num_matsets;
00121         unsigned int num_dirsets;
00122         unsigned int num_neusets;
00123         Range nodes;
00124 
00125         MeshInfo()
00126             : num_dim( 0 ), num_nodes( 0 ), num_elements( 0 ), num_matsets( 0 ), num_dirsets( 0 ), num_neusets( 0 )
00127         {
00128         }
00129     };
00130 
00131   private:
00132     //! interface instance
00133     Interface* mbImpl;
00134     // WriteUtilIface* mWriteIface;
00135 
00136     //! file name
00137     std::string fileName;
00138 
00139     //! Meshset Handle for the mesh that is currently being read
00140     EntityHandle mCurrentMeshHandle;
00141 
00142     //! Cached tags for reading.  Note that all these tags are defined when the
00143     //! core is initialized.
00144     Tag mMaterialSetTag;
00145     Tag mDirichletSetTag;
00146     Tag mNeumannSetTag;
00147     Tag mGlobalIdTag;
00148     Tag mMatSetIdTag;
00149 
00150     ErrorCode write_nodes( const int num_nodes, const Range& nodes, const int dimension, const char* file_name );
00151 };
00152 
00153 }  // namespace moab
00154 
00155 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines