AbstractTransportProblem.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2020 by The University of Queensland
* http://www.uq.edu.au
*
* Primary Business: Queensland, Australia
* Licensed under the Apache License, version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
* Development 2012-2013 by School of Earth Sciences
* Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
* Development from 2019 by School of Earth and Environmental Sciences
**
*****************************************************************************/
#ifndef __ESCRIPT_ABSTRACTTRANSPORTPROBLEM_H__
#define __ESCRIPT_ABSTRACTTRANSPORTPROBLEM_H__
#include "system_dep.h"
#include "FunctionSpace.h"
#include "TransportProblemException.h"
#include <boost/python/object.hpp>
namespace escript {
//
// Forward declaration
class Data;
class AbstractTransportProblem
{
public:
ESCRIPT_DLL_API
AbstractTransportProblem();
ESCRIPT_DLL_API
AbstractTransportProblem(const int blocksize,
const FunctionSpace& functionspace);
ESCRIPT_DLL_API
virtual ~AbstractTransportProblem();
ESCRIPT_DLL_API
int isEmpty() const;
ESCRIPT_DLL_API
inline FunctionSpace getFunctionSpace() const
{
if (isEmpty())
throw TransportProblemException("Error - Transport Problem is empty.");
return m_functionspace;
}
ESCRIPT_DLL_API
inline int getBlockSize() const
{
if (isEmpty())
throw TransportProblemException("Error - Transport Problem is empty.");
return m_blocksize;
}
ESCRIPT_DLL_API
Data solve(Data& u0, Data& source, const double dt, boost::python::object& options);
ESCRIPT_DLL_API
virtual void resetTransport(bool preserveSolverData) const;
ESCRIPT_DLL_API
void insertConstraint(Data& source, Data& q, Data& r);
/*
* \brief returns a safe time step size.
*/
ESCRIPT_DLL_API
virtual double getSafeTimeStepSize() const;
/*
* \brief returns the value for unlimited time step size.
*/
ESCRIPT_DLL_API
virtual double getUnlimitedTimeStepSize() const;
protected:
private:
ESCRIPT_DLL_API
virtual void setToSolution(Data& out, Data& u0, Data& source, double dt,
boost::python::object& options);
ESCRIPT_DLL_API
virtual void copyConstraint(Data& source, Data& q, Data& r);
int m_empty;
int m_blocksize;
FunctionSpace m_functionspace;
};
typedef boost::shared_ptr<AbstractTransportProblem> ATP_ptr;
} // end of namespace
#endif // __ESCRIPT_ABSTRACTTRANSPORTPROBLEM_H__
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
AbstractTransportProblem.h
escript::Data::getDataPointShape
const DataTypes::ShapeType & getDataPointShape() const
Return a reference to the data point shape.
Definition: Data.h:705
escript::NotImplementedError
An exception class for features which are not (yet) implemented.
Definition: EsysException.h:93
escript::TransportProblemException
Definition: TransportProblemException.h:42
escript::AbstractTransportProblem::m_empty
int m_empty
Definition: AbstractTransportProblem.h:169
escript::AbstractTransportProblem::AbstractTransportProblem
AbstractTransportProblem()
Default constructor for AbstractTransportProblem.
Definition: AbstractTransportProblem.cpp:41
escript::Data::getDataPointSize
int getDataPointSize() const
Return the size of the data point. It is the product of the data point shape dimensions.
Definition: Data.cpp:1360
escript::FunctionSpace
Definition: FunctionSpace.h:49
escript::Data::getFunctionSpace
const FunctionSpace & getFunctionSpace() const
Return the function space.
Definition: Data.h:463
escript::AbstractTransportProblem::m_functionspace
FunctionSpace m_functionspace
Definition: AbstractTransportProblem.h:171
escript::AbstractTransportProblem::insertConstraint
void insertConstraint(Data &source, Data &q, Data &r)
inserts constraint u_{,t}=r where q>0 into the problem
Definition: AbstractTransportProblem.cpp:87
system_dep.h
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:64
escript::AbstractTransportProblem::getBlockSize
int getBlockSize() const
returns the block size
Definition: AbstractTransportProblem.h:109
escript::DataTypes::ShapeType
std::vector< int > ShapeType
The shape of a single datapoint.
Definition: DataTypes.h:71
escript::AbstractTransportProblem::getFunctionSpace
FunctionSpace getFunctionSpace() const
returns the column function space
Definition: AbstractTransportProblem.h:97
escript::ATP_ptr
boost::shared_ptr< AbstractTransportProblem > ATP_ptr
Definition: AbstractTransportProblem.h:175
escript::AbstractTransportProblem::m_blocksize
int m_blocksize
Definition: AbstractTransportProblem.h:170
escript::AbstractTransportProblem::getUnlimitedTimeStepSize
virtual double getUnlimitedTimeStepSize() const
Definition: AbstractTransportProblem.cpp:132
escript::AbstractTransportProblem::setToSolution
virtual void setToSolution(Data &out, Data &u0, Data &source, double dt, boost::python::object &options)
sets solution out by time step dt.
Definition: AbstractTransportProblem.cpp:119
escript::AbstractTransportProblem::resetTransport
virtual void resetTransport(bool preserveSolverData) const
resets the transport operator typically as they have been updated.
Definition: AbstractTransportProblem.cpp:124
TransportProblemException.h
escript::Data::isEmpty
bool isEmpty() const
Definition: Data.cpp:1132
escript::AbstractTransportProblem::~AbstractTransportProblem
virtual ~AbstractTransportProblem()
Destructor.
Definition: AbstractTransportProblem.cpp:55
escript::AbstractTransportProblem::solve
Data solve(Data &u0, Data &source, const double dt, boost::python::object &options)
returns the solution u for a time step dt>0 with initial value u0 at time t=0
Definition: AbstractTransportProblem.cpp:64
escript::AbstractTransportProblem::getSafeTimeStepSize
virtual double getSafeTimeStepSize() const
Definition: AbstractTransportProblem.cpp:128
escript
Definition: AbstractContinuousDomain.cpp:23
DataTypes.h
escript::AbstractTransportProblem::isEmpty
int isEmpty() const
Definition: AbstractTransportProblem.cpp:58
Data.h
escript::Data::expand
void expand()
Whatever the current Data type make this into a DataExpanded.
Definition: Data.cpp:1180
ESYS_ASSERT
#define ESYS_ASSERT(a, b)
EsysAssert is a MACRO that will throw an exception if the boolean condition specified is false.
Definition: Assert.h:79
escript::AbstractTransportProblem::copyConstraint
virtual void copyConstraint(Data &source, Data &q, Data &r)
copy constraint u_{,t}=r where q>0 into the problem it can be assumed that q and r are not empty and ...
Definition: AbstractTransportProblem.cpp:114
escript::ValueError
An exception class that signals an invalid argument value.
Definition: EsysException.h:103
FunctionSpace.h
escript::Data::getDataPointRank
unsigned int getDataPointRank() const
Return the rank of the point data.
Definition: Data.h:512