dudley::ElementFile Class Reference

`#include <ElementFile.h>`

## Public Member Functions

| ElementFile (ElementTypeId etype, escript::JMPI mpiInfo)
| ~ElementFile ()
void | allocTable (dim_t NE)
| allocates the element table within an element file to hold NE elements More...
void | freeTable ()
| deallocates the element table within an element file More...
void | copyTable (index_t offset, index_t nodeOffset, index_t idOffset, const ElementFile *in)
void | print (const index_t *nodesId) const
| prints information about this element file to stdout More...
void | distributeByRankOfDOF (const int *mpiRankOfDOF, const index_t *nodesId)
| redistributes the elements including overlap by rank More...
void | createColoring (dim_t numNodes, const index_t *degreeOfFreedom)
void | optimizeOrdering ()
| reorders the elements so that they are stored close to the nodes More...
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)
| sets element tags to newTag where mask > 0 More...
ElementFile_Jacobians * | borrowJacobians (const NodeFile *nodes, bool reducedOrder) const
std::pair< index_t, index_t > | getNodeRange () const
void | updateTagList ()

## Public Attributes

escript::JMPI | MPIInfo
dim_t | numElements
| number of elements More...
index_t * | Id
int * | Tag
| Tag[i] is the tag of element i. More...
int * | Owner
| Owner[i] contains the rank that owns element i. More...
std::vector< int > | tagsInUse
| array of tags which are actually used More...
int | numNodes
| number of nodes per element More...
index_t * | Nodes
| Nodes[INDEX(k, i, numNodes)] is the k-th node in the i-th element. More...
index_t * | Color
index_t | minColor
| minimum color value More...
index_t | maxColor
| maximum color value More...
int | numDim
| number of spatial dimensions of the domain More...
int | numLocalDim
| dimension of the element e.g. 2 for a line in 2D or 3D More...
ElementTypeId | etype
| element type ID More...
const char * | ename
| name of element type More...
int | numShapes
| number of shape functions More...

## Private Member Functions

void | swapTable (ElementFile *other)

## Private Attributes

ElementFile_Jacobians * | jacobians
| jacobians of the shape function used for solution approximation More...
ElementFile_Jacobians * | jacobians_reducedQ

## Constructor & Destructor Documentation

## ElementFile()

dudley::ElementFile::ElementFile | ( | ElementTypeId | etype,
|  | escript::JMPI | mpiInfo
| ) |  |

References dudley::Dims, ename, dudley::getElementName(), jacobians, jacobians_reducedQ, dudley::localDims, numDim, numLocalDim, numNodes, and numShapes.

Referenced by optimizeOrdering().

## ~ElementFile()

dudley::ElementFile::~ElementFile | ( |  | ) |

References freeTable(), jacobians, and jacobians_reducedQ.

## Member Function Documentation

## allocTable()

void dudley::ElementFile::allocTable | ( | dim_t | NE | ) |

allocates the element table within an element file to hold NE elements

References Color, freeTable(), Id, INDEX2, maxColor, minColor, Nodes, numElements, numNodes, Owner, and Tag.

Referenced by dudley::cleanupAndThrow(), dudley::DudleyDomain::create2D(), dudley::DudleyDomain::create3D(), distributeByRankOfDOF(), dudley::DudleyDomain::load(), optimizeOrdering(), and dudley::DudleyDomain::readGmsh().

## borrowJacobians()

ElementFile_Jacobians * dudley::ElementFile::borrowJacobians | ( | const NodeFile * | nodes,
|  | bool | reducedOrder
| ) |  | const

References dudley::ElementFile_Jacobians::absD, dudley::Assemble_jacobians_2D(), dudley::Assemble_jacobians_2D_M1D_E1D(), dudley::Assemble_jacobians_3D(), dudley::Assemble_jacobians_3D_M2D_E2D(), dudley::NodeFile::Coordinates, dudley::ElementFile_Jacobians::DSDX, dudley::Nodes, dudley::ElementFile_Jacobians::numDim, dudley::NodeFile::numDim, dudley::ElementFile_Jacobians::numElements, dudley::ElementFile_Jacobians::numQuad, dudley::ElementFile_Jacobians::numShapes, dudley::QuadNums, dudley::ElementFile_Jacobians::quadweight, dudley::ElementFile_Jacobians::status, and dudley::NodeFile::status.

