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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6651 - (hide annotations)
Wed Feb 7 02:12:08 2018 UTC (21 months, 1 week ago) by jfenwick
File MIME type: text/plain
File size: 6011 byte(s)
Make everyone sad by touching all the files

Copyright dates update

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26