1 |
|
2 |
/******************************************************* |
3 |
* |
4 |
* Copyright (c) 2003-2010 by University of Queensland |
5 |
* Earth Systems Science Computational Center (ESSCC) |
6 |
* http://www.uq.edu.au/esscc |
7 |
* |
8 |
* Primary Business: Queensland, Australia |
9 |
* Licensed under the Open Software License version 3.0 |
10 |
* http://www.opensource.org/licenses/osl-3.0.php |
11 |
* |
12 |
*******************************************************/ |
13 |
|
14 |
#ifndef __WEIPA_DOMAINCHUNK_H__ |
15 |
#define __WEIPA_DOMAINCHUNK_H__ |
16 |
|
17 |
#include <weipa/weipa.h> |
18 |
|
19 |
class DBfile; |
20 |
|
21 |
namespace escript { |
22 |
class AbstractDomain; |
23 |
} |
24 |
|
25 |
namespace weipa { |
26 |
|
27 |
typedef enum { |
28 |
NODE_CENTERED=0, |
29 |
ZONE_CENTERED |
30 |
} Centering; |
31 |
|
32 |
|
33 |
/// \brief Abstract base class for weipa's interface to an Escript domain or |
34 |
/// one chunk thereof if domain decomposition was used. |
35 |
/// |
36 |
/// Implementations of this class load or convert data from an Escript domain |
37 |
/// with all meshes for weipa. |
38 |
/// |
39 |
/// Note that this class is not MPI aware, that is if domain decomposition |
40 |
/// was used then one instance of this class will hold one 'chunk' of the |
41 |
/// full domain. See the EscriptDataset class for how to process full domains. |
42 |
class DomainChunk |
43 |
{ |
44 |
public: |
45 |
/// \brief Initialises the domain using an escript domain instance. |
46 |
virtual bool initFromEscript(const escript::AbstractDomain* domain) = 0; |
47 |
|
48 |
/// \brief Reads the domain from a dump file. |
49 |
virtual bool initFromFile(const std::string& filename) = 0; |
50 |
|
51 |
/// \brief Writes the domain to a Silo file. |
52 |
virtual bool writeToSilo(DBfile* dbfile, const std::string& pathInSilo, |
53 |
const StringVec& labels, |
54 |
const StringVec& units) = 0; |
55 |
|
56 |
/// \brief Reorders elements so that 'ghost' elements (i.e. those that |
57 |
/// do not belong to ownIndex) appear last. |
58 |
virtual void reorderGhostZones(int ownIndex) = 0; |
59 |
|
60 |
/// \brief Removes 'ghost' elements and nodes. |
61 |
virtual void removeGhostZones(int ownIndex) = 0; |
62 |
|
63 |
/// \brief Returns the names of all meshes within this domain. |
64 |
virtual StringVec getMeshNames() const = 0; |
65 |
|
66 |
/// \brief Returns the names of all 'special' domain variables. |
67 |
virtual StringVec getVarNames() const = 0; |
68 |
|
69 |
/// \brief Returns element data with given name. |
70 |
virtual ElementData_ptr getElementsByName(const std::string& name) const=0; |
71 |
|
72 |
/// \brief Returns the node mesh with given name. |
73 |
virtual NodeData_ptr getMeshByName(const std::string& name) const = 0; |
74 |
|
75 |
/// \brief Creates and returns a variable with domain data. |
76 |
virtual DataVar_ptr getDataVarByName(const std::string& name) const = 0; |
77 |
|
78 |
/// \brief Returns whether data on given function space is node or cell |
79 |
/// centered |
80 |
virtual Centering getCenteringForFunctionSpace(int fsCode) const = 0; |
81 |
|
82 |
/// \brief Returns the node mesh for given function space code. |
83 |
virtual NodeData_ptr getMeshForFunctionSpace(int fsCode) const = 0; |
84 |
|
85 |
/// \brief Returns the element data for given function space code. |
86 |
virtual ElementData_ptr getElementsForFunctionSpace(int fsCode) const = 0; |
87 |
|
88 |
/// \brief Returns a pointer to the full nodes. |
89 |
virtual NodeData_ptr getNodes() const = 0; |
90 |
|
91 |
/// \brief Returns the absolute path within Silo file if writeToSilo() |
92 |
/// or setSiloPath() was called before, the empty string otherwise. |
93 |
virtual std::string getSiloPath() const = 0; |
94 |
|
95 |
/// \brief Sets the silo path to be used when saving to a Silo file. |
96 |
virtual void setSiloPath(const std::string& path) = 0; |
97 |
|
98 |
protected: |
99 |
/// \brief Destructor. |
100 |
virtual ~DomainChunk() {} |
101 |
}; |
102 |
|
103 |
} // namespace weipa |
104 |
|
105 |
#endif // __WEIPA_DOMAINCHUNK_H__ |
106 |
|