BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | Related Functions | List of all members
Bempp::BoundaryOperator< BasisFunctionType, ResultType > Class Template Reference

Operator acting on functions defined on a surface. More...

#include </home/wojtek/Projects/BEM/bempp-sven/bempp/lib/assembly/boundary_operator.hpp>

Public Member Functions

 BoundaryOperator ()
 Construct an uninitialized BoundaryOperator.
 
 BoundaryOperator (const shared_ptr< const Context< BasisFunctionType, ResultType > > &context, const shared_ptr< const AbstractBoundaryOperator< BasisFunctionType, ResultType > > &abstractOp)
 Construct and initialize a BoundaryOperator. More...
 
void initialize (const shared_ptr< const Context< BasisFunctionType, ResultType > > &context, const shared_ptr< const AbstractBoundaryOperator< BasisFunctionType, ResultType > > &abstractOp)
 Initialize or reinitialize a BoundaryOperator. More...
 
void uninitialize ()
 Uninitialize the BoundaryOperator. More...
 
bool isInitialized () const
 Return true if the BoundaryOperator has been initialized, false otherwise.
 
shared_ptr< const
AbstractBoundaryOperator
< BasisFunctionType,
ResultType > > 
abstractOperator () const
 Return a shared pointer to the encapsulated abstract boundary operator.
 
shared_ptr< const Context
< BasisFunctionType,
ResultType > > 
context () const
 Return a shared pointer to the stored Context object.
 
shared_ptr< const
DiscreteBoundaryOperator
< ResultType > > 
weakForm () const
 Return a shared pointer to the weak form of the encapsulated abstract boundary operator. More...
 
shared_ptr< const Space
< BasisFunctionType > > 
domain () const
 Return a shared pointer to the domain of the encapsulated abstract boundary operator. More...
 
shared_ptr< const Space
< BasisFunctionType > > 
range () const
 Return a shared pointer to the range of the encapsulated abstract boundary operator. More...
 
shared_ptr< const Space
< BasisFunctionType > > 
dualToRange () const
 Return a shared pointer to the space dual to the range of the encapsulated abstract boundary operator. More...
 
std::string label () const
 Return the label of this BoundaryOperator.
 
bool isWeakFormHeld () const
 Return true if the BoundaryOperator should prevent its weak form from being destroyed. More...
 
void holdWeakForm (bool value)
 Specify whether the BoundaryOperator should prevent its weak form from being destroyed. More...
 
void apply (const TranspositionMode trans, const GridFunction< BasisFunctionType, ResultType > &x_in, GridFunction< BasisFunctionType, ResultType > &y_inout, ResultType alpha, ResultType beta) const
 Act on a GridFunction. More...
 

Related Functions

(Note that these are not member functions.)

template<typename BasisFunctionType , typename ResultType >
BoundaryOperator
< BasisFunctionType,
ResultType > 
operator+ (const BoundaryOperator< BasisFunctionType, ResultType > &op)
 Return a BoundaryOperator identical to the operand.
 
template<typename BasisFunctionType , typename ResultType >
BoundaryOperator
< BasisFunctionType,
ResultType > 
operator- (const BoundaryOperator< BasisFunctionType, ResultType > &op)
 Return a BoundaryOperator equal to the operand multiplied by -1. More...
 
template<typename BasisFunctionType , typename ResultType >
BoundaryOperator
< BasisFunctionType,
ResultType > 
operator+ (const BoundaryOperator< BasisFunctionType, ResultType > &op1, const BoundaryOperator< BasisFunctionType, ResultType > &op2)
 Return a BoundaryOperator representing the sum of the operands. More...
 
template<typename BasisFunctionType , typename ResultType >
BoundaryOperator
< BasisFunctionType,
ResultType > 
operator- (const BoundaryOperator< BasisFunctionType, ResultType > &op1, const BoundaryOperator< BasisFunctionType, ResultType > &op2)
 Return a BoundaryOperator representing the difference of the operands. More...
 
