Newer
Older
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==

Thomas Witkowski
committed
// == http://www.amdis-fem.org ==
// == ==
// ============================================================================

Thomas Witkowski
committed
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.
/** \file AbstractFunction.h */
#ifndef AMDIS_ABSTRACTFUNCTION_H
#define AMDIS_ABSTRACTFUNCTION_H
#include "Global.h"
namespace AMDiS {
/**
* \ingroup Common
*
* \brief
* An AbstractFunction object represents a function
* f : ArgumentType -> ReturnType.
*
* AbstractFunction is a pure virtual class interface class.
* To create your own function you have to derive AbstractFunction and
* overload operator().
*/
template<typename ReturnType, typename ArgumentType>
class AbstractFunction
{
public:
/// Constructor.
AbstractFunction(int degree = 0) :
degree_(degree)
/// Returns \ref degree_.
/// Deligates the evaluation to overriden method f.
virtual ReturnType operator()(const ArgumentType& x) const = 0;
protected:
int degree_;
};
/**
* \ingroup Common
*
* \brief
* Interface for binary functions.
*/
template<typename ReturnType,
typename ArgumentType1,
typename ArgumentType2>
class BinaryAbstractFunction
{
public:
/// Constructor.
BinaryAbstractFunction(int degree = 0) :
degree_(degree)
{}
virtual ~BinaryAbstractFunction() {}
/// Returns \ref degree_.

Thomas Witkowski
committed
return degree_;
/// Deligates the evaluation to overriden method f.
virtual ReturnType operator()(const ArgumentType1& x,
const ArgumentType2& y) const = 0;
protected:
int degree_;
};
/**
* \ingroup Common
*
* \brief
* Interface for tertiary functions.
*/
template<typename ReturnType,
typename ArgumentType1,
typename ArgumentType2,
typename ArgumentType3>
class TertiaryAbstractFunction
{
public:
/// Constructor.
TertiaryAbstractFunction(int degree = 0) :
degree_(degree)
{}
virtual ~TertiaryAbstractFunction() {}
/// Returns \ref degree_.

Thomas Witkowski
committed
return degree_;
}
/// function evaluation.
virtual ReturnType operator()(const ArgumentType1& x,
const ArgumentType2& y,
const ArgumentType3& z) const = 0;
protected:
int degree_;
};
/**
* \ingroup Common
*
* \brief
* Interface for quart functions.
*/
template<typename ReturnType,
typename ArgumentType1,
typename ArgumentType2,
typename ArgumentType3,
typename ArgumentType4>
class QuartAbstractFunction
{
public:
/// Constructor.
QuartAbstractFunction(int degree = 0) :
degree_(degree)
{}
virtual ~QuartAbstractFunction() {}
/// Returns \ref degree_.

Thomas Witkowski
committed
return degree_;
}
/// function evaluation.
virtual ReturnType operator()(const ArgumentType1& x,
const ArgumentType2& y,
const ArgumentType3& z,
const ArgumentType4& u) const = 0;