Class documentation of Concepts

Loading...
Searching...
No Matches

#include <vector.hh>

Inheritance diagram for concepts::Vector< F >:
concepts::Function< F > concepts::OutputOperator

Public Member Functions

 Vector (const Vector< F > &f)
 Copy constructor.
 
template<class H >
 Vector (const Vector< H > &f)
 Copy constructor.
 
template<class G >
 Vector (const Space< G > &spc)
 
 Vector (const uint dim=0)
 
template<class G >
 Vector (const Space< G > &spc, const LinearForm< F, G > &lf)
 
template<class G >
 Vector (const Space< G > &spc, const std::string &fname)
 
template<class G >
 Vector (const Space< G > &spc, F *data)
 
 Vector (uint dim, F *data)
 
template<class H >
 Vector (const Vector< H > &fncX, F fnc(const H &))
 
template<class H >
 Vector (const Vector< H > &fncX, const F &fnc(const H &))
 
 Vector (const Vector< typename Realtype< F >::type > &V_R, const Vector< typename Realtype< F >::type > &V_I)
 
template<class H >
 Vector (const Vector< H > &fnc, const Set< IndexRange > &indices)
 
virtual Vector< F > & operator= (const Function< F > &fnc)
 Assignment operator.
 
Vector< F > & operator= (const Vector< F > &fnc)
 Assignement operator.
 
template<class H >
Vector< F > & operator= (const Function< H > &fnc)
 
Vector< F > & operator= (F c)
 Assignement operator.
 
virtual F & operator() (uint i)
 Index operator.
 
virtualoperator() (uint i) const
 Index operator.
 
uint size () const
 
virtual Function< F > & operator+= (const Function< F > &fnc)
 Addition operator.
 
virtual Function< F > & operator+= (F c)
 Addition operator.
 
Vector< F > operator+ (const Function< F > &fnc) const
 
Vector< F > operator+ (F c) const
 
virtual Function< F > & operator-= (const Function< F > &fnc)
 Subtraction operator.
 
virtual Function< F > & operator-= (F c)
 Subtraction operator.
 
Vector< F > operator- (const Function< F > &fnc) const
 
Vector< F > operator- (F c) const
 
virtual Function< F > & operator*= (F sc)
 Scaling operator.
 
Vector< F > operator* (F c) const
 
virtual Function< F > & operator/= (F sc)
 
Vector< F > operator/ (F c) const
 
operator* (const Vector< F > &fnc) const
 
template<class G >
Vector< F > & assemble (const Space< G > &spc, const LinearForm< F, G > &lf)
 Assembles the vector w.r.t. linear form lf and space spc.
 
Vector< F > & apply (F fnc(const F &))
 
 operator F* () const
 
F * data () const
 
virtual void resize (uint n)
 Sets a new size, previous data might be lost

 
virtual Function< F > & add (const Function< F > &fnc, F sc)
 Adds a times fnc to this function.
 
template<class H >
Vector< F > & add (const Vector< H > &fnc, F sc, uint offset=0)
 Adds a vector of possible different length and type with an offset.
 
template<class H >
Vector< F > & add (const Vector< H > &fnc)
 Adds a vector of possible different length and type.
 
Real l1 () const
 l1 norm
 
Real l2 () const
 l2 norm
 
Real l2_2 () const
 l2 norm squared
 
Real max () const
 Maximum of the absolute values in the vector, ie. $l^\infty$ norm.
 
uint n () const
 Elements in the vector.
 
void reverse ()
 
const Vector< F > & write (const std::string &fname) const
 
void storeMatlab (const char *filename, const char *name=0, bool append=false) const
 Stores the vector in a Matlab sparse matrix.
 
uint dim () const
 Returns the dimension of the function.
 

Protected Member Functions

virtual std::ostream & info (std::ostream &os) const
 Returns information in an output stream.
 
template<class G >
void fillEntries_ (const Space< G > &spc, const LinearForm< F, G > &lf)
 

Protected Attributes

Array< F > data_
 Vector data.
 
uint dim_
 Dimension of the function (or of the space the function is defined)
 

Detailed Description

template<class F>
class concepts::Vector< F >

A vector. The values of the function represented by this vector are stored elementwise in an array.

It is possible to write fast interfaces to other libraries since the array of values is under complete control of this class. An example is the interface to PETSc, where the vector data is not copied, but the data of PETSc is used.