template<typename BasisFunctionType , typename ResultType , typename ScalarType >
boost::enable_if< typename
boost::mpl::has_key
< boost::mpl::set< float,
double, std::complex< float >
, std::complex< double >
>, ScalarType >
, BoundaryOperator
< BasisFunctionType,
ResultType > >::type 
operator* (const BoundaryOperator< BasisFunctionType, ResultType > &op, const ScalarType &scalar)
 Return a BoundaryOperator representing the operator op multiplied by scalar. More...
 
template<typename BasisFunctionType , typename ResultType , typename ScalarType >
BoundaryOperator
< BasisFunctionType,
ResultType > 
operator* (const ScalarType &scalar, const BoundaryOperator< BasisFunctionType, ResultType > &op)
 Return a BoundaryOperator representing the operator op multiplied by scalar. More...
 
template<typename BasisFunctionType , typename ResultType , typename ScalarType >
BoundaryOperator
< BasisFunctionType,
ResultType > 
operator/ (const BoundaryOperator< BasisFunctionType, ResultType > &op, const ScalarType &scalar)
 Return a BoundaryOperator representing the operator op divided by scalar. More...
 
template<typename BasisFunctionType , typename ResultType >
GridFunction
< BasisFunctionType,
ResultType > 
operator* (const BoundaryOperator< BasisFunctionType, ResultType > &op, const GridFunction< BasisFunctionType, ResultType > &fun)
 Act with a BoundaryOperator on a GridFunction. More...
 
template<typename BasisFunctionType , typename ResultType >
BoundaryOperator
< BasisFunctionType,
ResultType > 
operator* (const BoundaryOperator< BasisFunctionType, ResultType > &op1, const BoundaryOperator< BasisFunctionType, ResultType > &op2)
 Return a BoundaryOperator representing the product of the operands (op1 * op2). More...
 
template<typename BasisFunctionType , typename ResultType >
BoundaryOperator
< BasisFunctionType,
ResultType > 
adjoint (const BoundaryOperator< BasisFunctionType, ResultType > &op)
 Return the adjoint of a BoundaryOperator. More...
 
template<typename BasisFunctionType , typename ResultType >
BoundaryOperator
< BasisFunctionType,
ResultType > 
adjoint (const BoundaryOperator< BasisFunctionType, ResultType > &op, const shared_ptr< const Space< BasisFunctionType > > &range)
 Return the adjoint of a BoundaryOperator. More...
 
template<typename BasisFunctionType , typename ResultType >
BoundaryOperator
< BasisFunctionType,
ResultType > & 
throwIfUninitialized (BoundaryOperator< BasisFunctionType, ResultType > &op, std::string message="")
 Check whether a BoundaryOperator object is initialized. More...
 
template<typename BasisFunctionType , typename ResultType >
const BoundaryOperator
< BasisFunctionType,
ResultType > & 
throwIfUninitialized (const BoundaryOperator< BasisFunctionType, ResultType > &op, std::string message="")
 

Detailed Description

template<typename BasisFunctionType, typename ResultType>
class Bempp::BoundaryOperator< BasisFunctionType, ResultType >

Operator acting on functions defined on a surface.

A BoundaryOperator is a lightweight wrapper of a pair of shared pointers to an AbstractBoundaryOperator and a DiscreteBoundaryOperator representing the weak form of the former. The weak form is evaluated lazily, on the first call to weakForm(). The Context object passed to the constructor of the BoundaryOperator or to the initialize() function determines how this weak form is calculated.

Note
Different threads should not share BoundaryOperator objects, since notably the weakForm() function is not thread-safe. Instead, each thread should hold its own copy of a BoundaryOperator (note that copying BoundaryOperators is cheap – the copy constructor is shallow).

See the documentation of AbstractBoundaryOperator for the decription of the template parameters BasisFunctionType and ResultType.

Constructor & Destructor Documentation

