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