escript  Revision_
SpeckleyElements.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_SPECKLEYELEMENTS_H__
18 #define __WEIPA_SPECKLEYELEMENTS_H__
19 
20 #include <weipa/ElementData.h>
21 #include <weipa/SpeckleyNodes.h>
22 
23 class DBfile;
24 
25 namespace speckley {
26 class SpeckleyDomain;
27 }
28 
29 
30 namespace weipa {
31 
33 typedef boost::shared_ptr<SpeckleyElements> SpeckleyElements_ptr;
34 
45 {
46 public:
47 
49  SpeckleyElements(const std::string& elementName, SpeckleyNodes_ptr nodes);
50 
53 
55  virtual ~SpeckleyElements() {}
56 
58  bool initFromSpeckley(const speckley::SpeckleyDomain* speckleyDomain, int fsType);
59 
62  void reorderGhostZones(int ownIndex);
63 
65  void removeGhostZones(int ownIndex);
66 
68  virtual void writeConnectivityVTK(std::ostream& os);
69 
75  bool writeToSilo(DBfile* dbfile, const std::string& siloPath,
76  const StringVec& labels, const StringVec& units,
77  bool writeMeshData);
78 
80  virtual StringVec getMeshNames() const;
81 
83  virtual StringVec getVarNames() const;
84 
86  virtual int getNumElements() const { return numElements; }
87 
89  virtual int getNodesPerElement() const { return nodesPerElement; }
90 
92  virtual int getGhostCount() const { return numGhostElements; }
93 
95  virtual ZoneType getType() const { return type; }
96 
98  virtual const IntVec& getNodeList() const { return nodes; }
99 
101  virtual const IntVec& getIDs() const { return ID; }
102 
106  virtual const IntVec& getVarDataByName(const std::string varName) const;
107 
109  virtual NodeData_ptr getNodes() const { return nodeMesh; }
110 
112  virtual ElementData_ptr getReducedElements() const { return ElementData_ptr(); }
113 
115  virtual const QuadMaskInfo& getQuadMask(int functionSpace) const { return quadMask; }
116 
120  virtual int getElementFactor() const { return 1; }
121 
122 private:
124  void buildMeshes();
125  IntVec prepareGhostIndices(int ownIndex);
126  void reorderArray(IntVec& v, const IntVec& idx, int elementsPerIndex);
127 
130  std::string name;
136  IntVec ID, tag, owner;
138 };
139 
140 } // namespace weipa
141 
142 #endif // __WEIPA_SPECKLEYELEMENTS_H__
143 
Definition: AbstractAssembler.cpp:18
This struct holds a mask (0&#39;s and 1&#39;s) that indicates which quad nodes contribute to a sub-element wh...
Definition: ElementData.h:39
virtual const IntVec & getNodeList() const
Returns a vector of the node IDs used by the elements.
Definition: SpeckleyElements.h:98
SpeckleyDomain extends the AbstractContinuousDomain interface for the Speckley library and is the bas...
Definition: speckley/src/SpeckleyDomain.h:84
virtual ZoneType getType() const
Returns the type of the elements.
Definition: SpeckleyElements.h:95
virtual int getElementFactor() const
If the original element type is not supported they are subdivided into N smaller elements (e...
Definition: SpeckleyElements.h:120
IntVec nodes
Definition: SpeckleyElements.h:135
Stores and manipulates one type of domain elements.
Definition: ElementData.h:48
Stores and manipulates one type of speckley mesh elements (cells, faces).
Definition: SpeckleyElements.h:44
virtual const IntVec & getIDs() const
Returns a vector of element IDs.
Definition: SpeckleyElements.h:101
ZoneType type
Definition: SpeckleyElements.h:134
virtual NodeData_ptr getNodes() const
Returns the node mesh instance used by the elements.
Definition: SpeckleyElements.h:109
std::vector< std::string > StringVec
Definition: weipa.h:60
virtual int getNodesPerElement() const
Returns the number of nodes per element.
Definition: SpeckleyElements.h:89
Definition: DataVar.cpp:39
std::string name
Definition: SpeckleyElements.h:130
std::vector< int > IntVec
Definition: weipa.h:59
virtual ~SpeckleyElements()
Destructor.
Definition: SpeckleyElements.h:55
ZoneType
Definition: ElementData.h:26
int nodesPerElement
Definition: SpeckleyElements.h:133
virtual ElementData_ptr getReducedElements() const
Returns the reduced elements.
Definition: SpeckleyElements.h:112
IntVec tag
Definition: SpeckleyElements.h:136
boost::shared_ptr< SpeckleyElements > SpeckleyElements_ptr
Definition: SpeckleyElements.h:32
SpeckleyNodes_ptr originalMesh
Definition: SpeckleyElements.h:129
virtual const QuadMaskInfo & getQuadMask(int functionSpace) const
Returns a QuadMaskInfo structure for given functionspace code.
Definition: SpeckleyElements.h:115
boost::shared_ptr< SpeckleyNodes > SpeckleyNodes_ptr
Definition: SpeckleyNodes.h:30
int numGhostElements
Definition: SpeckleyElements.h:132
boost::shared_ptr< ElementData > ElementData_ptr
Definition: weipa.h:66
SpeckleyNodes_ptr nodeMesh
Definition: SpeckleyElements.h:128
virtual int getGhostCount() const
Returns the number of "ghost" elements.
Definition: SpeckleyElements.h:92
boost::shared_ptr< NodeData > NodeData_ptr
Definition: weipa.h:68
SpeckleyElements()
Definition: SpeckleyElements.h:123
int numElements
Definition: SpeckleyElements.h:131
QuadMaskInfo quadMask
Definition: SpeckleyElements.h:137
virtual int getNumElements() const
Returns the number of elements.
Definition: SpeckleyElements.h:86