escript  Revision_
weipa/src/SpeckleyDomain.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_SPECKLEYDOMAIN_H__
18 #define __WEIPA_SPECKLEYDOMAIN_H__
19 
20 #include <weipa/DomainChunk.h>
21 #include <weipa/SpeckleyElements.h>
22 #include <boost/enable_shared_from_this.hpp>
23 
24 namespace weipa {
25 
35 class SpeckleyDomain : public DomainChunk, public boost::enable_shared_from_this<SpeckleyDomain>
36 {
37 public:
40  virtual ~SpeckleyDomain() {}
41  virtual bool initFromEscript(const escript::AbstractDomain* domain);
42  virtual bool initFromFile(const std::string& filename);
43  virtual bool writeToSilo(DBfile* dbfile, const std::string& pathInSilo,
44  const StringVec& labels, const StringVec& units,
45  bool writeMeshData);
46  virtual void reorderGhostZones(int ownIndex);
47  virtual void removeGhostZones(int ownIndex);
48  virtual StringVec getMeshNames() const;
49  virtual StringVec getVarNames() const;
50  virtual ElementData_ptr getElementsByName(const std::string& name) const;
51  virtual NodeData_ptr getMeshByName(const std::string& name) const;
52  virtual DataVar_ptr getDataVarByName(const std::string& name) const;
53  virtual Centering getCenteringForFunctionSpace(int fsCode) const;
54  virtual NodeData_ptr getMeshForFunctionSpace(int fsCode) const;
55  virtual ElementData_ptr getElementsForFunctionSpace(int fsCode) const;
56  virtual NodeData_ptr getNodes() const { return nodes; }
57  virtual std::string getSiloPath() const { return siloPath; }
58  virtual void setSiloPath(const std::string& path) { siloPath = path; }
59 
60 private:
61  bool initialized;
65  std::string siloPath;
66 };
67 
68 } // namespace weipa
69 
70 #endif // __WEIPA_SPECKLEYDOMAIN_H__
71 
weipa::SpeckleyDomain::initFromFile
virtual bool initFromFile(const std::string &filename)
Reads the domain from a dump file.
Definition: weipa/src/SpeckleyDomain.cpp:67
weipa::SpeckleyDomain::getCenteringForFunctionSpace
virtual Centering getCenteringForFunctionSpace(int fsCode) const
Returns whether data on given function space is node or cell centered.
Definition: weipa/src/SpeckleyDomain.cpp:73
weipa::SpeckleyDomain::siloPath
std::string siloPath
Definition: weipa/src/SpeckleyDomain.h:88
weipa::SpeckleyDomain::getMeshByName
virtual NodeData_ptr getMeshByName(const std::string &name) const
Returns the node mesh with given name.
Definition: weipa/src/SpeckleyDomain.cpp:198
weipa::SpeckleyNodes_ptr
boost::shared_ptr< SpeckleyNodes > SpeckleyNodes_ptr
Definition: SpeckleyNodes.h:29
weipa::SpeckleyDomain::writeToSilo
virtual bool writeToSilo(DBfile *dbfile, const std::string &pathInSilo, const StringVec &labels, const StringVec &units, bool writeMeshData)
Writes the domain to a Silo file.
Definition: weipa/src/SpeckleyDomain.cpp:220
weipa::SpeckleyDomain::getMeshNames
virtual StringVec getMeshNames() const
Returns the names of all meshes within this domain.
Definition: weipa/src/SpeckleyDomain.cpp:124
weipa::SpeckleyDomain::faces
SpeckleyElements_ptr faces
Definition: weipa/src/SpeckleyDomain.h:87
weipa::DataVar_ptr
boost::shared_ptr< DataVar > DataVar_ptr
Definition: weipa.h:63
weipa
Definition: DataVar.cpp:49
weipa::SpeckleyDomain::initFromEscript
virtual bool initFromEscript(const escript::AbstractDomain *domain)
Initialises the domain using an escript domain instance.
Definition: weipa/src/SpeckleyDomain.cpp:48
weipa::SpeckleyDomain::getDataVarByName
virtual DataVar_ptr getDataVarByName(const std::string &name) const
Creates and returns a variable with domain data.
Definition: weipa/src/SpeckleyDomain.cpp:155
weipa::SpeckleyDomain::setSiloPath
virtual void setSiloPath(const std::string &path)
Sets the silo path to be used when saving to a Silo file.
Definition: weipa/src/SpeckleyDomain.h:81
weipa::ElementData_ptr
boost::shared_ptr< ElementData > ElementData_ptr
Definition: weipa.h:65
weipa::SpeckleyDomain::reorderGhostZones
virtual void reorderGhostZones(int ownIndex)
Reorders elements so that 'ghost' elements (i.e. those that do not belong to ownIndex) appear last.
Definition: weipa/src/SpeckleyDomain.cpp:210
weipa::SpeckleyDomain::initialized
bool initialized
Definition: weipa/src/SpeckleyDomain.h:84
weipa::SpeckleyElements_ptr
boost::shared_ptr< SpeckleyElements > SpeckleyElements_ptr
Definition: SpeckleyElements.h:31
weipa::SpeckleyDomain::getElementsForFunctionSpace
virtual ElementData_ptr getElementsForFunctionSpace(int fsCode) const
Returns the element data for given function space code.
Definition: weipa/src/SpeckleyDomain.cpp:95
weipa::SpeckleyDomain::getVarNames
virtual StringVec getVarNames() const
Returns the names of all 'special' domain variables.
Definition: weipa/src/SpeckleyDomain.cpp:140
weipa::SpeckleyDomain::cells
SpeckleyElements_ptr cells
Definition: weipa/src/SpeckleyDomain.h:86
weipa::SpeckleyDomain::getElementsByName
virtual ElementData_ptr getElementsByName(const std::string &name) const
Returns element data with given name.
Definition: weipa/src/SpeckleyDomain.cpp:187
weipa::SpeckleyDomain::nodes
SpeckleyNodes_ptr nodes
Definition: weipa/src/SpeckleyDomain.h:85
weipa::SpeckleyDomain::removeGhostZones
virtual void removeGhostZones(int ownIndex)
Removes 'ghost' elements and nodes.
Definition: weipa/src/SpeckleyDomain.cpp:215
weipa::SpeckleyDomain::getSiloPath
virtual std::string getSiloPath() const
Returns the absolute path within Silo file if writeToSilo() or setSiloPath() was called before,...
Definition: weipa/src/SpeckleyDomain.h:80
weipa::NodeData_ptr
boost::shared_ptr< NodeData > NodeData_ptr
Definition: weipa.h:67
weipa::StringVec
std::vector< std::string > StringVec
Definition: weipa.h:59
weipa::SpeckleyDomain::getNodes
virtual NodeData_ptr getNodes() const
Returns a pointer to the full nodes.
Definition: weipa/src/SpeckleyDomain.h:79
weipa::SpeckleyDomain::~SpeckleyDomain
virtual ~SpeckleyDomain()
Definition: weipa/src/SpeckleyDomain.h:63
weipa::SpeckleyDomain::SpeckleyDomain
SpeckleyDomain()
Definition: weipa/src/SpeckleyDomain.cpp:34
escript::AbstractDomain
Base class for all escript domains.
Definition: AbstractDomain.h:56
weipa::Centering
Centering
Definition: DomainChunk.h:29
weipa::SpeckleyDomain::getMeshForFunctionSpace
virtual NodeData_ptr getMeshForFunctionSpace(int fsCode) const
Returns the node mesh for given function space code.
Definition: weipa/src/SpeckleyDomain.cpp:79