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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1407 - (show annotations)
Mon Feb 4 06:45:48 2008 UTC (11 years, 7 months ago) by gross
File size: 3356 byte(s)
new upwinding algorithm (still fails)
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 int blocksize,
27 const FunctionSpace& functionspace)
28 {
29 if (blocksize<=0)
30 throw TransportProblemException("Error - negative block size of transport problem.");
31 if ((theta<0.) or (theta>1.))
32 throw TransportProblemException("Error - theta needs to be between 0. and 1..");
33
34 m_empty=0;
35 m_blocksize=blocksize;
36 m_functionspace=functionspace;
37 m_theta=theta;
38 }
39
40 AbstractTransportProblem::~AbstractTransportProblem() {
41 }
42
43 int AbstractTransportProblem::isEmpty() const {
44 return m_empty;
45 }
46
47
48 Data AbstractTransportProblem::solve(Data& source, const double dt, const boost::python::dict& options) const
49 {
50 if (isEmpty())
51 throw TransportProblemException("Error - transport problem is empty.");
52 if (dt<=0.)
53 throw TransportProblemException("Error - dt needs to be positive.");
54 if (source.getFunctionSpace()!=getFunctionSpace())
55 throw TransportProblemException("Error - function space of transport problem and function space of source do not match.");
56 if (source.getDataPointSize()!=getBlockSize())
57 throw TransportProblemException("Error - block size of transport problem and source do not match.");
58 DataArrayView::ShapeType shape;
59 if (getBlockSize()>1) shape.push_back(getBlockSize());
60 Data out=Data(0.,shape,getFunctionSpace(),true);
61 setToSolution(out,source,dt,options);
62 return out;
63 }
64
65 void AbstractTransportProblem::setInitialValue(Data& u) const
66 {
67 if (isEmpty())
68 throw TransportProblemException("Error - transport problem is empty.");
69 if (u.getFunctionSpace()!=getFunctionSpace())
70 throw TransportProblemException("Error - function space of transport problem and function space of initial value do not match.");
71 if (u.getDataPointSize()!=getBlockSize())
72 throw TransportProblemException("Error - block size of transport problem and initial value source do not match.");
73 copyInitialValue(u);
74 }
75
76 void AbstractTransportProblem::copyInitialValue(Data& u) const
77 {
78 throw TransportProblemException("Error - copyInitialValue is not available");
79 }
80 void AbstractTransportProblem::setToSolution(Data& out,Data& source,const double dt, const boost::python::dict& options) const
81 {
82 throw TransportProblemException("Error - setToSolution is not available");
83 }
84 void AbstractTransportProblem::resetTransport() const
85 {
86 throw TransportProblemException("Error - resetProblem is not implemented.");
87 }
88 double AbstractTransportProblem::getSafeTimeStepSize() const
89 {
90 throw TransportProblemException("Error - getSafeTimeStepSize is not implemented.");
91 }
92
93 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26