XdmfGridCollection.hpp 5.55 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 59
   * @dontinclude ExampleXdmfGridCollection.cpp
   * @skipline New
60 61 62
   *
   * Python
   *
63 64
   * @dontinclude XdmfExampleGridCollection.py
   * @skipline New
65
   *
66 67
   * @return constructed XdmfGridCollection.
   */
68
  static shared_ptr<XdmfGridCollection> New();
69

70
  virtual ~XdmfGridCollection();
71

72 73
  LOKI_DEFINE_VISITABLE(XdmfGridCollection, XdmfGrid);
  static const std::string ItemTag;
74

75
  std::map<std::string, std::string> getItemProperties() const;
76

77
  std::string getItemTag() const;
78

79 80 81
  /**
   * Get the XdmfGridCollectionType associated with this grid collection.
   *
82 83 84 85
   * Example of use:
   *
   * C++
   *
86 87 88
   * @dontinclude ExampleXdmfGridCollection.cpp
   * Assuming that exampleCollection is a shared pointer to an XdmfGridCollection object with its type set
   * @skipline getType
89 90 91
   *
   * Python
   *
92
   * @dontinclude XdmfExampleGridCollection.py
93
   * Assuming that exampleCollection is a shared pointer to an XdmfGridCollection object with its type set
94
   * @skipline getType
95
   *
96 97
   * @return XdmfGridCollectionType of this collection.
   */
98
  shared_ptr<const XdmfGridCollectionType> getType() const;
99

100 101
  using XdmfDomain::insert;
  using XdmfGrid::insert;
102

103
  /**
104
   * Insert an information into the grid collection.
105
   *
106 107 108 109
   * Example of use:
   *
   * C++
   *
110 111 112 113 114
   * @dontinclude ExampleXdmfGridCollection.cpp
   * @skipline exampleInformation
   * @until setValue
   * Assuming that exampleCollection is a shared pointer to an XdmfGridCollection object
   * skipline insert
115 116 117
   *
   * Python
   *
118 119 120 121 122
   * @dontinclude XdmfExampleGridCollection.py
   * @skipline exampleInformation
   * @until setValue
   * Assuming that exampleCollection is a shared pointer to an XdmfGridCollection object
   * @skipline insert
123
   *
124 125
   * @param information an XdmfInformation to attach to this item.
   */
126
  void insert(const shared_ptr<XdmfInformation> information);
127

128
  /**
129 130
   * Set the XdmfGridCollectionType associated with this grid
   * collection.
131
   *
132 133 134 135
   * Example of use:
   *
   * C++
   *
136 137 138
   * @dontinclude ExampleXdmfGridCollection.cpp
   * Assuming that exampleCollection is a shared pointer to an XdmfGridCollection object
   * @skipline setType
139 140 141
   *
   * Python
   *
142
   * @dontinclude XdmfExampleGridCollection.py
143
   * Assuming that exampleCollection is a shared pointer to an XdmfGridCollection object
144
   * @skipline setType
145
   *
146 147
   * @param type the XdmfGridCollectionType to set.
   */
148
  void setType(const shared_ptr<const XdmfGridCollectionType> type);
149

150
  void traverse(const shared_ptr<XdmfBaseVisitor> visitor);
151

152
protected:
153

154
  XdmfGridCollection();
155

156 157
  virtual void
  populateItem(const std::map<std::string, std::string> & itemProperties,
158
               const std::vector<shared_ptr<XdmfItem> > & childItems,
159
               const XdmfCoreReader * const reader);
160

161
private:
162

163 164 165
  XdmfGridCollection(const XdmfGridCollection &);  // Not implemented.
  void operator=(const XdmfGridCollection &);  // Not implemented.

166
  shared_ptr<const XdmfGridCollectionType> mType;
167 168
};

169
#ifdef _WIN32
170
XDMF_TEMPLATE template class XDMF_EXPORT
171
shared_ptr<const XdmfGridCollectionType>;
172 173
#endif

174
#endif /* XDMFGRID_HPP_ */