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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1407 - (hide annotations)
Mon Feb 4 06:45:48 2008 UTC (11 years, 6 months ago) by gross
File size: 3356 byte(s)
new upwinding algorithm (still fails)
1 jgs 82
2 gross 1407 /* $Id$ */
3 ksteube 1312
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 gross 1364 #include "AbstractTransportProblem.h"
16     #include "TransportProblemException.h"
17 jgs 474 #include "DataArrayView.h"
18 jgs 480 #include "Data.h"
19 jgs 82
20     namespace escript {
21    
22 gross 1364 AbstractTransportProblem::AbstractTransportProblem() {
23 jgs 82 m_empty=1;
24     }
25    
26 gross 1407 AbstractTransportProblem::AbstractTransportProblem(const double theta, const int blocksize,
27 gross 1364 const FunctionSpace& functionspace)
28 jgs 82 {
29 gross 1364 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 jgs 82
34     m_empty=0;
35 gross 1364 m_blocksize=blocksize;
36     m_functionspace=functionspace;
37     m_theta=theta;
38 jgs 82 }
39    
40 gross 1364 AbstractTransportProblem::~AbstractTransportProblem() {
41 jgs 82 }
42    
43 gross 1364 int AbstractTransportProblem::isEmpty() const {
44 jgs 82 return m_empty;
45     }
46    
47    
48 gross 1364 Data AbstractTransportProblem::solve(Data& source, const double dt, const boost::python::dict& options) const
49 jgs 82 {
50     if (isEmpty())
51 gross 1364 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 jgs 82 DataArrayView::ShapeType shape;
59 gross 1364 if (getBlockSize()>1) shape.push_back(getBlockSize());
60     Data out=Data(0.,shape,getFunctionSpace(),true);
61     setToSolution(out,source,dt,options);
62 jgs 82 return out;
63     }
64    
65 gross 1364 void AbstractTransportProblem::setInitialValue(Data& u) const
66 jgs 82 {
67 gross 1364 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 jgs 82 }
75    
76 gross 1364 void AbstractTransportProblem::copyInitialValue(Data& u) const
77 jgs 82 {
78 gross 1364 throw TransportProblemException("Error - copyInitialValue is not available");
79 jgs 82 }
80 gross 1364 void AbstractTransportProblem::setToSolution(Data& out,Data& source,const double dt, const boost::python::dict& options) const
81 jgs 82 {
82 gross 1364 throw TransportProblemException("Error - setToSolution is not available");
83 jgs 82 }
84 gross 1364 void AbstractTransportProblem::resetTransport() const
85 jgs 102 {
86 gross 1364 throw TransportProblemException("Error - resetProblem is not implemented.");
87 jgs 102 }
88 gross 1407 double AbstractTransportProblem::getSafeTimeStepSize() const
89     {
90     throw TransportProblemException("Error - getSafeTimeStepSize is not implemented.");
91     }
92 jgs 82
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