Skip to content
Snippets Groups Projects
Commit 976066e9 authored by Robert Klöfkorn's avatar Robert Klöfkorn
Browse files

removed file depending on FR-dune-fem .

[[Imported from SVN: r4446]]
parent 94617ea1
No related branches found
No related tags found
No related merge requests found
......@@ -10,14 +10,14 @@ libcommon_la_SOURCES = stdstreams.cc configparser.cc exprtmpl.cc
AM_CPPFLAGS = -I$(top_srcdir)/..
commonincludedir = $(includedir)/dune/common
commoninclude_HEADERS = dlist.cc mapping.cc stdstreams.cc alignment.hh \
commoninclude_HEADERS = dlist.cc stdstreams.cc alignment.hh \
array.hh arraylist.hh bitfield.hh capabilities.hh debugstream.hh dlist.hh \
dynamictype.hh enumset.hh exceptions.hh fixedarray.hh fmatrix.hh \
function.hh functionspace.hh fvector.hh genericiterator.hh \
fvector.hh genericiterator.hh \
helpertemplates.hh interfaces.hh iteratorfacades.hh logictraits.hh \
mapping.hh matrix.hh misc.hh operator.hh poolallocator.hh simplevector.hh \
matrix.hh misc.hh poolallocator.hh simplevector.hh \
sllist.hh smartpointer.hh stack.hh stdstreams.hh timer.hh tuples.hh \
typeinfo.hh typetraits.hh vectorspace.hh precision.hh bigunsignedint.hh \
typeinfo.hh typetraits.hh precision.hh bigunsignedint.hh \
gcd.hh lcm.hh configparser.hh propertymap.hh \
exprtmpl.hh exprtmpl/scalar.inc exprtmpl/exprexpr.inc collectivecommunication.hh\
mpicollectivecommunication.hh geometrytype.hh tripel.hh utility.hh
......
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_FUNCTION_HH
#define DUNE_FUNCTION_HH
#include <dune/common/mapping.hh>
#include <dune/common/fvector.hh>
namespace Dune {
/** @defgroup FunctionCommon Functions
@ingroup AlgebraCommon
Functions are Mappings from \f$K^n\f$ into \f$L^m\f$ where
\f$K\f$ and \f$L\f$ are fields.
*/
/** @defgroup Function Function
@ingroup FunctionCommon
@{
*/
typedef int deriType;
/** @brief Class representing a function
* \todo Please doc me!
*/
/*! Abstract class representing a function
Template parameters are:
- FunctionSpaceImp type of the function space where the function
belongs to.
- FunctionImp type of the implemented function
*/
template< class FunctionSpaceImp, class FunctionImp>
class Function :
public Mapping < typename FunctionSpaceImp::DomainFieldType,
typename FunctionSpaceImp::RangeFieldType ,
typename FunctionSpaceImp::DomainType,
typename FunctionSpaceImp::RangeType > {
public:
typedef FunctionSpaceImp FunctionSpaceType;
//! ???
typedef typename FunctionSpaceType::DomainType DomainType ;
//! ???
typedef typename FunctionSpaceType::RangeType RangeType ;
//! ???
typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
//! ???
typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
//! Constructor
Function (const FunctionSpaceType & f) : functionSpace_ (f) {} ;
//! application operator
virtual void operator()(const DomainType & arg, RangeType & dest) const {
eval(arg,dest);
}
//! evaluate Function
void eval(const DomainType & arg, RangeType & dest) const {
asImp().eval(arg, dest);
}
//! evaluate function and derivatives
template <int derivation>
void evaluate ( const FieldVector<deriType, derivation> &diffVariable,
const DomainType& arg, RangeType & dest) const {
asImp().evaluate(diffVariable, arg, dest);
}
//! Get access to the related function space
const FunctionSpaceType& getFunctionSpace() const { return functionSpace_; }
protected:
//! Barton-Nackman trick
FunctionImp& asImp() {
return static_cast<FunctionImp&>(*this);
}
const FunctionImp& asImp() const {
return static_cast<const FunctionImp&>(*this);
}
//! The related function space
const FunctionSpaceType & functionSpace_;
private:
//! Helper function for Mapping
//! With this function, a combined mapping can choose the right application
//! operator (i.e. the one from Mapping itself, or from Function/Operator)
//! \note: Do not override this definition
virtual void apply (const DomainType& arg, RangeType& dest) const {
operator()(arg, dest);
}
};
/** @} end documentation group */
}
#endif
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_FUNCTIONSPACE_HH
#define DUNE_FUNCTIONSPACE_HH
#include <dune/common/fmatrix.hh>
#include "dynamictype.hh"
namespace Dune {
/** @defgroup FunctionSpace FunctionSpace
@ingroup Function
This provides the interfaces for discrete function spaces.
@{
*/
/** \brief An arbitrary function space
Base class for specific function spaces.
*/
template< typename DomainFieldImp, typename RangeFieldImp, int n, int m >
class FunctionSpace : public DynamicType {
public:
/** Intrinsic type used for values in the domain field (usually a double) */
typedef DomainFieldImp DomainFieldType;
/** Intrinsic type used for values in the range field (usually a double) */
typedef RangeFieldImp RangeFieldType;
/** \todo Please doc me! */
typedef FieldMatrix <RangeFieldImp, m, n> JacobianRangeType;
/** \todo Please doc me! */
typedef FieldVector<FieldMatrix<RangeFieldImp, n, n>, m> HessianRangeType;
/** Type of domain vector (using type of domain field) */
typedef FieldVector<DomainFieldImp, n> DomainType;
/** Type of range vector (using type of range field) */
typedef FieldVector<RangeFieldImp, m> RangeType;
/** Remember the dimensions of the domain and range field */
enum { DimDomain = n, DimRange = m};
/** Constructor taking an identifier */
FunctionSpace ( int ident ) : DynamicType (ident){} ;
};
template <class FunctionSpaceImp>
struct ToScalarFunctionSpace {};
template <
class DomainFieldImp, class RangeFieldImp, int dimDomain, int dimRange>
struct ToScalarFunctionSpace<
FunctionSpace<DomainFieldImp, RangeFieldImp, dimDomain, dimRange> >
{
typedef FunctionSpace<DomainFieldImp, RangeFieldImp, dimDomain, 1> Type;
};
/** @} end documentation group */
}
#endif
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
template<typename DFieldType,typename RFieldType, class DType, class RType>
Mapping<DFieldType,RFieldType,DType,RType> Mapping<DFieldType,RFieldType,DType,RType>::operator+(const MappingType &mapping) const {
const Mapping<DFieldType,RFieldType,DType,RType> &m = dynamic_cast<const Mapping<DFieldType,RFieldType,DType,RType>& >( mapping );
Mapping<DFieldType,RFieldType,DType,RType> newMapping = *this;
for ( typename std::vector<term>::const_iterator it = m.lincomb_.begin(); it != m.lincomb_.end(); it++ ) {
newMapping.lincomb_.push_back( *it );
}
return newMapping;
}
template<typename DFieldType,typename RFieldType, class DType, class RType>
Mapping<DFieldType,RFieldType,DType,RType> Mapping<DFieldType,RFieldType,DType,RType>::operator-(const MappingType &mapping) const {
const Mapping<DFieldType,RFieldType,DType,RType> &m = dynamic_cast<const Mapping<DFieldType,RFieldType,DType,RType>& >( mapping );
Mapping<DFieldType,RFieldType,DType,RType> newMapping = *this;
for ( typename std::vector<term>::const_iterator it = m.lincomb_.begin(); it != m.lincomb_.end(); it++ ) {
newMapping.lincomb_.push_back( term( *it->v_, -it->scalar_ ) );
}
return newMapping;
}
template<typename DFieldType,typename RFieldType, class DType, class RType>
Mapping<DFieldType,RFieldType,DType,RType>& Mapping<DFieldType,RFieldType,DType,RType>::operator+=(const MappingType &mapping) {
const Mapping<DFieldType,RFieldType,DType,RType> &m = dynamic_cast<const Mapping<DFieldType,RFieldType,DType,RType>& >( mapping );
for ( typename std::vector<term>::const_iterator it = m.lincomb_.begin(); it != m.lincomb_.end(); it++ ) {
lincomb_.push_back( *it );
}
return *this;
}
template<typename DFieldType,typename RFieldType, class DType, class RType>
Mapping<DFieldType,RFieldType,DType,RType>& Mapping<DFieldType,RFieldType,DType,RType>::operator-=(const MappingType &mapping) {
const Mapping<DFieldType,RFieldType,DType,RType> &m = dynamic_cast<const Mapping<DFieldType,RFieldType,DType,RType>& >( mapping );
for ( typename std::vector<term>::const_iterator it = m.lincomb_.begin(); it != m.lincomb_.end(); it++ ) {
lincomb_.push_back( term( *it->v_, -it->scalar_ ) );
}
return *this;
}
template<typename DFieldType,typename RFieldType, class DType, class RType>
Mapping<DFieldType,RFieldType,DType,RType>& Mapping<DFieldType,RFieldType,DType,RType>::operator*=(const Field &factor) {
for ( typename std::vector<term>::iterator it = lincomb_.begin(); it != lincomb_.end(); it++ ) {
it->scalar_ *= factor;
}
return *this;
}
template<typename DFieldType,typename RFieldType, class DType, class RType>
Mapping<DFieldType,RFieldType,DType,RType>& Mapping<DFieldType,RFieldType,DType,RType>::operator/=(const Field &divisor) {
for ( typename std::vector<term>::iterator it = lincomb_.begin(); it != lincomb_.end(); it++ ) {
it->scalar_ /= divisor;
}
return *this;
}
template<typename DFieldType,typename RFieldType, class DType, class RType>
Mapping<DFieldType,RFieldType,DType,RType>& Mapping<DFieldType,RFieldType,DType,RType>::operator=(const MappingType &mapping) {
const Mapping<DFieldType,RFieldType,DType,RType> &m = dynamic_cast<const Mapping<DFieldType,RFieldType,DType,RType>& >( mapping );
lincomb_.erase( lincomb_.begin(), lincomb_.end() );
for ( typename std::vector<term>::const_iterator it = m.lincomb_.begin(); it != m.lincomb_.end(); it++ ) {
lincomb_.push_back( term( *it->v_, -it->scalar_ ) );
}
return *this;
}
template<typename DFieldType,typename RFieldType, class DType, class RType>
Mapping<DFieldType,RFieldType,DType,RType> Mapping<DFieldType,RFieldType,DType,RType>::operator*(const Field &factor) const {
Mapping<DFieldType,RFieldType,DType,RType> newMapping = *this;
for ( typename std::vector<term>::iterator it = newMapping.lincomb_.begin(); it != newMapping.lincomb_.end(); it++ ) {
it->scalar_ *= factor;
}
return newMapping;
}
template<typename DFieldType,typename RFieldType, class DType, class RType>
Mapping<DFieldType,RFieldType,DType,RType> Mapping<DFieldType,RFieldType,DType,RType>::operator/(const Field &divisor) const {
Mapping<DFieldType,RFieldType,DType,RType> newMapping = *this;
for ( typename std::vector<term>::iterator it = newMapping.lincomb_.begin(); it != newMapping.lincomb_.end(); it++ ) {
it->scalar_ /= divisor;
}
return newMapping;
}
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_MAPPING_HH
#define DUNE_MAPPING_HH
#include "vectorspace.hh"
#include <vector>
namespace Dune {
/** @defgroup Mapping Mapping
\ingroup AlgebraCommon
Mappings in Dune always map from one vector space into another vector space.
@{
*/
/** \brief A mapping from one vector space into another
This class describes a general mapping from the domain vector space into
the range vector space.
It can also be used to construct linear combinations of mappings.
This two-sided character has the following consequence: when you address
an object of type mapping or any of its descendants through a reference
or pointer of type Mapping, the linear combination defined for that mapping
is evaluated. On the other hand, if you address through a reference of the
type of any of its descendants (notably Operator and Function), you'll
get the functionality specific for that type.
*/
template<typename DFieldType,typename RFieldType, class DType, class RType>
class Mapping //: public Vector < RFieldType >
{
public:
//! domain vector space (for usage in derived classes)
typedef DType DomainType;
//! range vector space
typedef RType RangeType;
//! integral type used in the construction of the domain vector space
typedef DFieldType DomainFieldType;
//! integral type used in the construction of the range vector space
typedef RFieldType RangeFieldType;
//! \todo why that one?
typedef RangeFieldType Field;
//! remember what type this class has
typedef Mapping<DFieldType,RFieldType,DType,RType> MappingType;
//! create Mappiung with empty linear combination
Mapping( )
{
lincomb_.push_back( term( *this, 1.0 ) );
}
//! delete linear combination if necessary
virtual ~Mapping( ) {}
//! operators for linear combinations
virtual MappingType operator + (const MappingType &) const ;
virtual MappingType operator - (const MappingType &) const ;
virtual MappingType operator * (const Field &) const ;
virtual MappingType operator / (const Field &) const ;
virtual MappingType& operator = (const MappingType &) ;
virtual MappingType& operator += (const MappingType &) ;
virtual MappingType& operator -= (const MappingType &) ;
virtual MappingType& operator *= (const Field &) ;
virtual MappingType& operator /= (const Field &) ;
//! apply the whole linear combination which was created with the
//! operators above, using the apply method of the combined operators
void operator() (const DomainType &Arg, RangeType &Dest ) const
{
//Dest.clear();
int count = 0;
for ( typename std::vector<term>::const_iterator it = lincomb_.begin(); it != lincomb_.end(); it++ )
{
if ( count == 0 ) {
it->v_->apply( Arg, Dest );
if ( it->scalar_ != 1. ) {
Dest *= it->scalar_;
}
} else {
RangeType tmp( Dest );
it->v_->apply( Arg, tmp );
if ( it->scalar_ == 1. ) {
Dest += tmp;
} else if ( it->scalar_ == -1. ) {
Dest -= tmp;
} else {
tmp *= it->scalar_;
Dest += tmp;
}
}
count++;
}
}
private:
virtual void apply (const DomainType &Arg, RangeType &Dest) const {
operator()(Arg, Dest);
}
struct term {
term() : v_(NULL), scalar_(1.0), scaleIt_(false) { }
term(const MappingType &mapping, Field scalar ) : v_(&mapping), scalar_(scalar), scaleIt_( true ) {
if ( scalar_ == 1. ) {
scaleIt_ = false;
}
}
const MappingType *v_;
Field scalar_;
bool scaleIt_;
};
std::vector<term> lincomb_;
};
#include "mapping.cc"
/** @} end documentation group */
}
#endif
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_OPERATOR_HH
#define DUNE_OPERATOR_HH
#include "mapping.hh"
namespace Dune
{
/** @defgroup OperatorCommon Operators
@ingroup AlgebraCommon
Operators are mappings from function spaces into function spaces.
*/
/** @defgroup Operator Operator
@ingroup OperatorCommon
@{
*/
/** \brief An abstract operator
*
* \todo Please doc me!
*/
template <typename DFieldType, typename RFieldType,
typename DType , typename RType>
class Operator : public Mapping <DFieldType,RFieldType,DType,RType>
{
public:
//! remember template parameters for derived classes
typedef DType DomainType;
typedef RType RangeType;
typedef DFieldType DomainFieldType;
typedef RFieldType RangeFieldType;
//! Application operator
virtual void operator() (const DomainType& arg, RangeType& dest) const = 0;
private:
//! Helper function for Mapping
//! With this function, a combined mapping can choose the right application
//! operator (i.e. the one from Mapping itself, or from Function/Operator)
//! \note: Do not override this definition
virtual void apply (const DomainType& arg, RangeType& dest) const {
operator()(arg, dest);
}
}; // end class Operator
/** @} end documentation group */
} // end namespace Dune
#endif
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_VECTORSPACE_HH
#define DUNE_VECTORSPACE_HH
namespace Dune {
/** @defgroup AlgebraCommon Functions and Operators
The Functions and Operators Module contains objects of
arbitrary vector spaces and mappings between them.
@{
*/
/** @defgroup Vector Elements of Vector Spaces
An instance of this class is an element of an vector space.
Elements of vector spaces can be added and multiplied by a
scalar.
@{
*/
/** \brief Vector class
* This is the base class for all methods and operators.
*/
template <typename Field>
class Vector
{
public:
virtual ~Vector() {};
//virtual Vector<Field> operator + (const Vector<Field> &) const = 0;
//virtual Vector<Field> operator - (const Vector<Field> &) const = 0;
//virtual Vector<Field> operator * (const Field &) const = 0;
//virtual Vector<Field> operator / (const Field &) const = 0;
/** \brief Assignment operator
\note Only returns itself...
*/
virtual Vector<Field>& operator = (const Vector<Field> &) { return *this;};
//! Addition
virtual Vector<Field>& operator += (const Vector<Field> &) = 0;
//! Subtraction
virtual Vector<Field>& operator -= (const Vector<Field> &) = 0;
//! Multiplication
virtual Vector<Field>& operator *= (const Field &) = 0;
//! Division
virtual Vector<Field>& operator /= (const Field &) = 0;
};
/** @} end documentation group */
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment