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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1387 - (hide 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 jgs 82
2 gross 1364 /* $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 1364 AbstractTransportProblem::AbstractTransportProblem(const double theta,const double dt_max,
27     const int blocksize,
28     const FunctionSpace& functionspace)
29 jgs 82 {
30 gross 1364 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 jgs 82
35     m_empty=0;
36 gross 1364 m_blocksize=blocksize;
37     m_functionspace=functionspace;
38     m_theta=theta;
39     m_dt_max=dt_max;
40 jgs 82 }
41    
42 gross 1364 AbstractTransportProblem::~AbstractTransportProblem() {
43 jgs 82 }
44    
45 gross 1364 int AbstractTransportProblem::isEmpty() const {
46 jgs 82 return m_empty;
47     }
48    
49    
50 gross 1364 Data AbstractTransportProblem::solve(Data& source, const double dt, const boost::python::dict& options) const
51 jgs 82 {
52     if (isEmpty())
53 gross 1364 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 jgs 82 DataArrayView::ShapeType shape;
61 gross 1364 if (getBlockSize()>1) shape.push_back(getBlockSize());
62     Data out=Data(0.,shape,getFunctionSpace(),true);
63     setToSolution(out,source,dt,options);
64 jgs 82 return out;
65     }
66    
67 gross 1364 void AbstractTransportProblem::setInitialValue(Data& u) const
68 jgs 82 {
69 gross 1364 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 jgs 82 }
77    
78 gross 1364 void AbstractTransportProblem::copyInitialValue(Data& u) const
79 jgs 82 {
80 gross 1364 throw TransportProblemException("Error - copyInitialValue is not available");
81 jgs 82 }
82 gross 1364 void AbstractTransportProblem::setToSolution(Data& out,Data& source,const double dt, const boost::python::dict& options) const
83 jgs 82 {
84 gross 1364 throw TransportProblemException("Error - setToSolution is not available");
85 jgs 82 }
86 gross 1364 void AbstractTransportProblem::resetTransport() const
87 jgs 102 {
88 gross 1364 throw TransportProblemException("Error - resetProblem is not implemented.");
89 jgs 102 }
90 jgs 82
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