template<typename BasisFunctionType , typename ResultType >
Bempp::BoundaryOperator< BasisFunctionType, ResultType >::BoundaryOperator ( const shared_ptr< const Context< BasisFunctionType, ResultType > > &  context,
const shared_ptr< const AbstractBoundaryOperator< BasisFunctionType, ResultType > > &  abstractOp 
)

Construct and initialize a BoundaryOperator.

Equivalent to calling the initialize() function on a BoundaryOperator object created with the default constructor. See the documentation of initialize() for a description of the constructor's parameters.

Note
User code should not need to invoke this constructor directly; it is more convenient to use non-member constructors supplied with particular AbstractBoundaryOperator subclasses (e.g. laplace3dSingleLayerBoundaryOperator(), identityOperator(), pseudoinverse() etc.), which construct an AbstractBoundaryOperator and wrap it in a BoundaryOperator in a single step.

References Bempp::BoundaryOperator< BasisFunctionType, ResultType >::context(), and Bempp::BoundaryOperator< BasisFunctionType, ResultType >::initialize().

Member Function Documentation

template<typename BasisFunctionType , typename ResultType >
void Bempp::BoundaryOperator< BasisFunctionType, ResultType >::apply ( const TranspositionMode  trans,
const GridFunction< BasisFunctionType, ResultType > &  x_in,
GridFunction< BasisFunctionType, ResultType > &  y_inout,
ResultType  alpha,
ResultType  beta 
) const

Act on a GridFunction.

This function sets y_inout to alpha * A * x_in + beta * y_inout, where A is the operator represented by this object.

The space of x_in must be identical with the domain of the encapsulated abstract boundary operator, whereas the space of y_inout and its dual must be identical with the range of the encapsulated abstract boundary operator and its dual; otherwise an exception is thrown. An exception is also thrown if the BoundaryOperator is uninitialized.

References Bempp::GridFunction< BasisFunctionType, ResultType >::coefficients(), Bempp::GridFunction< BasisFunctionType, ResultType >::projections(), Bempp::GridFunction< BasisFunctionType, ResultType >::setProjections(), and Bempp::GridFunction< BasisFunctionType, ResultType >::space().

Referenced by Bempp::BoundaryOperator< BasisFunctionType, ResultType >::operator*().

template<typename BasisFunctionType , typename ResultType >
shared_ptr< const Space< BasisFunctionType > > Bempp::BoundaryOperator< BasisFunctionType, ResultType >::domain ( ) const

Return a shared pointer to the domain of the encapsulated abstract boundary operator.

A null pointer is returned if this function is called on an uninitialized BoundaryOperator.

Referenced by Bempp::AbstractBoundaryOperatorPseudoinverse< BasisFunctionType_, ResultType_ >::AbstractBoundaryOperatorPseudoinverse(), and Bempp::AdjointAbstractBoundaryOperator< BasisFunctionType_, ResultType_ >::AdjointAbstractBoundaryOperator().

template<typename BasisFunctionType , typename ResultType >
shared_ptr< const Space< BasisFunctionType > > Bempp::BoundaryOperator< BasisFunctionType, ResultType >::dualToRange ( ) const
template<typename BasisFunctionType , typename ResultType >
void Bempp::BoundaryOperator< BasisFunctionType, ResultType >::holdWeakForm ( bool  value)

Specify whether the BoundaryOperator should prevent its weak form from being destroyed.

See isWeakFormHeld() for more information.

template<typename BasisFunctionType , typename ResultType >
void Bempp::BoundaryOperator< BasisFunctionType, ResultType >::initialize ( const shared_ptr< const Context< BasisFunctionType, ResultType > > &  context,
const shared_ptr< const AbstractBoundaryOperator< BasisFunctionType, ResultType > > &  abstractOp 
)

Initialize or reinitialize a BoundaryOperator.

Parameters
[in]contextShared pointer to a Context object that will be used to build the weak form of abstractOp when necessary.
[in]abstractOpShared pointer to an AbstractBoundaryOperator that will be encapsulated in this BoundaryOperator.

