1 |
|
2 |
/******************************************************* |
3 |
* |
4 |
* Copyright (c) 2003-2008 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 |
|
15 |
#if !defined escript_AbstractTransportProblem_H |
16 |
#define escript_AbstractTransportProblem_H |
17 |
#include "system_dep.h" |
18 |
|
19 |
#include "FunctionSpace.h" |
20 |
#include "TransportProblemException.h" |
21 |
|
22 |
#include <boost/python/dict.hpp> |
23 |
|
24 |
// |
25 |
// Forward declaration |
26 |
class Data; |
27 |
|
28 |
namespace escript { |
29 |
|
30 |
/** |
31 |
\brief |
32 |
Give a short description of what AbstractTransportProblem does. |
33 |
|
34 |
Description: |
35 |
Give a detailed description of AbstractTransportProblem |
36 |
|
37 |
Template Parameters: |
38 |
For templates describe any conditions that the parameters used in the |
39 |
template must satisfy |
40 |
*/ |
41 |
class AbstractTransportProblem { |
42 |
|
43 |
public: |
44 |
|
45 |
/** |
46 |
\brief |
47 |
Default constructor for AbstractTransportProblem |
48 |
|
49 |
Description: |
50 |
Default constructor for AbstractTransportProblem |
51 |
|
52 |
Preconditions: |
53 |
Describe any preconditions |
54 |
|
55 |
Throws: |
56 |
Describe any exceptions thrown |
57 |
*/ |
58 |
ESCRIPT_DLL_API |
59 |
AbstractTransportProblem(); |
60 |
|
61 |
ESCRIPT_DLL_API |
62 |
AbstractTransportProblem(const double theta, |
63 |
const int blocksize, |
64 |
const FunctionSpace& functionspace); |
65 |
|
66 |
/** |
67 |
\brief |
68 |
Destructor. |
69 |
*/ |
70 |
ESCRIPT_DLL_API |
71 |
virtual ~AbstractTransportProblem(); |
72 |
|
73 |
ESCRIPT_DLL_API |
74 |
int isEmpty() const; |
75 |
|
76 |
/** |
77 |
\brief |
78 |
returns the column function space |
79 |
*/ |
80 |
ESCRIPT_DLL_API |
81 |
inline FunctionSpace getFunctionSpace() const |
82 |
{ |
83 |
if (isEmpty()) |
84 |
throw TransportProblemException("Error - Transport Problem is empty."); |
85 |
return m_functionspace; |
86 |
} |
87 |
|
88 |
/** |
89 |
\brief |
90 |
returns the block size |
91 |
*/ |
92 |
ESCRIPT_DLL_API |
93 |
inline int getBlockSize() const |
94 |
{ |
95 |
if (isEmpty()) |
96 |
throw TransportProblemException("Error - Transport Problem is empty."); |
97 |
return m_blocksize; |
98 |
} |
99 |
|
100 |
/** |
101 |
\brief |
102 |
returns the solution u for a time step dt>0 |
103 |
*/ |
104 |
ESCRIPT_DLL_API |
105 |
Data solve(Data& source, const double dt, const boost::python::dict& options) const; |
106 |
|
107 |
/** |
108 |
\brief |
109 |
sets the value for u at time t=0. |
110 |
*/ |
111 |
ESCRIPT_DLL_API |
112 |
void setInitialValue(Data& u) const; |
113 |
|
114 |
/** |
115 |
\brief resets the transport operator typically as they have been updated. |
116 |
*/ |
117 |
ESCRIPT_DLL_API |
118 |
virtual void resetTransport() const; |
119 |
|
120 |
/** |
121 |
\brief |
122 |
inserts constraint u_{,t}=r where q>0 into the problem using a weighting factor |
123 |
*/ |
124 |
ESCRIPT_DLL_API |
125 |
void insertConstraint(Data& source, Data& q, Data& r, const double factor) const; |
126 |
/* |
127 |
* \brief returns a safe time step size. |
128 |
*/ |
129 |
ESCRIPT_DLL_API |
130 |
virtual double getSafeTimeStepSize() const; |
131 |
/* |
132 |
* \brief returns the value for unlimited time step size. |
133 |
*/ |
134 |
ESCRIPT_DLL_API |
135 |
virtual double getUnlimitedTimeStepSize() const; |
136 |
|
137 |
|
138 |
protected: |
139 |
|
140 |
private: |
141 |
|
142 |
/** |
143 |
\brief |
144 |
sets solution out by time step dt. |
145 |
*/ |
146 |
ESCRIPT_DLL_API |
147 |
virtual void setToSolution(Data& out,Data& source,const double dt, const boost::python::dict& options) const; |
148 |
|
149 |
/** |
150 |
\brief |
151 |
copies the initial value into the problem |
152 |
*/ |
153 |
ESCRIPT_DLL_API |
154 |
virtual void copyInitialValue(Data& u) const; |
155 |
/** |
156 |
\brief |
157 |
copy constraint u_{,t}=r where q>0 into the problem |
158 |
it can be assumed that q and r are not empty and have |
159 |
appropriate shape and function space. |
160 |
*/ |
161 |
ESCRIPT_DLL_API |
162 |
virtual void copyConstraint(Data& source, Data& q, Data& r, const double factor) const; |
163 |
|
164 |
int m_empty; |
165 |
int m_blocksize; |
166 |
double m_theta; |
167 |
FunctionSpace m_functionspace; |
168 |
|
169 |
}; |
170 |
|
171 |
|
172 |
} // end of namespace |
173 |
#endif |