/[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 2183 - (show annotations)
Fri Dec 19 03:52:50 2008 UTC (11 years, 11 months ago) by caltinay
File MIME type: text/plain
File size: 3061 byte(s)
Added escriptreader library with tools. For more information refer to README
file or wait for user documentation.

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

  ViewVC Help
Powered by ViewVC 1.1.26