escript Revision_
SpeckleyElements.h
Go to the documentation of this file.
1
2/*****************************************************************************
3*
4* Copyright (c) 2003-2020 by The University of Queensland
5* http://www.uq.edu.au
6*
7* Primary Business: Queensland, Australia
8* Licensed under the Apache License, version 2.0
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12* Development 2012-2013 by School of Earth Sciences
13* Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
14* Development from 2019 by School of Earth and Environmental Sciences
15**
16*****************************************************************************/
17
18#ifndef __WEIPA_SPECKLEYELEMENTS_H__
19#define __WEIPA_SPECKLEYELEMENTS_H__
20
21#include <weipa/ElementData.h>
22#include <weipa/SpeckleyNodes.h>
23
24class DBfile;
25
26namespace speckley {
27class SpeckleyDomain;
28}
29
30
31namespace weipa {
32
33class SpeckleyElements;
34typedef boost::shared_ptr<SpeckleyElements> SpeckleyElements_ptr;
35
46{
47public:
48
50 SpeckleyElements(const std::string& elementName, SpeckleyNodes_ptr nodes);
51
54
56 virtual ~SpeckleyElements() {}
57
59 bool initFromSpeckley(const speckley::SpeckleyDomain* speckleyDomain, int fsType);
60
63 void reorderGhostZones(int ownIndex);
64
66 void removeGhostZones(int ownIndex);
67
69 virtual void writeConnectivityVTK(std::ostream& os);
70
76 bool writeToSilo(DBfile* dbfile, const std::string& siloPath,
77 const StringVec& labels, const StringVec& units,
78 bool writeMeshData);
79
81 virtual StringVec getMeshNames() const;
82
84 virtual StringVec getVarNames() const;
85
87 virtual int getNumElements() const { return numElements; }
88
90 virtual int getNodesPerElement() const { return nodesPerElement; }
91
93 virtual int getGhostCount() const { return numGhostElements; }
94
96 virtual ZoneType getType() const { return type; }
97
99 virtual const IntVec& getNodeList() const { return nodes; }
100
102 virtual const IntVec& getIDs() const { return ID; }
103
107 virtual const IntVec& getVarDataByName(const std::string varName) const;
108
110 virtual NodeData_ptr getNodes() const { return nodeMesh; }
111
114
116 virtual const QuadMaskInfo& getQuadMask(int functionSpace) const { return quadMask; }
117
121 virtual int getElementFactor() const { return 1; }
122
123private:
125 void buildMeshes();
126 IntVec prepareGhostIndices(int ownIndex);
127 void reorderArray(IntVec& v, const IntVec& idx, int elementsPerIndex);
128
131 std::string name;
139};
140
141} // namespace weipa
142
143#endif // __WEIPA_SPECKLEYELEMENTS_H__
144
SpeckleyDomain extends the AbstractContinuousDomain interface for the Speckley library and is the bas...
Definition speckley/src/SpeckleyDomain.h:86
Stores and manipulates one type of domain elements.
Definition ElementData.h:50
Stores and manipulates one type of speckley mesh elements (cells, faces).
Definition SpeckleyElements.h:46
ZoneType type
Definition SpeckleyElements.h:135
virtual int getNumElements() const
Returns the number of elements.
Definition SpeckleyElements.h:87
void buildMeshes()
Definition SpeckleyElements.cpp:271
virtual const QuadMaskInfo & getQuadMask(int functionSpace) const
Returns a QuadMaskInfo structure for given functionspace code.
Definition SpeckleyElements.h:116
virtual void writeConnectivityVTK(std::ostream &os)
Writes connectivity data to a stream in VTK text format.
Definition SpeckleyElements.cpp:288
virtual int getGhostCount() const
Returns the number of "ghost" elements.
Definition SpeckleyElements.h:93
virtual const IntVec & getNodeList() const
Returns a vector of the node IDs used by the elements.
Definition SpeckleyElements.h:99
virtual StringVec getVarNames() const
Returns a vector with the mesh variable names.
Definition SpeckleyElements.cpp:210
IntVec prepareGhostIndices(int ownIndex)
Definition SpeckleyElements.cpp:251
void removeGhostZones(int ownIndex)
Removes "ghost" elements.
Definition SpeckleyElements.cpp:266
virtual StringVec getMeshNames() const
Returns the names of the meshes associated with the elements.
Definition SpeckleyElements.cpp:202
virtual const IntVec & getIDs() const
Returns a vector of element IDs.
Definition SpeckleyElements.h:102
SpeckleyElements()
Definition SpeckleyElements.h:124
virtual int getElementFactor() const
If the original element type is not supported they are subdivided into N smaller elements (e....
Definition SpeckleyElements.h:121
int nodesPerElement
Definition SpeckleyElements.h:134
virtual ~SpeckleyElements()
Destructor.
Definition SpeckleyElements.h:56
void reorderArray(IntVec &v, const IntVec &idx, int elementsPerIndex)
Definition SpeckleyElements.cpp:231
IntVec ID
Definition SpeckleyElements.h:137
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
IntVec owner
Definition SpeckleyElements.h:137
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
IntVec nodes
Definition SpeckleyElements.h:136
IntVec tag
Definition SpeckleyElements.h:137
std::string name
Definition SpeckleyElements.h:131
virtual NodeData_ptr getNodes() const
Returns the node mesh instance used by the elements.
Definition SpeckleyElements.h:110
virtual ElementData_ptr getReducedElements() const
Returns the reduced elements.
Definition SpeckleyElements.h:113
QuadMaskInfo quadMask
Definition SpeckleyElements.h:138
int numGhostElements
Definition SpeckleyElements.h:133
virtual const IntVec & getVarDataByName(const std::string varName) const
Returns an array of data values for the name provided.
Definition SpeckleyElements.cpp:219
virtual ZoneType getType() const
Returns the type of the elements.
Definition SpeckleyElements.h:96
bool initFromSpeckley(const speckley::SpeckleyDomain *speckleyDomain, int fsType)
Initialises with data from a SpeckleyDomain instance.
Definition SpeckleyElements.cpp:76
int numElements
Definition SpeckleyElements.h:132
virtual int getNodesPerElement() const
Returns the number of nodes per element.
Definition SpeckleyElements.h:90
SpeckleyNodes_ptr nodeMesh
Definition SpeckleyElements.h:129
SpeckleyNodes_ptr originalMesh
Definition SpeckleyElements.h:130
Definition AbstractAssembler.cpp:19
Definition DataVar.cpp:51
boost::shared_ptr< SpeckleyNodes > SpeckleyNodes_ptr
Definition SpeckleyNodes.h:32
std::vector< std::string > StringVec
Definition weipa.h:61
boost::shared_ptr< ElementData > ElementData_ptr
Definition weipa.h:67
std::vector< int > IntVec
Definition weipa.h:60
boost::shared_ptr< SpeckleyElements > SpeckleyElements_ptr
Definition SpeckleyElements.h:34
boost::shared_ptr< NodeData > NodeData_ptr
Definition weipa.h:69
ZoneType
Definition ElementData.h:27
This struct holds a mask (0's and 1's) that indicates which quad nodes contribute to a sub-element wh...
Definition ElementData.h:40