Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
WriteDamsel.hpp
Go to the documentation of this file.
1 //-------------------------------------------------------------------------
2 // Filename : WriteDamsel.hpp
3 //
4 // Purpose : ExodusII writer
5 //
6 // Special Notes : Lots of code taken from verde implementation
7 //
8 // Creator : Corey Ernst
9 //
10 // Date : 8/02
11 //
12 // Owner : Corey Ernst
13 //-------------------------------------------------------------------------
14 
15 #ifndef WRITEDAMSEL_HPP
16 #define WRITEDAMSEL_HPP
17 
18 #ifndef IS_BUILDING_MB
19 #error "WriteDamsel.hpp isn't supposed to be included into an application"
20 #endif
21 
22 #include <vector>
23 #include <string>
24 
25 #include "moab/Interface.hpp"
26 #include "moab/Range.hpp"
27 #include "moab/WriterIface.hpp"
29 #include "moab/FileOptions.hpp"
30 #include "DamselUtil.hpp"
31 
32 #include "damsel.h"
33 
34 namespace moab
35 {
36 
37 class WriteUtilIface;
38 class SequenceManager;
39 class Error;
40 
41 class WriteDamsel : public WriterIface
42 {
43  public:
44  //! Factory function, for ReaderWriter
45  static WriterIface* factory( Interface* iface );
46 
47  //! Constructor
48  WriteDamsel( Interface* impl );
49 
50  //! Destructor
51  virtual ~WriteDamsel();
52 
53  //! Primary interface function
54  //! \param file_name Filename being written
55  //! \param overwrite If true and the file exists, an error is returned
56  //! \param opts File options, e.g. whether and how to write in parallel
57  //! \param meshset_list If non-NULL, a vector of sets defining what is to be written
58  //! \param num_sets The number of sets to be written, only used if meshset_list is non-NULL
59  //! \param qa_records Strings defining provenance information
60  //! \param tag_list If non-NULL, only these tags should be written
61  //! \param num_tags The number of tag handles in tag_list, used only if tag_list is non-NULL
62  //! \param requested_output_dimension Dimension used for coordinates
63  ErrorCode write_file( const char* file_name,
64  const bool /* overwrite */,
65  const FileOptions& opts,
66  const EntityHandle* meshset_list,
67  const int num_sets,
68  const std::vector< std::string >& /* qa_records */,
69  const Tag* /* tag_list */ = NULL,
70  int /* num_tags */ = 0,
71  int /* requested_output_dimension */ = 3 );
72 
73  enum
74  {
75  DAMSEL_IS_TRACKING = 0x1
77 
78  private:
79  //! Initialize global information about dense/sparse/conventional tags, once for entire
80  //! write_file call
82 
83  //! Write a subrange of entities/sets; just a wrapper to write_[vertices, entities, sets]
85 
86  //! Write the vertices in the model, for the handles in the specified RangeSeqIntersectIter
87  //! \param rsi Range sequence iterator defining range of entities/sets to be written
89 
90  //! Write the entities in the model, for the handles in the specified RangeSeqIntersectIter
91  //! \param rsi Range sequence iterator defining range of entities/sets to be written
93 
94  //! Write the sets in the model, for the handles in the specified RangeSeqIntersectIter
95  //! \param rsi Range sequence iterator defining range of entities/sets to be written
97 
98  //! Map dense tags for the specified entities, using the specified damsel entity container
99  ErrorCode map_dense_tags( RangeSeqIntersectIter& rsi, damsel_container& ent_cont );
100 
101  //! Map sparse tags for all entities
103 
104  //! Interface instance
106 
107  //! WriteUtil object used in this writer
109 
110  //! Used to initialize the RangeSeqIntersectIter
112 
113  //! File name
114  std::string fileName;
115 
116  //! Utility for storing damsel-specific stuff
118 };
119 
121 {
122  ErrorCode rval = MB_SUCCESS;
123 
125  rval = write_vertices( rsi );
126  else if( MBENTITYSET > mbImpl->type_from_handle( rsi.get_start_handle() ) )
127  rval = write_entities( rsi );
128  // else
129  // rval = write_sets(rsi);
130 
131  return rval;
132 }
133 
134 } // namespace moab
135 
136 #endif