An exception is thrown if either of these pointers is NULL.

The provided shared pointers are stored in internal variables. In addition, any stored pointer to the weak form of the abstract boundary operator is invalidated.

Referenced by Bempp::BoundaryOperator< BasisFunctionType, ResultType >::BoundaryOperator().

template<typename BasisFunctionType , typename ResultType >
bool Bempp::BoundaryOperator< BasisFunctionType, ResultType >::isWeakFormHeld ( ) const

Return true if the BoundaryOperator should prevent its weak form from being destroyed.

If isWeakFormHeld() returns true, the BoundaryOperator stores a "strong" shared pointer to its discrete weak form once it is assembled for the first time, so that the weak form is held in memory at least as long as the BoundaryOperator object is in scope and its uninitialize() member function is not called.

Otherwise only a weak pointer to the weak form is stored; thus, the weak form remains in memory only as long as a shared pointer to it is held somewhere else in the program.

By default, isWeakFormHeld() returns true; call holdWeakForm(false) to change it.

template<typename BasisFunctionType , typename ResultType >
shared_ptr< const Space< BasisFunctionType > > Bempp::BoundaryOperator< BasisFunctionType, ResultType >::range ( ) const
template<typename BasisFunctionType , typename ResultType >
void Bempp::BoundaryOperator< BasisFunctionType, ResultType >::uninitialize ( )

Uninitialize the BoundaryOperator.

This function resets the internal shared pointers to the abstract boundary operator and its weak form to NULL.

template<typename BasisFunctionType , typename ResultType >
shared_ptr< const DiscreteBoundaryOperator< ResultType > > Bempp::BoundaryOperator< BasisFunctionType, ResultType >::weakForm ( ) const

Return a shared pointer to the weak form of the encapsulated abstract boundary operator.

An exception is thrown if this function is called on an uninitialized BoundaryOperator.

Friends And Related Function Documentation

template<typename BasisFunctionType , typename ResultType >
BoundaryOperator< BasisFunctionType, ResultType > adjoint ( const BoundaryOperator< BasisFunctionType, ResultType > &  op)
related

Return the adjoint of a BoundaryOperator.

An exception is thrown if the operand is uninitialized. This method tries to figure out the range space using a simple heuristic.

See Also
AdjointAbstractBoundaryOperator for the definition of the adjoint operator in BEM++. Note that this operator is only defined for real BasisFunctionType.

References Bempp::BoundaryOperator< BasisFunctionType, ResultType >::context().

template<typename BasisFunctionType , typename ResultType >
BoundaryOperator< BasisFunctionType, ResultType > adjoint ( const BoundaryOperator< BasisFunctionType, ResultType > &  op,
const shared_ptr< const Space< BasisFunctionType > > &  range 
)
related

Return the adjoint of a BoundaryOperator.

An exception is thrown if the operand is uninitialized. The range space needs to be given explicitly.

See Also
AdjointAbstractBoundaryOperator for the definition of the adjoint operator in BEM++. Note that this operator is only defined for real BasisFunctionType.

References Bempp::BoundaryOperator< BasisFunctionType, ResultType >::context().

template<typename BasisFunctionType , typename ResultType , typename ScalarType >
boost::enable_if< typename boost::mpl::has_key< boost::mpl::set< float, double, std::complex< float >, std::complex< double > >, ScalarType >, BoundaryOperator< BasisFunctionType, ResultType > >::type operator* ( const BoundaryOperator< BasisFunctionType, ResultType > &  op,
const ScalarType &  scalar 
)
related

Return a BoundaryOperator representing the operator op multiplied by scalar.

An exception is thrown if op is uninitialized.

References Bempp::BoundaryOperator< BasisFunctionType, ResultType >::context(), and Bempp::BoundaryOperator< BasisFunctionType, ResultType >::isInitialized().

