escript  Revision_
SpeckleyNodes.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_SPECKLEYNODES_H__
18 #define __WEIPA_SPECKLEYNODES_H__
19 
20 #include <weipa/NodeData.h>
21 
22 class DBfile;
23 
24 namespace speckley {
25 class SpeckleyDomain;
26 }
27 
28 namespace weipa {
29 
31 typedef boost::shared_ptr<SpeckleyNodes> SpeckleyNodes_ptr;
32 
38 class SpeckleyNodes : public NodeData
39 {
40 public:
42  SpeckleyNodes(const std::string& meshName);
43 
44  SpeckleyNodes(SpeckleyNodes_ptr fullNodes, IntVec& requiredNodes,
45  const std::string& meshName);
46 
48  SpeckleyNodes(const SpeckleyNodes& m);
49 
51  virtual ~SpeckleyNodes();
52 
54  bool initFromSpeckley(const speckley::SpeckleyDomain* speckleyDomain);
55 
57  bool writeToSilo(DBfile* dbfile);
58 
60  virtual void writeCoordinatesVTK(std::ostream& os, int ownIndex);
61 
63  void setSiloPath(const std::string& path) { siloPath = path; }
64 
68  const IntVec& getVarDataByName(const std::string& name) const;
69 
71  virtual StringVec getVarNames() const;
72 
74  virtual std::string getName() const { return name; }
75 
77  std::string getFullSiloName() const;
78 
80  virtual const IntVec& getNodeIDs() const { return nodeID; }
81 
83  virtual const IntVec& getNodeDistribution() const { return nodeDist; }
84 
86  virtual const IntVec& getGlobalNodeIndices() const { return nodeID; }
87 
89  virtual const CoordArray& getCoords() const { return coords; }
90 
92  virtual int getNumDims() const { return numDims; }
93 
95  virtual int getNumNodes() const { return numNodes; }
96 
98  virtual int getGlobalNumNodes() const { return globalNumNodes; }
99 
100 protected:
102  int numDims;
103  int numNodes;
108  std::string name;
109  std::string siloPath;
110 };
111 
112 
113 inline std::string SpeckleyNodes::getFullSiloName() const
114 {
115  std::string result(siloPath);
116  if (result.length() == 0 || *result.rbegin() != '/')
117  result += '/';
118  result += name;
119  return result;
120 }
121 
122 } // namespace weipa
123 
124 #endif // __WEIPA_SPECKLEYNODES_H__
125 
Definition: AbstractAssembler.cpp:18
virtual std::string getName() const
Returns the name of this node mesh.
Definition: SpeckleyNodes.h:74
int globalNumNodes
number of nodes
Definition: SpeckleyNodes.h:104
SpeckleyDomain extends the AbstractContinuousDomain interface for the Speckley library and is the bas...
Definition: speckley/src/SpeckleyDomain.h:84
int numNodes
dimensionality (2 or 3)
Definition: SpeckleyNodes.h:103
std::vector< float * > CoordArray
Definition: weipa.h:61
std::vector< std::string > StringVec
Definition: weipa.h:60
int numDims
x, y[, z] coordinates of nodes
Definition: SpeckleyNodes.h:102
std::string name
node distribution
Definition: SpeckleyNodes.h:108
IntVec nodeTag
node IDs
Definition: SpeckleyNodes.h:106
virtual int getNumDims() const
Returns the dimensionality of this mesh (2 or 3).
Definition: SpeckleyNodes.h:92
Stores and manipulates speckley mesh nodes.
Definition: SpeckleyNodes.h:38
Definition: NodeData.h:26
Definition: DataVar.cpp:39
virtual const IntVec & getNodeDistribution() const
Returns the node distribution array.
Definition: SpeckleyNodes.h:83
virtual int getNumNodes() const
Returns the number of mesh nodes.
Definition: SpeckleyNodes.h:95
std::vector< int > IntVec
Definition: weipa.h:59
boost::shared_ptr< SpeckleyNodes > SpeckleyNodes_ptr
Definition: SpeckleyNodes.h:30
CoordArray coords
Definition: SpeckleyNodes.h:101
std::string siloPath
the name of this node mesh
Definition: SpeckleyNodes.h:109
void setSiloPath(const std::string &path)
Sets the silo path to be used when saving.
Definition: SpeckleyNodes.h:63
IntVec nodeID
global number of nodes
Definition: SpeckleyNodes.h:105
virtual int getGlobalNumNodes() const
Returns the total number of mesh nodes for a distributed mesh.
Definition: SpeckleyNodes.h:98
IntVec nodeDist
node tags
Definition: SpeckleyNodes.h:107
virtual const CoordArray & getCoords() const
Returns the coordinates of the mesh nodes.
Definition: SpeckleyNodes.h:89
virtual const IntVec & getNodeIDs() const
Returns the node ID array.
Definition: SpeckleyNodes.h:80
virtual const IntVec & getGlobalNodeIndices() const
Returns the global node index array.
Definition: SpeckleyNodes.h:86