Refman

Download as pdf or txt
Download as pdf or txt
You are on page 1of 55

TestSpectral

0.0.0

Generated by Doxygen 1.7.6.1


Tue Aug 7 2012 22:05:08

Contents

Namespace Index 1.1 Namespace List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1 1 3 3 5 5 7 7 9 9 9

Class Index 2.1 Class List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

File Index 3.1 File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Namespace Documentation 4.1 spectral Namespace Reference . . . . . . . . . . . . . . . . . . . . . . 4.1.1 4.1.2 Detailed Description . . . . . . . . . . . . . . . . . . . . . . .

Enumeration Type Documentation . . . . . . . . . . . . . . . . 4.1.2.1 4.1.2.2 4.1.2.3 4.1.2.4 bctype . . . . . . . . . . . . . . . . . . . . . . . . .

cut_type . . . . . . . . . . . . . . . . . . . . . . . . 10 mapping . . . . . . . . . . . . . . . . . . . . . . . . 10 triatype . . . . . . . . . . . . . . . . . . . . . . . . . 10

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

spectral::FemBase Class Reference . . . . . . . . . . . . . . . . . . . 15 5.1.1 5.1.2 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 16

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

Member Function Documentation 5.1.3.1 5.1.3.2 operator()

. . . . . . . . . . . . . . . . . . . . . . . 16

operator[] . . . . . . . . . . . . . . . . . . . . . . . . 16

5.2

spectral::FemIntegrator Class Reference . . . . . . . . . . . . . . . . . 17 5.2.1 5.2.2 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 17

Constructor & Destructor Documentation . . . . . . . . . . . . . 17 5.2.2.1 FemIntegrator . . . . . . . . . . . . . . . . . . . . . 17 . . . . . . . . . . . . . . . . 17

5.2.3

Member Function Documentation 5.2.3.1 operator()

. . . . . . . . . . . . . . . . . . . . . . . 17

5.3

spectral::FemMap2d< T > Class Template Reference . . . . . . . . . . 18 5.3.1 5.3.2 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 18

Constructor & Destructor Documentation . . . . . . . . . . . . . 19 5.3.2.1 5.3.2.2 FemMap2d . . . . . . . . . . . . . . . . . . . . . . . 19 FemMap2d . . . . . . . . . . . . . . . . . . . . . . . 19 . . . . . . . . . . . . . . . . 19

5.3.3

Member Function Documentation 5.3.3.1 operator()

. . . . . . . . . . . . . . . . . . . . . . . 19

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

CONTENTS

iii

5.4

spectral::FemMesh Class Reference . . . . . . . . . . . . . . . . . . . 19 5.4.1 5.4.2 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 20

Constructor & Destructor Documentation . . . . . . . . . . . . . 20 5.4.2.1 5.4.2.2 FemMesh FemMesh . . . . . . . . . . . . . . . . . . . . . . . 20 . . . . . . . . . . . . . . . . . . . . . . . 20 . . . . . . . . . . . . . . . . 21

5.4.3

Member Function Documentation 5.4.3.1 5.4.3.2 5.4.3.3 5.4.3.4

getBordElements . . . . . . . . . . . . . . . . . . . . 21 getBordVertexes . . . . . . . . . . . . . . . . . . . . 21 getTriangle . . . . . . . . . . . . . . . . . . . . . . . 21 save_to_le . . . . . . . . . . . . . . . . . . . . . . 21

5.5

spectral::Map1d< T > Class Template Reference . . . . . . . . . . . . 21 5.5.1 5.5.2 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 22

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

Member Function Documentation 5.5.3.1 operator()

. . . . . . . . . . . . . . . . . . . . . . . 23

5.6

spectral::Point< T > Class Template Reference . . . . . . . . . . . . . 23 5.6.1 5.6.2 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 24

Constructor & Destructor Documentation . . . . . . . . . . . . . 24 5.6.2.1 5.6.2.2 Point . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Point . . . . . . . . . . . . . . . . . . . . . . . . . . 24 . . . . . . . . . . . . . . . . 24

5.6.3

Member Function Documentation 5.6.3.1 5.6.3.2 5.6.3.3

get . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 operator[] . . . . . . . . . . . . . . . . . . . . . . . . 24 operator[] . . . . . . . . . . . . . . . . . . . . . . . . 24

5.7

