ESScript  Revision_4488
FinleyNodes.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_FINLEYNODES_H__
17 #define __WEIPA_FINLEYNODES_H__
18 
19 #include <weipa/NodeData.h>
20 
21 class DBfile;
22 class NcFile;
23 struct Dudley_NodeFile;
24 namespace finley {
25  class NodeFile;
26 }
27 
28 namespace weipa {
29 
31 typedef boost::shared_ptr<FinleyNodes> FinleyNodes_ptr;
32 
38 class FinleyNodes : public NodeData
39 {
40 public:
42  FinleyNodes(const std::string& meshName);
43 
44  FinleyNodes(FinleyNodes_ptr fullNodes, IntVec& requiredNodes,
45  const std::string& meshName);
46 
48  FinleyNodes(const FinleyNodes& m);
49 
51  virtual ~FinleyNodes();
52 
54  bool initFromDudley(const Dudley_NodeFile* dudleyFile);
55 
57  bool initFromFinley(const finley::NodeFile* finleyFile);
58 
60  bool readFromNc(NcFile* ncFile);
61 
63  bool writeToSilo(DBfile* dbfile);
64 
66  virtual void writeCoordinatesVTK(std::ostream& os, int ownIndex);
67 
69  void setSiloPath(const std::string& path) { siloPath = path; }
70 
74  const IntVec& getVarDataByName(const std::string& name) const;
75 
77  virtual StringVec getVarNames() const;
78 
80  virtual std::string getName() const { return name; }
81 
83  std::string getFullSiloName() const;
84 
86  virtual const IntVec& getNodeIDs() const { return nodeID; }
87 
89  virtual const IntVec& getNodeDistribution() const { return nodeDist; }
90 
92  virtual const IntVec& getGlobalNodeIndices() const { return nodeGNI; }
93 
95  virtual const CoordArray& getCoords() const { return coords; }
96 
98  virtual int getNumDims() const { return numDims; }
99 
101  virtual int getNumNodes() const { return numNodes; }
102 
104  virtual int getGlobalNumNodes() const;
105 
106 protected:
108  int numDims;
109  int numNodes;
113  std::string name;
114  std::string siloPath;
115 };
116 
117 
118 inline std::string FinleyNodes::getFullSiloName() const
119 {
120  std::string result(siloPath);
121  if (result.length() == 0 || *result.rbegin() != '/')
122  result += '/';
123  result += name;
124  return result;
125 }
126 
127 } // namespace weipa
128 
129 #endif // __WEIPA_FINLEYNODES_H__
130