1 |
|
2 |
/******************************************************* |
3 |
* |
4 |
* Copyright (c) 2003-2009 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 finley_TransportProblemAdapter_H |
16 |
#define finley_TransportProblemAdapter_H |
17 |
#include "system_dep.h" |
18 |
|
19 |
extern "C" { |
20 |
#include "paso/SolverFCT.h" |
21 |
#include "paso/Options.h" |
22 |
} |
23 |
|
24 |
#include "FinleyAdapterException.h" |
25 |
#include "FinleyError.h" |
26 |
|
27 |
#include "escript/AbstractTransportProblem.h" |
28 |
#include "escript/Data.h" |
29 |
#include "escript/UtilC.h" |
30 |
|
31 |
#include <boost/python/object.hpp> |
32 |
#include <boost/shared_ptr.hpp> |
33 |
#include <boost/python/extract.hpp> |
34 |
|
35 |
namespace finley { |
36 |
|
37 |
class TransportProblemAdapter:public escript::AbstractTransportProblem { |
38 |
|
39 |
/** |
40 |
\brief |
41 |
Wrapper for Paso_FCTransportProblem. |
42 |
|
43 |
Description: |
44 |
Wrapper for Paso_FCTransportProblem. |
45 |
*/ |
46 |
|
47 |
public: |
48 |
|
49 |
/** |
50 |
/brief |
51 |
Default Constructor for TransportProblemAdapter. |
52 |
NB: Only throws an exception. |
53 |
*/ |
54 |
FINLEY_DLL_API |
55 |
TransportProblemAdapter(); |
56 |
|
57 |
/** |
58 |
/brief |
59 |
Constructor for TransportProblemAdapter. |
60 |
*/ |
61 |
FINLEY_DLL_API |
62 |
TransportProblemAdapter(Paso_FCTransportProblem* transport_problem, |
63 |
const double theta, |
64 |
const int block_size, |
65 |
const escript::FunctionSpace& functionspace); |
66 |
|
67 |
/** |
68 |
\brief |
69 |
Destructor for TransportProblemAdapter. As specified in the constructor |
70 |
this deallocates the pointer given to the constructor. |
71 |
*/ |
72 |
FINLEY_DLL_API |
73 |
~TransportProblemAdapter(); |
74 |
|
75 |
/** |
76 |
\brief |
77 |
Returns the pointer to the transport problem. |
78 |
*/ |
79 |
FINLEY_DLL_API |
80 |
Paso_FCTransportProblem* getPaso_FCTransportProblem() const; |
81 |
|
82 |
/** |
83 |
\brief |
84 |
Returns the transport problem as a const AbstractTransportProblem&. |
85 |
*/ |
86 |
inline const escript::AbstractTransportProblem& asAbstractTransportProblem() const |
87 |
{ |
88 |
return dynamic_cast<const escript::AbstractTransportProblem&>(*this); |
89 |
} |
90 |
|
91 |
/** |
92 |
\brief |
93 |
Returns a transport problem as a const TransportProblemAdapter&. |
94 |
*/ |
95 |
inline static const TransportProblemAdapter& asTransportProblemAdapter(const AbstractTransportProblem& transportproblem) |
96 |
{ |
97 |
return dynamic_cast<const TransportProblemAdapter&>(transportproblem); |
98 |
} |
99 |
|
100 |
/** |
101 |
* \brief resets the transport operator typically as they have been updated. |
102 |
* */ |
103 |
FINLEY_DLL_API |
104 |
virtual void resetTransport() const; |
105 |
|
106 |
/** |
107 |
* \brief returns a save time step size. |
108 |
*/ |
109 |
FINLEY_DLL_API |
110 |
virtual double getSafeTimeStepSize() const; |
111 |
|
112 |
/** |
113 |
* \brief \brief returns the value for unlimited time step size. |
114 |
*/ |
115 |
FINLEY_DLL_API |
116 |
virtual double getUnlimitedTimeStepSize() const; |
117 |
|
118 |
protected: |
119 |
|
120 |
private: |
121 |
|
122 |
/** |
123 |
* \brief |
124 |
* sets solution out by time step dt. |
125 |
* */ |
126 |
FINLEY_DLL_API |
127 |
virtual void setToSolution(escript::Data& out,escript::Data& source,const double dt, boost::python::object& options) const; |
128 |
|
129 |
/** |
130 |
* \brief |
131 |
* copies the initial value into the problem |
132 |
* */ |
133 |
FINLEY_DLL_API |
134 |
virtual void copyInitialValue(escript::Data& u) const; |
135 |
|
136 |
/** |
137 |
* \brief |
138 |
* copy constraint u_{,t}=r where q>0 into the problem |
139 |
* it is assumed that q and r are not empty and has appropriate shape and function space. |
140 |
* */ |
141 |
FINLEY_DLL_API |
142 |
virtual void copyConstraint(escript::Data& source, escript::Data& q, escript::Data& r, const double factor) const; |
143 |
|
144 |
|
145 |
// |
146 |
// pointer to the externally created finley mesh - transport_problem. |
147 |
// |
148 |
boost::shared_ptr<Paso_FCTransportProblem> m_transport_problem; |
149 |
|
150 |
}; |
151 |
|
152 |
} // end of namespace |
153 |
#endif |