/[escript]/trunk/weipa/src/RipleyElements.h
ViewVC logotype

Contents of /trunk/weipa/src/RipleyElements.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3792 - (show annotations)
Wed Feb 1 06:16:25 2012 UTC (7 years, 6 months ago) by caltinay
File MIME type: text/plain
File size: 4870 byte(s)
Merged ripley rectangular domain into trunk.

1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2012 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14 #ifndef __WEIPA_RIPLEYELEMENTS_H__
15 #define __WEIPA_RIPLEYELEMENTS_H__
16
17 #include <weipa/ElementData.h>
18 #include <weipa/RipleyNodes.h>
19
20 class DBfile;
21
22 namespace ripley {
23 class RipleyDomain;
24 }
25
26
27 namespace weipa {
28
29 class RipleyElements;
30 typedef boost::shared_ptr<RipleyElements> RipleyElements_ptr;
31
32 /// \brief Stores and manipulates one type of ripley mesh elements (cells,
33 /// faces).
34 ///
35 /// This class provides functionality to manipulate a ripley domain.
36 /// It is able to load element data from NetCDF files or retrieve it from
37 /// a RipleyDomain instance.
38 ///
39 /// \note The corresponding mesh nodes are not part of this class but are
40 /// stored in a NodeData instance.
41 class RipleyElements : public ElementData
42 {
43 public:
44
45 /// \brief Constructor with name and accompanying NodeData object.
46 RipleyElements(const std::string& elementName, RipleyNodes_ptr nodes);
47
48 /// \brief Copy constructor
49 RipleyElements(const RipleyElements& e);
50
51 /// \brief Destructor
52 virtual ~RipleyElements() {}
53
54 /// \brief Initialises with data from a RipleyDomain instance.
55 bool initFromRipley(const ripley::RipleyDomain* ripleyDomain, int fsType);
56
57 /// \brief Moves "ghost" elements (whose owner does not match ownIndex)
58 /// and the corresponding data to the end of the arrays.
59 void reorderGhostZones(int ownIndex);
60
61 /// \brief Removes "ghost" elements.
62 void removeGhostZones(int ownIndex);
63
64 /// \brief Writes connectivity data to a stream in VTK text format.
65 virtual void writeConnectivityVTK(std::ostream& os);
66
67 /// \brief Writes element data into given directory in given Silo file.
68 ///
69 /// Since the mesh depends on element information this method also writes
70 /// the node mesh itself. If Silo was not available at compile time or if
71 /// a Silo function fails this method returns false.
72 bool writeToSilo(DBfile* dbfile, const std::string& siloPath,
73 const StringVec& labels, const StringVec& units,
74 bool writeMeshData);
75
76 /// \brief Returns the names of the meshes associated with the elements.
77 virtual StringVec getMeshNames() const;
78
79 /// \brief Returns a vector with the mesh variable names.
80 virtual StringVec getVarNames() const;
81
82 /// \brief Returns the number of elements.
83 virtual int getNumElements() const { return numElements; }
84
85 /// \brief Returns the number of nodes per element.
86 virtual int getNodesPerElement() const { return nodesPerElement; }
87
88 /// \brief Returns the number of "ghost" elements.
89 virtual int getGhostCount() const { return numGhostElements; }
90
91 /// \brief Returns the type of the elements.
92 virtual ZoneType getType() const { return type; }
93
94 /// \brief Returns a vector of the node IDs used by the elements.
95 virtual const IntVec& getNodeList() const { return nodes; }
96
97 /// \brief Returns a vector of element IDs.
98 virtual const IntVec& getIDs() const { return ID; }
99
100 /// \brief Returns an array of data values for the name provided.
101 ///
102 /// The name must be one of the names returned from getVarNames().
103 virtual const IntVec& getVarDataByName(const std::string varName) const;
104
105 /// \brief Returns the node mesh instance used by the elements.
106 virtual NodeData_ptr getNodes() const { return nodeMesh; }
107
108 /// \brief Returns the reduced elements.
109 virtual ElementData_ptr getReducedElements() const { return ElementData_ptr(); }
110
111 /// \brief Returns a QuadMaskInfo structure for given functionspace code.
112 virtual const QuadMaskInfo& getQuadMask(int functionSpace) const { return quadMask; }
113
114 /// \brief If the original element type is not supported they are
115 /// subdivided into N smaller elements (e.g. one Rec9 -> four Rec4)
116 /// and this method returns the multiplication factor N.
117 virtual int getElementFactor() const { return 1; }
118
119 private:
120 RipleyElements() {}
121 void buildMeshes();
122 IntVec prepareGhostIndices(int ownIndex);
123 void reorderArray(IntVec& v, const IntVec& idx, int elementsPerIndex);
124
125 RipleyNodes_ptr nodeMesh;
126 RipleyNodes_ptr originalMesh;
127 std::string name;
128 int numElements;
129 int numGhostElements;
130 int nodesPerElement;
131 ZoneType type;
132 IntVec NperDim; // num elements per dimension
133 IntVec nodes;
134 IntVec ID, tag, owner;
135 QuadMaskInfo quadMask; // dummy
136 };
137
138 } // namespace weipa
139
140 #endif // __WEIPA_RIPLEYELEMENTS_H__
141

  ViewVC Help
Powered by ViewVC 1.1.26