ESScript  Revision_
RipleyNodes.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15 
16 #ifndef __WEIPA_RIPLEYNODES_H__
17 #define __WEIPA_RIPLEYNODES_H__
18 
19 #include <weipa/NodeData.h>
20 
21 class DBfile;
22 
23 namespace ripley {
24 class RipleyDomain;
25 }
26 
27 namespace weipa {
28 
30 typedef boost::shared_ptr<RipleyNodes> RipleyNodes_ptr;
31 
37 class RipleyNodes : public NodeData
38 {
39 public:
41  RipleyNodes(const std::string& meshName);
42 
43  RipleyNodes(RipleyNodes_ptr fullNodes, IntVec& requiredNodes,
44  const std::string& meshName);
45 
47  RipleyNodes(const RipleyNodes& m);
48 
50  virtual ~RipleyNodes();
51 
53  bool initFromRipley(const ripley::RipleyDomain* ripleyDomain);
54 
56  bool writeToSilo(DBfile* dbfile);
57 
59  virtual void writeCoordinatesVTK(std::ostream& os, int ownIndex);
60 
62  void setSiloPath(const std::string& path) { siloPath = path; }
63 
67  const IntVec& getVarDataByName(const std::string& name) const;
68 
70  virtual StringVec getVarNames() const;
71 
73  virtual std::string getName() const { return name; }
74 
76  std::string getFullSiloName() const;
77 
79  virtual const IntVec& getNodeIDs() const { return nodeID; }
80 
82  virtual const IntVec& getNodeDistribution() const { return nodeDist; }
83 
85  virtual const IntVec& getGlobalNodeIndices() const { return nodeID; }
86 
88  virtual const CoordArray& getCoords() const { return coords; }
89 
91  virtual int getNumDims() const { return numDims; }
92 
94  virtual int getNumNodes() const { return numNodes; }
95 
97  virtual int getGlobalNumNodes() const { return globalNumNodes; }
98 
99 protected:
101  int numDims;
102  int numNodes;
107  std::string name;
108  std::string siloPath;
109 };
110 
111 
112 inline std::string RipleyNodes::getFullSiloName() const
113 {
114  std::string result(siloPath);
115  if (result.length() == 0 || *result.rbegin() != '/')
116  result += '/';
117  result += name;
118  return result;
119 }
120 
121 } // namespace weipa
122 
123 #endif // __WEIPA_RIPLEYNODES_H__
124