![]() |
Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
00001 //-------------------------------------------------------------------------
00002 // Filename : WriteDamsel.hpp
00003 //
00004 // Purpose : ExodusII writer
00005 //
00006 // Special Notes : Lots of code taken from verde implementation
00007 //
00008 // Creator : Corey Ernst
00009 //
00010 // Date : 8/02
00011 //
00012 // Owner : Corey Ernst
00013 //-------------------------------------------------------------------------
00014
00015 #ifndef WRITEDAMSEL_HPP
00016 #define WRITEDAMSEL_HPP
00017
00018 #ifndef IS_BUILDING_MB
00019 #error "WriteDamsel.hpp isn't supposed to be included into an application"
00020 #endif
00021
00022 #include
00023 #include
00024
00025 #include "moab/Interface.hpp"
00026 #include "moab/Range.hpp"
00027 #include "moab/WriterIface.hpp"
00028 #include "RangeSeqIntersectIter.hpp"
00029 #include "moab/FileOptions.hpp"
00030 #include "DamselUtil.hpp"
00031
00032 #include "damsel.h"
00033
00034 namespace moab
00035 {
00036
00037 class WriteUtilIface;
00038 class SequenceManager;
00039 class Error;
00040
00041 class WriteDamsel : public WriterIface
00042 {
00043 public:
00044 //! Factory function, for ReaderWriter
00045 static WriterIface* factory( Interface* iface );
00046
00047 //! Constructor
00048 WriteDamsel( Interface* impl );
00049
00050 //! Destructor
00051 virtual ~WriteDamsel();
00052
00053 //! Primary interface function
00054 //! \param file_name Filename being written
00055 //! \param overwrite If true and the file exists, an error is returned
00056 //! \param opts File options, e.g. whether and how to write in parallel
00057 //! \param meshset_list If non-NULL, a vector of sets defining what is to be written
00058 //! \param num_sets The number of sets to be written, only used if meshset_list is non-NULL
00059 //! \param qa_records Strings defining provenance information
00060 //! \param tag_list If non-NULL, only these tags should be written
00061 //! \param num_tags The number of tag handles in tag_list, used only if tag_list is non-NULL
00062 //! \param requested_output_dimension Dimension used for coordinates
00063 ErrorCode write_file( const char* file_name,
00064 const bool /* overwrite */,
00065 const FileOptions& opts,
00066 const EntityHandle* meshset_list,
00067 const int num_sets,
00068 const std::vector< std::string >& /* qa_records */,
00069 const Tag* /* tag_list */ = NULL,
00070 int /* num_tags */ = 0,
00071 int /* requested_output_dimension */ = 3 );
00072
00073 enum
00074 {
00075 DAMSEL_IS_TRACKING = 0x1
00076 } DAMSEL_FLAGS;
00077
00078 private:
00079 //! Initialize global information about dense/sparse/conventional tags, once for entire
00080 //! write_file call
00081 ErrorCode init_tag_info();
00082
00083 //! Write a subrange of entities/sets; just a wrapper to write_[vertices, entities, sets]
00084 ErrorCode write_subrange( RangeSeqIntersectIter& rsi );
00085
00086 //! Write the vertices in the model, for the handles in the specified RangeSeqIntersectIter
00087 //! \param rsi Range sequence iterator defining range of entities/sets to be written
00088 ErrorCode write_vertices( RangeSeqIntersectIter& rsi );
00089
00090 //! Write the entities in the model, for the handles in the specified RangeSeqIntersectIter
00091 //! \param rsi Range sequence iterator defining range of entities/sets to be written
00092 ErrorCode write_entities( RangeSeqIntersectIter& rsi );
00093
00094 //! Write the sets in the model, for the handles in the specified RangeSeqIntersectIter
00095 //! \param rsi Range sequence iterator defining range of entities/sets to be written
00096 ErrorCode write_sets( RangeSeqIntersectIter& rsi );
00097
00098 //! Map dense tags for the specified entities, using the specified damsel entity container
00099 ErrorCode map_dense_tags( RangeSeqIntersectIter& rsi, damsel_container& ent_cont );
00100
00101 //! Map sparse tags for all entities
00102 ErrorCode map_sparse_tags();
00103
00104 //! Interface instance
00105 Interface* mbImpl;
00106
00107 //! WriteUtil object used in this writer
00108 WriteUtilIface* mWriteIface;
00109
00110 //! Used to initialize the RangeSeqIntersectIter
00111 SequenceManager* sequenceManager;
00112
00113 //! File name
00114 std::string fileName;
00115
00116 //! Utility for storing damsel-specific stuff
00117 DamselUtil dU;
00118 };
00119
00120 inline ErrorCode WriteDamsel::write_subrange( RangeSeqIntersectIter& rsi )
00121 {
00122 ErrorCode rval = MB_SUCCESS;
00123
00124 if( MBVERTEX == mbImpl->type_from_handle( rsi.get_start_handle() ) )
00125 rval = write_vertices( rsi );
00126 else if( MBENTITYSET > mbImpl->type_from_handle( rsi.get_start_handle() ) )
00127 rval = write_entities( rsi );
00128 // else
00129 // rval = write_sets(rsi);
00130
00131 return rval;
00132 }
00133
00134 } // namespace moab
00135
00136 #endif