/[escript]/trunk/escript/src/AbstractTransportProblem.cpp
ViewVC logotype

Contents of /trunk/escript/src/AbstractTransportProblem.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1387 - (show annotations)
Fri Jan 11 07:45:26 2008 UTC (11 years, 7 months ago) by trankine
Original Path: temp/escript/src/AbstractTransportProblem.cpp
File size: 3295 byte(s)
Restore the trunk that existed before the windows changes were committed to the (now moved to branches) old trunk.
1
2 /* $Id:$ */
3
4 /*******************************************************
5 *
6 * Copyright 2007 by University of Queensland
7 *
8 * http://esscc.uq.edu.au
9 * Primary Business: Queensland, Australia
10 * Licensed under the Open Software License version 3.0
11 * http://www.opensource.org/licenses/osl-3.0.php
12 *
13 *******************************************************/
14
15 #include "AbstractTransportProblem.h"
16 #include "TransportProblemException.h"
17 #include "DataArrayView.h"
18 #include "Data.h"
19
20 namespace escript {
21
22 AbstractTransportProblem::AbstractTransportProblem() {
23 m_empty=1;
24 }
25
26 AbstractTransportProblem::AbstractTransportProblem(const double theta,const double dt_max,
27 const int blocksize,
28 const FunctionSpace& functionspace)
29 {
30 if (blocksize<=0)
31 throw TransportProblemException("Error - negative block size of transport problem.");
32 if ((theta<0.) or (theta>1.))
33 throw TransportProblemException("Error - theta needs to be between 0. and 1..");
34
35 m_empty=0;
36 m_blocksize=blocksize;
37 m_functionspace=functionspace;
38 m_theta=theta;
39 m_dt_max=dt_max;
40 }
41
42 AbstractTransportProblem::~AbstractTransportProblem() {
43 }
44
45 int AbstractTransportProblem::isEmpty() const {
46 return m_empty;
47 }
48
49
50 Data AbstractTransportProblem::solve(Data& source, const double dt, const boost::python::dict& options) const
51 {
52 if (isEmpty())
53 throw TransportProblemException("Error - transport problem is empty.");
54 if (dt<=0.)
55 throw TransportProblemException("Error - dt needs to be positive.");
56 if (source.getFunctionSpace()!=getFunctionSpace())
57 throw TransportProblemException("Error - function space of transport problem and function space of source do not match.");
58 if (source.getDataPointSize()!=getBlockSize())
59 throw TransportProblemException("Error - block size of transport problem and source do not match.");
60 DataArrayView::ShapeType shape;
61 if (getBlockSize()>1) shape.push_back(getBlockSize());
62 Data out=Data(0.,shape,getFunctionSpace(),true);
63 setToSolution(out,source,dt,options);
64 return out;
65 }
66
67 void AbstractTransportProblem::setInitialValue(Data& u) const
68 {
69 if (isEmpty())
70 throw TransportProblemException("Error - transport problem is empty.");
71 if (u.getFunctionSpace()!=getFunctionSpace())
72 throw TransportProblemException("Error - function space of transport problem and function space of initial value do not match.");
73 if (u.getDataPointSize()!=getBlockSize())
74 throw TransportProblemException("Error - block size of transport problem and initial value source do not match.");
75 copyInitialValue(u);
76 }
77
78 void AbstractTransportProblem::copyInitialValue(Data& u) const
79 {
80 throw TransportProblemException("Error - copyInitialValue is not available");
81 }
82 void AbstractTransportProblem::setToSolution(Data& out,Data& source,const double dt, const boost::python::dict& options) const
83 {
84 throw TransportProblemException("Error - setToSolution is not available");
85 }
86 void AbstractTransportProblem::resetTransport() const
87 {
88 throw TransportProblemException("Error - resetProblem is not implemented.");
89 }
90
91 } // end of namespace

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26