/[escript]/trunk/tools/libescriptreader/src/escriptreader/ElementData.h
ViewVC logotype

Contents of /trunk/tools/libescriptreader/src/escriptreader/ElementData.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2187 - (show annotations)
Tue Dec 23 04:13:15 2008 UTC (12 years, 5 months ago) by caltinay
File MIME type: text/plain
File size: 3289 byte(s)
Moved escriptreader related classes into own namespace.

1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2008 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 //
15 // ElementData.h
16 //
17 #ifndef __ELEMENTDATA_H__
18 #define __ELEMENTDATA_H__
19
20 #include <finley/ReferenceElements.h> // for ElementTypeId
21 #include <escriptreader/Mesh.h>
22
23 class DBfile;
24 class NcFile;
25
26 namespace EscriptReader {
27
28 typedef enum {
29 ZONETYPE_BEAM=1,
30 ZONETYPE_HEX,
31 ZONETYPE_POLYGON,
32 ZONETYPE_QUAD,
33 ZONETYPE_TET,
34 ZONETYPE_TRIANGLE
35 } ZoneType;
36
37 struct FinleyElementInfo
38 {
39 ZoneType elementType, reducedElementType;
40 int elementFactor;
41 int elementSize, reducedElementSize;
42 const size_t* multiCellIndices;
43 };
44
45 //
46 //
47 //
48 class ElementData
49 {
50 friend class DataVar;
51 friend class MeshWithElements;
52 public:
53 ElementData(const std::string& elementName, const Mesh* mainMesh);
54
55 /// Copy constructor
56 ElementData(const ElementData& e);
57
58 /// Virtual destructor
59 virtual ~ElementData();
60
61 bool readFromNc(NcFile* ncfile);
62 void handleGhostZones(int ownIndex);
63 void removeGhostZones();
64 bool writeToSilo(DBfile* dbfile, const std::string& siloPath);
65
66 StringVec getMeshNames() const;
67 StringVec getVarNames() const;
68 int getCount() const { return count; }
69 int getReducedCount() const { return reducedCount; }
70 int getNodesPerElement() const { return nodesPerElement; }
71 int getReducedNodesPerElement() const { return reducedNodesPerElement; }
72 int getGhostCount() const { return numGhostElements; }
73 int getReducedGhostCount() const { return numReducedGhostElements; }
74 ZoneType getType() const { return type; }
75 ZoneType getReducedType() const { return reducedType; }
76 const IntVec& getNodeList() const { return nodes; }
77 const IntVec& getReducedNodeList() const { return reducedNodes; }
78 const IntVec& getIDs() const { return ID; }
79
80 private:
81 ElementData() {}
82 FinleyElementInfo getFinleyTypeInfo(ElementTypeId typeId);
83 void buildIndexMap();
84 void buildMeshes();
85 void buildReducedElements(const FinleyElementInfo& f);
86 void prepareGhostIndices(int ownIndex);
87 void reorderArray(IntVec& v, const IntVec& idx, int elementsPerIndex);
88
89 const IntVec& getVarDataByName(const std::string varName) const;
90
91 std::string name;
92 int count, reducedCount;
93 int numGhostElements, numReducedGhostElements;
94 IndexMap ID2idx;
95 IntVec indexArray, reducedIndexArray;
96 Mesh* fullMesh;
97 Mesh* reducedMesh;
98 const Mesh* originalMesh;
99 bool fullMeshIsOriginalMesh;
100
101 int numDims;
102 ZoneType type, reducedType;
103 int nodesPerElement, reducedNodesPerElement;
104 IntVec nodes, reducedNodes;
105 IntVec color, ID, tag;
106 IntVec owner, reducedOwner;
107 };
108
109 //
110 //
111 //
112 inline void ElementData::buildIndexMap()
113 {
114 ID2idx.clear();
115 size_t idx = 0;
116 IntVec::const_iterator idIt;
117 for (idIt = ID.begin(); idIt != ID.end(); idIt++, idx++)
118 ID2idx[*idIt] = idx;
119 }
120
121 } // namespace EscriptReader
122
123 #endif // __ELEMENTDATA_H__
124

  ViewVC Help
Powered by ViewVC 1.1.26