XdmfTopology.hpp 5.45 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 : XdmfTopology.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
#ifndef XDMFTOPOLOGY_HPP_
#define XDMFTOPOLOGY_HPP_

27 28 29
// Forward Declarations
class XdmfTopologyType;

30
// Includes
31
#include "Xdmf.hpp"
32
#include "XdmfArray.hpp"
33

34
/**
35
 * @brief Holds the connectivity information in an XdmfGrid.
36
 *
37 38 39 40
 * XdmfTopology is a required part of an XdmfGrid. It stores the
 * connectivity information for all points contained in an
 * XdmfGrid. XdmfTopology contains an XdmfTopologyType property which
 * should be set that specifies the element type stored.
41 42 43 44 45 46 47 48 49 50 51 52 53
 *
 * In the case of mixed topology types, the connectivity stores
 * topology type ids prior to each element's connectivity
 * information. For element types of varying sizes (Polyvertex,
 * Polyline, and Polygon), the topology type id is followed by a
 * number specifying the number of nodes in the element.  For example,
 * a tetrahedron element (id 6) followed by a polygon element (id 3)
 * with 5 points would look similar the following:
 *
 * 6 20 25 100 200 3 5 300 301 302 303 304
 *
 * The tetrahedron is composed of nodes 20, 25, 100, and 200. The
 * polygon is composed of nodes 300 to 304.
54
 */
55
class XDMF_EXPORT XdmfTopology : public XdmfArray {
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
56

57
public:
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
58

59 60 61
  /**
   * Create a new XdmfTopology.
   *
62 63 64 65
   * Example of use:
   *
   * C++
   *
66 67
   * @dontinclude ExampleXdmfTopology.cpp
   * @skipline New
68 69 70
   *
   * Python
   *
71 72
   * @dontinclude XdmfExampleTopology.py
   * @skipline New
73
   *
74 75
   * @return constructed XdmfTopology.
   */
76
  static shared_ptr<XdmfTopology> New();
77

78
  virtual ~XdmfTopology();
79

80 81
  LOKI_DEFINE_VISITABLE(XdmfTopology, XdmfArray);
  static const std::string ItemTag;
82

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

85
  std::string getItemTag() const;
86

87 88 89
  /**
   * Get the number of elements this Topology contains.
   *
90 91 92 93
   * Example of use:
   *
   * C++
   *
94 95 96
   * @dontinclude ExampleXdmfTopology.cpp
   * Assuming that exampleTopology is a shared pointer to an XdmfTopology object with values set
   * @skipline getNumberElements
97 98 99
   *
   * Python
   *
100
   * @dontinclude XdmfExampleTopology.py
101
   * Assuming that exampleTopology is a shared pointer to an XdmfTopology object with values set
102
   * @skipline getNumberElements
103
   *
104 105 106
   * @return int of number elements in the Topology.
   */
  virtual unsigned int getNumberElements() const;
107

108 109 110
  /**
   * Get the XdmfTopologyType associated with this topology.
   *
111 112 113 114
   * Example of use:
   *
   * C++
   *
115 116 117
   * @dontinclude ExampleXdmfTopology.cpp
   * Assuming that exampleTopology is a shared pointer to an XdmfTopology object with its type set
   * @skipline getType
118 119 120
   *
   * Python
   *
121
   * @dontinclude XdmfExampleTopology.py
122
   * Assuming that exampleTopology is a shared pointer to an XdmfTopology object with its type set
123
   * @skipline getType
124
   *
125 126
   * @return XdmfTopologyType of the topology.
   */
127
  shared_ptr<const XdmfTopologyType> getType() const;
128

129 130 131
  /**
   * Set the XdmfTopologyType associated with this topology.
   *
132 133 134 135
   * Example of use:
   *
   * C++
   *
136 137 138
   * @dontinclude ExampleXdmfTopology.cpp
   * @skipline New
   * @skipline setType
139 140 141
   *
   * Python
   *
142 143 144
   * @dontinclude XdmfExampleTopology.py
   * @skipline New
   * @skipline setType
145
   *
146 147
   * @param type the XdmfTopologyType to set.
   */
148
  void setType(const shared_ptr<const XdmfTopologyType> type);
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
149

150
protected:
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
151

152
  XdmfTopology();
153

154 155
  virtual void
  populateItem(const std::map<std::string, std::string> & itemProperties,
156
               const std::vector<shared_ptr<XdmfItem> > & childItems,
157
               const XdmfCoreReader * const reader);
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
158

159
private:
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
160

161 162 163
  XdmfTopology(const XdmfTopology &);  // Not implemented.
  void operator=(const XdmfTopology &);  // Not implemented.

164
  shared_ptr<const XdmfTopologyType> mType;
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
165 166
};

167
#ifdef _WIN32
168
XDMF_TEMPLATE template class XDMF_EXPORT
169
shared_ptr<const XdmfTopologyType>;
170 171
#endif

Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
172
#endif /* XDMFTOPOLOGY_HPP_ */