/[escript]/trunk/finley/src/ElementFile.h
ViewVC logotype

Contents of /trunk/finley/src/ElementFile.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6939 - (show annotations)
Mon Jan 20 03:37:18 2020 UTC (4 months, 1 week ago) by uqaeller
File MIME type: text/plain
File size: 6087 byte(s)
Updated the copyright header.


1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2020 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
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-2017 by Centre for Geoscience Computing (GeoComp)
14 * Development from 2019 by School of Earth and Environmental Sciences
15 **
16 *****************************************************************************/
17
18 #ifndef __FINLEY_ELEMENTFILE_H__
19 #define __FINLEY_ELEMENTFILE_H__
20
21 #include "Finley.h"
22 #include "NodeFile.h"
23 #include "ReferenceElementSets.h"
24 #include "Util.h"
25
26 namespace finley {
27
28 struct ElementFile_Jacobians
29 {
30 ElementFile_Jacobians(const_ShapeFunction_ptr basis);
31 ~ElementFile_Jacobians();
32
33 /// status of mesh when jacobians were updated last time
34 int status;
35 /// number of spatial dimensions
36 int numDim;
37 /// basis function used
38 const_ShapeFunction_ptr BasisFunctions;
39 /// total number of quadrature nodes used to calculate jacobians
40 /// = numSub * BasisFunctions->numQuadNodes
41 int numQuadTotal;
42 /// number of sides (=1 normal, =2 contact)
43 int numSides;
44 /// offset to sides (borrowed reference)
45 const int* offsets;
46 /// number of subelements
47 int numSub;
48 /// total number of shape functions = BasisFunctions->numShapes * numSides
49 int numShapesTotal;
50 /// local node selection list of length numSub*numShapesTotal
51 /// (borrowed reference)
52 const int* node_selection;
53 /// number of elements
54 dim_t numElements;
55 /// local volume
56 double* volume;
57 /// derivatives of shape functions in global coordinates at quadrature
58 /// points
59 double* DSDX;
60 };
61
62 class ElementFile
63 {
64 public:
65 ElementFile(const_ReferenceElementSet_ptr refElementSet,
66 escript::JMPI mpiInfo);
67 ~ElementFile();
68
69 /// allocates the element table within an element file to hold NE elements
70 void allocTable(dim_t NE);
71
72 /// deallocates the element table within an element file
73 void freeTable();
74
75 /// copies element file `in` into this element file starting from `offset`.
76 /// The elements `offset` to in->numElements+offset-1 will be overwritten.
77 void copyTable(index_t offset, index_t nodeOffset, index_t idOffset,
78 const ElementFile* in);
79
80 /// redistributes the elements including overlap by rank
81 void distributeByRankOfDOF(const std::vector<int>& mpiRankOfDOF,
82 index_t* nodesId);
83
84 /// Tries to reduce the number of colors used to color elements in this
85 /// ElementFile
86 void createColoring(const IndexVector& dofMap);
87
88 /// reorders the elements so that they are stored close to the nodes
89 void optimizeOrdering();
90
91 /// assigns new node reference numbers to the elements.
92 /// If k is the old node, the new node is newNode[k-offset].
93 void relabelNodes(const IndexVector& newNode, index_t offset);
94
95 void markNodes(std::vector<short>& mask, int offset, bool useLinear);
96
97 void gather(const index_t* index, const ElementFile* in);
98
99 void scatter(index_t* index, const ElementFile* in);
100
101 void setTags(const int newTag, const escript::Data& mask);
102
103 ElementFile_Jacobians* borrowJacobians(const NodeFile*, bool, bool) const;
104
105 /// returns the minimum and maximum reference number of nodes describing
106 /// the elements
107 inline std::pair<index_t,index_t> getNodeRange() const;
108
109 /// updates the list of tags in use. This method must be called by all
110 /// ranks.
111 inline void updateTagList();
112
113 private:
114 void swapTable(ElementFile* other);
115
116 public:
117 escript::JMPI MPIInfo;
118
119 /// the reference element to be used
120 const_ReferenceElementSet_ptr referenceElementSet;
121 /// number of elements
122 dim_t numElements;
123 /// Id[i] is the id number of node i. This number is used when elements
124 /// are resorted. In the entire code the term 'element id' refers to i and
125 /// not to Id[i] unless explicitly stated otherwise.
126 index_t* Id;
127
128 /// Tag[i] is the tag of element i
129 int* Tag;
130
131 /// Owner[i] contains the rank that owns element i
132 int* Owner;
133
134 /// array of tags which are actually used
135 std::vector<int> tagsInUse;
136
137 /// number of nodes per element
138 int numNodes;
139
140 /// Nodes[INDEX(k, i, numNodes)] is the k-th node in the i-th element.
141 /// Note that in the way the nodes are ordered Nodes[INDEX(k, i, numNodes)
142 /// is the k-th node of element i when referring to the linear version of
143 /// the mesh.
144 index_t* Nodes;
145
146 /// assigns each element a color. Elements with the same color don't share
147 /// a node so they can be processed simultaneously.
148 /// At any time Color must provide a valid value. In any case one can set
149 /// Color[e]=e for all e
150 index_t* Color;
151
152 /// minimum color value
153 index_t minColor;
154
155 /// maximum color value
156 index_t maxColor;
157
158 /// jacobians of the shape function used for solution approximation
159 ElementFile_Jacobians* jacobians;
160
161 /// jacobians of the shape function used for solution approximation for
162 /// reduced order of shape function
163 ElementFile_Jacobians* jacobians_reducedS;
164
165 /// jacobians of the shape function used for solution approximation for
166 /// reduced integration order
167 ElementFile_Jacobians* jacobians_reducedQ;
168
169 /// jacobians of the shape function used for solution approximation for
170 /// reduced integration order and reduced order of shape function
171 ElementFile_Jacobians* jacobians_reducedS_reducedQ;
172 };
173
174 inline std::pair<index_t,index_t> ElementFile::getNodeRange() const
175 {
176 return util::getMinMaxInt(numNodes, numElements, Nodes);
177 }
178
179 inline void ElementFile::updateTagList()
180 {
181 util::setValuesInUse(Tag, numElements, tagsInUse, MPIInfo);
182 }
183
184 } // namespace finley
185
186 #endif // __FINLEY_ELEMENTFILE_H__
187

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26