escript  Revision_
finley/src/ElementFile.h
Go to the documentation of this file.
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 {
32 
34  int status;
36  int numDim;
41  int numQuadTotal;
43  int numSides;
45  const int* offsets;
47  int numSub;
49  int numShapesTotal;
52  const int* node_selection;
56  double* volume;
59  double* DSDX;
60 };
61 
62 class ElementFile
63 {
64 public:
66  escript::JMPI mpiInfo);
67  ~ElementFile();
68 
70  void allocTable(dim_t NE);
71 
73  void freeTable();
74 
77  void copyTable(index_t offset, index_t nodeOffset, index_t idOffset,
78  const ElementFile* in);
79 
81  void distributeByRankOfDOF(const std::vector<int>& mpiRankOfDOF,
82  index_t* nodesId);
83 
86  void createColoring(const IndexVector& dofMap);
87 
89  void optimizeOrdering();
90 
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 
107  inline std::pair<index_t,index_t> getNodeRange() const;
108 
111  inline void updateTagList();
112 
113 private:
114  void swapTable(ElementFile* other);
115 
116 public:
118 
126  index_t* Id;
127 
129  int* Tag;
130 
132  int* Owner;
133 
135  std::vector<int> tagsInUse;
136 
138  int numNodes;
139 
145 
151 
154 
157 
160 
164 
168 
172 };
173 
174 inline std::pair<index_t,index_t> ElementFile::getNodeRange() const
175 {
177 }
178 
180 {
182 }
183 
184 } // namespace finley
185 
186 #endif // __FINLEY_ELEMENTFILE_H__
187 
finley::ElementFile_Jacobians::ElementFile_Jacobians
ElementFile_Jacobians(const_ShapeFunction_ptr basis)
Definition: finley/src/ElementFile_jacobians.cpp:35
finley::ElementFile::jacobians_reducedS_reducedQ
ElementFile_Jacobians * jacobians_reducedS_reducedQ
Definition: finley/src/ElementFile.h:183
finley::ElementFile::minColor
index_t minColor
minimum color value
Definition: finley/src/ElementFile.h:165
finley::ElementFile::scatter
void scatter(index_t *index, const ElementFile *in)
Definition: finley/src/ElementFile.cpp:156
finley::ElementFile::gather
void gather(const index_t *index, const ElementFile *in)
Definition: finley/src/ElementFile.cpp:137
finley::ElementFile::jacobians
ElementFile_Jacobians * jacobians
jacobians of the shape function used for solution approximation
Definition: finley/src/ElementFile.h:171
finley::ElementFile::allocTable
void allocTable(dim_t NE)
allocates the element table within an element file to hold NE elements
Definition: finley/src/ElementFile.cpp:77
finley::ElementFile::jacobians_reducedS
ElementFile_Jacobians * jacobians_reducedS
Definition: finley/src/ElementFile.h:175
finley::ElementFile_Jacobians::numShapesTotal
int numShapesTotal
total number of shape functions = BasisFunctions->numShapes * numSides
Definition: finley/src/ElementFile.h:74
finley::const_ReferenceElementSet_ptr
boost::shared_ptr< const ReferenceElementSet > const_ReferenceElementSet_ptr
Definition: ReferenceElementSets.h:92
finley::ElementFile::Tag
int * Tag
Tag[i] is the tag of element i.
Definition: finley/src/ElementFile.h:141
finley::ElementFile_Jacobians::volume
double * volume
local volume
Definition: finley/src/ElementFile.h:81
finley::ElementFile_Jacobians::node_selection
const int * node_selection
Definition: finley/src/ElementFile.h:77
NodeFile.h
finley::ElementFile_Jacobians
Definition: finley/src/ElementFile.h:40
finley::ElementFile::createColoring
void createColoring(const IndexVector &dofMap)
Tries to reduce the number of colours used to colour the elements.
Definition: finley/src/ElementFile.cpp:261
finley::ElementFile::relabelNodes
void relabelNodes(const IndexVector &newNode, index_t offset)
finley::ElementFile::~ElementFile
~ElementFile()
destructor
Definition: finley/src/ElementFile.cpp:67
ReferenceElementSets.h
Util.h
finley::ElementFile::setTags
void setTags(const int newTag, const escript::Data &mask)
Definition: finley/src/ElementFile.cpp:228
finley::ElementFile::Nodes
index_t * Nodes
Definition: finley/src/ElementFile.h:156
finley::ElementFile::getNodeRange
std::pair< index_t, index_t > getNodeRange() const
Definition: finley/src/ElementFile.h:186
finley::ElementFile::distributeByRankOfDOF
void distributeByRankOfDOF(const std::vector< int > &mpiRankOfDOF, index_t *nodesId)
redistributes the elements including overlap by rank
Definition: finley/src/ElementFile.cpp:342
finley::ElementFile::maxColor
index_t maxColor
maximum color value
Definition: finley/src/ElementFile.h:168
finley::ElementFile::ElementFile
ElementFile(const_ReferenceElementSet_ptr refElementSet, escript::JMPI mpiInfo)
Definition: finley/src/ElementFile.cpp:41
finley::util::setValuesInUse
void setValuesInUse(const int *values, dim_t numValues, std::vector< int > &valuesInUse, escript::JMPI mpiinfo)
Definition: finley/src/Util.cpp:368
finley::ElementFile_Jacobians::~ElementFile_Jacobians
~ElementFile_Jacobians()
Definition: finley/src/ElementFile_jacobians.cpp:46
finley::ElementFile::numElements
dim_t numElements
number of elements
Definition: finley/src/ElementFile.h:134
finley::ElementFile::jacobians_reducedQ
ElementFile_Jacobians * jacobians_reducedQ
Definition: finley/src/ElementFile.h:179
finley::ElementFile_Jacobians::numElements
dim_t numElements
number of elements
Definition: finley/src/ElementFile.h:79
finley::ElementFile::Owner
int * Owner
Owner[i] contains the rank that owns element i.
Definition: finley/src/ElementFile.h:144
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:63
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:90
finley::ElementFile::MPIInfo
escript::JMPI MPIInfo
Definition: finley/src/ElementFile.h:129
escript::JMPI
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:71
finley::ElementFile::freeTable
void freeTable()
deallocates the element table within an element file
Definition: finley/src/ElementFile.cpp:103
finley::util::getMinMaxInt
IndexPair getMinMaxInt(int dim, dim_t N, const index_t *values)
Definition: finley/src/Util.cpp:303
finley::ElementFile_Jacobians::numQuadTotal
int numQuadTotal
Definition: finley/src/ElementFile.h:66
finley::ElementFile::Color
index_t * Color
Definition: finley/src/ElementFile.h:162
finley::ElementFile::Id
index_t * Id
Definition: finley/src/ElementFile.h:138
finley::ElementFile_Jacobians::offsets
const int * offsets
offset to sides (borrowed reference)
Definition: finley/src/ElementFile.h:70
finley::ElementFile_Jacobians::status
int status
status of mesh when jacobians were updated last time
Definition: finley/src/ElementFile.h:59
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:85
finley::NodeFile
Definition: finley/src/NodeFile.h:40
finley::ElementFile::borrowJacobians
ElementFile_Jacobians * borrowJacobians(const NodeFile *, bool, bool) const
Definition: finley/src/ElementFile_jacobians.cpp:53
finley::ElementFile::copyTable
void copyTable(index_t offset, index_t nodeOffset, index_t idOffset, const ElementFile *in)
Definition: finley/src/ElementFile.cpp:118
finley::ElementFile::swapTable
void swapTable(ElementFile *other)
Definition: finley/src/ElementFile.cpp:173
finley::ElementFile::markNodes
void markNodes(std::vector< short > &mask, int offset, bool useLinear)
Definition: finley/src/ElementFile.cpp:317
finley::ElementFile_Jacobians::numSides
int numSides
number of sides (=1 normal, =2 contact)
Definition: finley/src/ElementFile.h:68
finley::ElementFile::tagsInUse
std::vector< int > tagsInUse
array of tags which are actually used
Definition: finley/src/ElementFile.h:147
Finley.h
finley::ElementFile
Definition: finley/src/ElementFile.h:74
finley::ElementFile_Jacobians::numDim
int numDim
number of spatial dimensions
Definition: finley/src/ElementFile.h:61
finley::const_ShapeFunction_ptr
boost::shared_ptr< const ShapeFunction > const_ShapeFunction_ptr
Definition: ShapeFunctions.h:99
finley::ElementFile_Jacobians::BasisFunctions
const_ShapeFunction_ptr BasisFunctions
basis function used
Definition: finley/src/ElementFile.h:63
finley::ElementFile_Jacobians::DSDX
double * DSDX
Definition: finley/src/ElementFile.h:84
finley::ElementFile::referenceElementSet
const_ReferenceElementSet_ptr referenceElementSet
the reference element to be used
Definition: finley/src/ElementFile.h:132
finley::ElementFile::optimizeOrdering
void optimizeOrdering()
reorders the elements so that they are stored close to the nodes
Definition: finley/src/ElementFile.cpp:186
finley::ElementFile::updateTagList
void updateTagList()
Definition: finley/src/ElementFile.h:191
finley::ElementFile_Jacobians::numSub
int numSub
number of subelements
Definition: finley/src/ElementFile.h:72
finley
A suite of factory methods for creating various finley domains.
Definition: finley/src/Assemble.h:32
escript::DataTypes::IndexVector
std::vector< index_t > IndexVector
Definition: DataTypes.h:88
finley::ElementFile::numNodes
int numNodes
number of nodes per element
Definition: finley/src/ElementFile.h:150