Test:
test::VectorTest
Examples
BGT_0.cc, RobinBCs.cc, arpackppTutorial.cc, elasticity2D_tutorial.cc, exactDtN.cc, howToGetStarted.cc, hpFEM2d-simple.cc, hpFEM2d.cc, hpFEM3d-EV.cc, inhomDirichletBCs.cc, inhomDirichletBCsLagrange.cc, inhomNeumannBCs.cc, linearDG1d.cc, linearFEM1d-simple.cc, linearFEM1d.cc, and parallelizationTutorial.cc.

Definition at line 39 of file vector.hh.

Constructor & Destructor Documentation

◆ Vector() [1/11]

template<class F >
template<class H >
concepts::Vector< F >::Vector ( const Vector< H > &  f)

Copy constructor.

Definition at line 253 of file vector.hh.

◆ Vector() [2/11]

template<class F >
template<class G >
concepts::Vector< F >::Vector ( const Space< G > &  spc)
inline

Constructor. Creates a vector with all entries set to 0.

Parameters
spcA space

Definition at line 51 of file vector.hh.

◆ Vector() [3/11]

template<class F >
concepts::Vector< F >::Vector ( const uint  dim = 0)
inline

Constructor. Creates a vector with all entries set to 0.

Parameters
dimnumber of entries

Definition at line 57 of file vector.hh.

◆ Vector() [4/11]

template<class F >
template<class G >
concepts::Vector< F >::Vector ( const Space< G > &  spc,
const LinearForm< F, G > &  lf 
)

Constructor. The entries are filled according to lf.

Parameters
spcA space
lfA linear form

Definition at line 270 of file vector.hh.

◆ Vector() [5/11]

template<class F >
template<class G >
concepts::Vector< F >::Vector ( const Space< G > &  spc,
const std::string &  fname 
)

File read constructor. The vector is read from a file. This should be endian proof.

Parameters
spcA space
fnameFilename

◆ Vector() [6/11]

template<class F >
template<class G >
concepts::Vector< F >::Vector ( const Space< G > &  spc,
F *  data 
)
inline

Constructor.

Use this constructor to create a vector from an array of data. The memory in data is not freed by this class.

Parameters
spcSpace on which the vector is defined
dataData of the vector

Definition at line 84 of file vector.hh.

◆ Vector() [7/11]

template<class F >
concepts::Vector< F >::Vector ( uint  dim,
F *  data 
)
inline

Definition at line 88 of file vector.hh.

◆ Vector() [8/11]

template<class F >
template<class H >
concepts::Vector< F >::Vector ( const Vector< H > &  fncX,
F   fncconst H & 
)

Constructor. Use this constructor to create a vector of type F out of a vector with entries of type H. The F type vector consists of elementwise evaluations of the function fnc.

Definition at line 260 of file vector.hh.

◆ Vector() [9/11]

template<class F >
template<class H >
concepts::Vector< F >::Vector ( const Vector< H > &  fncX,
const F &  fncconst H & 
)

Definition at line 277 of file vector.hh.

◆ Vector() [10/11]

template<class F >
concepts::Vector< F >::Vector ( const Vector< typename Realtype< F >::type > &  V_R,
const Vector< typename Realtype< F >::type > &  V_I 
)

Constructor. Use this constructor to build a vector of type F out of two vectors with entries of type Realtype<F>; works only for F = Cmplx, G = Real

◆ Vector() [11/11]

template<class F >
template<class H >
concepts::Vector< F >::Vector ( const Vector< H > &  fnc,
const Set< IndexRange > &  indices 
)

Constructor.

Takes (copies) the entries at the indices indices of vector fnc.

Definition at line 287 of file vector.hh.

Member Function Documentation

◆ add() [1/3]

template<class F >
virtual Function< F > & concepts::Vector< F >::add ( const Function< F > &  fnc,
a 
)
virtual

Adds a times fnc to this function.

Reimplemented from concepts::Function< F >.

◆ add() [2/3]

template<class F >
template<class H >
Vector< F > & concepts::Vector< F >::add ( const Vector< H > &  fnc)
inline

Adds a vector of possible different length and type.

Definition at line 209 of file vector.hh.

◆ add() [3/3]

template<class F >
template<class H >
Vector< F > & concepts::Vector< F >::add ( const Vector< H > &  fnc,
sc,
uint  offset = 0 
)

Adds a vector of possible different length and type with an offset.

Definition at line 307 of file vector.hh.