Referenced by dudley::Assemble_gradient(), dudley::Assemble_integrate(), and dudley::AssembleParameters::AssembleParameters().

## copyTable()

void dudley::ElementFile::copyTable | ( | index_t | offset,
|  | index_t | nodeOffset,
|  | index_t | idOffset,
|  | const ElementFile * | in
| ) |  |

copies element file `in` into this element file starting from `offset`. The elements `offset` to in->numElements+offset-1 will be overwritten.

References Id, INDEX2, MPIInfo, Nodes, numElements, numNodes, Owner, and Tag.

## createColoring()

void dudley::ElementFile::createColoring | ( | dim_t | numNodes,
|  | const index_t * | degreeOfFreedom
| ) |  |

Tries to reduce the number of colors used to color elements in this ElementFile

References Color, ESYS_ASSERT, dudley::util::getMinMaxInt(), INDEX2, maxColor, minColor, Nodes, numElements, and numNodes.

Referenced by dudley::DudleyDomain::createColoring().

## distributeByRankOfDOF()

void dudley::ElementFile::distributeByRankOfDOF | ( | const int * | mpiRankOfDOF,
|  | const index_t * | nodesId
| ) |  |

redistributes the elements including overlap by rank

References allocTable(), Id, INDEX2, MPI_INT, MPIInfo, Nodes, numElements, numNodes, Owner, and Tag.

Referenced by dudley::DudleyDomain::distributeByRankOfDOF().

## freeTable()

void dudley::ElementFile::freeTable | ( |  | ) |

deallocates the element table within an element file

References Color, Id, maxColor, minColor, Nodes, numElements, Owner, Tag, and tagsInUse.

Referenced by allocTable(), and ~ElementFile().

## gather()

void dudley::ElementFile::gather | ( | const index_t * | index,
|  | const ElementFile * | in
| ) |  |

gathers the elements from the element file `in` using index[0:out->elements-1]. `index` has to be between 0 and in->numElements-1. A conservative assumption on the colouring is made.

References Color, Id, INDEX2, maxColor, minColor, Nodes, numElements, numNodes, Owner, and Tag.

Referenced by optimizeOrdering().

## getNodeRange()

std::pair< index_t, index_t > dudley::ElementFile::getNodeRange | ( |  | ) | const

inline

returns the minimum and maximum reference number of nodes describing the elements

References dudley::util::getMinMaxInt(), dudley::Nodes, and dudley::ElementFile_Jacobians::numElements.

Referenced by dudley::DudleyDomain::resolveNodeIds().

## markNodes()

void dudley::ElementFile::markNodes | ( | std::vector< short > & | mask,
|  | index_t | offset
| ) |  | const

References INDEX2, Nodes, numElements, and numNodes.

Referenced by dudley::DudleyDomain::markNodes().

## optimizeOrdering()

void dudley::ElementFile::optimizeOrdering | ( |  | ) |

reorders the elements so that they are stored close to the nodes

References allocTable(), ElementFile(), etype, gather(), INDEX2, MPIInfo, Nodes, numElements, numNodes, dudley::util::sortValueAndIndex(), and swapTable().

Referenced by dudley::DudleyDomain::optimizeElementOrdering().

## print()

void dudley::ElementFile::print | ( | const index_t * | nodesId | ) | const

prints information about this element file to stdout

References Color, ename, Id, INDEX2, maxColor, minColor, Nodes, numElements, numNodes, Owner, and Tag.

## relabelNodes()

void dudley::ElementFile::relabelNodes | ( | const index_t * | newNode,
|  | index_t | offset
| ) |  |

