SpeckleyElements.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 __WEIPA_SPECKLEYELEMENTS_H__
#define __WEIPA_SPECKLEYELEMENTS_H__
#include <weipa/ElementData.h>
#include <weipa/SpeckleyNodes.h>
class DBfile;
namespace speckley {
class SpeckleyDomain;
}
namespace weipa {
class SpeckleyElements;
typedef boost::shared_ptr<SpeckleyElements> SpeckleyElements_ptr;
class SpeckleyElements : public ElementData
{
public:
SpeckleyElements(const std::string& elementName, SpeckleyNodes_ptr nodes);
SpeckleyElements(const SpeckleyElements& e);
virtual ~SpeckleyElements() {}
bool initFromSpeckley(const speckley::SpeckleyDomain* speckleyDomain, int fsType);
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; }
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 ElementData_ptr(); }
virtual const QuadMaskInfo& getQuadMask(int functionSpace) const { return quadMask; }
virtual int getElementFactor() const { return 1; }
private:
SpeckleyElements() {}
void buildMeshes();
IntVec prepareGhostIndices(int ownIndex);
void reorderArray(IntVec& v, const IntVec& idx, int elementsPerIndex);
SpeckleyNodes_ptr nodeMesh;
SpeckleyNodes_ptr originalMesh;
std::string name;
int numElements;
int numGhostElements;
int nodesPerElement;
ZoneType type;
IntVec nodes;
IntVec ID, tag, owner;
QuadMaskInfo quadMask; // dummy
};
} // namespace weipa
#endif // __WEIPA_SPECKLEYELEMENTS_H__
weipa::SpeckleyElements::prepareGhostIndices
IntVec prepareGhostIndices(int ownIndex)
Definition: SpeckleyElements.cpp:251
weipa::SpeckleyElements::getNodeList
virtual const IntVec & getNodeList() const
Returns a vector of the node IDs used by the elements.
Definition: SpeckleyElements.h:99
weipa::SpeckleyElements::getVarNames
virtual StringVec getVarNames() const
Returns a vector with the mesh variable names.
Definition: SpeckleyElements.cpp:210
weipa::SpeckleyElements::getGhostCount
virtual int getGhostCount() const
Returns the number of "ghost" elements.
Definition: SpeckleyElements.h:93
weipa::ZONETYPE_HEX
@ ZONETYPE_HEX
Definition: ElementData.h:58
weipa::SpeckleyElements::name
std::string name
Definition: SpeckleyElements.h:131
weipa::SpeckleyElements::reorderArray
void reorderArray(IntVec &v, const IntVec &idx, int elementsPerIndex)
Definition: SpeckleyElements.cpp:231
speckley::SpeckleyDomain::getOrder
int getOrder() const
returns the order of the domain
Definition: speckley/src/SpeckleyDomain.h:756
weipa::QuadMaskInfo
This struct holds a mask (0's and 1's) that indicates which quad nodes contribute to a sub-element wh...
Definition: ElementData.h:54
weipa::SpeckleyNodes_ptr
boost::shared_ptr< SpeckleyNodes > SpeckleyNodes_ptr
Definition: SpeckleyNodes.h:31
weipa::SpeckleyElements::~SpeckleyElements
virtual ~SpeckleyElements()
Destructor.
Definition: SpeckleyElements.h:56
weipa::ZONETYPE_UNKNOWN
@ ZONETYPE_UNKNOWN
Definition: ElementData.h:56
weipa::SpeckleyElements::quadMask
QuadMaskInfo quadMask
Definition: SpeckleyElements.h:138
speckley::SpeckleyDomain::getNumSubdivisionsPerDim
virtual const int * getNumSubdivisionsPerDim() const =0
returns the number of spatial subdivisions in each dimension
weipa::SpeckleyElements::writeToSilo
bool writeToSilo(DBfile *dbfile, const std::string &siloPath, const StringVec &labels, const StringVec &units, bool writeMeshData)
Writes element data into given directory in given Silo file.
Definition: SpeckleyElements.cpp:317
weipa
Definition: DataVar.cpp:51
weipa::ZoneType
ZoneType
Definition: ElementData.h:41
weipa::SpeckleyElements::nodes
IntVec nodes
Definition: SpeckleyElements.h:136
speckley
Definition: AbstractAssembler.cpp:19
weipa::SpeckleyElements::type
ZoneType type
Definition: SpeckleyElements.h:135
paso::util::copy
void copy(dim_t N, double *out, const double *in)
out = in
Definition: PasoUtil.h:116
weipa::SpeckleyElements::writeConnectivityVTK
virtual void writeConnectivityVTK(std::ostream &os)
Writes connectivity data to a stream in VTK text format.
Definition: SpeckleyElements.cpp:288
weipa::SpeckleyElements::nodesPerElement
int nodesPerElement
Definition: SpeckleyElements.h:134
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:93
weipa::SpeckleyElements::buildMeshes
void buildMeshes()
Definition: SpeckleyElements.cpp:271
speckley::SpeckleyDomain::borrowSampleReferenceIDs
const index_t * borrowSampleReferenceIDs(int fsType) const =0
returns the array of reference numbers for a function space type
weipa::SpeckleyElements::getReducedElements
virtual ElementData_ptr getReducedElements() const
Returns the reduced elements.
Definition: SpeckleyElements.h:113
weipa::SpeckleyElements
Stores and manipulates one type of speckley mesh elements (cells, faces).
Definition: SpeckleyElements.h:45
weipa::CoordArray
std::vector< float * > CoordArray
Definition: weipa.h:62
weipa::SpeckleyElements::getMeshNames
virtual StringVec getMeshNames() const
Returns the names of the meshes associated with the elements.
Definition: SpeckleyElements.cpp:202
weipa::SpeckleyElements::getVarDataByName
virtual const IntVec & getVarDataByName(const std::string varName) const
Returns an array of data values for the name provided.
Definition: SpeckleyElements.cpp:219
weipa::SpeckleyElements::owner
IntVec owner
Definition: SpeckleyElements.h:137
weipa::ElementData_ptr
boost::shared_ptr< ElementData > ElementData_ptr
Definition: weipa.h:67
weipa::ElementData
Stores and manipulates one type of domain elements.
Definition: ElementData.h:63
weipa::SpeckleyElements::getNodesPerElement
virtual int getNodesPerElement() const
Returns the number of nodes per element.
Definition: SpeckleyElements.h:90
speckley::SpeckleyDomain::getNumElementsPerDim
virtual const dim_t * getNumElementsPerDim() const =0
returns the number of elements per MPI rank in each dimension
speckley::SpeckleyDomain
SpeckleyDomain extends the AbstractContinuousDomain interface for the Speckley library and is the bas...
Definition: speckley/src/SpeckleyDomain.h:99
weipa::SpeckleyElements::numGhostElements
int numGhostElements
Definition: SpeckleyElements.h:133
weipa::SpeckleyElements_ptr
boost::shared_ptr< SpeckleyElements > SpeckleyElements_ptr
Definition: SpeckleyElements.h:33
weipa::SpeckleyElements::numElements
int numElements
Definition: SpeckleyElements.h:132
speckley::SpeckleyDomain::getNumNodesPerDim
virtual const dim_t * getNumNodesPerDim() const =0
returns the number of nodes per MPI rank in each dimension
weipa::SpeckleyElements::removeGhostZones
void removeGhostZones(int ownIndex)
Removes "ghost" elements.
Definition: SpeckleyElements.cpp:266
weipa::ZONETYPE_QUAD
@ ZONETYPE_QUAD
Definition: ElementData.h:60
weipa::SpeckleyElements::nodeMesh
SpeckleyNodes_ptr nodeMesh
Definition: SpeckleyElements.h:129
weipa::SpeckleyElements::reorderGhostZones
void reorderGhostZones(int ownIndex)
Moves "ghost" elements (whose owner does not match ownIndex) and the corresponding data to the end of...
Definition: SpeckleyElements.cpp:261
speckley::Elements
@ Elements
Definition: Speckley.h:80
speckley::SpeckleyDomain::getDataShape
virtual std::pair< int, dim_t > getDataShape(int fsType) const
returns the number of data points per sample, and the number of samples as a pair.
Definition: speckley/src/SpeckleyDomain.cpp:126
weipa::SpeckleyElements::getType
virtual ZoneType getType() const
Returns the type of the elements.
Definition: SpeckleyElements.h:96
weipa::SpeckleyElements::ID
IntVec ID
Definition: SpeckleyElements.h:137
weipa::SpeckleyElements::getQuadMask
virtual const QuadMaskInfo & getQuadMask(int functionSpace) const
Returns a QuadMaskInfo structure for given functionspace code.
Definition: SpeckleyElements.h:116
weipa::NodeData_ptr
boost::shared_ptr< NodeData > NodeData_ptr
Definition: weipa.h:69
weipa::StringVec
std::vector< std::string > StringVec
Definition: weipa.h:61
weipa::SpeckleyElements::initFromSpeckley
bool initFromSpeckley(const speckley::SpeckleyDomain *speckleyDomain, int fsType)
Initialises with data from a SpeckleyDomain instance.
Definition: SpeckleyElements.cpp:76
speckley::SpeckleyDomain::getMPIRank
virtual int getMPIRank() const
returns the MPI rank of this processor
Definition: speckley/src/SpeckleyDomain.h:130
speckley::SpeckleyDomain::getDim
virtual int getDim() const
returns the number of spatial dimensions of the domain
Definition: speckley/src/SpeckleyDomain.h:171
weipa::SpeckleyElements::originalMesh
SpeckleyNodes_ptr originalMesh
Definition: SpeckleyElements.h:130
weipa::ZONETYPE_POLYGON
@ ZONETYPE_POLYGON
Definition: ElementData.h:59
speckley::SpeckleyDomain::getNumFacesPerBoundary
virtual const dim_t * getNumFacesPerBoundary() const =0
returns the number of face elements in the order (left,right,bottom,top,[front,back]) on current MPI ...
weipa::SpeckleyElements::tag
IntVec tag
Definition: SpeckleyElements.h:137
weipa::SpeckleyElements::getIDs
virtual const IntVec & getIDs() const
Returns a vector of element IDs.
Definition: SpeckleyElements.h:102
weipa::IntVec
std::vector< int > IntVec
Definition: weipa.h:60
weipa::SpeckleyElements::getNodes
virtual NodeData_ptr getNodes() const
Returns the node mesh instance used by the elements.
Definition: SpeckleyElements.h:110
weipa::ZONETYPE_BEAM
@ ZONETYPE_BEAM
Definition: ElementData.h:57
weipa::SpeckleyElements::getNumElements
virtual int getNumElements() const
Returns the number of elements.
Definition: SpeckleyElements.h:87
weipa::SpeckleyElements::SpeckleyElements
SpeckleyElements()
Definition: SpeckleyElements.h:124
weipa::SpeckleyNodes
Stores and manipulates speckley mesh nodes.
Definition: SpeckleyNodes.h:39
weipa::SpeckleyElements::getElementFactor
virtual int getElementFactor() const
If the original element type is not supported they are subdivided into N smaller elements (e....
Definition: SpeckleyElements.h:121