XdmfTopology.hpp 4.25 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 62 63
  /**
   * Create a new XdmfTopology.
   *
   * @return constructed XdmfTopology.
   */
64
  static shared_ptr<XdmfTopology> New();
65

66
  virtual ~XdmfTopology();
67

68 69
  LOKI_DEFINE_VISITABLE(XdmfTopology, XdmfArray);
  static const std::string ItemTag;
70

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

73
  std::string getItemTag() const;
74

75 76 77 78 79 80
  /**
   * Get the number of elements this Topology contains.
   *
   * @return int of number elements in the Topology.
   */
  virtual unsigned int getNumberElements() const;
81

82 83 84 85 86
  /**
   * Get the XdmfTopologyType associated with this topology.
   *
   * @return XdmfTopologyType of the topology.
   */
87
  shared_ptr<const XdmfTopologyType> getType() const;
88

89 90 91 92 93
  /**
   * Set the XdmfTopologyType associated with this topology.
   *
   * @param type the XdmfTopologyType to set.
   */
94
  void setType(const shared_ptr<const XdmfTopologyType> type);
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
95

96
protected:
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
97

98
  XdmfTopology();
99

100 101
  virtual void
  populateItem(const std::map<std::string, std::string> & itemProperties,
102
               std::vector<shared_ptr<XdmfItem> > & childItems,
103
               const XdmfCoreReader * const reader);
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
104

105
private:
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
106

107 108 109
  XdmfTopology(const XdmfTopology &);  // Not implemented.
  void operator=(const XdmfTopology &);  // Not implemented.

110
  shared_ptr<const XdmfTopologyType> mType;
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
111 112
};

113
#ifdef _WIN32
114
XDMF_TEMPLATE template class XDMF_EXPORT
115
shared_ptr<const XdmfTopologyType>;
116 117
#endif

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