ESScript  Revision_4488
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 #include <dudley/ElementType.h> // for Dudley_ElementTypeId
23 #include <finley/ReferenceElements.h> // for Finley_ElementTypeId
24 
25 class DBfile;
26 class NcFile;
27 
28 struct Dudley_ElementFile;
29 
30 namespace finley {
31  class ElementFile;
32 }
33 
34 namespace weipa {
35 
39 {
43  const size_t* multiCellIndices;
45  int quadDim;
46 };
47 
49 typedef boost::shared_ptr<FinleyElements> FinleyElements_ptr;
50 
61 {
62 public:
63 
65  FinleyElements(const std::string& elementName, FinleyNodes_ptr nodes);
66 
69 
71  virtual ~FinleyElements() {}
72 
74  bool initFromDudley(const Dudley_ElementFile* dudleyFile);
75 
77  bool initFromFinley(const finley::ElementFile* finleyFile);
78 
80  bool readFromNc(NcFile* ncfile);
81 
84  void reorderGhostZones(int ownIndex);
85 
87  void removeGhostZones(int ownIndex);
88 
90  virtual void writeConnectivityVTK(std::ostream& os);
91 
97  bool writeToSilo(DBfile* dbfile, const std::string& siloPath,
98  const StringVec& labels, const StringVec& units,
99  bool writeMeshData);
100 
102  virtual StringVec getMeshNames() const;
103 
105  virtual StringVec getVarNames() const;
106 
108  virtual int getNumElements() const { return numElements; }
109 
111  virtual int getNodesPerElement() const { return nodesPerElement; }
112 
114  virtual int getGhostCount() const { return numGhostElements; }
115 
117  virtual ZoneType getType() const { return type; }
118 
121 
123  virtual const IntVec& getNodeList() const { return nodes; }
124 
126  virtual const IntVec& getIDs() const { return ID; }
127 
131  virtual const IntVec& getVarDataByName(const std::string varName) const;
132 
134  virtual NodeData_ptr getNodes() const { return nodeMesh; }
135 
138 
140  virtual const QuadMaskInfo& getQuadMask(int functionSpace) const;
141 
145  virtual int getElementFactor() const { return elementFactor; }
146 
147 private:
151  void buildMeshes();
153  IntVec prepareGhostIndices(int ownIndex);
154  void reorderArray(IntVec& v, const IntVec& idx, int elementsPerIndex);
155  QuadMaskInfo buildQuadMask(const CoordArray& quadNodes, int numQNodes);
156 
160  std::string name;
171 };
172 
173 } // namespace weipa
174 
175 #endif // __WEIPA_FINLEYELEMENTS_H__
176