XdmfGridCollection.hpp 5.48 KB
Newer Older
Kenneth Leiter's avatar
Kenneth Leiter committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*****************************************************************************/
/*                                    XDMF                                   */
/*                       eXtensible Data Model and Format                    */
/*                                                                           */
/*  Id : XdmfGridCollection.hpp                                              */
/*                                                                           */
/*  Author:                                                                  */
/*     Kenneth Leiter                                                        */
/*     kenneth.leiter@arl.army.mil                                           */
/*     US Army Research Laboratory                                           */
/*     Aberdeen Proving Ground, MD                                           */
/*                                                                           */
/*     Copyright @ 2011 US Army Research Laboratory                          */
/*     All Rights Reserved                                                   */
/*     See Copyright.txt for details                                         */
/*                                                                           */
/*     This software is distributed WITHOUT ANY WARRANTY; without            */
/*     even the implied warranty of MERCHANTABILITY or FITNESS               */
/*     FOR A PARTICULAR PURPOSE.  See the above copyright notice             */
/*     for more information.                                                 */
/*                                                                           */
/*****************************************************************************/

24 25 26
#ifndef XDMFGRIDCOLLECTION_HPP_
#define XDMFGRIDCOLLECTION_HPP_

27 28 29
// Forward Declarations
class XdmfGridCollectionType;

30
// Includes
31
#include "Xdmf.hpp"
32
#include "XdmfDomain.hpp"
33
#include "XdmfGrid.hpp"
34 35 36 37

/**
 * @brief A spatial or temporal collection of XdmfGrids.
 *
38 39 40 41
 * A temporal collection is timestep data.  Each child grid represents
 * the state at a single timestep.  A spatial collection consists of
 * XdmfGrids that are arranged together in space. E.g. a partitioned
 * mesh.
42
 *
43 44
 * It is valid to nest collections. A spatial collection inside a
 * temporal collection is commonly used.
45
 */
46
class XDMF_EXPORT XdmfGridCollection : public XdmfDomain,
47
                                       public XdmfGrid {
48

49
public:
50

51 52 53
  /**
   * Create a new XdmfGridCollection.
   *
54 55 56 57
   * Example of use:
   *
   * C++
   *
58
   * @dontinclude ExampleXdmfGridCollection.cpp
59 60
   * @skipline //#initalization
   * @until //#initalization
61 62 63
   *
   * Python
   *
64
   * @dontinclude XdmfExampleGridCollection.py
65 66
   * @skipline #//initalization
   * @until #//initalization
67
   *
68 69
   * @return constructed XdmfGridCollection.
   */
70
  static shared_ptr<XdmfGridCollection> New();
71

72
  virtual ~XdmfGridCollection();
73

74 75
  LOKI_DEFINE_VISITABLE(XdmfGridCollection, XdmfGrid);
  static const std::string ItemTag;
76

77
  std::map<std::string, std::string> getItemProperties() const;
78

79
  std::string getItemTag() const;
80

81 82 83
  /**
   * Get the XdmfGridCollectionType associated with this grid collection.
   *
84 85 86 87
   * Example of use:
   *
   * C++
   *
88
   * @dontinclude ExampleXdmfGridCollection.cpp
89 90 91 92
   * @skipline //#initalization
   * @until //#initalization
   * @skipline //#getType
   * @until //#getType
93 94 95
   *
   * Python
   *
96
   * @dontinclude XdmfExampleGridCollection.py
97 98 99 100
   * @skipline #//initalization
   * @until #//initalization
   * @skipline #//getType
   * @until #//getType
101
   *
102 103
   * @return XdmfGridCollectionType of this collection.
   */
104
  shared_ptr<const XdmfGridCollectionType> getType() const;
105

106 107
  using XdmfDomain::insert;
  using XdmfGrid::insert;
108

109
  /**
110
   * Insert an information into the grid collection.
111
   *
112 113 114 115
   * Example of use:
   *
   * C++
   *
116
   * @dontinclude ExampleXdmfGridCollection.cpp
117 118 119 120
   * @skipline //#initalization
   * @until //#initalization
   * @skipline //#insert
   * @until //#insert
121 122 123
   *
   * Python
   *
124
   * @dontinclude XdmfExampleGridCollection.py
125 126 127 128
   * @skipline #//initalization
   * @until #//initalization
   * @skipline #//insert
   * @until #//insert
129
   *
130 131
   * @param information an XdmfInformation to attach to this item.
   */
132
  void insert(const shared_ptr<XdmfInformation> information);
133

134
  /**
135 136
   * Set the XdmfGridCollectionType associated with this grid
   * collection.
137
   *
138 139 140 141
   * Example of use:
   *
   * C++
   *
142
   * @dontinclude ExampleXdmfGridCollection.cpp
143 144 145 146
   * @skipline //#initalization
   * @until //#initalization
   * @skipline //#setType
   * @until //#setType
147 148 149
   *
   * Python
   *
150
   * @dontinclude XdmfExampleGridCollection.py
151 152 153 154
   * @skipline #//initalization
   * @until #//initalization
   * @skipline #//setType
   * @until #//setType
155
   *
156 157
   * @param type the XdmfGridCollectionType to set.
   */
158
  void setType(const shared_ptr<const XdmfGridCollectionType> type);
159

160
  void traverse(const shared_ptr<XdmfBaseVisitor> visitor);
161

162
protected:
163

164
  XdmfGridCollection();
165

166 167
  virtual void
  populateItem(const std::map<std::string, std::string> & itemProperties,
168
               const std::vector<shared_ptr<XdmfItem> > & childItems,
169
               const XdmfCoreReader * const reader);
170

171
private:
172

173 174 175
  XdmfGridCollection(const XdmfGridCollection &);  // Not implemented.
  void operator=(const XdmfGridCollection &);  // Not implemented.

176
  shared_ptr<const XdmfGridCollectionType> mType;
177 178
};

179
#ifdef _WIN32
180
XDMF_TEMPLATE template class XDMF_EXPORT
181
shared_ptr<const XdmfGridCollectionType>;
182 183
#endif

184
#endif /* XDMFGRID_HPP_ */