XdmfGraph.hpp 3.53 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 24 25 26 27 28 29 30 31
/*****************************************************************************/
/*                                    XDMF                                   */
/*                       eXtensible Data Model and Format                    */
/*                                                                           */
/*  Id : XdmfGraph.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.                                                 */
/*                                                                           */
/*****************************************************************************/

#ifndef XDMFGRAPH_HPP_
#define XDMFGRAPH_HPP_

// Forward Declarations
class XdmfAttribute;

// Includes
#include "Xdmf.hpp"
Andrew J. Burns (Cont's avatar
Andrew J. Burns (Cont committed
32
#include "XdmfTime.hpp"
Kenneth Leiter's avatar
Kenneth Leiter committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#include "XdmfSparseMatrix.hpp"

/**
 * @brief Graph stored in sparse matrix form.
 *
 * Stores graph information in sparse matrix form. Attributes defining
 * node and edge information can be inserted.
 */
class XDMF_EXPORT XdmfGraph : public XdmfSparseMatrix {

public:

  /**
   * Create a new XdmfGraph.
   *
48 49 50 51 52
   * Example of use:
   *
   * C++
   *
   * @dontinclude ExampleXdmfGraph.cpp
53 54
   * @skipline //#initialization
   * @until //#initialization
55 56 57 58
   *
   * Python
   *
   * @dontinclude XdmfExampleGraph.py
59 60
   * @skipline #//initialization
   * @until #//initialization
61
   *
Kenneth Leiter's avatar
Kenneth Leiter committed
62 63
   * @param numberNodes number of nodes in graph.
   *
64
   * @return    Constructed XdmfGraph.
Kenneth Leiter's avatar
Kenneth Leiter committed
65 66 67 68 69
   */
  static shared_ptr<XdmfGraph> New(const unsigned int numberNodes);

  virtual ~XdmfGraph();

70 71
  LOKI_DEFINE_VISITABLE(XdmfGraph, XdmfSparseMatrix)
  XDMF_CHILDREN(XdmfGraph, XdmfAttribute, Attribute, Name)
Kenneth Leiter's avatar
Kenneth Leiter committed
72 73 74 75
  static const std::string ItemTag;

  std::string getItemTag() const;

76 77 78 79
  shared_ptr<XdmfTime> getTime();

  shared_ptr<const XdmfTime> getTime() const;

Kenneth Leiter's avatar
Kenneth Leiter committed
80 81
  unsigned int getNumberNodes() const;

82 83
  using XdmfSparseMatrix::insert;

84 85
  void setTime(const shared_ptr<XdmfTime> time);

Kenneth Leiter's avatar
Kenneth Leiter committed
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
  void traverse(const shared_ptr<XdmfBaseVisitor> visitor);

protected:

  XdmfGraph(const unsigned int numberNodes);

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

private:

  XdmfGraph(const XdmfGraph &);  // Not implemented.
  void operator=(const XdmfGraph &);  // Not implemented.
101 102

  shared_ptr<XdmfTime> mTime;
Kenneth Leiter's avatar
Kenneth Leiter committed
103 104 105 106 107 108
};

#ifdef _WIN32
#endif

#endif /* XDMFGRAPH_HPP_ */