/[escript]/branches/trilinos_from_5897/dudley/src/ElementFile.h
ViewVC logotype

Contents of /branches/trilinos_from_5897/dudley/src/ElementFile.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6079 - (show annotations)
Mon Mar 21 12:22:38 2016 UTC (2 years, 10 months ago) by caltinay
File MIME type: text/plain
File size: 5368 byte(s)
Big commit - making dudley much more like finley to make it more
managable. Fixed quite a few issues that had been fixed in finley.
Disposed of all ReducedNode/ReducedDOF entities that dudley never supported.
Compiles and passes tests.

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The 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 __DUDLEY_ELEMENTFILE_H__
18 #define __DUDLEY_ELEMENTFILE_H__
19
20 #include "Dudley.h"
21 #include "NodeFile.h"
22 #include "ElementType.h"
23 #include "Util.h"
24
25 namespace dudley {
26
27 struct ElementFile_Jacobians
28 {
29 ElementFile_Jacobians();
30 ~ElementFile_Jacobians();
31
32 /// status of mesh when jacobians where updated last time
33 int status;
34 /// number of spatial dimensions
35 dim_t numDim;
36 /// number of quadrature nodes used to calculate jacobians
37 dim_t numQuad;
38 /// number of shape functions
39 dim_t numShapes;
40 /// number of elements
41 dim_t numElements;
42 /// used to compute volume
43 double *absD;
44 /// used to compute volume
45 double quadweight;
46 /// derivatives of shape functions in global coordinates at quadrature
47 /// points
48 double* DSDX;
49 };
50
51 class ElementFile
52 {
53 public:
54 ElementFile(ElementTypeId etype, escript::JMPI MPIInfo);
55 ~ElementFile();
56
57 /// allocates the element table within an element file to hold NE elements
58 void allocTable(dim_t numElements);
59
60 /// deallocates the element table within an element file
61 void freeTable();
62
63 /// copies element file `in` into this element file starting from `offset`.
64 /// The elements `offset` to in->numElements+offset-1 will be overwritten.
65 void copyTable(index_t offset, index_t nodeOffset, index_t idOffset,
66 const ElementFile* in);
67
68 /// redistributes the elements including overlap by rank
69 void distributeByRankOfDOF(const int* mpiRankOfDOF,
70 const index_t* nodesId);
71
72 /// Tries to reduce the number of colors used to color elements in this
73 /// ElementFile
74 void createColoring(dim_t numNodes, const index_t* degreeOfFreedom);
75
76 /// reorders the elements so that they are stored close to the nodes
77 void optimizeOrdering();
78
79 /// assigns new node reference numbers to the elements.
80 /// If k is the old node, the new node is newNode[k-offset].
81 void relabelNodes(const index_t* newNode, index_t offset);
82
83 void markNodes(std::vector<short>& mask, index_t offset) const;
84
85 /// gathers the elements from the element file `in` using
86 /// index[0:out->elements-1]. `index` has to be between 0 and
87 /// in->numElements-1. A conservative assumption on the colouring is made.
88 void gather(const index_t* index, const ElementFile* in);
89
90 /// sets element tags to newTag where mask > 0
91 void setTags(int newTag, const escript::Data& mask);
92
93 ElementFile_Jacobians* borrowJacobians(const NodeFile* nodes,
94 bool reducedOrder) const;
95
96 /// returns the minimum and maximum node reference number of nodes
97 /// describing the elements
98 inline std::pair<index_t,index_t> getNodeRange() const;
99
100 void updateTagList();
101
102 private:
103 void swapTable(ElementFile* other);
104
105 public:
106 escript::JMPI MPIInfo;
107
108 /// number of elements
109 dim_t numElements;
110
111 /// Id[i] is the id number of node i. this number is used when elements
112 /// are resorted. In the entire code the term 'element id' refers to i and
113 /// not to Id[i] unless explicitly stated otherwise.
114 index_t* Id;
115
116 /// Tag[i] is the tag of element i
117 int* Tag;
118
119 /// Owner[i] contains the rank that owns element i
120 int* Owner;
121
122 /// array of tags which are actually used
123 std::vector<int> tagsInUse;
124
125 /// number of nodes per element
126 int numNodes;
127
128 /// Nodes[INDEX(k, i, numNodes)] is the k-th node in the i-the element.
129 index_t* Nodes;
130
131 /// assigns each element a color. Elements with the same color don't share
132 /// a node so they can be processed simultaneously. At any time Color must
133 /// provide a valid value. In any case one can set Color[e]=e for all e.
134 index_t* Color;
135
136 /// minimum color value
137 index_t minColor;
138
139 /// maximum color value
140 index_t maxColor;
141
142 /// number of spatial dimensions of the domain
143 dim_t numDim;
144
145 /// dimension of the element e.g. 2 for a line in 2D or 3D
146 dim_t numLocalDim;
147
148 /// element type ID
149 ElementTypeId etype;
150
151 /// name of element type
152 const char *ename;
153
154 /// number of shape functions
155 dim_t numShapes;
156
157 /// jacobians of the shape function used for solution approximation
158 ElementFile_Jacobians* jacobians;
159
160 /// jacobians of the shape function used for solution approximation for
161 /// reduced integration order
162 ElementFile_Jacobians* jacobians_reducedQ;
163 };
164
165 inline void ElementFile::updateTagList()
166 {
167 util::setValuesInUse(Tag, numElements, tagsInUse, MPIInfo);
168 }
169
170 inline std::pair<index_t,index_t> ElementFile::getNodeRange() const
171 {
172 return util::getMinMaxInt(numNodes, numElements, Nodes);
173 }
174
175 } // namespace dudley
176
177 #endif // __DUDLEY_ELEMENTFILE_H__
178

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26