spectral::Poly Class Reference . . . . . . . . . . . . . . . . . . . . . . 25 5.7.1 5.7.2 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 26

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

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

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

operator+= . . . . . . . . . . . . . . . . . . . . . . . 27 operator-= . . . . . . . . . . . . . . . . . . . . . . . 27 operator[] . . . . . . . . . . . . . . . . . . . . . . . . 28 primitive . . . . . . . . . . . . . . . . . . . . . . . . 28 . . . . . . . . . . . . . . . . . . . . . . . 28 . . . . . . . . . . . . . . . . . . . . . . . 28

5.7.3.10 setdegree 5.7.3.11 setdegree 5.8 5.9

sine Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 spectral::Tern< T > Class Template Reference 5.9.1 5.9.2 Detailed Description . . . . . . . . . . . . . 29

. . . . . . . . . . . . . . . . . . . . . . . 29

Constructor & Destructor Documentation . . . . . . . . . . . . . 29 5.9.2.1 5.9.2.2 Tern . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Tern . . . . . . . . . . . . . . . . . . . . . . . . . . 29 . . . . . . . . . . . . . . . . 30

5.9.3

Member Function Documentation 5.9.3.1 5.9.3.2 5.9.3.3

get . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 operator[] . . . . . . . . . . . . . . . . . . . . . . . . 30 operator[] . . . . . . . . . . . . . . . . . . . . . . . . 30

5.10 spectral::Triangle Class Reference . . . . . . . . . . . . . . . . . . . . 30 5.10.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 31

5.10.2 Constructor & Destructor Documentation . . . . . . . . . . . . . 31 5.10.2.1 Triangle 5.10.2.2 Triangle . . . . . . . . . . . . . . . . . . . . . . . . 31 . . . . . . . . . . . . . . . . . . . . . . . . 31 . . . . . . . . . . . . . . . . 31

5.10.3 Member Function Documentation 5.10.3.1 operator()

. . . . . . . . . . . . . . . . . . . . . . . 31

5.10.3.2 operator[] . . . . . . . . . . . . . . . . . . . . . . . . 32 5.11 spectral::UMFMatrix Class Reference . . . . . . . . . . . . . . . . . . . 32 5.11.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 33

5.11.2 Constructor & Destructor Documentation . . . . . . . . . . . . . 33


Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

CONTENTS

5.11.2.1 UMFMatrix . . . . . . . . . . . . . . . . . . . . . . . 33 5.11.2.2 UMFMatrix . . . . . . . . . . . . . . . . . . . . . . . 33 5.11.3 Member Function Documentation . . . . . . . . . . . . . . . . 34

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

fem-base.hpp File Reference . . . . . . . . . . . . . . . . . . . . . . . 37 6.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 38

6.2

fem-integrator.cpp File Reference . . . . . . . . . . . . . . . . . . . . . 38 6.2.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 38

6.3

fem-integrator.hpp File Reference . . . . . . . . . . . . . . . . . . . . . 38 6.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 39

6.4

fem-map2d.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . 39 6.4.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 39

6.5

fem-map2d.hpp File Reference . . . . . . . . . . . . . . . . . . . . . . 39 6.5.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 40

6.6

fem-mesh.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . 40 6.6.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 40

6.7

fem-mesh.hpp File Reference . . . . . . . . . . . . . . . . . . . . . . . 40 6.7.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 41 . . . . . . . . . . . . . . . . . . . . . . . . 41 . . . . . . . . . . . . . . . . . . . . . . . 41

6.8

map1d.cpp File Reference 6.8.1 Detailed Description

6.9

map1d.hpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . 42 6.9.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 42

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

vi

CONTENTS

6.10 point.hpp File Reference

. . . . . . . . . . . . . . . . . . . . . . . . . 42 . . . . . . . . . . . . . . . . . . . . . . . 43

6.10.1 Detailed Description

6.11 poly.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . 43 6.11.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 44

6.12 poly.hpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . 44 6.12.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 45

6.13 triangle.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . 45 6.13.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 45

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

6.16 umfmatrix.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . 46 6.16.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 46

6.17 umfmatrix.hpp File Reference . . . . . . . . . . . . . . . . . . . . . . . 47 6.17.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . 47

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

Chapter 1

Namespace Index
1.1 Namespace List

Here is a list of all documented namespaces with brief descriptions: spectral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Namespace Index

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

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

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

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

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

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

