finley/src/ElementFile.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2020 by The University of Queensland
* http://www.uq.edu.au
*
* Primary Business: Queensland, Australia
* Licensed under the Apache License, version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
* Development 2012-2013 by School of Earth Sciences
* Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
* Development from 2019 by School of Earth and Environmental Sciences
**
*****************************************************************************/
#ifndef __FINLEY_ELEMENTFILE_H__
#define __FINLEY_ELEMENTFILE_H__
#include "Finley.h"
#include "NodeFile.h"
#include "ReferenceElementSets.h"
#include "Util.h"
namespace finley {
struct ElementFile_Jacobians
{
ElementFile_Jacobians(const_ShapeFunction_ptr basis);
~ElementFile_Jacobians();
int status;
int numDim;
const_ShapeFunction_ptr BasisFunctions;
int numQuadTotal;
int numSides;
const int* offsets;
int numSub;
int numShapesTotal;
const int* node_selection;
dim_t numElements;
double* volume;
double* DSDX;
};
class ElementFile
{
public:
ElementFile(const_ReferenceElementSet_ptr refElementSet,
escript::JMPI mpiInfo);
~ElementFile();
void allocTable(dim_t NE);
void freeTable();
void copyTable(index_t offset, index_t nodeOffset, index_t idOffset,
const ElementFile* in);
void distributeByRankOfDOF(const std::vector<int>& mpiRankOfDOF,
index_t* nodesId);
void createColoring(const IndexVector& dofMap);
void optimizeOrdering();
void relabelNodes(const IndexVector& newNode, index_t offset);
void markNodes(std::vector<short>& mask, int offset, bool useLinear);
void gather(const index_t* index, const ElementFile* in);
void scatter(index_t* index, const ElementFile* in);
void setTags(const int newTag, const escript::Data& mask);
ElementFile_Jacobians* borrowJacobians(const NodeFile*, bool, bool) const;
inline std::pair<index_t,index_t> getNodeRange() const;
inline void updateTagList();
private:
void swapTable(ElementFile* other);
public:
escript::JMPI MPIInfo;
const_ReferenceElementSet_ptr referenceElementSet;
dim_t numElements;
index_t* Id;
int* Tag;
int* Owner;
std::vector<int> tagsInUse;
int numNodes;
index_t* Nodes;
index_t* Color;
index_t minColor;
index_t maxColor;
ElementFile_Jacobians* jacobians;
ElementFile_Jacobians* jacobians_reducedS;
ElementFile_Jacobians* jacobians_reducedQ;
ElementFile_Jacobians* jacobians_reducedS_reducedQ;
};
inline std::pair<index_t,index_t> ElementFile::getNodeRange() const
{
return util::getMinMaxInt(numNodes, numElements, Nodes);
}
inline void ElementFile::updateTagList()
{
util::setValuesInUse(Tag, numElements, tagsInUse, MPIInfo);
}
} // namespace finley
#endif // __FINLEY_ELEMENTFILE_H__
Finley.h
ReferenceElementSets.h
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:64
finley::ElementFile
Definition: finley/src/ElementFile.h:63
finley::ElementFile::Nodes
index_t * Nodes
Definition: finley/src/ElementFile.h:144
finley::ElementFile::minColor
index_t minColor
minimum color value
Definition: finley/src/ElementFile.h:153
finley::ElementFile::ElementFile
ElementFile(const_ReferenceElementSet_ptr refElementSet, escript::JMPI mpiInfo)
Definition: finley/src/ElementFile.cpp:29
finley::ElementFile::freeTable
void freeTable()
deallocates the element table within an element file
Definition: finley/src/ElementFile.cpp:91
finley::ElementFile::jacobians_reducedQ
ElementFile_Jacobians * jacobians_reducedQ
Definition: finley/src/ElementFile.h:167
finley::ElementFile::getNodeRange
std::pair< index_t, index_t > getNodeRange() const
Definition: finley/src/ElementFile.h:174
finley::ElementFile::setTags
void setTags(const int newTag, const escript::Data &mask)
Definition: finley/src/ElementFile.cpp:216
finley::ElementFile::swapTable
void swapTable(ElementFile *other)
Definition: finley/src/ElementFile.cpp:161
finley::ElementFile::optimizeOrdering
void optimizeOrdering()
reorders the elements so that they are stored close to the nodes
Definition: finley/src/ElementFile.cpp:174
finley::ElementFile::Id
index_t * Id
Definition: finley/src/ElementFile.h:126
finley::ElementFile::scatter
void scatter(index_t *index, const ElementFile *in)
Definition: finley/src/ElementFile.cpp:144
finley::ElementFile::maxColor
index_t maxColor
maximum color value
Definition: finley/src/ElementFile.h:156
finley::ElementFile::MPIInfo
escript::JMPI MPIInfo
Definition: finley/src/ElementFile.h:117
finley::ElementFile::Tag
int * Tag
Tag[i] is the tag of element i.
Definition: finley/src/ElementFile.h:129
finley::ElementFile::copyTable
void copyTable(index_t offset, index_t nodeOffset, index_t idOffset, const ElementFile *in)
Definition: finley/src/ElementFile.cpp:106
finley::ElementFile::relabelNodes
void relabelNodes(const IndexVector &newNode, index_t offset)
finley::ElementFile::Color
index_t * Color
Definition: finley/src/ElementFile.h:150
finley::ElementFile::tagsInUse
std::vector< int > tagsInUse
array of tags which are actually used
Definition: finley/src/ElementFile.h:135
finley::ElementFile::jacobians_reducedS_reducedQ
ElementFile_Jacobians * jacobians_reducedS_reducedQ
Definition: finley/src/ElementFile.h:171
finley::ElementFile::gather
void gather(const index_t *index, const ElementFile *in)
Definition: finley/src/ElementFile.cpp:125
finley::ElementFile::updateTagList
void updateTagList()
Definition: finley/src/ElementFile.h:179
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:330
finley::ElementFile::~ElementFile
~ElementFile()
destructor
Definition: finley/src/ElementFile.cpp:55
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:65
finley::ElementFile::jacobians_reducedS
ElementFile_Jacobians * jacobians_reducedS
Definition: finley/src/ElementFile.h:163
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:249
finley::ElementFile::referenceElementSet
const_ReferenceElementSet_ptr referenceElementSet
the reference element to be used
Definition: finley/src/ElementFile.h:120
finley::ElementFile::numNodes
int numNodes
number of nodes per element
Definition: finley/src/ElementFile.h:138
finley::ElementFile::borrowJacobians
ElementFile_Jacobians * borrowJacobians(const NodeFile *, bool, bool) const
Definition: finley/src/ElementFile_jacobians.cpp:41
finley::ElementFile::jacobians
ElementFile_Jacobians * jacobians
jacobians of the shape function used for solution approximation
Definition: finley/src/ElementFile.h:159
finley::ElementFile::numElements
dim_t numElements
number of elements
Definition: finley/src/ElementFile.h:122
finley::ElementFile::markNodes
void markNodes(std::vector< short > &mask, int offset, bool useLinear)
Definition: finley/src/ElementFile.cpp:305
finley::ElementFile::Owner
int * Owner
Owner[i] contains the rank that owns element i.
Definition: finley/src/ElementFile.h:132
finley::NodeFile
Definition: finley/src/NodeFile.h:42
NodeFile.h
Util.h
escript::DataTypes::IndexVector
std::vector< index_t > IndexVector
Definition: DataTypes.h:64
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:66
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:61
escript::JMPI
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:74
finley::util::getMinMaxInt
IndexPair getMinMaxInt(int dim, dim_t N, const index_t *values)
Definition: finley/src/Util.cpp:278
finley::util::setValuesInUse
void setValuesInUse(const int *values, dim_t numValues, std::vector< int > &valuesInUse, escript::JMPI mpiinfo)
Definition: finley/src/Util.cpp:343
finley
A suite of factory methods for creating various finley domains.
Definition: finley/src/Assemble.h:32
finley::const_ShapeFunction_ptr
boost::shared_ptr< const ShapeFunction > const_ShapeFunction_ptr
Definition: ShapeFunctions.h:102
finley::const_ReferenceElementSet_ptr
boost::shared_ptr< const ReferenceElementSet > const_ReferenceElementSet_ptr
Definition: ReferenceElementSets.h:80
finley::ElementFile_Jacobians
Definition: finley/src/ElementFile.h:29
finley::ElementFile_Jacobians::status
int status
status of mesh when jacobians were updated last time
Definition: finley/src/ElementFile.h:34
finley::ElementFile_Jacobians::BasisFunctions
const_ShapeFunction_ptr BasisFunctions
basis function used
Definition: finley/src/ElementFile.h:38
finley::ElementFile_Jacobians::numSub
int numSub
number of subelements
Definition: finley/src/ElementFile.h:47
finley::ElementFile_Jacobians::volume
double * volume
local volume
Definition: finley/src/ElementFile.h:56
finley::ElementFile_Jacobians::DSDX
double * DSDX
Definition: finley/src/ElementFile.h:59
finley::ElementFile_Jacobians::numShapesTotal
int numShapesTotal
total number of shape functions = BasisFunctions->numShapes * numSides
Definition: finley/src/ElementFile.h:49
finley::ElementFile_Jacobians::numDim
int numDim
number of spatial dimensions
Definition: finley/src/ElementFile.h:36
finley::ElementFile_Jacobians::~ElementFile_Jacobians
~ElementFile_Jacobians()
Definition: finley/src/ElementFile_jacobians.cpp:34
finley::ElementFile_Jacobians::numSides
int numSides
number of sides (=1 normal, =2 contact)
Definition: finley/src/ElementFile.h:43
finley::ElementFile_Jacobians::node_selection
const int * node_selection
Definition: finley/src/ElementFile.h:52
finley::ElementFile_Jacobians::offsets
const int * offsets
offset to sides (borrowed reference)
Definition: finley/src/ElementFile.h:45
finley::ElementFile_Jacobians::ElementFile_Jacobians
ElementFile_Jacobians(const_ShapeFunction_ptr basis)
Definition: finley/src/ElementFile_jacobians.cpp:23
finley::ElementFile_Jacobians::numQuadTotal
int numQuadTotal
Definition: finley/src/ElementFile.h:41
finley::ElementFile_Jacobians::numElements
dim_t numElements
number of elements
Definition: finley/src/ElementFile.h:54