QuOc

 

Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp > Class Template Reference

This class provides an interface for general linear operators on functions that live on levelsets (given as aol::Vector on a grid). It provides assembly routines for the corresponding matrices and apply routines for direct application to a aol::Vector. More...

#include <FELevelsetOpInterface.h>

Inheritance diagram for qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >:
aol::Op< aol::Vector< ConfiguratorType::RealType > >

List of all members.

Public Member Functions

 FELevelsetOpInterface (const typename ConfiguratorType::InitType &Grid, const typename ConfiguratorType::ArrayType &LevelsetFunction, const aol::OperatorType OpType=aol::ONTHEFLY)
virtual ~FELevelsetOpInterface ()
void applyAdd (const aol::Vector< RealType > &Arg, aol::Vector< RealType > &Dest) const
void reset ()
ConfiguratorType::MatrixType & getMatrix ()
template<typename MatrixType >
void assembleAddMatrix (MatrixType &Mat, const RealType Factor=aol::NumberTrait< RealType >::one) const

Protected Types

typedef ConfiguratorType::RealType RealType

Protected Member Functions

void multiplyOnTheFly (const aol::Vector< RealType > &Arg, aol::Vector< RealType > &Dest) const
void assembleMatrix () const
Imp & asImp ()
const Imp & asImp () const

Protected Attributes

const ConfiguratorType _config
const ConfiguratorType::ArrayType & _levelsetFunction
ConfiguratorType::MatrixType * _mat
const aol::OperatorType _opType

Detailed Description

template<typename ConfiguratorType, typename Imp>
class qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >

This class provides an interface for general linear operators on functions that live on levelsets (given as aol::Vector on a grid). It provides assembly routines for the corresponding matrices and apply routines for direct application to a aol::Vector.

Currently, only midpoint quadrature is implemented.

Author:
Wirth

Definition at line 45 of file FELevelsetOpInterface.h.


Member Typedef Documentation

template<typename ConfiguratorType , typename Imp >
typedef ConfiguratorType::RealType qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::RealType [protected]

Definition at line 49 of file FELevelsetOpInterface.h.


Constructor & Destructor Documentation

template<typename ConfiguratorType , typename Imp >
qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::FELevelsetOpInterface ( const typename ConfiguratorType::InitType &  Grid,
const typename ConfiguratorType::ArrayType &  LevelsetFunction,
const aol::OperatorType  OpType = aol::ONTHEFLY 
) [inline, explicit]

The grid and the levelset function together define the zero levelset, where the operands of the operator live.

Definition at line 60 of file FELevelsetOpInterface.h.

                                                                                                                                                                                           :
      _config ( Grid ),
      _levelsetFunction ( LevelsetFunction ),
      _mat ( NULL ),
      _opType ( OpType ) {}

template<typename ConfiguratorType , typename Imp >
virtual qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::~FELevelsetOpInterface (  )  [inline, virtual]

Definition at line 66 of file FELevelsetOpInterface.h.

                                    {
    delete _mat;
  }


Member Function Documentation

template<typename ConfiguratorType , typename Imp >
void qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::applyAdd ( const aol::Vector< RealType > &  Arg,
aol::Vector< RealType > &  Dest 
) const [inline]

Definition at line 70 of file FELevelsetOpInterface.h.

References aol::ASSEMBLED, and aol::ONTHEFLY.

                                                                                    {
    switch ( _opType ) {
      case aol::ONTHEFLY:
        multiplyOnTheFly ( Arg, Dest );
        break;
      case aol::ASSEMBLED:
        if ( !_mat )
          assembleMatrix( );
        _mat->applyAdd ( Arg, Dest );
        break;
    };
  }

template<typename ConfiguratorType , typename Imp >
const Imp& qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::asImp (  )  const [inline, protected]

Definition at line 163 of file FELevelsetOpInterface.h.

{ return static_cast<const Imp&> ( *this ); }

template<typename ConfiguratorType , typename Imp >
Imp& qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::asImp (  )  [inline, protected]

Definition at line 162 of file FELevelsetOpInterface.h.

{ return static_cast<Imp&> ( *this ); }

template<typename ConfiguratorType , typename Imp >
template<typename MatrixType >
void qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::assembleAddMatrix ( MatrixType Mat,
const RealType  Factor = aol::NumberTrait<RealType>::one 
) const [inline]

(this assembled matrix * Factor) is added to Mat

