SpeckleyNodes.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_SPECKLEYNODES_H__
#define __WEIPA_SPECKLEYNODES_H__
#include <weipa/NodeData.h>
class DBfile;
namespace speckley {
class SpeckleyDomain;
}
namespace weipa {
class SpeckleyNodes;
typedef boost::shared_ptr<SpeckleyNodes> SpeckleyNodes_ptr;
class SpeckleyNodes : public NodeData
{
public:
SpeckleyNodes(const std::string& meshName);
SpeckleyNodes(SpeckleyNodes_ptr fullNodes, IntVec& requiredNodes,
const std::string& meshName);
SpeckleyNodes(const SpeckleyNodes& m);
virtual ~SpeckleyNodes();
bool initFromSpeckley(const speckley::SpeckleyDomain* speckleyDomain);
bool writeToSilo(DBfile* dbfile);
virtual void writeCoordinatesVTK(std::ostream& os, int ownIndex);
void setSiloPath(const std::string& path) { siloPath = path; }
const IntVec& getVarDataByName(const std::string& name) const;
virtual StringVec getVarNames() const;
virtual std::string getName() const { return name; }
std::string getFullSiloName() const;
virtual const IntVec& getNodeIDs() const { return nodeID; }
virtual const IntVec& getNodeDistribution() const { return nodeDist; }
virtual const IntVec& getGlobalNodeIndices() const { return nodeID; }
virtual const CoordArray& getCoords() const { return coords; }
virtual int getNumDims() const { return numDims; }
virtual int getNumNodes() const { return numNodes; }
virtual int getGlobalNumNodes() const { return globalNumNodes; }
protected:
CoordArray coords;
int numDims;
int numNodes;
int globalNumNodes;
IntVec nodeID;
IntVec nodeTag;
IntVec nodeDist;
std::string name;
std::string siloPath;
};
inline std::string SpeckleyNodes::getFullSiloName() const
{
std::string result(siloPath);
if (result.length() == 0 || *result.rbegin() != '/')
result += '/';
result += name;
return result;
}
} // namespace weipa
#endif // __WEIPA_SPECKLEYNODES_H__
weipa::SpeckleyNodes::nodeTag
IntVec nodeTag
node IDs
Definition: SpeckleyNodes.h:107
weipa::SpeckleyNodes::numDims
int numDims
x, y[, z] coordinates of nodes
Definition: SpeckleyNodes.h:103
speckley::SpeckleyDomain::getLocalCoordinate
virtual double getLocalCoordinate(dim_t index, int dim) const =0
returns the index'th coordinate value in given dimension for this rank
weipa::SpeckleyNodes::coords
CoordArray coords
Definition: SpeckleyNodes.h:102
weipa::SpeckleyNodes::siloPath
std::string siloPath
the name of this node mesh
Definition: SpeckleyNodes.h:110
weipa::SpeckleyNodes::nodeID
IntVec nodeID
global number of nodes
Definition: SpeckleyNodes.h:106
weipa::SpeckleyNodes_ptr
boost::shared_ptr< SpeckleyNodes > SpeckleyNodes_ptr
Definition: SpeckleyNodes.h:31
weipa::SpeckleyNodes::getVarNames
virtual StringVec getVarNames() const
Returns a vector with the mesh variable names.
Definition: SpeckleyNodes.cpp:195
weipa
Definition: DataVar.cpp:51
weipa::SpeckleyNodes::getVarDataByName
const IntVec & getVarDataByName(const std::string &name) const
Returns an array of nodal data by the given name.
Definition: SpeckleyNodes.cpp:182
weipa::SpeckleyNodes::writeToSilo
bool writeToSilo(DBfile *dbfile)
Writes node data to a Silo file.
Definition: SpeckleyNodes.cpp:227
speckley
Definition: AbstractAssembler.cpp:19
paso::util::copy
void copy(dim_t N, double *out, const double *in)
out = in
Definition: PasoUtil.h:116
weipa::NodeData
Definition: NodeData.h:41
weipa::SpeckleyNodes::nodeDist
IntVec nodeDist
node tags
Definition: SpeckleyNodes.h:108
weipa::SpeckleyNodes::setSiloPath
void setSiloPath(const std::string &path)
Sets the silo path to be used when saving.
Definition: SpeckleyNodes.h:64
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:93
speckley::SpeckleyDomain::borrowSampleReferenceIDs
const index_t * borrowSampleReferenceIDs(int fsType) const =0
returns the array of reference numbers for a function space type
weipa::IndexMap
std::map< int, size_t > IndexMap
Definition: weipa.h:63
weipa::CoordArray
std::vector< float * > CoordArray
Definition: weipa.h:62
weipa::SpeckleyNodes::getGlobalNumNodes
virtual int getGlobalNumNodes() const
Returns the total number of mesh nodes for a distributed mesh.
Definition: SpeckleyNodes.h:99
weipa::SpeckleyNodes::globalNumNodes
int globalNumNodes
number of nodes
Definition: SpeckleyNodes.h:105
weipa::SpeckleyNodes::getGlobalNodeIndices
virtual const IntVec & getGlobalNodeIndices() const
Returns the global node index array.
Definition: SpeckleyNodes.h:87
weipa::SpeckleyNodes::~SpeckleyNodes
virtual ~SpeckleyNodes()
Virtual destructor.
Definition: SpeckleyNodes.cpp:111
weipa::SpeckleyNodes::initFromSpeckley
bool initFromSpeckley(const speckley::SpeckleyDomain *speckleyDomain)
Initialises with speckley domain.
Definition: SpeckleyNodes.cpp:121
weipa::SpeckleyNodes::getNodeIDs
virtual const IntVec & getNodeIDs() const
Returns the node ID array.
Definition: SpeckleyNodes.h:81
speckley::SpeckleyDomain
SpeckleyDomain extends the AbstractContinuousDomain interface for the Speckley library and is the bas...
Definition: speckley/src/SpeckleyDomain.h:99
weipa::SpeckleyNodes::numNodes
int numNodes
dimensionality (2 or 3)
Definition: SpeckleyNodes.h:104
weipa::SpeckleyNodes::getCoords
virtual const CoordArray & getCoords() const
Returns the coordinates of the mesh nodes.
Definition: SpeckleyNodes.h:90
speckley::SpeckleyDomain::getNodeDistribution
virtual IndexVector getNodeDistribution() const =0
returns the node distribution vector
speckley::SpeckleyDomain::getNumNodesPerDim
virtual const dim_t * getNumNodesPerDim() const =0
returns the number of nodes per MPI rank in each dimension
weipa::SpeckleyNodes::getName
virtual std::string getName() const
Returns the name of this node mesh.
Definition: SpeckleyNodes.h:75
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::SpeckleyNodes::writeCoordinatesVTK
virtual void writeCoordinatesVTK(std::ostream &os, int ownIndex)
Writes coordinates to a stream in VTK text format.
Definition: SpeckleyNodes.cpp:206
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:88
weipa::SpeckleyNodes::getFullSiloName
std::string getFullSiloName() const
Returns full Silo mesh name, e.g. "/block0000/Nodes".
Definition: SpeckleyNodes.h:114
weipa::StringVec
std::vector< std::string > StringVec
Definition: weipa.h:61
weipa::SpeckleyNodes::getNumDims
virtual int getNumDims() const
Returns the dimensionality of this mesh (2 or 3).
Definition: SpeckleyNodes.h:93
speckley::SpeckleyDomain::getDim
virtual int getDim() const
returns the number of spatial dimensions of the domain
Definition: speckley/src/SpeckleyDomain.h:171
weipa::SpeckleyNodes::getNumNodes
virtual int getNumNodes() const
Returns the number of mesh nodes.
Definition: SpeckleyNodes.h:96
speckley::IndexVector
std::vector< index_t > IndexVector
Definition: Speckley.h:61
weipa::SpeckleyNodes::SpeckleyNodes
SpeckleyNodes(const std::string &meshName)
Constructor with mesh name.
Definition: SpeckleyNodes.cpp:40
speckley::SpeckleyDomain::getNumDataPointsGlobal
virtual dim_t getNumDataPointsGlobal() const =0
returns the number of data points summed across all MPI processes
weipa::IntVec
std::vector< int > IntVec
Definition: weipa.h:60
weipa::SpeckleyNodes::name
std::string name
node distribution
Definition: SpeckleyNodes.h:109
weipa::SpeckleyNodes::getNodeDistribution
virtual const IntVec & getNodeDistribution() const
Returns the node distribution array.
Definition: SpeckleyNodes.h:84
weipa::SpeckleyNodes
Stores and manipulates speckley mesh nodes.
Definition: SpeckleyNodes.h:39
speckley::Nodes
@ Nodes
Definition: Speckley.h:78