escript  Revision_Unversioneddirectory
FinleyElements.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_FINLEYELEMENTS_H__
18 #define __WEIPA_FINLEYELEMENTS_H__
19 
20 #include <weipa/ElementData.h>
21 #include <weipa/FinleyNodes.h>
22 
23 #ifdef USE_DUDLEY
24 #include <dudley/ElementType.h> // for Dudley_ElementTypeId
25 #endif
26 #ifdef USE_FINLEY
27 #include <finley/ReferenceElements.h> // for finley::ElementTypeId
28 #endif
29 
30 class DBfile;
31 class NcFile;
32 
33 struct Dudley_ElementFile;
34 
35 namespace finley {
36  class ElementFile;
37 }
38 
39 namespace weipa {
40 
44 {
47  int elementSize, reducedElementSize;
48  const size_t* multiCellIndices;
50  int quadDim;
51 };
52 
54 typedef boost::shared_ptr<FinleyElements> FinleyElements_ptr;
55 
66 {
67 public:
68 
70  FinleyElements(const std::string& elementName, FinleyNodes_ptr nodes);
71 
74 
76  virtual ~FinleyElements() {}
77 
79  bool initFromDudley(const Dudley_ElementFile* dudleyFile);
80 
82  bool initFromFinley(const finley::ElementFile* finleyFile);
83 
85  bool readFromNc(NcFile* ncfile);
86 
89  void reorderGhostZones(int ownIndex);
90 
92  void removeGhostZones(int ownIndex);
93 
95  virtual void writeConnectivityVTK(std::ostream& os);
96 
102  bool writeToSilo(DBfile* dbfile, const std::string& siloPath,
103  const StringVec& labels, const StringVec& units,
104  bool writeMeshData);
105 
107  virtual StringVec getMeshNames() const;
108 
110  virtual StringVec getVarNames() const;
111 
113  virtual int getNumElements() const { return numElements; }
114 
116  virtual int getNodesPerElement() const { return nodesPerElement; }
117 
119  virtual int getGhostCount() const { return numGhostElements; }
120 
122  virtual ZoneType getType() const { return type; }
123 
124 #ifdef USE_FINLEY
125  finley::ElementTypeId getFinleyTypeId() const { return finleyTypeId; }
127 #endif
128 
130  virtual const IntVec& getNodeList() const { return nodes; }
131 
133  virtual const IntVec& getIDs() const { return ID; }
134 
138  virtual const IntVec& getVarDataByName(const std::string varName) const;
139 
141  virtual NodeData_ptr getNodes() const { return nodeMesh; }
142 
144  virtual ElementData_ptr getReducedElements() const { return reducedElements; }
145 
147  virtual const QuadMaskInfo& getQuadMask(int functionSpace) const;
148 
152  virtual int getElementFactor() const { return elementFactor; }
153 
154 private:
156 #ifdef USE_DUDLEY
157  FinleyElementInfo getDudleyTypeInfo(Dudley_ElementTypeId typeId);
158 #endif
159 #ifdef USE_FINLEY
160  FinleyElementInfo getFinleyTypeInfo(finley::ElementTypeId typeId);
161  finley::ElementTypeId finleyTypeId;
162 #endif
163  void buildMeshes();
164  void buildReducedElements(const FinleyElementInfo& f);
165  IntVec prepareGhostIndices(int ownIndex);
166  void reorderArray(IntVec& v, const IntVec& idx, int elementsPerIndex);
167  QuadMaskInfo buildQuadMask(const CoordArray& quadNodes, int numQNodes);
168 
169  FinleyElements_ptr reducedElements;
172  std::string name;
178  IntVec color, ID, tag;
182 };
183 
184 } // namespace weipa
185 
186 #endif // __WEIPA_FINLEYELEMENTS_H__
187 
virtual int getGhostCount() const
Returns the number of "ghost" elements.
Definition: FinleyElements.h:119
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 NodeData_ptr getNodes() const
Returns the node mesh instance used by the elements.
Definition: FinleyElements.h:141
const size_t * multiCellIndices
Definition: FinleyElements.h:48
int numElements
Definition: FinleyElements.h:173
std::vector< float * > CoordArray
Definition: weipa.h:57
virtual ElementData_ptr getReducedElements() const
Returns the reduced elements.
Definition: FinleyElements.h:144
Stores and manipulates one type of domain elements.
Definition: ElementData.h:48
boost::shared_ptr< FinleyNodes > FinleyNodes_ptr
Definition: FinleyNodes.h:31
virtual int getNodesPerElement() const
Returns the number of nodes per element.
Definition: FinleyElements.h:116
Holds information that is used to convert from finley element types to elements supported by Silo and...
Definition: FinleyElements.h:43
int numGhostElements
Definition: FinleyElements.h:174
boost::shared_ptr< FinleyElements > FinleyElements_ptr
Definition: FinleyElements.h:53
virtual ~FinleyElements()
Destructor.
Definition: FinleyElements.h:76
int nodesPerElement
Definition: FinleyElements.h:175
int elementFactor
Definition: FinleyElements.h:181
bool useQuadNodes
Definition: FinleyElements.h:49
IntVec tag
Definition: FinleyElements.h:178
std::vector< std::string > StringVec
Definition: weipa.h:56
Dudley_ElementTypeId
Definition: ElementType.h:20
Definition: finley/src/Assemble.h:32
ZoneType reducedElementType
Definition: FinleyElements.h:45
FinleyNodes_ptr nodeMesh
Definition: FinleyElements.h:170
FinleyElements_ptr reducedElements
Definition: FinleyElements.h:169
Definition: DataVar.cpp:43
virtual int getNumElements() const
Returns the number of elements.
Definition: FinleyElements.h:113
virtual const IntVec & getNodeList() const
Returns a vector of the node IDs used by the elements.
Definition: FinleyElements.h:130
std::vector< int > IntVec
Definition: weipa.h:55
ZoneType
Definition: ElementData.h:26
FinleyNodes_ptr originalMesh
Definition: FinleyElements.h:171
ZoneType type
Definition: FinleyElements.h:176
Stores and manipulates one type of finley mesh elements (cells, faces or contacts).
Definition: FinleyElements.h:65
std::string name
Definition: FinleyElements.h:172
virtual int getElementFactor() const
If the original element type is not supported they are subdivided into N smaller elements (e...
Definition: FinleyElements.h:152
int quadDim
Definition: FinleyElements.h:50
virtual ZoneType getType() const
Returns the type of the elements.
Definition: FinleyElements.h:122
virtual const IntVec & getIDs() const
Returns a vector of element IDs.
Definition: FinleyElements.h:133
FinleyElements()
Definition: FinleyElements.h:155
int reducedElementSize
Definition: FinleyElements.h:47
ElementTypeId
Definition: ReferenceElements.h:38
IntVec nodes
Definition: FinleyElements.h:177
boost::shared_ptr< ElementData > ElementData_ptr
Definition: weipa.h:62
IntVec owner
Definition: FinleyElements.h:179
boost::shared_ptr< NodeData > NodeData_ptr
Definition: weipa.h:64
QuadMaskInfo reducedQuadMask
Definition: FinleyElements.h:180
Definition: finley/src/ElementFile.h:60
Definition: dudley/src/ElementFile.h:40
int elementFactor
Definition: FinleyElements.h:46