FinleyNodes.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_FINLEYNODES_H__
#define __WEIPA_FINLEYNODES_H__
#include <weipa/NodeData.h>
class DBfile;
#ifdef NETCDF4
#include <ncFile.h>
#define NCFTYPE netCDF::NcFile&
#else
class NcFile;
#define NCFTYPE NcFile*
#endif
namespace finley {
class NodeFile;
}
namespace dudley {
class NodeFile;
}
namespace weipa {
class FinleyNodes;
typedef boost::shared_ptr<FinleyNodes> FinleyNodes_ptr;
class FinleyNodes : public NodeData
{
public:
FinleyNodes(const std::string& meshName);
FinleyNodes(FinleyNodes_ptr fullNodes, IntVec& requiredNodes,
const std::string& meshName);
FinleyNodes(const FinleyNodes& m);
virtual ~FinleyNodes();
bool initFromDudley(const dudley::NodeFile* dudleyFile);
bool initFromFinley(const finley::NodeFile* finleyFile);
bool readFromNc(NCFTYPE ncFile);
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 nodeGNI; }
virtual const CoordArray& getCoords() const { return coords; }
virtual int getNumDims() const { return numDims; }
virtual int getNumNodes() const { return numNodes; }
virtual int getGlobalNumNodes() const;
protected:
CoordArray coords;
int numDims;
int numNodes;
IntVec nodeID;
IntVec nodeTag, nodeGDOF, nodeGNI, nodeGRDFI, nodeGRNI;
IntVec nodeDist;
std::string name;
std::string siloPath;
};
inline std::string FinleyNodes::getFullSiloName() const
{
std::string result(siloPath);
if (result.length() == 0 || *result.rbegin() != '/')
result += '/';
result += name;
return result;
}
} // namespace weipa
#undef NCFTYPE
#endif // __WEIPA_FINLEYNODES_H__
NCFTYPE
#define NCFTYPE
Definition: FinleyNodes.h:31
dudley::NodeFile
Definition: dudley/src/NodeFile.h:40
finley::NodeFile
Definition: finley/src/NodeFile.h:42
weipa::FinleyNodes
Stores and manipulates finley mesh nodes.
Definition: FinleyNodes.h:52
weipa::FinleyNodes::initFromDudley
bool initFromDudley(const dudley::NodeFile *dudleyFile)
Initialises with dudley node file.
Definition: FinleyNodes.cpp:142
weipa::FinleyNodes::siloPath
std::string siloPath
the name of this node mesh
Definition: FinleyNodes.h:127
weipa::FinleyNodes::writeCoordinatesVTK
virtual void writeCoordinatesVTK(std::ostream &os, int ownIndex)
Writes coordinates to a stream in VTK text format.
Definition: FinleyNodes.cpp:444
weipa::FinleyNodes::nodeGRDFI
IntVec nodeGRDFI
Definition: FinleyNodes.h:124
weipa::FinleyNodes::nodeGNI
IntVec nodeGNI
Definition: FinleyNodes.h:124
weipa::FinleyNodes::getNodeIDs
virtual const IntVec & getNodeIDs() const
Returns the node ID array.
Definition: FinleyNodes.h:99
weipa::FinleyNodes::getNodeDistribution
virtual const IntVec & getNodeDistribution() const
Returns the node distribution array.
Definition: FinleyNodes.h:102
weipa::FinleyNodes::numDims
int numDims
x, y[, z] coordinates of nodes
Definition: FinleyNodes.h:121
weipa::FinleyNodes::getCoords
virtual const CoordArray & getCoords() const
Returns the coordinates of the mesh nodes.
Definition: FinleyNodes.h:108
weipa::FinleyNodes::getGlobalNumNodes
virtual int getGlobalNumNodes() const
Returns the total number of mesh nodes for a distributed mesh.
Definition: FinleyNodes.cpp:433
weipa::FinleyNodes::getNumNodes
virtual int getNumNodes() const
Returns the number of mesh nodes.
Definition: FinleyNodes.h:114
weipa::FinleyNodes::getVarNames
virtual StringVec getVarNames() const
Returns a vector with the mesh variable names.
Definition: FinleyNodes.cpp:418
weipa::FinleyNodes::nodeTag
IntVec nodeTag
node IDs
Definition: FinleyNodes.h:124
weipa::FinleyNodes::getFullSiloName
std::string getFullSiloName() const
Returns full Silo mesh name, e.g. "/block0000/Nodes".
Definition: FinleyNodes.h:131
weipa::FinleyNodes::getNumDims
virtual int getNumDims() const
Returns the dimensionality of this mesh (2 or 3).
Definition: FinleyNodes.h:111
weipa::FinleyNodes::nodeDist
IntVec nodeDist
Definition: FinleyNodes.h:125
weipa::FinleyNodes::name
std::string name
node distribution
Definition: FinleyNodes.h:126
weipa::FinleyNodes::initFromFinley
bool initFromFinley(const finley::NodeFile *finleyFile)
Initialises with finley node file.
Definition: FinleyNodes.cpp:189
weipa::FinleyNodes::~FinleyNodes
virtual ~FinleyNodes()
Virtual destructor.
Definition: FinleyNodes.cpp:132
weipa::FinleyNodes::getName
virtual std::string getName() const
Returns the name of this node mesh.
Definition: FinleyNodes.h:93
weipa::FinleyNodes::nodeID
IntVec nodeID
number of nodes
Definition: FinleyNodes.h:123
weipa::FinleyNodes::nodeGRNI
IntVec nodeGRNI
Definition: FinleyNodes.h:124
weipa::FinleyNodes::FinleyNodes
FinleyNodes(const std::string &meshName)
Constructor with mesh name.
Definition: FinleyNodes.cpp:55
weipa::FinleyNodes::getGlobalNodeIndices
virtual const IntVec & getGlobalNodeIndices() const
Returns the global node index array.
Definition: FinleyNodes.h:105
weipa::FinleyNodes::coords
CoordArray coords
Definition: FinleyNodes.h:120
weipa::FinleyNodes::numNodes
int numNodes
dimensionality (2 or 3)
Definition: FinleyNodes.h:122
weipa::FinleyNodes::nodeGDOF
IntVec nodeGDOF
Definition: FinleyNodes.h:124
weipa::FinleyNodes::setSiloPath
void setSiloPath(const std::string &path)
Sets the silo path to be used when saving.
Definition: FinleyNodes.h:82
weipa::FinleyNodes::writeToSilo
bool writeToSilo(DBfile *dbfile)
Writes node data to a Silo file.
Definition: FinleyNodes.cpp:465
weipa::FinleyNodes::readFromNc
bool readFromNc(NcFile *ncFile)
Reads node data from a NetCDF file.
Definition: FinleyNodes.cpp:320
weipa::FinleyNodes::getVarDataByName
const IntVec & getVarDataByName(const std::string &name) const
Returns an array of nodal data by the given name.
Definition: FinleyNodes.cpp:397
weipa::NodeData
Definition: NodeData.h:28
dudley
A suite of factory methods for creating 2D and 3D dudley domains.
Definition: dudley/src/Assemble.h:32
finley
A suite of factory methods for creating various finley domains.
Definition: finley/src/Assemble.h:32
weipa
Definition: DataVar.cpp:51
weipa::StringVec
std::vector< std::string > StringVec
Definition: weipa.h:61
weipa::IntVec
std::vector< int > IntVec
Definition: weipa.h:60
weipa::CoordArray
std::vector< float * > CoordArray
Definition: weipa.h:62
weipa::FinleyNodes_ptr
boost::shared_ptr< FinleyNodes > FinleyNodes_ptr
Definition: FinleyNodes.h:43