/[escript]/branches/split/weipa/src/RipleyElements.h
ViewVC logotype

Contents of /branches/split/weipa/src/RipleyElements.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4724 - (show annotations)
Thu Mar 6 05:22:12 2014 UTC (5 years, 1 month ago) by jfenwick
File MIME type: text/plain
File size: 5007 byte(s)
Work towards parallel domains

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

  ViewVC Help
Powered by ViewVC 1.1.26