Escript  Revision_4320
FinleyElements.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 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 since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15 
16 #ifndef __WEIPA_FINLEYELEMENTS_H__
17 #define __WEIPA_FINLEYELEMENTS_H__
18 
19 #include <weipa/ElementData.h>
20 #include <weipa/FinleyNodes.h>
21 
22 extern "C" {
23 #include <dudley/ElementType.h> // for Dudley_ElementTypeId
24 #include <finley/ReferenceElements.h> // for Finley_ElementTypeId
25 }
26 
27 class DBfile;
28 class NcFile;
29 
30 struct Dudley_ElementFile;
31 struct Finley_ElementFile;
32 
33 namespace weipa {
34 
38 {
42  const size_t* multiCellIndices;
44  int quadDim;
45 };
46 
48 typedef boost::shared_ptr<FinleyElements> FinleyElements_ptr;
49 
60 {
61 public:
62 
64  FinleyElements(const std::string& elementName, FinleyNodes_ptr nodes);
65 
68 
70  virtual ~FinleyElements() {}
71 
73  bool initFromDudley(const Dudley_ElementFile* dudleyFile);
74 
76  bool initFromFinley(const Finley_ElementFile* finleyFile);
77 
79  bool readFromNc(NcFile* ncfile);
80 
83  void reorderGhostZones(int ownIndex);
84 
86  void removeGhostZones(int ownIndex);
87 
89  virtual void writeConnectivityVTK(std::ostream& os);
90 
96  bool writeToSilo(DBfile* dbfile, const std::string& siloPath,
97  const StringVec& labels, const StringVec& units,
98  bool writeMeshData);
99 
101  virtual StringVec getMeshNames() const;
102 
104  virtual StringVec getVarNames() const;
105 
107  virtual int getNumElements() const { return numElements; }
108 
110  virtual int getNodesPerElement() const { return nodesPerElement; }
111 
113  virtual int getGhostCount() const { return numGhostElements; }
114 
116  virtual ZoneType getType() const { return type; }
117 
120 
122  virtual const IntVec& getNodeList() const { return nodes; }
123 
125  virtual const IntVec& getIDs() const { return ID; }
126 
130  virtual const IntVec& getVarDataByName(const std::string varName) const;
131 
133  virtual NodeData_ptr getNodes() const { return nodeMesh; }
134 
137 
139  virtual const QuadMaskInfo& getQuadMask(int functionSpace) const;
140 
144  virtual int getElementFactor() const { return elementFactor; }
145 
146 private:
150  void buildMeshes();
152  IntVec prepareGhostIndices(int ownIndex);
153  void reorderArray(IntVec& v, const IntVec& idx, int elementsPerIndex);
154  QuadMaskInfo buildQuadMask(const CoordArray& quadNodes, int numQNodes);
155 
159  std::string name;
170 };
171 
172 } // namespace weipa
173 
174 #endif // __WEIPA_FINLEYELEMENTS_H__
175