escript  Revision_
FinleyElements.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2017 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 
33 #ifdef NETCDF4
34 #include <ncFile.h>
35 #define NCFTYPE netCDF::NcFile&
36 #else
37 class NcFile;
38 #define NCFTYPE NcFile*
39 #endif
40 
41 namespace dudley {
42  class ElementFile;
43 }
44 
45 namespace finley {
46  class ElementFile;
47 }
48 
49 namespace weipa {
50 
54 {
57  int elementSize, reducedElementSize;
58  const size_t* multiCellIndices;
60  int quadDim;
61 };
62 
64 typedef boost::shared_ptr<FinleyElements> FinleyElements_ptr;
65 
76 {
77 public:
78 
80  FinleyElements(const std::string& elementName, FinleyNodes_ptr nodes);
81 
84 
86  virtual ~FinleyElements() {}
87 
89  bool initFromDudley(const dudley::ElementFile* dudleyFile);
90 
92  bool initFromFinley(const finley::ElementFile* finleyFile);
93 
95  bool readFromNc(NCFTYPE ncfile);
96 
99  void reorderGhostZones(int ownIndex);
100 
102  void removeGhostZones(int ownIndex);
103 
105  virtual void writeConnectivityVTK(std::ostream& os);
106 
112  bool writeToSilo(DBfile* dbfile, const std::string& siloPath,
113  const StringVec& labels, const StringVec& units,
114  bool writeMeshData);
115 
117  virtual StringVec getMeshNames() const;
118 
120  virtual StringVec getVarNames() const;
121 
123  virtual int getNumElements() const { return numElements; }
124 
126  virtual int getNodesPerElement() const { return nodesPerElement; }
127 
129  virtual int getGhostCount() const { return numGhostElements; }
130 
132  virtual ZoneType getType() const { return type; }
133 
134 #ifdef USE_FINLEY
135  finley::ElementTypeId getFinleyTypeId() const { return finleyTypeId; }
137 #endif
138 
140  virtual const IntVec& getNodeList() const { return nodes; }
141 
143  virtual const IntVec& getIDs() const { return ID; }
144 
148  virtual const IntVec& getVarDataByName(const std::string varName) const;
149 
151  virtual NodeData_ptr getNodes() const { return nodeMesh; }
152 
154  virtual ElementData_ptr getReducedElements() const { return reducedElements; }
155 
157  virtual const QuadMaskInfo& getQuadMask(int functionSpace) const;
158 
162  virtual int getElementFactor() const { return elementFactor; }
163 
164 private:
166 #ifdef USE_DUDLEY
167  FinleyElementInfo getDudleyTypeInfo(dudley::ElementTypeId typeId);
168 #endif
169 #ifdef USE_FINLEY
170  FinleyElementInfo getFinleyTypeInfo(finley::ElementTypeId typeId);
171  finley::ElementTypeId finleyTypeId;
172 #endif
173  void buildMeshes();
174  void buildReducedElements(const FinleyElementInfo& f);
175  IntVec prepareGhostIndices(int ownIndex);
176  void reorderArray(IntVec& v, const IntVec& idx, int elementsPerIndex);
177  QuadMaskInfo buildQuadMask(const CoordArray& quadNodes, int numQNodes);
178 
179  FinleyElements_ptr reducedElements;
182  std::string name;
188  IntVec color, ID, tag;
192 };
193 
194 } // namespace weipa
195 
196 #undef NCFTYPE
197 #endif // __WEIPA_FINLEYELEMENTS_H__
198 
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:123
const size_t * multiCellIndices
Definition: FinleyElements.h:58
int numElements
Definition: FinleyElements.h:183
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:140
Stores and manipulates one type of domain elements.
Definition: ElementData.h:48
boost::shared_ptr< FinleyNodes > FinleyNodes_ptr
Definition: FinleyNodes.h:42
Holds information that is used to convert from finley element types to elements supported by Silo and...
Definition: FinleyElements.h:53
int numGhostElements
Definition: FinleyElements.h:184
boost::shared_ptr< FinleyElements > FinleyElements_ptr
Definition: FinleyElements.h:63
virtual ~FinleyElements()
Destructor.
Definition: FinleyElements.h:86
virtual int getGhostCount() const
Returns the number of "ghost" elements.
Definition: FinleyElements.h:129
int nodesPerElement
Definition: FinleyElements.h:185
int elementFactor
Definition: FinleyElements.h:191
bool useQuadNodes
Definition: FinleyElements.h:59
IntVec tag
Definition: FinleyElements.h:188
std::vector< std::string > StringVec
Definition: weipa.h:60
virtual ElementData_ptr getReducedElements() const
Returns the reduced elements.
Definition: FinleyElements.h:154
A suite of factory methods for creating various finley domains.
Definition: finley/src/Assemble.h:31
ZoneType reducedElementType
Definition: FinleyElements.h:55
FinleyNodes_ptr nodeMesh
Definition: FinleyElements.h:180
FinleyElements_ptr reducedElements
Definition: FinleyElements.h:179
Definition: DataVar.cpp:50
#define NCFTYPE
Definition: FinleyElements.h:38
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:151
FinleyNodes_ptr originalMesh
Definition: FinleyElements.h:181
ZoneType type
Definition: FinleyElements.h:186
ElementTypeId
Definition: ElementType.h:24
Stores and manipulates one type of finley mesh elements (cells, faces or contacts).
Definition: FinleyElements.h:75
virtual int getElementFactor() const
If the original element type is not supported they are subdivided into N smaller elements (e...
Definition: FinleyElements.h:162
std::string name
Definition: FinleyElements.h:182
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:60
FinleyElements()
Definition: FinleyElements.h:165
virtual ZoneType getType() const
Returns the type of the elements.
Definition: FinleyElements.h:132
int reducedElementSize
Definition: FinleyElements.h:57
ElementTypeId
Definition: ReferenceElements.h:38
IntVec nodes
Definition: FinleyElements.h:187
virtual const IntVec & getIDs() const
Returns a vector of element IDs.
Definition: FinleyElements.h:143
virtual int getNodesPerElement() const
Returns the number of nodes per element.
Definition: FinleyElements.h:126
boost::shared_ptr< ElementData > ElementData_ptr
Definition: weipa.h:66
IntVec owner
Definition: FinleyElements.h:189
boost::shared_ptr< NodeData > NodeData_ptr
Definition: weipa.h:68
QuadMaskInfo reducedQuadMask
Definition: FinleyElements.h:190
Definition: finley/src/ElementFile.h:61
int elementFactor
Definition: FinleyElements.h:56