Refman
Refman
Refman
0.0.0
Contents
1 1 3 3 5 5 7 7 9 9 9
Namespace Documentation 4.1 spectral Namespace Reference . . . . . . . . . . . . . . . . . . . . . . 4.1.1 4.1.2 Detailed Description . . . . . . . . . . . . . . . . . . . . . . .
4.1.3
Function Documentation . . . . . . . . . . . . . . . . . . . . . 10 4.1.3.1 4.1.3.2 4.1.3.3 4.1.3.4 4.1.3.5 4.1.3.6 4.1.3.7 4.1.3.8 _Dx . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 _Dy . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 cavalieri_simpson . . . . . . . . . . . . . . . . . . . 11 deate . . . . . . . . . . . . . . . . . . . . . . . . . 11 horner . . . . . . . . . . . . . . . . . . . . . . . . . 11 legendre . . . . . . . . . . . . . . . . . . . . . . . . 11 newton . . . . . . . . . . . . . . . . . . . . . . . . . 11 operator . . . . . . . . . . . . . . . . . . . . . . . . 11
ii
CONTENTS operator . . . . . . . . . . . . . . . . . . . . . . . . 11
4.1.3.9
4.1.3.10 operator . . . . . . . . . . . . . . . . . . . . . . . . 12 4.1.3.11 operator . . . . . . . . . . . . . . . . . . . . . . . . 12 4.1.3.12 operator- . . . . . . . . . . . . . . . . . . . . . . . . 12 4.1.3.13 operator<< . . . . . . . . . . . . . . . . . . . . . . 12 4.1.3.14 operator<< . . . . . . . . . . . . . . . . . . . . . . 12 4.1.3.15 operator<< . . . . . . . . . . . . . . . . . . . . . . 12 4.1.3.16 operator>> . . . . . . . . . . . . . . . . . . . . . . 12 4.1.3.17 operator>> . . . . . . . . . . . . . . . . . . . . . . 13 4.1.3.18 operator>> . . . . . . . . . . . . . . . . . . . . . . 13 5 Class Documentation 5.1 15
Constructor & Destructor Documentation . . . . . . . . . . . . . 16 5.1.2.1 5.1.2.2 5.1.2.3 FemBase . . . . . . . . . . . . . . . . . . . . . . . . 16 FemBase . . . . . . . . . . . . . . . . . . . . . . . . 16 FemBase . . . . . . . . . . . . . . . . . . . . . . . . 16 . . . . . . . . . . . . . . . . 16
5.1.3
. . . . . . . . . . . . . . . . . . . . . . . 16
operator[] . . . . . . . . . . . . . . . . . . . . . . . . 16
5.2
5.2.3
. . . . . . . . . . . . . . . . . . . . . . . 17
5.3
5.3.3
. . . . . . . . . . . . . . . . . . . . . . . 19
CONTENTS
iii
5.4
5.4.3
5.5
Constructor & Destructor Documentation . . . . . . . . . . . . . 22 5.5.2.1 5.5.2.2 5.5.2.3 Map1d . . . . . . . . . . . . . . . . . . . . . . . . . 22 Map1d . . . . . . . . . . . . . . . . . . . . . . . . . 22 Map1d . . . . . . . . . . . . . . . . . . . . . . . . . 23 . . . . . . . . . . . . . . . . 23
5.5.3
. . . . . . . . . . . . . . . . . . . . . . . 23
5.6
5.6.3
5.7
Constructor & Destructor Documentation . . . . . . . . . . . . . 26 5.7.2.1 5.7.2.2 5.7.2.3 5.7.2.4 Poly Poly Poly Poly . . . . . . . . . . . . . . . . . . . . . . . . . . 26 . . . . . . . . . . . . . . . . . . . . . . . . . . 26 . . . . . . . . . . . . . . . . . . . . . . . . . . 26 . . . . . . . . . . . . . . . . . . . . . . . . . . 26
iv
CONTENTS
5.7.2.5 5.7.3
Poly
. . . . . . . . . . . . . . . . . . . . . . . . . . 26 . . . . . . . . . . . . . . . . 27
Member Function Documentation 5.7.3.1 5.7.3.2 5.7.3.3 5.7.3.4 5.7.3.5 5.7.3.6 5.7.3.7 5.7.3.8 5.7.3.9
a . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 degree . . . . . . . . . . . . . . . . . . . . . . . . . 27 differentiate . . . . . . . . . . . . . . . . . . . . . . 27
integrate . . . . . . . . . . . . . . . . . . . . . . . . 27 operator() . . . . . . . . . . . . . . . . . . . . . . . 27
sine Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 spectral::Tern< T > Class Template Reference 5.9.1 5.9.2 Detailed Description . . . . . . . . . . . . . 29
. . . . . . . . . . . . . . . . . . . . . . . 29
5.9.3
. . . . . . . . . . . . . . . . . . . . . . . 31
CONTENTS
5.11.3.1 getAi . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.11.3.2 getAp . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.11.3.3 getAx . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.11.3.4 getAxG . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.11.3.5 multiply . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.11.3.6 multiply . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.11.3.7 resize . . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.11.3.8 resize_sizeA . . . . . . . . . . . . . . . . . . . . . . 35 5.11.3.9 resize_sizeNZ . . . . . . . . . . . . . . . . . . . . . 35 5.11.3.10 solve . . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.11.3.11 solve . . . . . . . . . . . . . . . . . . . . . . . . . . 36 6 File Documentation 6.1 37
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6.9
vi
CONTENTS
. . . . . . . . . . . . . . . . . . . . . . . . . 42 . . . . . . . . . . . . . . . . . . . . . . . 43
6.14 triangle.hpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . 45 6.14.1 Detailed Description 6.15 typedefs.hpp File Reference 6.15.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 46 . . . . . . . . . . . . . . . . . . . . . . . 46 . . . . . . . . . . . . . . . . . . . . . . . 46
Chapter 1
Namespace Index
1.1 Namespace List
Namespace Index
Chapter 2
Class Index
2.1 Class List
Here are the classes, structs, unions and interfaces with brief descriptions: spectral::FemBase Lagrangian basis for the FEM method . . . spectral::FemIntegrator FEM Integrator . . . . . . . . . . . . . . . spectral::FemMap2d< T > Afne map from and to the reference triangle spectral::FemMesh FEM Mesh . . . . . . . . . . . . . . . . . spectral::Map1d< T > 1d afne map . . . . . . . . . . . . . . . . spectral::Point< T > Point class . . . . . . . . . . . . . . . . . spectral::Poly Polinomial rappresentation class . . . . . . sine . . . . . . . . . . . . . . . . . . . . . . . . . . spectral::Tern< T > Tern class . . . . . . . . . . . . . . . . . . spectral::Triangle Triangle Class . . . . . . . . . . . . . . . . spectral::UMFMatrix Store the UMF matrix . . . . . . . . . . . . . . . . . . . . . . . . . 15 . . . . . . . . . . . . . 17 . . . . . . . . . . . . 18 . . . . . . . . . . . . . 19 . . . . . . . . . . . . . 21 . . . . . . . . . . . . . 23 . . . . . . . . . . . . . 25 . . . . . . . . . . . . . 28 . . . . . . . . . . . . . 29 . . . . . . . . . . . . . 30 . . . . . . . . . . . . . 32
Class Index
Chapter 3
File Index
3.1 File List
Here is a list of all documented les with brief descriptions: fem-base.hpp FemBase class and differential operator . . . . . . . fem-integrator.cpp FEM integrator . . . . . . . . . . . . . . . . . . . . fem-integrator.hpp FEM integrator . . . . . . . . . . . . . . . . . . . . fem-map2d.cpp This le contains the FemMap2d class . . . . . . . . fem-map2d.hpp This le contains the FemMap2d class . . . . . . . . fem-mesh.cpp FEM Mesh . . . . . . . . . . . . . . . . . . . . . . fem-mesh.hpp FEM Mesh . . . . . . . . . . . . . . . . . . . . . . map1d.cpp This le contains the Map1d class . . . . . . . . . . map1d.hpp Map1d class . . . . . . . . . . . . . . . . . . . . . point.hpp Point class . . . . . . . . . . . . . . . . . . . . . . poly.cpp Polynomial class and companion functions denitions poly.hpp An efcient implementation of a polynomial . . . . . tern.hpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . triangle.cpp Triangle class . . . . . . . . . . . . . . . . . . . . . triangle.hpp Triangle class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 . . . . . . . . 38 . . . . . . . . 38 . . . . . . . . 39 . . . . . . . . 39 . . . . . . . . 40 . . . . . . . . 40 . . . . . . . . 41 . . . . . . . . 42 . . . . . . . . 42 . . . . . . . . 43 . . . . . . . . 44 . . . . . . . . ?? . . . . . . . . 45 . . . . . . . . 45
File Index
typedefs.hpp Type Denitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 umfmatrix.cpp This le contains the UMFMatrix class . . . . . . . . . . . . . . . . 46 umfmatrix.hpp This le contains the UMFMatrix class . . . . . . . . . . . . . . . . 47
Chapter 4
Namespace Documentation
4.1 spectral Namespace Reference
Classes
class FemBase
Lagrangian basis for the FEM method.
class FemIntegrator
FEM Integrator.
class FemMap2d
Afne map from and to the reference triangle.
class FemMesh
FEM Mesh.
class Map1d
1d afne map
class Point
Point class.
class Poly
Polinomial rappresentation class.
class Tern
Tern class.
class Triangle
Triangle Class.
class UMFMatrix
Store the UMF matrix.
Enumerations
enum bctype { dirichlet, neumann, mortar, nonmortar }
The enumerator type.
Namespace Documentation
Functions
FemBase _Dx (FemBase const &fb, double weight)
Computes the partial derivatives with respect to x.
template<> std::ostream & operator<< (std::ostream &strm, FemMap2d< direct > &M) template<> std::ostream & operator<< (std::ostream &strm, FemMap2d< inverse > &M) template<mapping T> std::ostream & operator<< (std::ostream &strm, FemMap2d< T > &M) template<> std::ostream & operator<< (std::ostream &strm, Map1d< direct > const &M) template<> std::ostream & operator<< (std::ostream &strm, Map1d< inverse > const &M) template<mapping T> std::ostream & operator<< (std::ostream &strm, Map1d< T > const &M)
Outputs the mapping in the format [-1,1]-->[x,y] or [x,y]-->[-1,1] depending on the chosen mapping. Note that the [x,y] may not be a proper interval, as it may be x>y. In such case the map is intended to be decreasing.
template<class T > std::ostream & operator<< (std::ostream &strm, Point< T > const &P)
The << operator for the points.
template<class T > std::istream & operator>> (std::istream &strm, Point< T > &P)
The >> operator for the points.
Poly operator (Poly a, double x) Poly operator (double x, Poly a) double newton (Poly const &p, double delta, double eps, double x0, int nmax) double horner (Poly const &p, double delta, double eps, int nmax)
Newton-Horner Method.
template<class T > std::ostream & operator<< (std::ostream &strm, Tern< T > const &P)
The << operator for the Terns.
template<class T > std::istream & operator>> (std::istream &strm, Tern< T > &P)
The >> operator for the Terns.
4.1.1
Detailed Description
4.1.2
4.1.2.1
The enumerator type. This is an enumeration used for the boundary conditions.
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
10
Namespace Documentation
4.1.2.2
enum spectral::cut_type
Cut Type. This is used to distinguish the two ways that we have to split a given domain in two subdomains with the same rectangular shape.
4.1.2.3
enum spectral::mapping
Mapping Type. This is used to distinguish the direct afne map with the inverse map.
4.1.2.4
enum spectral::triatype
The Triangle Type. This is used to store the Triangle orientation: up or down. Please remember that a Triangle is always supposed to be rectangular and parallel to the axes.
4.1.3
Function Documentation
4.1.3.1 FemBase spectral::_Dx ( FemBase const & fb, double weight ) Computes the partial derivatives with respect to x. The weight coefcient is used as a moltiplicative coefcient for the derivatives. This is used to keep in account the afne map between the reference element and the sical domain and to make the derivatives on the sical domain. This function is not intended for the use of the nal user, use FemMesh.Dx instead. See also FemMesh::Dx
4.1.3.2 FemBase spectral::_Dy ( FemBase const & fb, double weight ) Computes the partial derivatives with respect to y. The weight coefcient is used as a moltiplicative coefcient for the derivatives. This is used to keep in account the afne map between the reference element and the sical domain and to make the derivatives on the sical domain. This function is not intended for the use of the nal user, use FemMesh.Dy instead. See also FemMesh::Dy
11
4.1.3.3
1d integration using the Cavalieri Simpson formula This is to be used for 1d integrations with FEM.
4.1.3.4
Horner deaction. Given a root r of a polynomial p this function returns the deacted polynomial q
4.1.3.5
double spectral::horner ( Poly const & p, double delta, double eps, int nmax )
Newton-Horner Method. Computes all the roots of a given polynomial using the Newton-Horner Method. The roots are supposed to be all __real__!
4.1.3.6
Legendre polynomial generator. Computes the Legendre polynomial of degree degree over the reference interval [-1,1]. The given polynomial should be initializated with the correct degree:
int n=10; Poly L(n); legendre(L);
4.1.3.7
double spectral::newton ( Poly const & p, double delta, double eps, double xnew, int nmax )
4.1.3.8
Overloaded operator . Please note that the operator is overloaded only for the multiplication between a FemBase and a double not for the multiplication of two FemBase objects
4.1.3.9
Overloaded operator .
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
12
Namespace Documentation
Please note that the operator is overloaded only for the multiplication between a FemBase and a double not for the multiplication of two FemBase objects
4.1.3.10 Poly spectral::operator ( Poly a, double x ) operator overloaded for the multiplication with a double
4.1.3.11 Poly spectral::operator ( double x, Poly a ) operator overloaded for the multiplication with a double
4.1.3.13
template<class T > std::ostream & spectral::operator<< ( std::ostream & strm, Tern< T > const & P )
The << operator for the Terns. This is used to print Terns in an human readable manner
4.1.3.14
template<class T > std::ostream & spectral::operator<< ( std::ostream & strm, Point< T > const & P )
The << operator for the points. This is used to print points in an human readable manner
4.1.3.15
4.1.3.16
template<class T > std::istream & spectral::operator>> ( std::istream & strm, Tern< T > & P )
The >> operator for the Terns. It prints one after another the three elements of the tern.
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
13
4.1.3.17
template<class T > std::istream & spectral::operator>> ( std::istream & strm, Point< T > & P )
so the x-coordinate is the rst written, while the y-one is the second.
4.1.3.18
Overloaded >> operator. This is used to ll the polynomial coefcients with the input stream of numbers stranting from the lower orders monomials. Excessive input is thrown away withtout any check.
14
Namespace Documentation
Chapter 5
Class Documentation
5.1 spectral::FemBase Class Reference
#include <fem-base.hpp>
16
Class Documentation
Friends
FemBase _Dx (FemBase const &, double) FemBase _Dy (FemBase const &, double)
5.1.1
Detailed Description
Lagrangian basis for the FEM method. This class represents the Lagrangian basis for the FEM method. This is a functor. The element is: = cxx + cyy + cc the three coefcients are stored as double.
5.1.2
5.1.2.2 spectral::FemBase::FemBase ( int vertex ) Standard constructor for the basis. This will create the element associated with the vertex number vertex. The numaration for the vertex of the reference triangle starts from 0 and goes on in anticlockwise manner.
5.1.2.3 spectral::FemBase::FemBase ( double cx, double cy, double cc ) Full constructor. Build a FemBase element using the given coefcients
5.1.3
5.1.3.1
5.1.3.2
Direct access to the coefcients. The numeration of the coefcients starts from 0, and the rst coefcient is cx, followed by cy and cc
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
17
The documentation for this class was generated from the following les: fem-base.hpp fem-base.cpp
5.2
FEM Integrator.
#include <fem-integrator.hpp>
template<class T > double operator() (T const &f, Triangle const &tria) const
The Integrate Function.
template<> double operator() (int const &f, Triangle const &tria) const template<> double operator() (double const &f, Triangle const &tria) const
5.2.1
Detailed Description
FEM Integrator. This implements the 7-point quadrature formula on the reference triangle.
5.2.2
5.2.2.1
The Constructor. Stores in 3 C-style arrays the nodes coordinates and the weights for quadrature of order ord between 1 and 5. If ord is not between 1 and 5, degree 3 is chosen but a warning is printed)
5.2.3
5.2.3.1
18
Class Documentation
The template argument f can be one of the following: 1) a functor whose operator() has signature: double operator() (double,double) 2) a pointer to a function with signature: double fun(double,double) 3) a double or integer constant The documentation for this class was generated from the following les: fem-integrator.hpp fem-integrator.cpp
5.3
#include <fem-map2d.hpp>
template<> Point< double > operator() (double xhat, double yhat) const template<> Point< double > operator() (double x, double y) const
Friends
std::ostream & operator<< (std::ostream &strm, FemMap2d< T > &M)
5.3.1
Detailed Description
template<mapping T>class spectral::FemMap2d< T > Afne map from and to the reference triangle. The direct map maps the reference triangle into the given one, while the inverse map maps a given triangle into the reference one.
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
19
5.3.2
5.3.2.1
The default constructor. This will build an identity map on the reference triangle. (Almost useless... :D )
5.3.2.2
5.3.3
5.3.3.1
Overloaded () operator. Evaluates the mapping in the point (x,y). The documentation for this class was generated from the following le: fem-map2d.hpp
5.4
FEM Mesh.
#include <fem-mesh.hpp>
FemMesh ()
FemMesh destructor.
20
Class Documentation
int getNumTriangles () const void getTriangle (int elemnum, Triangle &tria) const
Get the element number elemnum.
void getBoundaryEdge (int edgenum, Point< double > &A, Point< double > &B, bctype &bc) const void getBordElements (int border, std::vector< int > &elements) const
Elements with at least one vertex on the border.
void getBordVertexes (int border, int elemnum, std::vector< int > &vertexes) const
Vertexes on the border of an element.
void save_to_le (std::valarray< double > const &vec, char const lename) const
Writes the given array in the given le.
5.4.1
Detailed Description
FEM Mesh. Methods and data for the Finite Element Method
5.4.2
5.4.2.1 spectral::FemMesh::FemMesh ( bctype b0, bctype b1, bctype b2, bctype b3, Point< double > const & A = Point<double>(0,0), Point< double > const & B = Point<double>(1,1), double area = -1 ) FemMesh constructor. This will build a triangular mesh on a rectangular domain restricted between points A (south-west) and B (north-east), where BC types are given in the following order ____2____ | B| 3 | |1 |A________| 0
5.4.2.2 spectral::FemMesh::FemMesh ( FemMesh const & mesh ) FemMesh copy constructor. This will copy a triangular mesh on a rectangular domain restricted between points A (south-west) and B (north-east)
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
21
5.4.3
5.4.3.1
Elements with at least one vertex on the border. This method will store the list of the elements with at least one vertex on the border border . The convenction for the border is:
2 -----------------------| | | | 3 | | | | |______________________| 0
5.4.3.2
void spectral::FemMesh::getBordVertexes ( int border, int elemnum, std::vector< int > & vertexes ) const
Vertexes on the border of an element. This method will store the list of vertexes on the border border . The convenction for the border is the same of the FemMesh::getBordElements function. The vertex number are in the local numeration.
5.4.3.3
Get the element number elemnum. tria will be overwritten and will contain the data of the FEM element elemnum
5.4.3.4
void spectral::FemMesh::save_to_le ( std::valarray< double > const & vec, char const lename ) const
Writes the given array in the given le. The output le format is an ASCII formatted to be used with the GNUPLOT plotting function "splot". Consult the GNUPLOT manual for more informations about this format. The documentation for this class was generated from the following les: fem-mesh.hpp fem-mesh.cpp
5.5
1d afne map
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
22
Class Documentation
#include <map1d.hpp>
Map1d ()
The default constructor.
template<> double operator() (double z) const template<> double operator() (double z) const
Friends
std::ostream & operator<< (std::ostream &strm, Map1d< T > const &M)
5.5.1
Detailed Description
template<mapping T>class spectral::Map1d< T > 1d afne map This class is to be used to map a given interval from and to [-1,1]. The direct map maps [-1,1] into [x,y], while the inverse [x,y] into [-1,1]. It is possible that y<x.
5.5.2
5.5.2.1
5.5.2.2
23
5.5.2.3
5.5.3
5.5.3.1
[inline]
The overloaded operator (). Computes (z). The documentation for this class was generated from the following le: map1d.hpp
5.6
Point class.
#include <point.hpp>
void move (T a, T b)
Moves the point to a new position.
void ptplus (T a)
Adds a to the coordinates of the point.
24
Class Documentation
5.6.1
Detailed Description
template<class T>class spectral::Point< T > Point class. This simple class is just an implementation of a point in a bidimensional manifold.
5.6.2
5.6.2.1
5.6.2.2
Point copy constructor. This is used to let a Point to be initializated as equal to another Point
5.6.3
5.6.3.1
5.6.3.2
Point coordinate. Returns a reference to the n-sim coordinate of the point. If P is a Point than P[n] can be a left member.
5.6.3.3
Point coordinate. Returns the n-sim coordinate of the point. The documentation for this class was generated from the following le: point.hpp
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
25
5.7
#include <poly.hpp>
void setdegree ()
Computes the new degree of the polynomial.
26
Class Documentation
Friends
std::ostream & operator<< (std::ostream &strm, Poly P) std::istream & operator>> (std::istream &strm, Poly &P)
5.7.1
Detailed Description
ai xi
5.7.2
5.7.2.1 spectral::Poly::Poly ( ) Default polynomial constructor. This constructor will create a void polynomial of degree "-1"
5.7.2.2 spectral::Poly::Poly ( int const n ) Build an empty polynomial. This constructor will initializate a zero polynomial with degree n. WARNING: as this will build an empty polynomial with a degree which is nonzero, working with this polynomial if the coefcients are not re-assigned could lead to strange behaviour
5.7.2.3 spectral::Poly::Poly ( double const & x ) Convert a double to a polynomial. This constructor is used to convert a number into a polynomial. This is usefull if we want to sum or multiply a double to a polynomial.
5.7.2.4 spectral::Poly::Poly ( Poly const & p ) Poly copy constructor. This is the copy constructor for Poly
5.7.2.5 spectral::Poly::Poly ( double const const & coefcients, int degree ) Build a polynomial with given coefcients. This constructor will create a polynomial of degree degree : p(x) = ai xi where i goes from 0 to degree and ai = coefcients[i] .
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
27
5.7.3
5.7.3.1
5.7.3.2
Returns the degree of the polynomial. The degree will be 0 for the constants and -1 for the void polynomial. This is an inline function.
5.7.3.3
Calculate the derivate of the polynomial. This function outputs a new polinomial b(x) such that: b(x) = dx
d p(x)
5.7.3.4
Calculate the integral of the polynomial on a given intervall (a,b) This method does not call the primitive and evaluate method and will not instanziate a new polynomial object so if should be preferred over a joint use of the evaluate and primitive methods for efciency reasons.
5.7.3.5
Evaluate the polynomial in x. This function uses the Horner method to evaluate the polynomial. This method has linear complexity and doesnt evaluate any power of x so it is very fast!
5.7.3.6
Sum and assignment operator. Please notice that if a(x) Pn and b(x) Pm doing a+=b or b+=a will not have the same complexity since if n > m b+=a will require to create a temoporary vector of coefcients
5.7.3.7
28
Class Documentation
This is designed to reuse the code from the sum and assignment operator without the need to build a new polynomial -this
5.7.3.8
Returns an . Please notice that this will return a reference to an so the instruction p[3]=2; will be valid. For this reason the use of the const function .a is prefferred where possible.
5.7.3.9 Poly spectral::Poly::primitive ( ) const Calculate the primitive of the polynomial. This function outputs a new polinomial b(x) such that: trary constant in b(x) is 0.
db(x) dx
5.7.3.10
Change the degree of the polynomial. Warning. This will nuke the polynomial coefcients! This will change the degree of the polynomial to n. A new vector of coefcients is reserved in memory. The old one is deleted!
5.7.3.11
void spectral::Poly::setdegree ( )
Computes the new degree of the polynomial. This will compute the new degree of the polynomial if the coefcients of the highest degree monomials are zero. The documentation for this class was generated from the following les: poly.hpp poly.cpp
5.8
29
5.9
Tern class.
#include <tern.hpp>
5.9.1
Detailed Description
template<class T>class spectral::Tern< T > Tern class. This simple class is just an implementation of a Tern in a bidimensional manifold.
5.9.2
5.9.2.1
5.9.2.2
Tern copy constructor. This is used to let a Tern to be initializated as equal to another Tern
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
30
Class Documentation
5.9.3
5.9.3.1
Tern coordinate. Returns the value of the n-th element of the Tern.
5.9.3.2
Tern element access. Returns a reference to the n-th element of the Tern. If P is a Tern than P[n] can be a left member.
5.9.3.3
Tern element value. Returns the value of the n-th element of the Tern. The documentation for this class was generated from the following le: tern.hpp
5.10
Triangle Class.
#include <triangle.hpp>
31
5.10.1
Detailed Description
Triangle Class. A basic implementation of a triangle. The convention for the triangle type and the ordering of the vertex is the following:
Notation 2 | \ | \ | \ | \ | \ 0 ---- 1 up 1 ---\ \ \ \ \ 2 down 0 | | | | |
5.10.2
5.10.2.1 spectral::Triangle::Triangle ( ) Default Constructor. This will create the reference triangle: A = (0,0) B = (1,0) C = (0,1)
5.10.2.2 spectral::Triangle::Triangle ( Point< double > VP[3] ) Standard Constructor. The triangle will be initialized given the vertexes point. Enumeration is from smaller values of x to larger and from smaller y to larger The triangle is "up" if its pointing up else its down. The triangle is supposed to be rectangular and aligned with the axes.
5.10.3
5.10.3.1
operator()
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
32
Class Documentation
5.10.3.2 Point< double > & spectral::Triangle::operator[ ] ( int n ) Returns a reference to the n-th vertex. This is used to modify the Triangle vertex The documentation for this class was generated from the following les: triangle.hpp triangle.cpp
5.11
#include <umfmatrix.hpp>
void solve (std::valarray< double > const &b, std::valarray< double > &u) const
Solve the problem.
33
void multiply (std::valarray< double > const &in, std::valarray< double > &out) const
Multiply a vector for the matrix.
void factorize ()
Factorizes the matrix.
void ush ()
Copies the element of Ax in AxG.
void clean ()
Clean UMFPACK data.
5.11.1
Detailed Description
Store the UMF matrix. CSR (Compact Sparse Row) Matrix format and UMFPACK wrappers
5.11.2
5.11.2.1 spectral::UMFMatrix::UMFMatrix ( int sizeA, int sizeNZ ) The UMFMatrix class constructor. Parameters sizeA Matrix dimension sizeNZ Number of non zero elements
5.11.2.2 spectral::UMFMatrix::UMFMatrix ( UMFMatrix const & oldUMFMatrix ) The UMFMatrix class copy constructor. Parameters Class to be copied
34
Class Documentation
5.11.3
5.11.3.1
Get the element of Ai. Parameters idxpos The index of the element
5.11.3.2
Get the element of Ap. Parameters idxpos The index of the element
5.11.3.3
Get the element of Ax. Parameters idxpos The index of the element
5.11.3.4
Get the element of AxG. Parameters idxpos The index of the element
5.11.3.5
void spectral::UMFMatrix::multiply ( std::valarray< double > const & in, std::valarray< double > & out ) const
Multiply a vector for the matrix. Parameters in The vector that will be multiplied out The solution
5.11 spectral::UMFMatrix Class Reference void spectral::UMFMatrix::multiply ( double const V, double AV ) const
35
5.11.3.6
Multiply a vector for the matrix. Parameters V The vector that will be moltiply AV The solution
5.11.3.7
Resize the problem. Parameters sizeAnew The size of the new problem sizeNZnew The number of non zero elements of the problem
5.11.3.8
Resize the dimension of the problem. Parameters sizeAnew The size of the new problem
5.11.3.9
Resize the number of non zero elements of the problem. Parameters sizeNZnew The number of non zero elements of the problem
5.11.3.10
void spectral::UMFMatrix::solve ( std::valarray< double > const & b, std::valarray< double > & u ) const
Solve the problem. Parameters b The known term vector u The solution vector
36
5.11.3.11
Solve the problem. Parameters b The known term vector x The solution vector
The documentation for this class was generated from the following les: umfmatrix.hpp umfmatrix.cpp
Chapter 6
File Documentation
6.1 fem-base.hpp File Reference
Classes
class spectral::FemBase
Lagrangian basis for the FEM method.
Namespaces
namespace spectral
Functions
FemBase spectral::_Dx (FemBase const &fb, double weight)
Computes the partial derivatives with respect to x.
File Documentation
6.1.1
Detailed Description
FemBase class and differential operator. This le contains the denition of the FemBase class and of the differential operators x and y
6.2
FEM integrator.
#include "fem-integrator.hpp"
Namespaces
namespace spectral
6.2.1
Detailed Description
FEM integrator. This le contains the implementation of the class FemIntegrator which is used for the FEM method.
6.3
FEM integrator.
Classes
class spectral::FemIntegrator
FEM Integrator.
Namespaces
namespace spectral
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
39
Functions
template<class T > double spectral::cavalieri_simpson (T const &f, double x, double y)
1d integration using the Cavalieri Simpson formula
6.3.1
Detailed Description
FEM integrator. This le contains the class FemIntegrator which is used for the FEM method.
6.4
#include "fem-map2d.hpp"
Namespaces
namespace spectral
Functions
template<> std::ostream & spectral::operator<< (std::ostream &strm, FemMap2d< direct > &M) template<> std::ostream & spectral::operator<< (std::ostream &strm, FemMap2d< inverse > &M)
6.4.1
Detailed Description
This le contains the FemMap2d class. This le contains the specializations of the operator() for the direct and the inverse map
6.5
#include "triangle.hpp"
#include
40
File Documentation
Classes
class spectral::FemMap2d< T >
Afne map from and to the reference triangle.
Namespaces
namespace spectral
Functions
template<mapping T> std::ostream & spectral::operator<< (std::ostream &strm, FemMap2d< T > &M)
6.5.1
Detailed Description
This le contains the FemMap2d class. This class is to be used to reppresent the afne transformation between the reference triangle and a given triangle in the FEM mesh.
6.6
FEM Mesh.
#include <fstream> #include <sstream> #include <string> #include <cstdlib> #include <cassert> #include "fem-mesh.hpp"
Namespaces
namespace spectral
6.6.1
Detailed Description
FEM Mesh. This le contains the basic geometric classes for the FEM method: Triangle and Mesh
6.7
FEM Mesh.
#include <fstream> #include <valarray> #include <vector> #include <utility> #include "fem-integrator.hpp" #include
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
41
#include "triangle.-
Classes
class spectral::FemMesh
FEM Mesh.
Namespaces
namespace spectral
6.7.1
Detailed Description
6.8
#include "map1d.hpp"
Namespaces
namespace spectral
Functions
template<> std::ostream & spectral::operator<< (std::ostream &strm, Map1d< direct > const &M) template<> std::ostream & spectral::operator<< (std::ostream &strm, Map1d< inverse > const &M)
6.8.1
Detailed Description
This le contains the Map1d class. This le contains the specializations of the operator() for the direct and the inverse map
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
42
File Documentation
6.9
Map1d class.
Classes
class spectral::Map1d< T >
1d afne map
Namespaces
namespace spectral
Functions
template<mapping T> std::ostream & spectral::operator<< (std::ostream &strm, Map1d< T > const &M)
Outputs the mapping in the format [-1,1]-->[x,y] or [x,y]-->[-1,1] depending on the chosen mapping. Note that the [x,y] may not be a proper interval, as it may be x>y. In such case the map is intended to be decreasing.
6.9.1
Detailed Description
6.10
Point class.
Classes
class spectral::Point< T >
Point class.
Namespaces
namespace spectral
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
43
Functions
template<class T > std::ostream & spectral::operator<< (std::ostream &strm, Point< T > const &P)
The << operator for the points. template<class T > std::istream & spectral::operator>> (std::istream &strm, Point< T > &P) The >> operator for the points.
6.10.1
Detailed Description
Point class. This simple class is just an implementation of a point in a bidimensional manifold.
6.11
Namespaces
namespace spectral
Functions
Poly spectral::deate (Poly const &p, double const &r)
Horner deaction.
Poly spectral::operator (Poly a, double x) Poly spectral::operator (double x, Poly a) double spectral::newton (Poly const &p, double delta, double eps, double x0, int nmax) double spectral::horner (Poly const &p, double delta, double eps, int nmax)
Newton-Horner Method.
44
File Documentation
6.11.1
Detailed Description
6.12
Classes
class spectral::Poly
Polinomial rappresentation class.
Namespaces
namespace spectral
Functions
Poly spectral::deate (Poly const &p, double const &r)
Horner deaction.
Poly spectral::operator (Poly a, double x) Poly spectral::operator (double x, Poly a) double spectral::newton (Poly const &p, double delta, double eps, double x0, int nmax) double spectral::horner (Poly const &p, double delta, double eps, int nmax)
Newton-Horner Method.
45
6.12.1
Detailed Description
An efcient implementation of a polynomial. This class include usefull and fast methods to evaluate polynomial, nd polynomial roots, differentiate, integrate, data tting and interpolation.
6.13
Triangle class.
Namespaces
namespace spectral
6.13.1
Detailed Description
6.14
Triangle class.
Classes
class spectral::Triangle
Triangle Class.
Namespaces
namespace spectral
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen
46
File Documentation
6.14.1
Detailed Description
6.15
Type Denitions.
Namespaces
namespace spectral
Enumerations
enum spectral::bctype { dirichlet, neumann, mortar, nonmortar }
The enumerator type.
6.15.1
Detailed Description
Type Denitions.
6.16
Namespaces
namespace spectral
6.16.1
Detailed Description
47
6.17
#include <valarray>
Classes
class spectral::UMFMatrix
Store the UMF matrix.
Namespaces
namespace spectral
6.17.1
Detailed Description
This le contains the UMFMatrix class. This le contains the UMFMatrix class