XdmfGrid.hpp 5.84 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 : XdmfGrid.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.                                                 */
/*                                                                           */
/*****************************************************************************/

Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
24 25 26 27 28 29
#ifndef XDMFGRID_HPP_
#define XDMFGRID_HPP_

// Forward Declarations
class XdmfAttribute;
class XdmfGeometry;
30
class XdmfMap;
31
class XdmfSet;
32
class XdmfTime;
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
33 34 35
class XdmfTopology;

// Includes
36
#include "Xdmf.hpp"
37
#include "XdmfItem.hpp"
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
38

39
/**
40 41
 * @brief A mesh containing elements, points, and fields attached to
 * the mesh.
42
 *
43 44 45 46 47 48
 * XdmfGrid represents a mesh. It is required to contain two other
 * Xdmf data structures, an XdmfGeometry that stores point locations
 * and an XdmfTopology that store connectivity
 * information. XdmfAttributes can be inserted into the XdmfGrid to
 * specify fields centered on various parts of the mesh.  XdmfSets can
 * be inserted into XdmfGrids to specify collections of mesh elements.
49
 *
50 51 52
 * XdmfGrid is an abstract base class. There are several
 * implementations for representing both structured and unstructured
 * grids.
53
 */
54
class XDMF_EXPORT XdmfGrid : public virtual XdmfItem {
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
55

56
public:
57 58 59 60 61 62

  virtual ~XdmfGrid() = 0;

  LOKI_DEFINE_VISITABLE(XdmfGrid, XdmfItem);
  XDMF_CHILDREN(XdmfAttribute, Attribute, Name);
  XDMF_CHILDREN(XdmfSet, Set, Name);
63
  XDMF_CHILDREN(XdmfMap, Map, Name);
64 65 66 67 68 69 70
  static const std::string ItemTag;

  /**
   * Get the geometry associated with this grid.
   *
   * @return the geometry associated with this grid.
   */
71
  shared_ptr<const XdmfGeometry> getGeometry() const;
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86

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

  virtual std::string getItemTag() const;

  /**
   * Get the name of the grid.
   *
   * @return the name of the grid.
   */
  std::string getName() const;

  /**
   * Get the time associated with this grid.
   *
87 88
   * @return pointer to the XdmfTime attached to this grid. If no
   * XdmfTime is attached, return a NULL pointer.
89
   */
90
  shared_ptr<XdmfTime> getTime();
91 92 93 94

  /**
   * Get the time associated with this grid (const version).
   *
95 96
   * @return pointer to the XdmfTime attached to this grid. If no
   * XdmfTime is attached, return a NULL pointer.
97
   */
98
  shared_ptr<const XdmfTime> getTime() const;
99 100 101 102 103 104

  /**
   * Get the topology associated with this grid.
   *
   * @return the topology associated with this grid.
   */
105
  shared_ptr<const XdmfTopology> getTopology() const;
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120

  using XdmfItem::insert;

  /**
   * Set the name of the grid.
   *
   * @param name of the grid to set.
   */
  void setName(const std::string & name);

  /**
   * Set the time associated with this grid.
   *
   * @param time an XdmfTime to associate with this grid.
   */
121
  void setTime(const shared_ptr<XdmfTime> time);
122

123
  virtual void traverse(const shared_ptr<XdmfBaseVisitor> visitor);
124

125
protected:
126

127 128
  XdmfGrid(const shared_ptr<XdmfGeometry> geometry,
           const shared_ptr<XdmfTopology> topology,
129 130 131 132
           const std::string & name = "Grid");

  virtual void
  populateItem(const std::map<std::string, std::string> & itemProperties,
133
               std::vector<shared_ptr<XdmfItem> > & childItems,
134 135
               const XdmfCoreReader * const reader);

136 137
  shared_ptr<XdmfGeometry> mGeometry;
  shared_ptr<XdmfTopology> mTopology;
138

139
private:
140 141 142 143 144

  XdmfGrid(const XdmfGrid &);  // Not implemented.
  void operator=(const XdmfGrid &);  // Not implemented.

  std::string mName;
145
  shared_ptr<XdmfTime> mTime;
146

Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
147 148
};

149
#ifdef _WIN32
150
XDMF_TEMPLATE template class XDMF_EXPORT
151
std::allocator<shared_ptr<XdmfAttribute> >;
152
XDMF_TEMPLATE template class XDMF_EXPORT
153 154
std::vector<shared_ptr<XdmfAttribute>,
            std::allocator<shared_ptr<XdmfAttribute> > >;
155
XDMF_TEMPLATE template class XDMF_EXPORT
156
std::allocator<shared_ptr<XdmfSet> >;
157
XDMF_TEMPLATE template class XDMF_EXPORT
158 159
std::vector<shared_ptr<XdmfSet>,
            std::allocator<shared_ptr<XdmfSet> > >;
160
XDMF_TEMPLATE template class XDMF_EXPORT
161
shared_ptr<XdmfGeometry>;
162
XDMF_TEMPLATE template class XDMF_EXPORT
163
shared_ptr<const XdmfGeometry>;
164
XDMF_TEMPLATE template class XDMF_EXPORT
165
shared_ptr<XdmfTopology>;
166
XDMF_TEMPLATE template class XDMF_EXPORT
167
shared_ptr<const XdmfTopology>;
168
XDMF_TEMPLATE template class XDMF_EXPORT
169
shared_ptr<XdmfMap>;
170
XDMF_TEMPLATE template class XDMF_EXPORT
171
shared_ptr<const XdmfMap>;
172
XDMF_TEMPLATE template class XDMF_EXPORT
173
shared_ptr<XdmfTime>;
174
XDMF_TEMPLATE template class XDMF_EXPORT
175
shared_ptr<const XdmfTime>;
176 177
#endif

Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
178
#endif /* XDMFGRID_HPP_ */