◆ apply()

template<class F >
Vector< F > & concepts::Vector< F >::apply ( F   fncconst F &)

Application operator to each component, e.g. std::sin or std::conj

◆ data()

template<class F >
F * concepts::Vector< F >::data ( ) const
inline
Examples
parallelizationTutorial.cc.

Definition at line 192 of file vector.hh.

◆ dim()

template<class F >
uint concepts::Function< F >::dim ( ) const
inlineinherited

Returns the dimension of the function.

Definition at line 53 of file basis.hh.

◆ info()

template<class F >
virtual std::ostream & concepts::Vector< F >::info ( std::ostream &  os) const
protectedvirtual

Returns information in an output stream.

Reimplemented from concepts::Function< F >.

◆ l2()

template<class F >
Real concepts::Vector< F >::l2 ( ) const
inline

l2 norm

Definition at line 215 of file vector.hh.

◆ n()

template<class F >
uint concepts::Vector< F >::n ( ) const
inline

Elements in the vector.

Definition at line 224 of file vector.hh.

◆ operator F*()

template<class F >
concepts::Vector< F >::operator F* ( ) const
inline

Conversion operator. Returns the array of values.

Definition at line 190 of file vector.hh.

◆ operator()() [1/2]

template<class F >
virtual F & concepts::Vector< F >::operator() ( uint  i)
inlinevirtual

Index operator.

Implements concepts::Function< F >.

Definition at line 140 of file vector.hh.

◆ operator()() [2/2]

template<class F >
virtual F concepts::Vector< F >::operator() ( uint  i) const
inlinevirtual

Index operator.

Implements concepts::Function< F >.

Definition at line 143 of file vector.hh.

◆ operator*()

template<class F >
F concepts::Vector< F >::operator* ( const Vector< F > &  fnc) const

Inner product (v = this, w = \fnc)

\[v \cdot w\]

or

\[v \cdot \overline{w}\]

for complex vectors respectivly.

◆ operator*=()

template<class F >
virtual Function< F > & concepts::Vector< F >::operator*= ( sc)
virtual

Scaling operator.

Reimplemented from concepts::Function< F >.

◆ operator+=() [1/2]

template<class F >
virtual Function< F > & concepts::Vector< F >::operator+= ( const Function< F > &  fnc)
virtual

Addition operator.

Reimplemented from concepts::Function< F >.

◆ operator+=() [2/2]

template<class F >
virtual Function< F > & concepts::Vector< F >::operator+= ( c)
virtual

Addition operator.

Reimplemented from concepts::Function< F >.

◆ operator-=() [1/2]

template<class F >
virtual Function< F > & concepts::Vector< F >::operator-= ( const Function< F > &  fnc)
virtual

Subtraction operator.

Reimplemented from concepts::Function< F >.

◆ operator-=() [2/2]

template<class F >
virtual Function< F > & concepts::Vector< F >::operator-= ( c)
virtual

Subtraction operator.

Reimplemented from concepts::Function< F >.

◆ operator=() [1/2]

template<class F >
virtual Vector< F > & concepts::Vector< F >::operator= ( const Function< F > &  fnc)
virtual

Assignment operator.

Implements concepts::Function< F >.

◆ operator=() [2/2]

template<class F >
template<class H >
Vector< F > & concepts::Vector< F >::operator= ( const Function< H > &  fnc)

Definition at line 298 of file vector.hh.

◆ resize()

template<class F >
virtual void concepts::Vector< F >::resize ( uint  n)
inlinevirtual

Sets a new size, previous data might be lost

Definition at line 195 of file vector.hh.

◆ reverse()

template<class F >
void concepts::Vector< F >::reverse ( )

Definition at line 316 of file vector.hh.

◆ size()

template<class F >
uint concepts::Vector< F >::size ( ) const
inline
Examples
parallelizationTutorial.cc.

Definition at line 147 of file vector.hh.

◆ write()

template<class F >
const Vector< F > & concepts::Vector< F >::write ( const std::string &  fname) const

Writes the vector to a file. This should be endian proof.

Parameters
fnameFilename

Member Data Documentation

◆ data_

template<class F >
Array<F> concepts::Vector< F >::data_
protected

Vector data.

Definition at line 243 of file vector.hh.

◆ dim_

template<class F >
uint concepts::Function< F >::dim_
protectedinherited

Dimension of the function (or of the space the function is defined)

Definition at line 57 of file basis.hh.


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