enum triatype { up, down }


The Triangle Type.

enum mapping { direct, inverse }


Mapping Type.

enum cut_type { horizontal, vertical }


Cut Type.

Functions
FemBase _Dx (FemBase const &fb, double weight)
Computes the partial derivatives with respect to x.

FemBase _Dy (FemBase const &fb, double weight)


Computes the partial derivatives with respect to y.

FemBase operator+ (FemBase a, FemBase b)


Overloaded operator binary +.

FemBase operator- (FemBase a)


Overloaded operator unary -.

FemBase operator- (FemBase a, FemBase b)


Overloaded operator binary -.

FemBase operator (FemBase a, double x)


Overloaded operator . FemBase operator (double x, FemBase a) Overloaded operator . template<class T > double cavalieri_simpson (T const &f, double x, double y) 1d integration using the Cavalieri Simpson formula

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.

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

4.1 spectral Namespace Reference

template<class T > std::istream & operator>> (std::istream &strm, Point< T > &P)
The >> operator for the points.

Poly deate (Poly const &p, double const &r)


Horner deaction.

Poly operator- (Poly p)


Unary Minus.

Poly operator+ (Poly a, Poly b)


Sum Operator.

Poly operator- (Poly a, Poly b)


Returns a-b.

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.

void legendre (Poly &L)


Legendre polynomial generator.

std::ostream & operator<< (std::ostream &strm, Poly P)


Overloaded << operator.

std::istream & operator>> (std::istream &strm, Poly &P)


Overloaded >> operator.

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

A number which is less then MPI_SPECTRAL_POLYEPS is zero for us.

4.1.2
4.1.2.1

Enumeration Type Documentation


enum spectral::bctype

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

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

4.1 spectral Namespace Reference

11

4.1.3.3

template<class T > double spectral::cavalieri_simpson ( T const & f, double x, double y )

1d integration using the Cavalieri Simpson formula This is to be used for 1d integrations with FEM.

4.1.3.4

Poly spectral::deate ( Poly const & p, double const & r )

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

void spectral::legendre ( Poly & L )

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);

Will make L a Legendre polynomial of degree 10.

4.1.3.7

double spectral::newton ( Poly const & p, double delta, double eps, double xnew, int nmax )

Newton method for the polynomial

4.1.3.8

FemBase spectral::operator ( FemBase a, double x )

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

FemBase spectral::operator ( double x, FemBase a )

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.12 Poly spectral::operator- ( Poly p ) Unary Minus. Returns -p

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

std::ostream & spectral::operator<< ( std::ostream & strm, Poly P )

Overloaded << operator. Used to print Polynomials

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

4.1 spectral Namespace Reference

13

4.1.3.17

template<class T > std::istream & spectral::operator>> ( std::istream & strm, Point< T > & P )

The >> operator for the points. It just do:


strm >> P[0] >> P[1]; return strm;

so the x-coordinate is the rst written, while the y-one is the second.

4.1.3.18

std::istream & spectral::operator>> ( std::istream & strm, Poly & P )

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.

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

14

Namespace Documentation

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

Chapter 5

Class Documentation
5.1 spectral::FemBase Class Reference

Lagrangian basis for the FEM method.

#include <fem-base.hpp>

Public Member Functions


FemBase ()
The default constructor.

FemBase (int vertex)


Standard constructor for the basis.

FemBase (double cx, double cy, double cc)


Full constructor.

FemBase (FemBase const &fb)


Copy constructor.

FemBase & operator= (FemBase const &fb)


Overloaded operator =.

double operator() (double xhat, double yhat) const


Overloaded operator ().

double & operator[ ] (int n)


Direct access to the coefcients.

FemBase & operator+= (FemBase const &phi)


Overloaded operator +=.

FemBase & operator-= (FemBase const &phi)


Overloaded operator -=.

FemBase & operator= (double alpha)


Overloaded operator + for FemBase, scalar product.

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

Constructor & Destructor Documentation

5.1.2.1 spectral::FemBase::FemBase ( ) The default constructor. This creates a zero element.

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

Member Function Documentation


double spectral::FemBase::operator() ( double xhat, double yhat ) const [inline]

Overloaded operator (). Computes in the given point and returns it

5.1.3.2

double & spectral::FemBase::operator[ ] ( int n )

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

