escript  Revision_
RipleyElements.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2018 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 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 #ifndef __WEIPA_RIPLEYELEMENTS_H__
18 #define __WEIPA_RIPLEYELEMENTS_H__
19 
20 #include <weipa/ElementData.h>
21 #include <weipa/RipleyNodes.h>
22 
23 class DBfile;
24 
25 namespace ripley {
26 class RipleyDomain;
27 }
28 
29 
30 namespace weipa {
31 
32 class RipleyElements;
33 typedef boost::shared_ptr<RipleyElements> RipleyElements_ptr;
34 
44 class RipleyElements : public ElementData
45 {
46 public:
47 
49  RipleyElements(const std::string& elementName, RipleyNodes_ptr nodes);
50 
53 
55  virtual ~RipleyElements() {}
56 
58  bool initFromRipley(const ripley::RipleyDomain* ripleyDomain, int fsType);
59 
62  void reorderGhostZones(int ownIndex);
63 
65  void removeGhostZones(int ownIndex);
66 
68  virtual void writeConnectivityVTK(std::ostream& os);
69 
75  bool writeToSilo(DBfile* dbfile, const std::string& siloPath,
76  const StringVec& labels, const StringVec& units,
77  bool writeMeshData);
78 
80  virtual StringVec getMeshNames() const;
81 
83  virtual StringVec getVarNames() const;
84 
86  virtual int getNumElements() const { return numElements; }
87 
89  virtual int getNodesPerElement() const { return nodesPerElement; }
90 
92  virtual int getGhostCount() const { return numGhostElements; }
93 
95  virtual ZoneType getType() const { return type; }
96 
98  virtual const IntVec& getNodeList() const { return nodes; }
99 
101  virtual const IntVec& getIDs() const { return ID; }
102 
106  virtual const IntVec& getVarDataByName(const std::string varName) const;
107 
109  virtual NodeData_ptr getNodes() const { return nodeMesh; }
110 
112  virtual ElementData_ptr getReducedElements() const { return ElementData_ptr(); }
113 
115  virtual const QuadMaskInfo& getQuadMask(int functionSpace) const { return quadMask; }
116 
120  virtual int getElementFactor() const { return 1; }
121 
122 private:
123  RipleyElements() {}
124  void buildMeshes();
125  IntVec prepareGhostIndices(int ownIndex);
126  void reorderArray(IntVec& v, const IntVec& idx, int elementsPerIndex);
127 
130  std::string name;
137  QuadMaskInfo quadMask; // dummy
138 };
139 
140 } // namespace weipa
141 
142 #endif // __WEIPA_RIPLEYELEMENTS_H__
143 
weipa::RipleyElements::getType
virtual ZoneType getType() const
Returns the type of the elements.
Definition: RipleyElements.h:94
weipa::RipleyElements::ID
IntVec ID
Definition: RipleyElements.h:135
ripley
Definition: ripley/src/AbstractAssembler.h:24
weipa::RipleyElements::numGhostElements
int numGhostElements
Definition: RipleyElements.h:131
ripley::RipleyDomain::getOwnerVector
virtual RankVector getOwnerVector(int fsType) const =0
returns a vector of rank numbers where vec[i]=n means that rank n 'owns' element/face element i.
weipa::RipleyElements::removeGhostZones
void removeGhostZones(int ownIndex)
Removes "ghost" elements.
Definition: RipleyElements.cpp:326
weipa::RipleyElements::reorderArray
void reorderArray(IntVec &v, const IntVec &idx, int elementsPerIndex)
Definition: RipleyElements.cpp:271
weipa::ZONETYPE_HEX
Definition: ElementData.h:52
weipa::RipleyElements::nodesPerElement
int nodesPerElement
Definition: RipleyElements.h:132
weipa::RipleyElements
Stores and manipulates one type of ripley mesh elements (cells, faces).
Definition: RipleyElements.h:43
ripley::RipleyDomain::getNumNodesPerDim
virtual const dim_t * getNumNodesPerDim() const =0
returns the number of nodes per MPI rank in each dimension
weipa::RipleyElements::getNodes
virtual NodeData_ptr getNodes() const
Returns the node mesh instance used by the elements.
Definition: RipleyElements.h:108
weipa::RipleyElements::getGhostCount
virtual int getGhostCount() const
Returns the number of "ghost" elements.
Definition: RipleyElements.h:91
ripley::Elements
Definition: Ripley.h:65
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:50
weipa::RipleyElements::getIDs
virtual const IntVec & getIDs() const
Returns a vector of element IDs.
Definition: RipleyElements.h:100
weipa::ZONETYPE_UNKNOWN
Definition: ElementData.h:50
weipa::RipleyElements::getElementFactor
virtual int getElementFactor() const
If the original element type is not supported they are subdivided into N smaller elements (e....
Definition: RipleyElements.h:119
weipa
Definition: DataVar.cpp:49
weipa::ZoneType
ZoneType
Definition: ElementData.h:37
weipa::RipleyElements_ptr
boost::shared_ptr< RipleyElements > RipleyElements_ptr
Definition: RipleyElements.h:31
weipa::RipleyElements::getVarDataByName
virtual const IntVec & getVarDataByName(const std::string varName) const
Returns an array of data values for the name provided.
Definition: RipleyElements.cpp:259
weipa::RipleyNodes
Stores and manipulates ripley mesh nodes.
Definition: RipleyNodes.h:37
weipa::RipleyElements::prepareGhostIndices
IntVec prepareGhostIndices(int ownIndex)
Definition: RipleyElements.cpp:292
paso::util::copy
void copy(dim_t N, double *out, const double *in)
out = in
Definition: PasoUtil.h:110
weipa::RipleyElements::getMeshNames
virtual StringVec getMeshNames() const
Returns the names of the meshes associated with the elements.
Definition: RipleyElements.cpp:242
ripley::RipleyDomain
RipleyDomain extends the AbstractContinuousDomain interface for the Ripley library and is the base cl...
Definition: ripley/src/RipleyDomain.h:112
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:87
weipa::CoordArray
std::vector< float * > CoordArray
Definition: weipa.h:60
weipa::RipleyElements::getQuadMask
virtual const QuadMaskInfo & getQuadMask(int functionSpace) const
Returns a QuadMaskInfo structure for given functionspace code.
Definition: RipleyElements.h:114
weipa::ElementData_ptr
boost::shared_ptr< ElementData > ElementData_ptr
Definition: weipa.h:65
weipa::ElementData
Stores and manipulates one type of domain elements.
Definition: ElementData.h:59
weipa::RipleyElements::reorderGhostZones
void reorderGhostZones(int ownIndex)
Moves "ghost" elements (whose owner does not match ownIndex) and the corresponding data to the end of...
Definition: RipleyElements.cpp:313
weipa::RipleyElements::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: RipleyElements.cpp:386
ripley::RipleyDomain::getDim
virtual int getDim() const
returns the number of spatial dimensions of the domain
Definition: ripley/src/RipleyDomain.h:187
weipa::RipleyElements::name
std::string name
Definition: RipleyElements.h:129
ripley::FaceElements
Definition: Ripley.h:67
weipa::RipleyElements::getVarNames
virtual StringVec getVarNames() const
Returns a vector with the mesh variable names.
Definition: RipleyElements.cpp:250
weipa::ZONETYPE_QUAD
Definition: ElementData.h:54
ripley::RipleyDomain::borrowSampleReferenceIDs
const dim_t * borrowSampleReferenceIDs(int fsType) const =0
returns the array of reference numbers for a function space type
weipa::RipleyElements::nodes
IntVec nodes
Definition: RipleyElements.h:134
weipa::RipleyElements::owner
IntVec owner
Definition: RipleyElements.h:135
weipa::RipleyElements::writeConnectivityVTK
virtual void writeConnectivityVTK(std::ostream &os)
Writes connectivity data to a stream in VTK text format.
Definition: RipleyElements.cpp:357
weipa::RipleyElements::initFromRipley
bool initFromRipley(const ripley::RipleyDomain *ripleyDomain, int fsType)
Initialises with data from a RipleyDomain instance.
Definition: RipleyElements.cpp:73
weipa::NodeData_ptr
boost::shared_ptr< NodeData > NodeData_ptr
Definition: weipa.h:67
weipa::RipleyElements::originalMesh
RipleyNodes_ptr originalMesh
Definition: RipleyElements.h:128
weipa::StringVec
std::vector< std::string > StringVec
Definition: weipa.h:59
weipa::RipleyElements::RipleyElements
RipleyElements()
Definition: RipleyElements.h:122
weipa::RipleyElements::getNodeList
virtual const IntVec & getNodeList() const
Returns a vector of the node IDs used by the elements.
Definition: RipleyElements.h:97
weipa::RipleyElements::tag
IntVec tag
Definition: RipleyElements.h:135
ripley::RipleyDomain::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::ZONETYPE_POLYGON
Definition: ElementData.h:53
weipa::RipleyElements::~RipleyElements
virtual ~RipleyElements()
Destructor.
Definition: RipleyElements.h:54
weipa::RipleyElements::buildMeshes
void buildMeshes()
Definition: RipleyElements.cpp:340
weipa::RipleyElements::getNodesPerElement
virtual int getNodesPerElement() const
Returns the number of nodes per element.
Definition: RipleyElements.h:88
ripley::RipleyDomain::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: ripley/src/RipleyDomain.cpp:150
weipa::RipleyElements::quadMask
QuadMaskInfo quadMask
Definition: RipleyElements.h:136
weipa::IntVec
std::vector< int > IntVec
Definition: weipa.h:58
ripley::RipleyDomain::getNumElementsPerDim
virtual const dim_t * getNumElementsPerDim() const =0
returns the number of elements per MPI rank in each dimension
weipa::RipleyElements::type
ZoneType type
Definition: RipleyElements.h:133
weipa::RipleyElements::nodeMesh
RipleyNodes_ptr nodeMesh
Definition: RipleyElements.h:127
weipa::ZONETYPE_BEAM
Definition: ElementData.h:51
weipa::RipleyElements::numElements
int numElements
Definition: RipleyElements.h:130
weipa::RipleyElements::getNumElements
virtual int getNumElements() const
Returns the number of elements.
Definition: RipleyElements.h:85
weipa::RipleyNodes_ptr
boost::shared_ptr< RipleyNodes > RipleyNodes_ptr
Definition: RipleyNodes.h:29
weipa::RipleyElements::getReducedElements
virtual ElementData_ptr getReducedElements() const
Returns the reduced elements.
Definition: RipleyElements.h:111