dudley/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 __DUDLEY_ELEMENTFILE_H__
#define __DUDLEY_ELEMENTFILE_H__
#include "Dudley.h"
#include "NodeFile.h"
#include "ElementType.h"
#include "Util.h"
namespace dudley {
struct ElementFile_Jacobians
{
ElementFile_Jacobians();
~ElementFile_Jacobians();
int status;
int numDim;
int numQuad;
int numShapes;
dim_t numElements;
double *absD;
double quadweight;
double* DSDX;
};
class ElementFile
{
public:
ElementFile(ElementTypeId etype, 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 print(const index_t* nodesId) const;
void distributeByRankOfDOF(const int* mpiRankOfDOF,
const index_t* nodesId);
void createColoring(dim_t numNodes, const index_t* degreeOfFreedom);
void optimizeOrdering();
void relabelNodes(const index_t* newNode, index_t offset);
void markNodes(std::vector<short>& mask, index_t offset) const;
void gather(const index_t* index, const ElementFile* in);
void setTags(int newTag, const escript::Data& mask);
ElementFile_Jacobians* borrowJacobians(const NodeFile* nodes,
bool reducedOrder) const;
inline std::pair<index_t,index_t> getNodeRange() const;
inline void updateTagList();
private:
void swapTable(ElementFile* other);
public:
escript::JMPI MPIInfo;
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;
int numDim;
int numLocalDim;
ElementTypeId etype;
const char *ename;
int numShapes;
private:
ElementFile_Jacobians* jacobians;
ElementFile_Jacobians* jacobians_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 dudley
#endif // __DUDLEY_ELEMENTFILE_H__
dudley::ElementFile_Jacobians::DSDX
double * DSDX
Definition: dudley/src/ElementFile.h:77
dudley::ElementFile_Jacobians::numShapes
int numShapes
number of shape functions
Definition: dudley/src/ElementFile.h:68
dudley::ElementFile::numShapes
int numShapes
number of shape functions
Definition: dudley/src/ElementFile.h:173
escript::Data::getNumDataPointsPerSample
int getNumDataPointsPerSample() const
Return the number of data points per sample.
Definition: Data.h:544
escript::Data::isComplex
bool isComplex() const
True if components of this data are stored as complex.
Definition: Data.cpp:1160
finley::util::ValueAndIndexList
std::vector< IndexPair > ValueAndIndexList
Definition: finley/src/Util.h:59
dudley::ElementFile::Tag
int * Tag
Tag[i] is the tag of element i.
Definition: dudley/src/ElementFile.h:135
finley::ElementFile::minColor
index_t minColor
minimum color value
Definition: finley/src/ElementFile.h:167
dudley::ElementFile::copyTable
void copyTable(index_t offset, index_t nodeOffset, index_t idOffset, const ElementFile *in)
Definition: dudley/src/ElementFile.cpp:108
dudley::ElementFile_Jacobians
Definition: dudley/src/ElementFile.h:42
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:79
finley::ElementFile::gather
void gather(const index_t *index, const ElementFile *in)
Definition: finley/src/ElementFile.cpp:139
dudley::DudleyException
Definition: DudleyException.h:39
dudley::ElementFile::jacobians_reducedQ
ElementFile_Jacobians * jacobians_reducedQ
Definition: dudley/src/ElementFile.h:181
dudley::ElementFile::gather
void gather(const index_t *index, const ElementFile *in)
Definition: dudley/src/ElementFile.cpp:148
dudley::ElementFile::createColoring
void createColoring(dim_t numNodes, const index_t *degreeOfFreedom)
Definition: ElementFile_createColoring.cpp:39
dudley::ElementFile::getNodeRange
std::pair< index_t, index_t > getNodeRange() const
Definition: dudley/src/ElementFile.h:184
dudley::NodeFile
Definition: dudley/src/NodeFile.h:39
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:79
dudley::Nodes
@ Nodes
Definition: Dudley.h:67
INDEX2
#define INDEX2(_X1_, _X2_, _N1_)
Definition: index.h:23
dudley::ElementFile::swapTable
void swapTable(ElementFile *other)
Definition: dudley/src/ElementFile.cpp:165
finley::const_ReferenceElementSet_ptr
boost::shared_ptr< const ReferenceElementSet > const_ReferenceElementSet_ptr
Definition: ReferenceElementSets.h:94
escript::Data::getSampleDataRO
const DataTypes::real_t * getSampleDataRO(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0) const
Return the sample data for the given sample no. Please do not use this unless you NEED to access samp...
Definition: Data.h:1989
dudley::util::getMinMaxInt
IndexPair getMinMaxInt(int dim, dim_t N, const index_t *values)
Definition: dudley/src/Util.cpp:187
finley::ElementFile::Tag
int * Tag
Tag[i] is the tag of element i.
Definition: finley/src/ElementFile.h:143
dudley::ElementFile::Nodes
index_t * Nodes
Nodes[INDEX(k, i, numNodes)] is the k-th node in the i-th element.
Definition: dudley/src/ElementFile.h:147
dudley::ElementFile::freeTable
void freeTable()
deallocates the element table within an element file
Definition: dudley/src/ElementFile.cpp:95
finley::ElementFile_Jacobians
Definition: finley/src/ElementFile.h:42
dudley::ElementFile::allocTable
void allocTable(dim_t NE)
allocates the element table within an element file to hold NE elements
Definition: dudley/src/ElementFile.cpp:68
dudley::ElementFile_Jacobians::numQuad
int numQuad
number of quadrature nodes used to calculate jacobians
Definition: dudley/src/ElementFile.h:66
finley::const_ReferenceElement_ptr
boost::shared_ptr< const ReferenceElement > const_ReferenceElement_ptr
Definition: ReferenceElements.h:214
dudley::ElementFile::Owner
int * Owner
Owner[i] contains the rank that owns element i.
Definition: dudley/src/ElementFile.h:138
dudley::ElementFile::markNodes
void markNodes(std::vector< short > &mask, index_t offset) const
Definition: dudley/src/ElementFile.cpp:242
escript::Data::getDataPointSize
int getDataPointSize() const
Return the size of the data point. It is the product of the data point shape dimensions.
Definition: Data.cpp:1360
dudley::ElementFile_Jacobians::absD
double * absD
used to compute volume
Definition: dudley/src/ElementFile.h:72
dudley::ElementFile::jacobians
ElementFile_Jacobians * jacobians
jacobians of the shape function used for solution approximation
Definition: dudley/src/ElementFile.h:177
finley::ElementFile::Nodes
index_t * Nodes
Definition: finley/src/ElementFile.h:158
Dudley.h
dudley::ElementFile::ename
const char * ename
name of element type
Definition: dudley/src/ElementFile.h:170
dudley::ElementFile::distributeByRankOfDOF
void distributeByRankOfDOF(const int *mpiRankOfDOF, const index_t *nodesId)
redistributes the elements including overlap by rank
Definition: ElementFile_distributeByRankOfDOF.cpp:38
finley::ElementFile::maxColor
index_t maxColor
maximum color value
Definition: finley/src/ElementFile.h:170
dudley::ElementFile_Jacobians::status
int status
status of mesh when jacobians were updated last time
Definition: dudley/src/ElementFile.h:62
MPI_INT
#define MPI_INT
Definition: EsysMPI.h:46
finley::ElementFile::ElementFile
ElementFile(const_ReferenceElementSet_ptr refElementSet, escript::JMPI mpiInfo)
Definition: finley/src/ElementFile.cpp:43
dudley::ElementFile::maxColor
index_t maxColor
maximum color value
Definition: dudley/src/ElementFile.h:158
escript::Data::getNumSamples
int getNumSamples() const
Return the number of samples.
Definition: Data.h:533
dudley::ElementFile::minColor
index_t minColor
minimum color value
Definition: dudley/src/ElementFile.h:155
finley::ElementFile::numElements
dim_t numElements
number of elements
Definition: finley/src/ElementFile.h:136
dudley::localDims
static const int localDims[8]
Definition: ShapeTable.h:67
dudley
A suite of factory methods for creating 2D and 3D dudley domains.
Definition: dudley/src/Assemble.h:32
finley::ElementFile::Owner
int * Owner
Owner[i] contains the rank that owns element i.
Definition: finley/src/ElementFile.h:146
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:64
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:93
dudley::ElementFile::numElements
dim_t numElements
number of elements
Definition: dudley/src/ElementFile.h:127
escript::JMPI
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:72
dudley::ElementFile
Definition: dudley/src/ElementFile.h:66
ElementFile.h
dudley::hasReducedIntegrationOrder
bool hasReducedIntegrationOrder(const escript::Data &in)
Definition: Dudley.h:75
ElementFile.h
dudley::ElementFile::Id
index_t * Id
Definition: dudley/src/ElementFile.h:132
finley::ElementFile::Color
index_t * Color
Definition: finley/src/ElementFile.h:164
paso::swap
void swap(index_t *r, index_t *c, double *v, int left, int right)
Definition: SparseMatrix.cpp:71
dudley::util::ValueAndIndexList
std::vector< IndexPair > ValueAndIndexList
Definition: dudley/src/Util.h:59
dudley::ElementFile::print
void print(const index_t *nodesId) const
prints information about this element file to stdout
Definition: dudley/src/ElementFile.cpp:131
finley::ElementFile::Id
index_t * Id
Definition: finley/src/ElementFile.h:140
dudley::ElementFile::numDim
int numDim
number of spatial dimensions of the domain
Definition: dudley/src/ElementFile.h:161
dudley::ElementFile::MPIInfo
escript::JMPI MPIInfo
Definition: dudley/src/ElementFile.h:124
dudley::Dims
static const int Dims[8]
Definition: ShapeTable.h:68
NodeFile.h
escript::Data::numSamplesEqual
bool numSamplesEqual(int numDataPointsPerSample, int numSamples) const
Returns true if the number of data points per sample and the number of samples match the respective a...
Definition: Data.h:555
ShapeTable.h
dudley::ElementFile::optimizeOrdering
void optimizeOrdering()
reorders the elements so that they are stored close to the nodes
Definition: dudley/src/ElementFile.cpp:178
dudley::ElementFile_Jacobians::numDim
int numDim
number of spatial dimensions
Definition: dudley/src/ElementFile.h:64
dudley::ElementFile::updateTagList
void updateTagList()
Definition: dudley/src/ElementFile.h:189
dudley::util::sortValueAndIndex
void sortValueAndIndex(ValueAndIndexList &array)
orders a ValueAndIndexList by value.
Definition: dudley/src/Util.cpp:67
dudley::util::setValuesInUse
void setValuesInUse(const int *values, dim_t numValues, std::vector< int > &valuesInUse, escript::JMPI mpiinfo)
Definition: dudley/src/Util.cpp:252
dudley::ElementFile::ElementFile
ElementFile(ElementTypeId etype, escript::JMPI mpiInfo)
Definition: dudley/src/ElementFile.cpp:39
dudley::ElementFile::relabelNodes
void relabelNodes(const index_t *newNode, index_t offset)
Definition: dudley/src/ElementFile.cpp:252
dudley::ElementFile::numLocalDim
int numLocalDim
dimension of the element e.g. 2 for a line in 2D or 3D
Definition: dudley/src/ElementFile.h:164
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:88
ElementType.h
finley::Nodes
@ Nodes
Definition: Finley.h:82
Util.h
dudley::ElementFile_Jacobians::numElements
dim_t numElements
number of elements
Definition: dudley/src/ElementFile.h:70
dudley::ElementFile_Jacobians::quadweight
double quadweight
used to compute volume
Definition: dudley/src/ElementFile.h:74
finley::ElementFile::tagsInUse
std::vector< int > tagsInUse
array of tags which are actually used
Definition: finley/src/ElementFile.h:149
finley::ElementFile
Definition: finley/src/ElementFile.h:76
dudley::ElementFile_Jacobians::ElementFile_Jacobians
ElementFile_Jacobians()
Definition: dudley/src/ElementFile_jacobians.cpp:38
dudley::ElementFile::Color
index_t * Color
Definition: dudley/src/ElementFile.h:152
dudley::getElementName
const char * getElementName(ElementTypeId id)
Definition: ShapeTable.cpp:118
escript::Data::actsExpanded
bool actsExpanded() const
Return true if this Data is expanded or resolves to expanded. That is, if it has a separate value for...
Definition: Data.cpp:1118
dudley::util::gather
void gather(int len, const index_t *index, int numData, const double *in, double *out)
Definition: dudley/src/Util.cpp:72
dudley::ElementFile::setTags
void setTags(int newTag, const escript::Data &mask)
sets element tags to newTag where mask > 0
Definition: dudley/src/ElementFile.cpp:207
finley
A suite of factory methods for creating various finley domains.
Definition: finley/src/Assemble.h:32
ESYS_ASSERT
#define ESYS_ASSERT(a, b)
EsysAssert is a MACRO that will throw an exception if the boolean condition specified is false.
Definition: Assert.h:79
dudley::ElementFile::tagsInUse
std::vector< int > tagsInUse
array of tags which are actually used
Definition: dudley/src/ElementFile.h:141
escript::ValueError
An exception class that signals an invalid argument value.
Definition: EsysException.h:103
dudley::ElementTypeId
ElementTypeId
Definition: ElementType.h:39
dudley::ElementFile::etype
ElementTypeId etype
element type ID
Definition: dudley/src/ElementFile.h:167
dudley::ElementFile_Jacobians::~ElementFile_Jacobians
~ElementFile_Jacobians()
Definition: dudley/src/ElementFile_jacobians.cpp:49
dudley::ElementFile::numNodes
int numNodes
number of nodes per element
Definition: dudley/src/ElementFile.h:144
escript::DataTypes::IndexVector
std::vector< index_t > IndexVector
Definition: DataTypes.h:91
dudley::ElementFile::borrowJacobians
ElementFile_Jacobians * borrowJacobians(const NodeFile *nodes, bool reducedOrder) const
Definition: dudley/src/ElementFile_jacobians.cpp:55
dudley::ElementFile::~ElementFile
~ElementFile()
Definition: dudley/src/ElementFile.cpp:61
finley::ElementFile::numNodes
int numNodes
number of nodes per element
Definition: finley/src/ElementFile.h:152