FinleyElements.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2017 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 by Centre for Geoscience Computing (GeoComp)
*
*****************************************************************************/
#ifndef __WEIPA_FINLEYELEMENTS_H__
#define __WEIPA_FINLEYELEMENTS_H__
#include <weipa/ElementData.h>
#include <weipa/FinleyNodes.h>
#ifdef USE_DUDLEY
#include <dudley/Dudley.h> // for DUDLEY_...
#include <dudley/ElementType.h> // for dudley::ElementTypeId
#endif
#ifdef USE_FINLEY
#include <finley/ReferenceElements.h> // for finley::ElementTypeId
#endif
class DBfile;
#ifdef NETCDF4
#include <ncFile.h>
#define NCFTYPE netCDF::NcFile&
#else
class NcFile;
#define NCFTYPE NcFile*
#endif
namespace dudley {
class ElementFile;
}
namespace finley {
class ElementFile;
}
namespace weipa {
struct FinleyElementInfo
{
ZoneType elementType, reducedElementType;
int elementFactor;
int elementSize, reducedElementSize;
const size_t* multiCellIndices;
bool useQuadNodes;
int quadDim;
};
class FinleyElements;
typedef boost::shared_ptr<FinleyElements> FinleyElements_ptr;
class FinleyElements : public ElementData
{
public:
FinleyElements(const std::string& elementName, FinleyNodes_ptr nodes);
FinleyElements(const FinleyElements& e);
virtual ~FinleyElements() {}
bool initFromDudley(const dudley::ElementFile* dudleyFile);
bool initFromFinley(const finley::ElementFile* finleyFile);
bool readFromNc(NCFTYPE ncfile);
void reorderGhostZones(int ownIndex);
void removeGhostZones(int ownIndex);
virtual void writeConnectivityVTK(std::ostream& os);
bool writeToSilo(DBfile* dbfile, const std::string& siloPath,
const StringVec& labels, const StringVec& units,
bool writeMeshData);
virtual StringVec getMeshNames() const;
virtual StringVec getVarNames() const;
virtual int getNumElements() const { return numElements; }
virtual int getNodesPerElement() const { return nodesPerElement; }
virtual int getGhostCount() const { return numGhostElements; }
virtual ZoneType getType() const { return type; }
#ifdef USE_FINLEY
finley::ElementTypeId getFinleyTypeId() const { return finleyTypeId; }
#endif
virtual const IntVec& getNodeList() const { return nodes; }
virtual const IntVec& getIDs() const { return ID; }
virtual const IntVec& getVarDataByName(const std::string varName) const;
virtual NodeData_ptr getNodes() const { return nodeMesh; }
virtual ElementData_ptr getReducedElements() const { return reducedElements; }
virtual const QuadMaskInfo& getQuadMask(int functionSpace) const;
virtual int getElementFactor() const { return elementFactor; }
private:
FinleyElements() {}
#ifdef USE_DUDLEY
FinleyElementInfo getDudleyTypeInfo(dudley::ElementTypeId typeId);
#endif
#ifdef USE_FINLEY
FinleyElementInfo getFinleyTypeInfo(finley::ElementTypeId typeId);
finley::ElementTypeId finleyTypeId;
#endif
void buildMeshes();
void buildReducedElements(const FinleyElementInfo& f);
IntVec prepareGhostIndices(int ownIndex);
void reorderArray(IntVec& v, const IntVec& idx, int elementsPerIndex);
QuadMaskInfo buildQuadMask(const CoordArray& quadNodes, int numQNodes);
FinleyElements_ptr reducedElements;
FinleyNodes_ptr nodeMesh;
FinleyNodes_ptr originalMesh;
std::string name;
int numElements;
int numGhostElements;
int nodesPerElement;
ZoneType type;
IntVec nodes;
IntVec color, ID, tag;
IntVec owner;
QuadMaskInfo quadMask, reducedQuadMask;
int elementFactor;
};
} // namespace weipa
#undef NCFTYPE
#endif // __WEIPA_FINLEYELEMENTS_H__
weipa::QuadMaskInfo
This struct holds a mask (0&#39;s and 1&#39;s) that indicates which quad nodes contribute to a sub-element wh...
Definition: ElementData.h:39
weipa::FinleyElements::getNumElements
virtual int getNumElements() const
Returns the number of elements.
Definition: FinleyElements.h:123
weipa::FinleyElementInfo::multiCellIndices
const size_t * multiCellIndices
Definition: FinleyElements.h:58
weipa::FinleyElements::numElements
int numElements
Definition: FinleyElements.h:183
weipa::CoordArray
std::vector< float * > CoordArray
Definition: weipa.h:61
weipa::FinleyElements::getNodeList
virtual const IntVec & getNodeList() const
Returns a vector of the node IDs used by the elements.
Definition: FinleyElements.h:140
weipa::ElementData
Stores and manipulates one type of domain elements.
Definition: ElementData.h:48
weipa::FinleyNodes_ptr
boost::shared_ptr< FinleyNodes > FinleyNodes_ptr
Definition: FinleyNodes.h:42
weipa::FinleyElementInfo
Holds information that is used to convert from finley element types to elements supported by Silo and...
Definition: FinleyElements.h:53
weipa::FinleyElements::numGhostElements
int numGhostElements
Definition: FinleyElements.h:184
weipa::FinleyElements_ptr
boost::shared_ptr< FinleyElements > FinleyElements_ptr
Definition: FinleyElements.h:63
weipa::FinleyElements::~FinleyElements
virtual ~FinleyElements()
Destructor.
Definition: FinleyElements.h:86
weipa::FinleyElements::getGhostCount
virtual int getGhostCount() const
Returns the number of "ghost" elements.
Definition: FinleyElements.h:129
weipa::FinleyElements::nodesPerElement
int nodesPerElement
Definition: FinleyElements.h:185
weipa::FinleyElements::elementFactor
int elementFactor
Definition: FinleyElements.h:191
weipa::FinleyElementInfo::useQuadNodes
bool useQuadNodes
Definition: FinleyElements.h:59
weipa::FinleyElements::tag
IntVec tag
Definition: FinleyElements.h:188
weipa::StringVec
std::vector< std::string > StringVec
Definition: weipa.h:60
weipa::FinleyElements::getReducedElements
virtual ElementData_ptr getReducedElements() const
Returns the reduced elements.
Definition: FinleyElements.h:154
finley
A suite of factory methods for creating various finley domains.
Definition: finley/src/Assemble.h:31
weipa::FinleyElementInfo::reducedElementType
ZoneType reducedElementType
Definition: FinleyElements.h:55
weipa::FinleyElements::nodeMesh
FinleyNodes_ptr nodeMesh
Definition: FinleyElements.h:180
weipa::FinleyElements::reducedElements
FinleyElements_ptr reducedElements
Definition: FinleyElements.h:179
weipa
Definition: DataVar.cpp:50
NCFTYPE
#define NCFTYPE
Definition: FinleyElements.h:38
weipa::IntVec
std::vector< int > IntVec
Definition: weipa.h:59
weipa::ZoneType
ZoneType
Definition: ElementData.h:26
weipa::FinleyElements::getNodes
virtual NodeData_ptr getNodes() const
Returns the node mesh instance used by the elements.
Definition: FinleyElements.h:151
weipa::FinleyElements::originalMesh
FinleyNodes_ptr originalMesh
Definition: FinleyElements.h:181
weipa::FinleyElements::type
ZoneType type
Definition: FinleyElements.h:186
dudley::ElementTypeId
ElementTypeId
Definition: ElementType.h:24
weipa::FinleyElements
Stores and manipulates one type of finley mesh elements (cells, faces or contacts).
Definition: FinleyElements.h:75
weipa::FinleyElements::getElementFactor
virtual int getElementFactor() const
If the original element type is not supported they are subdivided into N smaller elements (e...
Definition: FinleyElements.h:162
weipa::FinleyElements::name
std::string name
Definition: FinleyElements.h:182
dudley::ElementFile
Definition: dudley/src/ElementFile.h:51
dudley
A suite of factory methods for creating 2D and 3D dudley domains.
Definition: dudley/src/Assemble.h:31
weipa::FinleyElementInfo::quadDim
int quadDim
Definition: FinleyElements.h:60
weipa::FinleyElements::FinleyElements
FinleyElements()
Definition: FinleyElements.h:165
weipa::FinleyElements::getType
virtual ZoneType getType() const
Returns the type of the elements.
Definition: FinleyElements.h:132
weipa::FinleyElementInfo::reducedElementSize
int reducedElementSize
Definition: FinleyElements.h:57
finley::ElementTypeId
ElementTypeId
Definition: ReferenceElements.h:38
weipa::FinleyElements::nodes
IntVec nodes
Definition: FinleyElements.h:187
weipa::FinleyElements::getIDs
virtual const IntVec & getIDs() const
Returns a vector of element IDs.
Definition: FinleyElements.h:143
weipa::FinleyElements::getNodesPerElement
virtual int getNodesPerElement() const
Returns the number of nodes per element.
Definition: FinleyElements.h:126
weipa::ElementData_ptr
boost::shared_ptr< ElementData > ElementData_ptr
Definition: weipa.h:66
weipa::FinleyElements::owner
IntVec owner
Definition: FinleyElements.h:189
weipa::NodeData_ptr
boost::shared_ptr< NodeData > NodeData_ptr
Definition: weipa.h:68
weipa::FinleyElements::reducedQuadMask
QuadMaskInfo reducedQuadMask
Definition: FinleyElements.h:190
finley::ElementFile
Definition: finley/src/ElementFile.h:61
weipa::FinleyElementInfo::elementFactor
int elementFactor
Definition: FinleyElements.h:56