assigns new node reference numbers to the elements. If k is the old node, the new node is newNode[k-offset].

References INDEX2, Nodes, numElements, and numNodes.

Referenced by dudley::DudleyDomain::relabelElementNodes().

## setTags()

void dudley::ElementFile::setTags | ( | int | newTag,
|  | const escript::Data & | mask
| ) |  |

sets element tags to newTag where mask > 0

References escript::Data::actsExpanded(), escript::Data::getDataPointSize(), escript::Data::getSampleDataRO(), dudley::hasReducedIntegrationOrder(), escript::Data::isComplex(), numElements, numNodes, escript::Data::numSamplesEqual(), Tag, and updateTagList().

Referenced by dudley::DudleyDomain::setTags().

## swapTable()

void dudley::ElementFile::swapTable | ( | ElementFile * | other | ) |

private

References Color, Id, maxColor, minColor, Nodes, numElements, Owner, paso::swap(), Tag, and tagsInUse.

Referenced by optimizeOrdering().

## updateTagList()

void dudley::ElementFile::updateTagList | ( |  | ) |

inline

References dudley::ElementFile_Jacobians::numElements, and dudley::util::setValuesInUse().

Referenced by dudley::cleanupAndThrow(), dudley::DudleyDomain::load(), setTags(), and dudley::DudleyDomain::updateTagList().

## Member Data Documentation

## Color

index_t* dudley::ElementFile::Color

assigns each element a color. Elements with the same color don't share a node so they can be processed simultaneously. At any time Color must provide a valid value. In any case one can set Color[e]=e for all e.

Referenced by allocTable(), dudley::Assemble_LumpedSystem(), dudley::Assemble_PDE_Points(), dudley::Assemble_PDE_Single_2D(), dudley::Assemble_PDE_Single_3D(), dudley::Assemble_PDE_System_2D(), dudley::Assemble_PDE_System_3D(), dudley::cleanupAndThrow(), createColoring(), dudley::DudleyDomain::dump(), freeTable(), gather(), dudley::IndexList_insertElements(), dudley::IndexList_insertElementsWithRowRangeNoMainDiagonal(), weipa::FinleyElements::initFromDudley(), dudley::DudleyDomain::load(), print(), dudley::DudleyDomain::printElementInfo(), dudley::DudleyDomain::readGmsh(), dudley::DudleyDomain::relabelElementNodes(), and swapTable().

## ename

const char* dudley::ElementFile::ename

name of element type

Referenced by ElementFile(), print(), dudley::DudleyDomain::printElementInfo(), and dudley::DudleyDomain::writeElementInfo().

## etype

ElementTypeId dudley::ElementFile::etype

element type ID

Referenced by dudley::DudleyDomain::dump(), weipa::FinleyElements::initFromDudley(), optimizeOrdering(), dudley::DudleyDomain::printElementInfo(), and dudley::DudleyDomain::relabelElementNodes().

## Id

index_t* dudley::ElementFile::Id

Id[i] is the id number of node i. This number is used when elements are resorted. In the entire code the term 'element id' refers to i and not to Id[i] unless explicitly stated otherwise.

Referenced by allocTable(), dudley::DudleyDomain::borrowSampleReferenceIDs(), dudley::cleanupAndThrow(), copyTable(), dudley::DudleyDomain::create2D(), dudley::DudleyDomain::create3D(), distributeByRankOfDOF(), dudley::DudleyDomain::dump(), freeTable(), gather(), weipa::FinleyElements::initFromDudley(), dudley::DudleyDomain::load(), print(), dudley::DudleyDomain::printElementInfo(), dudley::DudleyDomain::readGmsh(), dudley::DudleyDomain::relabelElementNodes(), swapTable(), and dudley::DudleyDomain::writeElementInfo().

## jacobians

ElementFile_Jacobians* dudley::ElementFile::jacobians

private

jacobians of the shape function used for solution approximation

Referenced by ElementFile(), and ~ElementFile().