5.2 spectral::FemIntegrator Class Reference

17

The documentation for this class was generated from the following les: fem-base.hpp fem-base.cpp

5.2

spectral::FemIntegrator Class Reference

FEM Integrator.

#include <fem-integrator.hpp>

Public Member Functions


FemIntegrator ()
The Constructor.

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

Constructor & Destructor Documentation


spectral::FemIntegrator::FemIntegrator ( )

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

Member Function Documentation


template<class T > double spectral::FemIntegrator::operator() ( T const & f, Triangle const & tria ) const [inline]

The Integrate Function.


Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

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

spectral::FemMap2d< T > Class Template Reference

Afne map from and to the reference triangle.

#include <fem-map2d.hpp>

Public Member Functions


FemMap2d ()
The default constructor.

FemMap2d (Triangle const &triangle)


Standard constructor.

FemMap2d (FemMap2d< T > const &phi)


Copy constructor.

FemMap2d< T > & operator= (FemMap2d< T > const &phi)


Overloaded = operator.

Point< double > operator() (double x, double y) const


Overloaded () operator.

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

5.4 spectral::FemMesh Class Reference

19

5.3.2
5.3.2.1

Constructor & Destructor Documentation


template<mapping T> spectral::FemMap2d< T >::FemMap2d ( )

The default constructor. This will build an identity map on the reference triangle. (Almost useless... :D )

5.3.2.2

template<mapping T> spectral::FemMap2d< T >::FemMap2d ( Triangle const & triangle )

Standard constructor. Builds a map with the given triangle.

5.3.3
5.3.3.1

Member Function Documentation


template<mapping T> Point< double > spectral::FemMap2d< T >::operator() ( double x, double y ) const

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

spectral::FemMesh Class Reference

FEM Mesh.

#include <fem-mesh.hpp>

Public Member Functions


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.

FemMesh (FemMesh const &mesh)


FemMesh copy constructor.

FemMesh ()
FemMesh destructor.

double getTrianglesArea () const int getNumVertexes () const int getNumEdges () const


Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

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.

Point< double > getVertexPosition (int vertexid) const


Returns the coordinates of a given vertex (on the global numaration)

void save_to_le (std::valarray< double > const &vec, char const lename) const
Writes the given array in the given le.

template<class T > double integrate (T F)


Integrates t over the whole domain Integrates a function over the physical domain (FemMesh::restriction is called for every element)

5.4.1

Detailed Description

FEM Mesh. Methods and data for the Finite Element Method

5.4.2

Constructor & Destructor Documentation

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

5.5 spectral::Map1d< T > Class Template Reference

21

5.4.3
5.4.3.1

Member Function Documentation


void spectral::FemMesh::getBordElements ( int border, std::vector< int > & elements ) const

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

void spectral::FemMesh::getTriangle ( int elemnum, Triangle & tria ) const

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

spectral::Map1d< T > Class Template Reference

1d afne map
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

22

Class Documentation

#include <map1d.hpp>

Public Member Functions


Map1d (double x, double y)
The standard constructor.

Map1d (Map1d< T > const &phi)


Copy constructor.

Map1d ()
The default constructor.

double operator() (double z) const


The overloaded operator ().

Map1d< T > & operator= (Map1d< T > const &phi)


Overloaded operator =.

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

Constructor & Destructor Documentation


template<mapping T> spectral::Map1d< T >::Map1d ( double x, double y )

The standard constructor. Nothing special to say about this one

5.5.2.2

template<mapping T> spectral::Map1d< T >::Map1d ( Map1d< T > const & phi )

Copy constructor. This is needed to make this work with Functor


Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

5.6 spectral::Point< T > Class Template Reference

23

5.5.2.3

template<mapping T> spectral::Map1d< T >::Map1d ( )

The default constructor. This will initialize an identity map on [-1,1]

5.5.3
5.5.3.1

Member Function Documentation


template<mapping T> double spectral::Map1d< T >::operator() ( double z ) const

[inline]
The overloaded operator (). Computes (z). The documentation for this class was generated from the following le: map1d.hpp

5.6

spectral::Point< T > Class Template Reference

Point class.

#include <point.hpp>

Public Member Functions


Point ()
Trivial constructor.

Point (T const a, T const b)


Point constructor.

Point (Point< T > const &P)


Point copy constructor.

