escript  Revision_
weipa/src/FinleyDomain.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_FINLEYDOMAIN_H__
19 #define __WEIPA_FINLEYDOMAIN_H__
20 
21 #include <weipa/DomainChunk.h>
22 #include <weipa/FinleyElements.h>
23 #include <boost/enable_shared_from_this.hpp>
24 
25 namespace finley {
26  class Mesh;
27 }
28 
29 namespace weipa {
30 
42 class FinleyDomain : public DomainChunk, public boost::enable_shared_from_this<FinleyDomain>
43 {
44 public:
45  FinleyDomain();
46  FinleyDomain(const FinleyDomain& m);
47  virtual ~FinleyDomain();
48  virtual bool initFromEscript(const escript::AbstractDomain* domain);
49  virtual bool initFromFile(const std::string& filename);
50  virtual bool writeToSilo(DBfile* dbfile, const std::string& pathInSilo,
51  const StringVec& labels, const StringVec& units,
52  bool writeMeshData);
53  virtual void reorderGhostZones(int ownIndex);
54  virtual void removeGhostZones(int ownIndex);
55  virtual StringVec getMeshNames() const;
56  virtual StringVec getVarNames() const;
57  virtual ElementData_ptr getElementsByName(const std::string& name) const;
58  virtual NodeData_ptr getMeshByName(const std::string& name) const;
59  virtual DataVar_ptr getDataVarByName(const std::string& name) const;
60  virtual Centering getCenteringForFunctionSpace(int fsCode) const;
61  virtual NodeData_ptr getMeshForFunctionSpace(int fsCode) const;
62  virtual ElementData_ptr getElementsForFunctionSpace(int fsCode) const;
63  virtual NodeData_ptr getNodes() const { return nodes; }
64  virtual std::string getSiloPath() const { return siloPath; }
65  virtual void setSiloPath(const std::string& path) { siloPath = path; }
66 
67 private:
68  void cleanup();
69 
75  std::string siloPath;
76 };
77 
78 } // namespace weipa
79 
80 #endif // __WEIPA_FINLEYDOMAIN_H__
81 
weipa::FinleyDomain::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/FinleyDomain.cpp:506
weipa::FinleyDomain::~FinleyDomain
virtual ~FinleyDomain()
Definition: weipa/src/FinleyDomain.cpp:78
weipa::FinleyDomain::removeGhostZones
virtual void removeGhostZones(int ownIndex)
Removes 'ghost' elements and nodes.
Definition: weipa/src/FinleyDomain.cpp:487
weipa::FinleyDomain::getElementsForFunctionSpace
virtual ElementData_ptr getElementsForFunctionSpace(int fsCode) const
Returns the element data for given function space code.
Definition: weipa/src/FinleyDomain.cpp:252
weipa::FinleyDomain::faces
FinleyElements_ptr faces
Definition: weipa/src/FinleyDomain.h:72
weipa::FinleyDomain::getMeshNames
virtual StringVec getMeshNames() const
Returns the names of all meshes within this domain.
Definition: weipa/src/FinleyDomain.cpp:333
weipa::FinleyDomain::nodes
FinleyNodes_ptr nodes
Definition: weipa/src/FinleyDomain.h:70
weipa::FinleyDomain::getDataVarByName
virtual DataVar_ptr getDataVarByName(const std::string &name) const
Creates and returns a variable with domain data.
Definition: weipa/src/FinleyDomain.cpp:371
weipa::FinleyDomain::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/FinleyDomain.cpp:469
weipa::DataVar_ptr
boost::shared_ptr< DataVar > DataVar_ptr
Definition: weipa.h:64
weipa
Definition: DataVar.cpp:50
weipa::FinleyDomain::siloPath
std::string siloPath
Definition: weipa/src/FinleyDomain.h:74
weipa::FinleyDomain::contacts
FinleyElements_ptr contacts
Definition: weipa/src/FinleyDomain.h:73
weipa::FinleyElements_ptr
boost::shared_ptr< FinleyElements > FinleyElements_ptr
Definition: FinleyElements.h:63
weipa::FinleyDomain::initFromFile
virtual bool initFromFile(const std::string &filename)
Reads the domain from a dump file.
Definition: weipa/src/FinleyDomain.cpp:183
weipa::FinleyDomain::cells
FinleyElements_ptr cells
Definition: weipa/src/FinleyDomain.h:71
weipa::ElementData_ptr
boost::shared_ptr< ElementData > ElementData_ptr
Definition: weipa.h:66
weipa::FinleyDomain::FinleyDomain
FinleyDomain()
Definition: weipa/src/FinleyDomain.cpp:57
weipa::FinleyDomain::cleanup
void cleanup()
Definition: weipa/src/FinleyDomain.cpp:86
weipa::FinleyDomain::getElementsByName
virtual ElementData_ptr getElementsByName(const std::string &name) const
Returns element data with given name.
Definition: weipa/src/FinleyDomain.cpp:432
weipa::FinleyDomain::setSiloPath
virtual void setSiloPath(const std::string &path)
Sets the silo path to be used when saving to a Silo file.
Definition: weipa/src/FinleyDomain.h:64
weipa::FinleyDomain::initialized
bool initialized
Definition: weipa/src/FinleyDomain.h:69
weipa::NodeData_ptr
boost::shared_ptr< NodeData > NodeData_ptr
Definition: weipa.h:68
weipa::StringVec
std::vector< std::string > StringVec
Definition: weipa.h:60
weipa::FinleyDomain::getVarNames
virtual StringVec getVarNames() const
Returns the names of all 'special' domain variables.
Definition: weipa/src/FinleyDomain.cpp:351
weipa::FinleyDomain::getNodes
virtual NodeData_ptr getNodes() const
Returns a pointer to the full nodes.
Definition: weipa/src/FinleyDomain.h:62
escript::AbstractDomain
Base class for all escript domains.
Definition: AbstractDomain.h:62
weipa::FinleyDomain::getMeshByName
virtual NodeData_ptr getMeshByName(const std::string &name) const
Returns the node mesh with given name.
Definition: weipa/src/FinleyDomain.cpp:454
weipa::FinleyNodes_ptr
boost::shared_ptr< FinleyNodes > FinleyNodes_ptr
Definition: FinleyNodes.h:42
weipa::FinleyDomain::getMeshForFunctionSpace
virtual NodeData_ptr getMeshForFunctionSpace(int fsCode) const
Returns the node mesh for given function space code.
Definition: weipa/src/FinleyDomain.cpp:235
weipa::Centering
Centering
Definition: DomainChunk.h:30
finley
A suite of factory methods for creating various finley domains.
Definition: finley/src/Assemble.h:32
weipa::FinleyDomain::initFromEscript
virtual bool initFromEscript(const escript::AbstractDomain *domain)
Initialises the domain using an escript domain instance.
Definition: weipa/src/FinleyDomain.cpp:98
weipa::FinleyDomain::getSiloPath
virtual std::string getSiloPath() const
Returns the absolute path within Silo file if writeToSilo() or setSiloPath() was called before,...
Definition: weipa/src/FinleyDomain.h:63
weipa::FinleyDomain::getCenteringForFunctionSpace
virtual Centering getCenteringForFunctionSpace(int fsCode) const
Returns whether data on given function space is node or cell centered.
Definition: weipa/src/FinleyDomain.cpp:218