/[escript]/trunk/pasowrap/src/TransportProblemAdapter.h
ViewVC logotype

Contents of /trunk/pasowrap/src/TransportProblemAdapter.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4346 - (show annotations)
Tue Apr 2 04:46:45 2013 UTC (6 years, 4 months ago) by jfenwick
File MIME type: text/plain
File size: 4143 byte(s)
Bringing the changes from doubleplusgood branch.
Can't merge directly because svn doesn't transfer changes to renamed files (mutter grumble).
1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15
16 /* This file was extracted from finley's CPPAdapter then modified */
17
18 #if !defined TransportProblemAdapter_H
19 #define TransportProblemAdapter_H
20 #include "system_dep.h"
21
22 #include "paso/Transport.h"
23 #include "paso/Options.h"
24
25 #include "PasoException.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 paso {
36
37 class TransportProblemAdapter:public escript::AbstractTransportProblem {
38
39 /**
40 \brief
41 Wrapper for Paso_TransportProblem.
42
43 Description:
44 Wrapper for Paso_TransportProblem.
45 */
46
47 public:
48
49 /**
50 /brief
51 Default Constructor for TransportProblemAdapter.
52 NB: Only throws an exception.
53 */
54 PASOWRAP_DLL_API
55 TransportProblemAdapter();
56
57 /**
58 /brief
59 Constructor for TransportProblemAdapter.
60 */
61 PASOWRAP_DLL_API
62 TransportProblemAdapter(Paso_TransportProblem* transport_problem,
63 const int block_size,
64 const escript::FunctionSpace& functionspace);
65
66 /**
67 \brief
68 Destructor for TransportProblemAdapter. As specified in the constructor
69 this deallocates the pointer given to the constructor.
70 */
71 PASOWRAP_DLL_API
72 ~TransportProblemAdapter();
73
74 /**
75 \brief
76 Returns the pointer to the transport problem.
77 */
78 PASOWRAP_DLL_API
79 Paso_TransportProblem* getPaso_TransportProblem() const;
80
81 /**
82 \brief
83 Returns the transport problem as a const AbstractTransportProblem&.
84 */
85 inline const escript::AbstractTransportProblem& asAbstractTransportProblem() const
86 {
87 return dynamic_cast<const escript::AbstractTransportProblem&>(*this);
88 }
89
90 /**
91 \brief
92 Returns a transport problem as a const TransportProblemAdapter&.
93 */
94 inline static const TransportProblemAdapter& asTransportProblemAdapter(const AbstractTransportProblem& transportproblem)
95 {
96 return dynamic_cast<const TransportProblemAdapter&>(transportproblem);
97 }
98
99 /**
100 * \brief resets the transport operator typically as they have been updated.
101 * */
102 PASOWRAP_DLL_API
103 virtual void resetTransport() const;
104
105 /**
106 * \brief returns a save time step size.
107 */
108 PASOWRAP_DLL_API
109 virtual double getSafeTimeStepSize() const;
110
111 /**
112 * \brief \brief returns the value for unlimited time step size.
113 */
114 PASOWRAP_DLL_API
115 virtual double getUnlimitedTimeStepSize() const;
116
117 /**
118 \brief
119 returns the identifier of the transport problem type to be used
120 when a particular solver, preconditioner and package is used
121 */
122 PASOWRAP_DLL_API
123 static int getTransportTypeId(const int solver, const int preconditioner,
124 const int package, const bool symmetry, Esys_MPIInfo* mpiInfo);
125
126 protected:
127
128 private:
129
130 /**
131 * \brief
132 * sets solution out by time step dt.
133 * */
134 PASOWRAP_DLL_API
135 virtual void setToSolution(escript::Data& out,escript::Data& u0, escript::Data& source,const double dt, boost::python::object& options) const;
136
137
138 /**
139 * \brief
140 * copy constraint u_{,t}=r where q>0 into the problem
141 * it is assumed that q and r are not empty and has appropriate shape and function space.
142 * */
143 PASOWRAP_DLL_API
144 virtual void copyConstraint(escript::Data& source, escript::Data& q, escript::Data& r) const;
145
146
147 //
148 // pointer to the externally created transport_problem.
149 //
150 boost::shared_ptr<Paso_TransportProblem> m_transport_problem;
151
152 };
153
154 } // end of namespace
155 #endif

  ViewVC Help
Powered by ViewVC 1.1.26