T & operator[ ] (int n)


Point coordinate.

T operator[ ] (int n) const


Point coordinate.

Point< T > & operator= (Point< T > const &P)


Overloaded operator =.

void move (Point< T > const &P)


Moves the point to a new position.

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.

T get (int n) const


Point coordinate.
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

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

Constructor & Destructor Documentation


template<class T> spectral::Point< T >::Point ( T const a, T const b )

Point constructor. This will build a point given its coordinates

5.6.2.2

template<class T> spectral::Point< T >::Point ( Point< T > const & P )

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

Member Function Documentation


template<class T > T spectral::Point< T >::get ( int n ) const

Point coordinate. Returns the n-sim coordinate of the point.

5.6.3.2

template<class T > T & spectral::Point< T >::operator[ ] ( int n )

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

template<class T > T spectral::Point< T >::operator[ ] ( int n ) const

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

5.7 spectral::Poly Class Reference

25

5.7

spectral::Poly Class Reference

Polinomial rappresentation class.

#include <poly.hpp>

Public Member Functions


Poly ()
Default polynomial constructor.

Poly (int const n)


Build an empty polynomial.

Poly (double const &x)


Convert a double to a polynomial.

Poly (Poly const &p)


Poly copy constructor.

Poly (double const const &coefcients, int degree)


Build a polynomial with given coefcients.

Poly & operator= (Poly const &p)


Copy assignment.

int degree () const


Returns the degree of the polynomial.

double a (int n) const


Returns an . double & operator[ ] (int n) Returns an . void setdegree (int n) Change the degree of the polynomial.

void setdegree ()
Computes the new degree of the polynomial.

double operator() (double x) const


Evaluate the polynomial in x.

Poly differentiate () const


Calculate the derivate of the polynomial.

Poly primitive () const


Calculate the primitive of the polynomial.

double integrate (double const &a, double const &b) const


Calculate the integral of the polynomial on a given intervall (a,b)

Poly & operator+= (Poly const &p)


Sum and assignment operator.

Poly & operator= (double const &alpha)


Multiplication by a scalar.

Poly & operator-= (Poly const &p)


Difference and assignment operator.

bool operator== (Poly const &p) const


true if the two polynomials are equal

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

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

Polinomial rappresentation class. Polynomials are written in the form:


n i=0

ai xi

5.7.2

Constructor & Destructor Documentation

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

5.7 spectral::Poly Class Reference

27

5.7.3
5.7.3.1

Member Function Documentation


double spectral::Poly::a ( int n ) const [inline]

Returns an . This is an inline function.

5.7.3.2

int spectral::Poly::degree ( ) const [inline]

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

Poly spectral::Poly::differentiate ( ) const

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

double spectral::Poly::integrate ( double const & a, double const & b ) const

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

double spectral::Poly::operator() ( double x ) const [inline]

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

Poly & spectral::Poly::operator+= ( Poly const & p )

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

Poly & spectral::Poly::operator-= ( Poly const & p )

Difference and assignment operator.


Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

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

double & spectral::Poly::operator[ ] ( int n ) [inline]

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

= p(x). The chosen arbi-

5.7.3.10

void spectral::Poly::setdegree ( int n )

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

sine Struct Reference

Public Member Functions


double operator() (double x, double y) const The documentation for this struct was generated from the following le: testSpectral.cpp
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

5.9 spectral::Tern< T > Class Template Reference

29

5.9

spectral::Tern< T > Class Template Reference

Tern class.

#include <tern.hpp>

Public Member Functions


Tern ()
Trivial constructor.

Tern (T const a, T const b, T const c)


Tern constructor.

Tern (Tern< T > const &P)


Tern copy constructor.

T & operator[ ] (int n)


Tern element access.

T operator[ ] (int n) const


Tern element value.

Tern< T > & operator= (Tern< T > const &P)


Overloaded operator =.

T get (int n) const


Tern coordinate.

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

Constructor & Destructor Documentation


template<class T > spectral::Tern< T >::Tern ( T const a, T const b, T const c )

Tern constructor. This will build a Tern given its elements

5.9.2.2

template<class T > spectral::Tern< T >::Tern ( Tern< T > const & P )

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

Member Function Documentation


template<class T > T spectral::Tern< T >::get ( int n ) const

Tern coordinate. Returns the value of the n-th element of the Tern.

