escript  Revision_4925
FinleyElements.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2014 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
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 #include <dudley/ElementType.h> // for Dudley_ElementTypeId
24 #include <finley/ReferenceElements.h> // for finley::ElementTypeId
25 
26 class DBfile;
27 class NcFile;
28 
29 struct Dudley_ElementFile;
30 
31 namespace finley {
32  class ElementFile;
33 }
34 
35 namespace weipa {
36 
40 {
44  const size_t* multiCellIndices;
46  int quadDim;
47 };
48 
50 typedef boost::shared_ptr<FinleyElements> FinleyElements_ptr;
51 
62 {
63 public:
64 
66  FinleyElements(const std::string& elementName, FinleyNodes_ptr nodes);
67 
70 
72  virtual ~FinleyElements() {}
73 
75  bool initFromDudley(const Dudley_ElementFile* dudleyFile);
76 
78  bool initFromFinley(const finley::ElementFile* finleyFile);
79 
81  bool readFromNc(NcFile* ncfile);
82 
85  void reorderGhostZones(int ownIndex);
86 
88  void removeGhostZones(int ownIndex);
89 
91  virtual void writeConnectivityVTK(std::ostream& os);
92 
98  bool writeToSilo(DBfile* dbfile, const std::string& siloPath,
99  const StringVec& labels, const StringVec& units,
100  bool writeMeshData);
101 
103  virtual StringVec getMeshNames() const;
104 
106  virtual StringVec getVarNames() const;
107 
109  virtual int getNumElements() const { return numElements; }
110 
112  virtual int getNodesPerElement() const { return nodesPerElement; }
113 
115  virtual int getGhostCount() const { return numGhostElements; }
116 
118  virtual ZoneType getType() const { return type; }
119 
122 
124  virtual const IntVec& getNodeList() const { return nodes; }
125 
127  virtual const IntVec& getIDs() const { return ID; }
128 
132  virtual const IntVec& getVarDataByName(const std::string varName) const;
133 
135  virtual NodeData_ptr getNodes() const { return nodeMesh; }
136 
139 
141  virtual const QuadMaskInfo& getQuadMask(int functionSpace) const;
142 
146  virtual int getElementFactor() const { return elementFactor; }
147 
148 private:
152  void buildMeshes();
154  IntVec prepareGhostIndices(int ownIndex);
155  void reorderArray(IntVec& v, const IntVec& idx, int elementsPerIndex);
156  QuadMaskInfo buildQuadMask(const CoordArray& quadNodes, int numQNodes);
157 
161  std::string name;
172 };
173 
174 } // namespace weipa
175 
176 #endif // __WEIPA_FINLEYELEMENTS_H__
177 
finley::ElementTypeId getFinleyTypeId() const
Returns the original type id of the Finley reference elements.
Definition: FinleyElements.h:121
virtual int getGhostCount() const
Returns the number of "ghost" elements.
Definition: FinleyElements.h:115
finley::ElementTypeId finleyTypeId
Definition: FinleyElements.h:166
IntVec prepareGhostIndices(int ownIndex)
Definition: FinleyElements.cpp:554
This struct holds a mask (0's and 1's) that indicates which quad nodes contribute to a sub-element wh...
Definition: ElementData.h:39
virtual StringVec getMeshNames() const
Returns the names of the meshes associated with the elements.
Definition: FinleyElements.cpp:396
virtual NodeData_ptr getNodes() const
Returns the node mesh instance used by the elements.
Definition: FinleyElements.h:135
const size_t * multiCellIndices
Definition: FinleyElements.h:44
int numElements
Definition: FinleyElements.h:162
std::vector< float * > CoordArray
Definition: weipa.h:57
virtual ElementData_ptr getReducedElements() const
Returns the reduced elements.
Definition: FinleyElements.h:138
Stores and manipulates one type of domain elements.
Definition: ElementData.h:48
QuadMaskInfo buildQuadMask(const CoordArray &quadNodes, int numQNodes)
Definition: FinleyElements.cpp:1097
boost::shared_ptr< FinleyNodes > FinleyNodes_ptr
Definition: FinleyNodes.h:31
virtual const QuadMaskInfo & getQuadMask(int functionSpace) const
Returns a QuadMaskInfo structure for given functionspace code.
Definition: FinleyElements.cpp:444
virtual int getNodesPerElement() const
Returns the number of nodes per element.
Definition: FinleyElements.h:112
void reorderGhostZones(int ownIndex)
Moves "ghost" elements (whose owner does not match ownIndex) and the corresponding data to the end of...
Definition: FinleyElements.cpp:578
Holds information that is used to convert from finley element types to elements supported by Silo and...
Definition: FinleyElements.h:39
int numGhostElements
Definition: FinleyElements.h:163
IntVec ID
Definition: FinleyElements.h:168
boost::shared_ptr< FinleyElements > FinleyElements_ptr
Definition: FinleyElements.h:49
virtual ~FinleyElements()
Destructor.
Definition: FinleyElements.h:72
int nodesPerElement
Definition: FinleyElements.h:164
int elementFactor
Definition: FinleyElements.h:171
virtual const IntVec & getVarDataByName(const std::string varName) const
Returns an array of data values for the name provided.
Definition: FinleyElements.cpp:425
bool useQuadNodes
Definition: FinleyElements.h:45
IntVec tag
Definition: FinleyElements.h:168
std::vector< std::string > StringVec
Definition: weipa.h:56
bool writeToSilo(DBfile *dbfile, const std::string &siloPath, const StringVec &labels, const StringVec &units, bool writeMeshData)
Writes element data into given directory in given Silo file.
Definition: FinleyElements.cpp:679
Dudley_ElementTypeId
Definition: ElementType.h:20
FinleyElementInfo getDudleyTypeInfo(Dudley_ElementTypeId typeId)
Definition: FinleyElements.cpp:789
void buildReducedElements(const FinleyElementInfo &f)
Definition: FinleyElements.cpp:481
ZoneType reducedElementType
Definition: FinleyElements.h:41
FinleyNodes_ptr nodeMesh
Definition: FinleyElements.h:159
FinleyElementInfo getFinleyTypeInfo(finley::ElementTypeId typeId)
Definition: FinleyElements.cpp:834
FinleyElements_ptr reducedElements
Definition: FinleyElements.h:158
bool initFromFinley(const finley::ElementFile *finleyFile)
Initialises with data from a Finley_ElementFile instance.
Definition: FinleyElements.cpp:200
virtual int getNumElements() const
Returns the number of elements.
Definition: FinleyElements.h:109
int elementSize
Definition: FinleyElements.h:43
virtual const IntVec & getNodeList() const
Returns a vector of the node IDs used by the elements.
Definition: FinleyElements.h:124
std::vector< int > IntVec
Definition: weipa.h:55
ZoneType
Definition: ElementData.h:26
bool initFromDudley(const Dudley_ElementFile *dudleyFile)
Initialises with data from a Dudley_ElementFile instance.
Definition: FinleyElements.cpp:147
FinleyNodes_ptr originalMesh
Definition: FinleyElements.h:160
ZoneType type
Definition: FinleyElements.h:165
Stores and manipulates one type of finley mesh elements (cells, faces or contacts).
Definition: FinleyElements.h:61
void removeGhostZones(int ownIndex)
Removes "ghost" elements.
Definition: FinleyElements.cpp:598
std::string name
Definition: FinleyElements.h:161
virtual StringVec getVarNames() const
Returns a vector with the mesh variable names.
Definition: FinleyElements.cpp:412
virtual void writeConnectivityVTK(std::ostream &os)
Writes connectivity data to a stream in VTK text format.
Definition: FinleyElements.cpp:642
virtual int getElementFactor() const
If the original element type is not supported they are subdivided into N smaller elements (e...
Definition: FinleyElements.h:146
int quadDim
Definition: FinleyElements.h:46
virtual ZoneType getType() const
Returns the type of the elements.
Definition: FinleyElements.h:118
virtual const IntVec & getIDs() const
Returns a vector of element IDs.
Definition: FinleyElements.h:127
IntVec color
Definition: FinleyElements.h:168
QuadMaskInfo quadMask
Definition: FinleyElements.h:170
FinleyElements()
Definition: FinleyElements.h:149
int reducedElementSize
Definition: FinleyElements.h:43
ElementTypeId
Definition: ReferenceElements.h:38
ZoneType elementType
Definition: FinleyElements.h:41
IntVec nodes
Definition: FinleyElements.h:167
boost::shared_ptr< ElementData > ElementData_ptr
Definition: weipa.h:62
void reorderArray(IntVec &v, const IntVec &idx, int elementsPerIndex)
Definition: FinleyElements.cpp:458
IntVec owner
Definition: FinleyElements.h:169
boost::shared_ptr< NodeData > NodeData_ptr
Definition: weipa.h:64
bool readFromNc(NcFile *ncfile)
Reads element data from escript/finley NetCDF file.
Definition: FinleyElements.cpp:293
QuadMaskInfo reducedQuadMask
Definition: FinleyElements.h:170
void buildMeshes()
Definition: FinleyElements.cpp:619
Definition: finley/src/ElementFile.h:60
Definition: dudley/src/ElementFile.h:40
int elementFactor
Definition: FinleyElements.h:42