Escript  Revision_4320
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 struct Finley_NodeFile;
25 
26 namespace weipa {
27 
29 typedef boost::shared_ptr<FinleyNodes> FinleyNodes_ptr;
30 
36 class FinleyNodes : public NodeData
37 {
38 public:
40  FinleyNodes(const std::string& meshName);
41 
42  FinleyNodes(FinleyNodes_ptr fullNodes, IntVec& requiredNodes,
43  const std::string& meshName);
44 
46  FinleyNodes(const FinleyNodes& m);
47 
49  virtual ~FinleyNodes();
50 
52  bool initFromDudley(const Dudley_NodeFile* dudleyFile);
53 
55  bool initFromFinley(const Finley_NodeFile* finleyFile);
56 
58  bool readFromNc(NcFile* ncFile);
59 
61  bool writeToSilo(DBfile* dbfile);
62 
64  virtual void writeCoordinatesVTK(std::ostream& os, int ownIndex);
65 
67  void setSiloPath(const std::string& path) { siloPath = path; }
68 
72  const IntVec& getVarDataByName(const std::string& name) const;
73 
75  virtual StringVec getVarNames() const;
76 
78  virtual std::string getName() const { return name; }
79 
81  std::string getFullSiloName() const;
82 
84  virtual const IntVec& getNodeIDs() const { return nodeID; }
85 
87  virtual const IntVec& getNodeDistribution() const { return nodeDist; }
88 
90  virtual const IntVec& getGlobalNodeIndices() const { return nodeGNI; }
91 
93  virtual const CoordArray& getCoords() const { return coords; }
94 
96  virtual int getNumDims() const { return numDims; }
97 
99  virtual int getNumNodes() const { return numNodes; }
100 
102  virtual int getGlobalNumNodes() const;
103 
104 protected:
106  int numDims;
107  int numNodes;
111  std::string name;
112  std::string siloPath;
113 };
114 
115 
116 inline std::string FinleyNodes::getFullSiloName() const
117 {
118  std::string result(siloPath);
119  if (result.length() == 0 || *result.rbegin() != '/')
120  result += '/';
121  result += name;
122  return result;
123 }
124 
125 } // namespace weipa
126 
127 #endif // __WEIPA_FINLEYNODES_H__
128