5.9.3.2

template<class T > T & spectral::Tern< T >::operator[ ] ( int n )

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

template<class T > T spectral::Tern< T >::operator[ ] ( int n ) const

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

spectral::Triangle Class Reference

Triangle Class.

#include <triangle.hpp>

Public Member Functions


Triangle ()
Default Constructor.

Triangle (Point< double > VP[3])


Standard Constructor.

Triangle (Triangle const &triangle)


Copy constructor.

Triangle & operator= (Triangle const &triangle)


operator=

double operator() (int n, int m) const


operator()

triatype mytype () const


Returns the triangle type.

void settype (triatype t)


Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

5.10 spectral::Triangle Class Reference

31

Modies the Triangle type.

Point< double > & operator[ ] (int n)


Returns a reference to the n-th vertex.

double lengthX (void) const


Returns the length of the side parallel with the x-axis.

double lengthY (void) const


Returns the length of the side parallel with the y-axis.

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

Constructor & Destructor Documentation

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

Member Function Documentation


double spectral::Triangle::operator() ( int n, int m ) const

operator()
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

32

Class Documentation

This will return the m-sim coordinate of the n-sim vertex

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

spectral::UMFMatrix Class Reference

Store the UMF matrix.

#include <umfmatrix.hpp>

Public Member Functions


UMFMatrix ()
Default constructor.

UMFMatrix (int sizeA, int sizeNZ)


The UMFMatrix class constructor.

UMFMatrix (UMFMatrix const &)


The UMFMatrix class copy constructor.

void resize_sizeA (int sizeAnew)


Resize the dimension of the problem.

void resize_sizeNZ (int sizeNZnew)


Resize the number of non zero elements of the problem.

void resize (int sizeA, int sizeNZ)


Resize the problem.

void solve (std::valarray< double > const &b, std::valarray< double > &u) const
Solve the problem.

void solve (double const b, double x) const


Solve the problem.

int getsizeA () const


Returns sizeA.

int getsizeNZ () const


Returns sizeNZ.

int & getAp (int idxpos)


Get the element of Ap.

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

5.11 spectral::UMFMatrix Class Reference

33

int & getAi (int idxpos)


Get the element of Ai.

double & getAx (int idxpos)


Get the element of Ax.

double & getAxG (int idxpos)


Get the element of AxG.

void multiply (std::valarray< double > const &in, std::valarray< double > &out) const
Multiply a vector for the matrix.

void multiply (double const V, double AV) const


Multiply a vector for the matrix.

double fullmatrix () const


Copy the UMF matrix in an array of arrays: use only for debugging purposes!

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

Constructor & Destructor Documentation

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

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

34

Class Documentation

5.11.3
5.11.3.1

Member Function Documentation


int & spectral::UMFMatrix::getAi ( int idxpos ) [inline]

Get the element of Ai. Parameters idxpos The index of the element

5.11.3.2

int & spectral::UMFMatrix::getAp ( int idxpos ) [inline]

Get the element of Ap. Parameters idxpos The index of the element

5.11.3.3

double & spectral::UMFMatrix::getAx ( int idxpos ) [inline]

Get the element of Ax. Parameters idxpos The index of the element

5.11.3.4

double & spectral::UMFMatrix::getAxG ( int idxpos ) [inline]

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

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

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

void spectral::UMFMatrix::resize ( int sizeA, int sizeNZ )

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

void spectral::UMFMatrix::resize_sizeA ( int sizeAnew )

Resize the dimension of the problem. Parameters sizeAnew The size of the new problem

5.11.3.9

void spectral::UMFMatrix::resize_sizeNZ ( int sizeNZnew )

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

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

36

Class Documentation void spectral::UMFMatrix::solve ( double const b, double x ) const

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

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

Chapter 6

File Documentation
6.1 fem-base.hpp File Reference

FemBase class and differential operator.

#include <iostream> #include "typedefs.hpp"

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.

FemBase spectral::_Dy (FemBase const &fb, double weight)


Computes the partial derivatives with respect to y.

FemBase spectral::operator+ (FemBase a, FemBase b)


Overloaded operator binary +.

FemBase spectral::operator- (FemBase a)


Overloaded operator unary -.

FemBase spectral::operator- (FemBase a, FemBase b)


Overloaded operator binary -.

FemBase spectral::operator (FemBase a, double x)