## jacobians_reducedQ

ElementFile_Jacobians* dudley::ElementFile::jacobians_reducedQ

private

jacobians of the shape function used for solution approximation for reduced integration order

Referenced by ElementFile(), and ~ElementFile().

## maxColor

index_t dudley::ElementFile::maxColor

maximum color value

Referenced by allocTable(), dudley::cleanupAndThrow(), createColoring(), freeTable(), gather(), dudley::DudleyDomain::load(), print(), dudley::DudleyDomain::readGmsh(), and swapTable().

## minColor

index_t dudley::ElementFile::minColor

minimum color value

Referenced by allocTable(), dudley::Assemble_LumpedSystem(), dudley::Assemble_PDE_Points(), dudley::Assemble_PDE_Single_2D(), dudley::Assemble_PDE_Single_3D(), dudley::Assemble_PDE_System_2D(), dudley::Assemble_PDE_System_3D(), dudley::cleanupAndThrow(), createColoring(), freeTable(), gather(), dudley::IndexList_insertElements(), dudley::IndexList_insertElementsWithRowRangeNoMainDiagonal(), dudley::DudleyDomain::load(), print(), dudley::DudleyDomain::readGmsh(), and swapTable().

## MPIInfo

escript::JMPI dudley::ElementFile::MPIInfo

Referenced by dudley::Assemble_gradient(), dudley::Assemble_interpolate(), copyTable(), distributeByRankOfDOF(), and optimizeOrdering().

## Nodes

index_t* dudley::ElementFile::Nodes

Nodes[INDEX(k, i, numNodes)] is the k-th node in the i-th element.

Referenced by allocTable(), dudley::Assemble_getNormal(), dudley::Assemble_getSize(), dudley::Assemble_gradient(), dudley::Assemble_interpolate(), dudley::Assemble_LumpedSystem(), dudley::Assemble_PDE_Points(), dudley::Assemble_PDE_Single_2D(), dudley::Assemble_PDE_Single_3D(), dudley::Assemble_PDE_System_2D(), dudley::Assemble_PDE_System_3D(), dudley::cleanupAndThrow(), copyTable(), dudley::DudleyDomain::create2D(), dudley::DudleyDomain::create3D(), createColoring(), distributeByRankOfDOF(), dudley::DudleyDomain::dump(), freeTable(), gather(), dudley::IndexList_insertElements(), dudley::IndexList_insertElementsWithRowRangeNoMainDiagonal(), weipa::FinleyElements::initFromDudley(), dudley::DudleyDomain::load(), markNodes(), optimizeOrdering(), print(), dudley::DudleyDomain::printElementInfo(), dudley::DudleyDomain::readGmsh(), dudley::DudleyDomain::relabelElementNodes(), relabelNodes(), swapTable(), and dudley::DudleyDomain::writeElementInfo().

## numDim

int dudley::ElementFile::numDim

number of spatial dimensions of the domain

Referenced by dudley::Assemble_AverageElementData(), dudley::Assemble_CopyElementData(), dudley::Assemble_getNormal(), dudley::Assemble_getSize(), dudley::Assemble_interpolate(), dudley::Assemble_LumpedSystem(), dudley::AssembleParameters::AssembleParameters(), and ElementFile().

## numElements

dim_t dudley::ElementFile::numElements

number of elements

Referenced by allocTable(), dudley::Assemble_AverageElementData(), dudley::Assemble_CopyElementData(), dudley::Assemble_getNormal(), dudley::Assemble_getSize(), dudley::Assemble_gradient(), dudley::Assemble_integrate(), dudley::Assemble_interpolate(), dudley::Assemble_LumpedSystem(), dudley::Assemble_PDE(), dudley::Assemble_PDE_Points(), dudley::Assemble_PDE_Single_2D(), dudley::Assemble_PDE_Single_3D(), dudley::Assemble_PDE_System_2D(), dudley::Assemble_PDE_System_3D(), dudley::AssembleParameters::AssembleParameters(), copyTable(), createColoring(), distributeByRankOfDOF(), dudley::DudleyDomain::dump(), freeTable(), gather(), dudley::DudleyDomain::getDataShape(), dudley::IndexList_insertElements(), dudley::IndexList_insertElementsWithRowRangeNoMainDiagonal(), weipa::FinleyElements::initFromDudley(), markNodes(), optimizeOrdering(), print(), dudley::DudleyDomain::printElementInfo(), dudley::DudleyDomain::relabelElementNodes(), relabelNodes(), setTags(), swapTable(), and dudley::DudleyDomain::writeElementInfo().