template<typename BasisFunctionType , typename ResultType , typename ScalarType >
BoundaryOperator< BasisFunctionType, ResultType > operator* ( const ScalarType &  scalar,
const BoundaryOperator< BasisFunctionType, ResultType > &  op 
)
related

Return a BoundaryOperator representing the operator op multiplied by scalar.

An exception is thrown if op is uninitialized.

template<typename BasisFunctionType , typename ResultType >
GridFunction< BasisFunctionType, ResultType > operator* ( const BoundaryOperator< BasisFunctionType, ResultType > &  op,
const GridFunction< BasisFunctionType, ResultType > &  fun 
)
related
template<typename BasisFunctionType , typename ResultType >
BoundaryOperator< BasisFunctionType, ResultType > operator* ( const BoundaryOperator< BasisFunctionType, ResultType > &  op1,
const BoundaryOperator< BasisFunctionType, ResultType > &  op2 
)
related

Return a BoundaryOperator representing the product of the operands (op1 * op2).

An exception is thrown if any of the operands is uninitialized.

References Bempp::BoundaryOperator< BasisFunctionType, ResultType >::context(), and Bempp::BoundaryOperator< BasisFunctionType, ResultType >::isInitialized().

template<typename BasisFunctionType , typename ResultType >
BoundaryOperator< BasisFunctionType, ResultType > operator+ ( const BoundaryOperator< BasisFunctionType, ResultType > &  op1,
const BoundaryOperator< BasisFunctionType, ResultType > &  op2 
)
related

Return a BoundaryOperator representing the sum of the operands.

An exception is thrown if either of the operands is uninitialized.

References Bempp::BoundaryOperator< BasisFunctionType, ResultType >::context(), and Bempp::BoundaryOperator< BasisFunctionType, ResultType >::isInitialized().

template<typename BasisFunctionType , typename ResultType >
BoundaryOperator< BasisFunctionType, ResultType > operator- ( const BoundaryOperator< BasisFunctionType, ResultType > &  op)
related

Return a BoundaryOperator equal to the operand multiplied by -1.

An exception is thrown if either of the operands is uninitialized.

References Bempp::BoundaryOperator< BasisFunctionType, ResultType >::isInitialized().

template<typename BasisFunctionType , typename ResultType >
BoundaryOperator< BasisFunctionType, ResultType > operator- ( const BoundaryOperator< BasisFunctionType, ResultType > &  op1,
const BoundaryOperator< BasisFunctionType, ResultType > &  op2 
)
related

Return a BoundaryOperator representing the difference of the operands.

if either of the operands is uninitialized.

References Bempp::BoundaryOperator< BasisFunctionType, ResultType >::isInitialized().

template<typename BasisFunctionType , typename ResultType , typename ScalarType >
BoundaryOperator< BasisFunctionType, ResultType > operator/ ( const BoundaryOperator< BasisFunctionType, ResultType > &  op,
const ScalarType &  scalar 
)
related

Return a BoundaryOperator representing the operator op divided by scalar.

Note
scalar must not be zero.

References Bempp::BoundaryOperator< BasisFunctionType, ResultType >::isInitialized().

template<typename BasisFunctionType , typename ResultType >
BoundaryOperator< BasisFunctionType, ResultType > & throwIfUninitialized ( BoundaryOperator< BasisFunctionType, ResultType > &  op,
std::string  message = "" 
)
related

Check whether a BoundaryOperator object is initialized.

This function checks whether the BoundaryOperator op is initialized. If so, it returns a reference to op, otherwise it throws a std::invalid_argument exception with message message (or a default message if message is left empty).

References Bempp::BoundaryOperator< BasisFunctionType, ResultType >::isInitialized().

template<typename BasisFunctionType , typename ResultType >
const BoundaryOperator< BasisFunctionType, ResultType > & throwIfUninitialized ( const BoundaryOperator< BasisFunctionType, ResultType > &  op,
std::string  message = "" 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References Bempp::BoundaryOperator< BasisFunctionType, ResultType >::isInitialized().


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