Definition at line 135 of file FELevelsetOpInterface.h.

                                                                                                        {
    // will contain the global indices of the DOFs
    int globalDofs[ConfiguratorType::maxNumLocalDofs];
    // will contain the local system matrix for one single element
    aol::Mat<ConfiguratorType::maxNumLocalDofs,ConfiguratorType::maxNumLocalDofs,RealType> localMatrix;

    // traverse all lines on the interface
    qc::IsoLineManager2d<ConfiguratorType> isoManager ( _config.getInitializer(), _levelsetFunction );
    for ( qc::IsoLineIterator2d<ConfiguratorType> isoIt = isoManager.begin(); isoIt != isoManager.end(); isoIt++ ) {
      // assemble the local matrix for the current element
      this->asImp().prepareLocalMatrix ( isoIt, localMatrix );

      const int numLocalDofs = _config.getNumLocalDofs ( isoIt->el );

      // get the global indices of the local Dofs of the current element
      for ( int i = 0; i < numLocalDofs; ++i )
        globalDofs[i] = _config.localToGlobal ( isoIt->el, i );

      // finally add the locally computed values to the matrix
      for ( int i = 0; i < numLocalDofs; ++i )
        for ( int j = 0; j < numLocalDofs; ++j )
          Mat.add ( globalDofs[i], globalDofs[j], Factor * localMatrix [ i ][ j ] );
    }
  }

template<typename ConfiguratorType , typename Imp >
void qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::assembleMatrix (  )  const [inline, protected]

Definition at line 125 of file FELevelsetOpInterface.h.

                               {
    if ( _mat )
      delete _mat;
    _mat = _config.createNewMatrix( );
    assembleAddMatrix ( *_mat );
  }

template<typename ConfiguratorType , typename Imp >
ConfiguratorType::MatrixType& qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::getMatrix (  )  [inline]

Definition at line 90 of file FELevelsetOpInterface.h.

                                                    {
    if ( !_mat ) {
      _mat = _config.createNewMatrix( );
      assembleMatrix( );
    }
    //return dynamic_cast<typename ConfiguratorType::MatrixType&>(*_mat);
    return *_mat;
  }

template<typename ConfiguratorType , typename Imp >
void qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::multiplyOnTheFly ( const aol::Vector< RealType > &  Arg,
aol::Vector< RealType > &  Dest 
) const [inline, protected]

Definition at line 100 of file FELevelsetOpInterface.h.

                                                                                            {
    // will contain the global indices of the DOFs
    int globalDofs[ConfiguratorType::maxNumLocalDofs];
    // will contain the local system matrix for one single element
    aol::Mat<ConfiguratorType::maxNumLocalDofs,ConfiguratorType::maxNumLocalDofs,RealType> localMatrix;

    // traverse all lines on the interface
    qc::IsoLineManager2d<ConfiguratorType> isoManager ( _config.getInitializer(), _levelsetFunction );
    for ( qc::IsoLineIterator2d<ConfiguratorType> isoIt = isoManager.begin(); isoIt != isoManager.end(); isoIt++ ) {
      // assemble the local matrix belonging to the current element
      this->asImp().prepareLocalMatrix ( isoIt, localMatrix );

      const int numLocalDofs = _config.getNumLocalDofs ( isoIt->el );

      // get the global indices to the current Dofs
      for ( int i = 0; i < numLocalDofs; ++i )
        globalDofs[i] = _config.localToGlobal ( isoIt->el, i );

      // finally add the locally computed values to the result
      for ( int i = 0; i < numLocalDofs; ++i )
        for ( int j = 0; j < numLocalDofs; ++j )
          Dest[globalDofs[i]] += localMatrix [ i ][ j ] * Arg[globalDofs[j]] ;
    }
  }

template<typename ConfiguratorType , typename Imp >
void qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::reset (  )  [inline]

Definition at line 84 of file FELevelsetOpInterface.h.

                {
    if ( _mat )
      delete _mat;
    _mat = NULL;
  }


Member Data Documentation

template<typename ConfiguratorType , typename Imp >
const ConfiguratorType qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::_config [protected]

Definition at line 51 of file FELevelsetOpInterface.h.

template<typename ConfiguratorType , typename Imp >
const ConfiguratorType::ArrayType& qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::_levelsetFunction [protected]

Definition at line 52 of file FELevelsetOpInterface.h.

template<typename ConfiguratorType , typename Imp >
ConfiguratorType::MatrixType* qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::_mat [mutable, protected]

Definition at line 53 of file FELevelsetOpInterface.h.

template<typename ConfiguratorType , typename Imp >
const aol::OperatorType qc::FELevelsetOpInterface< ConfiguratorType, QC_2D, Imp >::_opType [protected]

Definition at line 54 of file FELevelsetOpInterface.h.


The documentation for this class was generated from the following file:

Generated on Fri Sep 9 2011 21:10:01 for QuocMesh by doxygen 1.7.1