## numLocalDim

int dudley::ElementFile::numLocalDim

dimension of the element e.g. 2 for a line in 2D or 3D

Referenced by dudley::Assemble_getNormal(), ElementFile(), and dudley::DudleyDomain::getDataShape().

## numNodes

int dudley::ElementFile::numNodes

number of nodes per element

Referenced by allocTable(), dudley::Assemble_getNormal(), dudley::Assemble_getSize(), dudley::Assemble_gradient(), dudley::Assemble_interpolate(), dudley::AssembleParameters::AssembleParameters(), copyTable(), dudley::DudleyDomain::create2D(), dudley::DudleyDomain::create3D(), createColoring(), distributeByRankOfDOF(), dudley::DudleyDomain::dump(), ElementFile(), gather(), dudley::IndexList_insertElements(), dudley::IndexList_insertElementsWithRowRangeNoMainDiagonal(), weipa::FinleyElements::initFromDudley(), markNodes(), optimizeOrdering(), print(), dudley::DudleyDomain::printElementInfo(), dudley::DudleyDomain::readGmsh(), dudley::DudleyDomain::relabelElementNodes(), relabelNodes(), setTags(), and dudley::DudleyDomain::writeElementInfo().

## numShapes

int dudley::ElementFile::numShapes

number of shape functions

Referenced by ElementFile(), and dudley::IndexList_insertElements().

## Owner

int* dudley::ElementFile::Owner

Owner[i] contains the rank that owns element i.

Referenced by allocTable(), dudley::Assemble_integrate(), dudley::cleanupAndThrow(), copyTable(), dudley::DudleyDomain::create2D(), dudley::DudleyDomain::create3D(), distributeByRankOfDOF(), dudley::DudleyDomain::dump(), freeTable(), gather(), weipa::FinleyElements::initFromDudley(), dudley::DudleyDomain::load(), print(), dudley::DudleyDomain::printElementInfo(), dudley::DudleyDomain::readGmsh(), dudley::DudleyDomain::relabelElementNodes(), and swapTable().

## Tag

int* dudley::ElementFile::Tag

Tag[i] is the tag of element i.

Referenced by allocTable(), dudley::cleanupAndThrow(), copyTable(), dudley::DudleyDomain::create2D(), dudley::DudleyDomain::create3D(), distributeByRankOfDOF(), dudley::DudleyDomain::dump(), freeTable(), gather(), dudley::DudleyDomain::getTagFromSampleNo(), weipa::FinleyElements::initFromDudley(), dudley::DudleyDomain::load(), print(), dudley::DudleyDomain::printElementInfo(), dudley::DudleyDomain::readGmsh(), dudley::DudleyDomain::relabelElementNodes(), setTags(), swapTable(), and dudley::DudleyDomain::writeElementInfo().

## tagsInUse

std::vector<int> dudley::ElementFile::tagsInUse

array of tags which are actually used

Referenced by dudley::DudleyDomain::borrowListOfTagsInUse(), freeTable(), dudley::DudleyDomain::getNumberOfTagsInUse(), and swapTable().

The documentation for this class was generated from the following files:

- dudley/src/ElementFile.h
- dudley/src/ElementFile.cpp
- ElementFile_createColoring.cpp
- ElementFile_distributeByRankOfDOF.cpp
- dudley/src/ElementFile_jacobians.cpp