moab
WriteDamsel.hpp
Go to the documentation of this file.
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 <vector>
00023 #include <string>
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 class WriteUtilIface;
00037 class SequenceManager;
00038 class Error;
00039 
00040 class WriteDamsel : public WriterIface
00041 {
00042  
00043 public:
00045   static WriterIface* factory( Interface* iface );
00046 
00048   WriteDamsel(Interface *impl);
00049 
00051   virtual ~WriteDamsel();
00052 
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 {DAMSEL_IS_TRACKING = 0x1
00074   } DAMSEL_FLAGS;
00075   
00076 private:
00077 
00079   ErrorCode init_tag_info();
00080 
00082   ErrorCode write_subrange(RangeSeqIntersectIter &rsi);
00083   
00086   ErrorCode write_vertices(RangeSeqIntersectIter &rsi);
00087   
00090   ErrorCode write_entities(RangeSeqIntersectIter &rsi);
00091   
00094   ErrorCode write_sets(RangeSeqIntersectIter &rsi);
00095   
00097   ErrorCode map_dense_tags(RangeSeqIntersectIter &rsi, damsel_container &ent_cont);
00098 
00100   ErrorCode map_sparse_tags();
00101 
00103   Interface *mbImpl;
00104 
00106   WriteUtilIface* mWriteIface;
00107 
00109   Error *mError;
00110   
00112   SequenceManager *sequenceManager;
00113 
00115   std::string fileName;
00116 
00118   DamselUtil dU;
00119 };
00120 
00121 inline ErrorCode WriteDamsel::write_subrange(RangeSeqIntersectIter &rsi) 
00122 {
00123   ErrorCode rval = MB_SUCCESS;
00124 
00125   if (MBVERTEX == mbImpl->type_from_handle(rsi.get_start_handle())) 
00126     rval = write_vertices(rsi);
00127 
00128   else if (MBENTITYSET > mbImpl->type_from_handle(rsi.get_start_handle())) 
00129     rval = write_entities(rsi);
00130 
00131 //  else
00132 //    rval = write_sets(rsi);
00133 
00134   return rval;
00135 }
00136 
00137 } // namespace moab
00138 
00139 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines