escript  Revision_
FinleyNodes.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 #ifndef __WEIPA_FINLEYNODES_H__
18 #define __WEIPA_FINLEYNODES_H__
19 
20 #include <weipa/NodeData.h>
21 
22 class DBfile;
23 class NcFile;
24 
25 namespace finley {
26  class NodeFile;
27 }
28 namespace dudley {
29  class NodeFile;
30 }
31 
32 namespace weipa {
33 
35 typedef boost::shared_ptr<FinleyNodes> FinleyNodes_ptr;
36 
42 class FinleyNodes : public NodeData
43 {
44 public:
46  FinleyNodes(const std::string& meshName);
47 
48  FinleyNodes(FinleyNodes_ptr fullNodes, IntVec& requiredNodes,
49  const std::string& meshName);
50 
52  FinleyNodes(const FinleyNodes& m);
53 
55  virtual ~FinleyNodes();
56 
58  bool initFromDudley(const dudley::NodeFile* dudleyFile);
59 
61  bool initFromFinley(const finley::NodeFile* finleyFile);
62 
64  bool readFromNc(NcFile* ncFile);
65 
67  bool writeToSilo(DBfile* dbfile);
68 
70  virtual void writeCoordinatesVTK(std::ostream& os, int ownIndex);
71 
73  void setSiloPath(const std::string& path) { siloPath = path; }
74 
78  const IntVec& getVarDataByName(const std::string& name) const;
79 
81  virtual StringVec getVarNames() const;
82 
84  virtual std::string getName() const { return name; }
85 
87  std::string getFullSiloName() const;
88 
90  virtual const IntVec& getNodeIDs() const { return nodeID; }
91 
93  virtual const IntVec& getNodeDistribution() const { return nodeDist; }
94 
96  virtual const IntVec& getGlobalNodeIndices() const { return nodeGNI; }
97 
99  virtual const CoordArray& getCoords() const { return coords; }
100 
102  virtual int getNumDims() const { return numDims; }
103 
105  virtual int getNumNodes() const { return numNodes; }
106 
108  virtual int getGlobalNumNodes() const;
109 
110 protected:
112  int numDims;
113  int numNodes;
115  IntVec nodeTag, nodeGDOF, nodeGNI, nodeGRDFI, nodeGRNI;
117  std::string name;
118  std::string siloPath;
119 };
120 
121 
122 inline std::string FinleyNodes::getFullSiloName() const
123 {
124  std::string result(siloPath);
125  if (result.length() == 0 || *result.rbegin() != '/')
126  result += '/';
127  result += name;
128  return result;
129 }
130 
131 } // namespace weipa
132 
133 #endif // __WEIPA_FINLEYNODES_H__
134 
std::vector< float * > CoordArray
Definition: weipa.h:61
boost::shared_ptr< FinleyNodes > FinleyNodes_ptr
Definition: FinleyNodes.h:34
Stores and manipulates finley mesh nodes.
Definition: FinleyNodes.h:42
virtual std::string getName() const
Returns the name of this node mesh.
Definition: FinleyNodes.h:84
std::vector< std::string > StringVec
Definition: weipa.h:60
IntVec nodeID
number of nodes
Definition: FinleyNodes.h:114
A suite of factory methods for creating various finley domains.
Definition: finley/src/Assemble.h:31
int numDims
x, y[, z] coordinates of nodes
Definition: FinleyNodes.h:112
IntVec nodeTag
node IDs
Definition: FinleyNodes.h:115
Definition: NodeData.h:26
Definition: DataVar.cpp:39
virtual const IntVec & getNodeIDs() const
Returns the node ID array.
Definition: FinleyNodes.h:90
std::vector< int > IntVec
Definition: weipa.h:59
std::string siloPath
the name of this node mesh
Definition: FinleyNodes.h:118
Definition: finley/src/NodeFile.h:40
A suite of factory methods for creating 2D and 3D dudley domains.
Definition: dudley/src/Assemble.h:31
virtual int getNumDims() const
Returns the dimensionality of this mesh (2 or 3).
Definition: FinleyNodes.h:102
virtual const CoordArray & getCoords() const
Returns the coordinates of the mesh nodes.
Definition: FinleyNodes.h:99
virtual const IntVec & getGlobalNodeIndices() const
Returns the global node index array.
Definition: FinleyNodes.h:96
CoordArray coords
Definition: FinleyNodes.h:111
virtual int getNumNodes() const
Returns the number of mesh nodes.
Definition: FinleyNodes.h:105
int numNodes
dimensionality (2 or 3)
Definition: FinleyNodes.h:113
std::string name
node distribution
Definition: FinleyNodes.h:117
void setSiloPath(const std::string &path)
Sets the silo path to be used when saving.
Definition: FinleyNodes.h:73
Definition: dudley/src/NodeFile.h:38
virtual const IntVec & getNodeDistribution() const
Returns the node distribution array.
Definition: FinleyNodes.h:93
IntVec nodeDist
Definition: FinleyNodes.h:116