Overloaded operator .

38 FemBase spectral::operator (double x, FemBase a)


Overloaded operator .

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.cpp File Reference

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.hpp File Reference

FEM integrator.

#include <cassert> #include "triangle.hpp" #include "fem-map2d.hpp"

Classes
class spectral::FemIntegrator
FEM Integrator.

Namespaces
namespace spectral
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

6.4 fem-map2d.cpp File Reference

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

fem-map2d.cpp File Reference

This le contains the FemMap2d class.

#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

fem-map2d.hpp File Reference

This le contains the FemMap2d class.

#include "point.hpp" "typedefs.hpp"

#include "triangle.hpp"

#include

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

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.cpp File Reference

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.hpp File Reference

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

6.8 map1d.cpp File Reference

41

"point.hpp" #include "typedefs.hpp" hpp" #include "tern.hpp"

#include "triangle.-

Classes
class spectral::FemMesh
FEM Mesh.

Namespaces
namespace spectral

6.7.1

Detailed Description

FEM Mesh. This le contains the FemMesh class

6.8

map1d.cpp File Reference

This le contains the Map1d class.

#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.hpp File Reference

Map1d class.

#include <cassert> #include "typedefs.hpp"

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

Map1d class. This class is to be used to map two unidimensional domains

6.10

point.hpp File Reference

Point class.

#include <cassert> #include <iostream>

Classes
class spectral::Point< T >
Point class.

Namespaces
namespace spectral
Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

6.11 poly.cpp File Reference

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

poly.cpp File Reference

Polynomial class and companion functions denitions.

#include <cassert> #include "poly.hpp" #include <cmath>

Namespaces
namespace spectral

Functions
Poly spectral::deate (Poly const &p, double const &r)
Horner deaction.

Poly spectral::operator- (Poly p)


Unary Minus.

Poly spectral::operator+ (Poly a, Poly b)


Sum Operator.

Poly spectral::operator- (Poly a, Poly b)


Returns a-b.

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.

void spectral::legendre (Poly &L)


Legendre polynomial generator.

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

44

File Documentation

std::ostream & spectral::operator<< (std::ostream &strm, Poly P)


Overloaded << operator. std::istream & spectral::operator>> (std::istream &strm, Poly &P) Overloaded >> operator.

6.11.1

Detailed Description

Polynomial class and companion functions denitions.

6.12

poly.hpp File Reference

An efcient implementation of a polynomial.

#include <iostream> #include "typedefs.hpp"

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 p)


Unary Minus.

Poly spectral::operator+ (Poly a, Poly b)


Sum Operator.

Poly spectral::operator- (Poly a, Poly b)


Returns a-b.

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.

void spectral::legendre (Poly &L)


Legendre polynomial generator.

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

6.13 triangle.cpp File Reference

45

std::ostream & spectral::operator<< (std::ostream &strm, Poly P)


Overloaded << operator.

std::istream & spectral::operator>> (std::istream &strm, Poly &P)


Overloaded >> operator.

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.cpp File Reference

Triangle class.

#include "triangle.hpp" #include <cassert>

Namespaces
namespace spectral

6.13.1

Detailed Description

Triangle class. This le contains the Triangle class

6.14

triangle.hpp File Reference

Triangle class.

#include <cmath> #include "point.hpp" #include "typedefs.hpp"

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

Triangle class. This le contains the Triangle class

6.15

typedefs.hpp File Reference

Type Denitions.

Namespaces
namespace spectral

Enumerations
enum spectral::bctype { dirichlet, neumann, mortar, nonmortar }
The enumerator type.

enum spectral::triatype { up, down }


The Triangle Type.

enum spectral::mapping { direct, inverse }


Mapping Type.

enum spectral::cut_type { horizontal, vertical }


Cut Type.

6.15.1

Detailed Description

Type Denitions.

6.16

umfmatrix.cpp File Reference

This le contains the UMFMatrix class.

#include <cassert> #include <iostream> #include "umfmatrix.hpp"

Namespaces
namespace spectral

6.16.1

Detailed Description

This le contains the UMFMatrix class.


Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

6.17 umfmatrix.hpp File Reference

47

6.17

umfmatrix.hpp File Reference

This le contains the UMFMatrix class.

#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

Generated on Tue Aug 7 2012 22:05:07 for TestSpectral by Doxygen

You might also like