Skip to content
Snippets Groups Projects
Commit 631bde21 authored by Nicolas Marsic's avatar Nicolas Marsic
Browse files

Doc ...

parent 72a47106
No related branches found
No related tags found
No related merge requests found
Showing
with 440 additions and 124 deletions
......@@ -2,13 +2,16 @@
#define _BASIS_H_
/**
@class Basis
@brief Mother class of all Basis
@interface Basis
@brief Common Interface of all Basis
This class is the @em mother (by @em inheritence) of all Basis.@n
This class is the @em common @em interface for all Basis.@n
A Basis is @em set of @em linearly @em independent Polynomial%s
(or Vector%s of Polynomial%s).@n
@note
A Basis is an @em interface, so it @em can't be instanciated
*/
class Basis{
......@@ -52,7 +55,6 @@ class Basis{
//! @li 1 for 1-form
//! @li 2 for 2-form
//! @li 3 for 3-form
//! @todo Check if the 'form numbering' is good
int getType(void) const;
//! @return Returns the @em dimension
......@@ -80,8 +82,10 @@ class Basis{
int getSize(void) const;
protected:
//! @internal
//! Instantiate a new Basis
//! @warning Users can't instantiate a Basis
//!
//! @endinternal
Basis(void);
};
......
......@@ -23,16 +23,16 @@ Basis* BasisGenerator::generate(int elementType,
int basisType,
int order){
switch(elementType){
case TYPE_TRI: return TriGen(basisType, order);
case TYPE_QUA: return QuaGen(basisType, order);
case TYPE_HEX: return HexGen(basisType, order);
case TYPE_TRI: return triGen(basisType, order);
case TYPE_QUA: return quaGen(basisType, order);
case TYPE_HEX: return hexGen(basisType, order);
default: throw Exception("Unknown Element Type (%d) for Basis Generation",
elementType);
}
}
Basis* BasisGenerator::TriGen(int basisType,
Basis* BasisGenerator::triGen(int basisType,
int order){
switch(basisType){
case 0: return new TriNodeBasis(order);
......@@ -47,7 +47,7 @@ Basis* BasisGenerator::TriGen(int basisType,
}
}
Basis* BasisGenerator::QuaGen(int basisType,
Basis* BasisGenerator::quaGen(int basisType,
int order){
switch(basisType){
case 0: return new QuadNodeBasis(order);
......@@ -59,7 +59,7 @@ Basis* BasisGenerator::QuaGen(int basisType,
}
}
Basis* BasisGenerator::HexGen(int basisType,
Basis* BasisGenerator::hexGen(int basisType,
int order){
switch(basisType){
case 0: return new HexNodeBasis(order);
......
......@@ -5,9 +5,14 @@
/**
@class BasisGenerator
@brief A bunch of static method to generate basis
@brief A bunch of class method to generate a Basis
A bunch of static method to generate basis
A BasisGenerator is a bunch of @em class
methods to generate a Basis.
@note
A BasisGenerator got @em only @em class @em methods,
so it is not required to instanciate it.
*/
class BasisGenerator{
......@@ -19,9 +24,98 @@ class BasisGenerator{
int basisType,
int order);
static Basis* TriGen(int basisType, int order);
static Basis* QuaGen(int basisType, int order);
static Basis* HexGen(int basisType, int order);
static Basis* triGen(int basisType, int order);
static Basis* quaGen(int basisType, int order);
static Basis* hexGen(int basisType, int order);
};
/**
@fn BasisGenerator::BasisGenerator
Instantiates a new BasisGenerator
@note
A BasisGenerator got @em only @em class @em methods,
so it is not required to instanciate it.
**
@fn BasisGenerator::~BasisGenerator
Deletes this BasisGenerator
**
@fn BasisGenerator::generate
@param elementType The type of the element,
on which the requested Basis will be created
@param basisType The Basis type
@param order The order or the requested Basis
This method will @em instanciate the requested Basis
@return Returns a @em pointer to a newly
@em instantiated Basis
@note Element types are:
@li @c TYPE_TRI for Triangles
@li @c TYPE_QUA for Quadrangles
@li @c TYPE_HEX for Hexahedrons
@note Basis types are:
@li @c 0 for 0-Form
@li @c 1 for 1-Form
@li @c 2 for 2-Form
@li @c 3 for 3-Form
**
@fn BasisGenerator::triGen
@param basisType The Basis type
@param order The order or the requested Basis
This method will @em instanciate the requested Basis,
with a @em Triangle for support
@return Returns a @em pointer to a newly
@em instantiated Basis
@note Basis types are:
@li @c 0 for 0-Form
@li @c 1 for 1-Form
@li @c 2 for 2-Form
@li @c 3 for 3-Form
**
@fn BasisGenerator::quaGen
@param basisType The Basis type
@param order The order or the requested Basis
This method will @em instanciate the requested Basis,
with a @em Quadrangle for support
@return Returns a @em pointer to a newly
@em instantiated Basis
@note Basis types are:
@li @c 0 for 0-Form
@li @c 1 for 1-Form
@li @c 2 for 2-Form
@li @c 3 for 3-Form
**
@fn BasisGenerator::hexGen
@param basisType The Basis type
@param order The order or the requested Basis
This method will @em instanciate the requested Basis,
with a @em Hexahedron for support
@return Returns a @em pointer to a newly
@em instantiated Basis
@note Basis types are:
@li @c 0 for 0-Form
@li @c 1 for 1-Form
@li @c 2 for 2-Form
@li @c 3 for 3-Form
**
*/
#endif
......@@ -6,12 +6,16 @@
#include "Polynomial.h"
/**
@class BasisScalar
@brief Mother class of all
@em scalar Basis
@interface BasisScalar
@brief Common Interface for all
@em Scalar Basis
This class is the @em mother (by @em inheritence)
of all @em scalar Basis.@n
This class is the @em common @em interface for all
@em scalar Basis.@n
@note
A BasisScalar is an @em interface,
so it @em can't be instanciated
*/
class BasisScalar: public Basis{
......@@ -28,8 +32,10 @@ class BasisScalar: public Basis{
const std::vector<Polynomial>& getFunctions(void) const;
protected:
//! Instantiate a new BasisScalar
//! @warning Users can't instantiate a BasisScalar
//! @internal
//! Instantiates a new BasisScalar
//!
//! @endinternal
BasisScalar(void);
};
......
......@@ -34,7 +34,7 @@ int ain(int argc, char** argv){
// Plot Basis //
HexNodeBasis b(1);
PlotBasis plot(goe, b, writer);
PlotBasis plot(b, goe, writer);
plot.plot("basis");
// Stop Gmsh //
......
......@@ -6,12 +6,16 @@
#include "Polynomial.h"
/**
@class BasisVector
@brief Mother class of all
@em vectorial Basis
@interface BasisVector
@brief Common Interface for all
@em Vectorial Basis
This class is the @em mother (by @em inheritence)
of all @em vectorial Basis.@n
This class is the @em common @em interface for all
@em vectorial Basis.@n
@note
A BasisVector is an @em interface,
so it @em can't be instanciated
*/
class BasisVector: public Basis{
......@@ -28,8 +32,10 @@ class BasisVector: public Basis{
const std::vector<std::vector<Polynomial> >& getFunctions(void) const;
protected:
//! @internal
//! Instantiate a new BasisVector
//! @warning Users can't instantiate a BasisVector
//!
//! @endinternal
BasisVector(void);
};
......
......@@ -139,75 +139,3 @@ int FunctionSpace::getElementType(const Dof& dof) const{
return 3;
}
int FunctionSpace::getElementGlobalId(const Dof& dof) const{
return dof.getEntity();
}
/*
#include "Polynomial.h"
#include "BasisScalar.h"
#include "fullMatrix.h"
#include "Mapper.h"
#include "Exception.h"
void FunctionSpace::
interpolateAtNodes(const MElement& elem,
const vector<double>& coef,
std::vector<double>& nodeValue) const{
// Check
unsigned int wS = coef.size();
unsigned int bS = basis->getSize();
if(wS < bS)
throw Exception
("Not enough coefs for interpolation:\nBasis: %d -- coefs: %d",
bS, wS);
if(wS > bS)
throw Exception
("Too much coefs for interpolation:\nBasis: %d -- coefs: %d",
bS, wS);
// Get Nodes
MElement& element = const_cast<MElement&>(elem);
vector<MVertex*> node;
element.getVertices(node);
unsigned int N = node.size();
// Get Functions
const vector<Polynomial>& fun =
static_cast<const BasisScalar*>(basis)->getBasis();
// Init some stuff
fullMatrix<double> invJac(3, 3);
fullVector<double> xyz(3);
fullVector<double> origin(3);
origin(0) = node[0]->x();
origin(1) = node[0]->y();
origin(2) = node[0]->z();
// Interpolate
for(unsigned int n = 0; n < N; n++){
// Map from physical to reference space
xyz(0) = node[n]->x();
xyz(1) = node[n]->y();
xyz(2) = node[n]->z();
element.getJacobian(xyz(0), xyz(1), xyz(2), invJac);
invJac.invertInPlace();
const fullVector<double> uvw =
Mapper::invMap(xyz, origin, invJac);
printf("(%lf\t%lf\t%lf)\n", uvw(0), uvw(1), uvw(2));
// Interpolate
const int id = node[n]->getNum() - 1;
for(unsigned int i = 0; i < bS; i++)
nodeValue[id] += fun[i].at(uvw(0), uvw(1), uvw(2)) * coef[i];
}
}
*/
......@@ -15,13 +15,23 @@
#include "MFace.h"
/**
@class FunctionSpace
@brief A Function Space
@interface FunctionSpace
@brief Common Interface of all Function Spaces
This class represents a Function Space
This is the @em common @em interface of
all Function Spaces.@n
A FunctionSpace is defined on a @em support,
which is a collection of MElement%s (GroupOfElement).@n
Those MElement%s @em must belong to the @em same Mesh.
@note
A FunctionSpace is an @em interface, so it
can't be instantiated.
@todo
Hybrid Mesh@n
Allow Hybrid Mesh
*/
class FunctionSpace{
......@@ -48,20 +58,136 @@ class FunctionSpace{
unsigned int getNFunctionPerCell(const MElement& element) const;
std::vector<Dof> getKeys(const MElement& element) const;
std::vector<Dof> getKeys(const MVertex& element) const;
std::vector<Dof> getKeys(const MEdge& element) const;
std::vector<Dof> getKeys(const MFace& element) const;
std::vector<Dof> getKeys(const MVertex& vertex) const;
std::vector<Dof> getKeys(const MEdge& edge) const;
std::vector<Dof> getKeys(const MFace& face) const;
int getElementType(const Dof& dof) const;
int getElementGlobalId(const Dof& dof) const;
protected:
FunctionSpace();
FunctionSpace(void);
void build(const GroupOfElement& goe,
int basisType, int order);
};
/**
@internal
@fn FunctionSpace::FunctionSpace
Instatiate a new FunctionSpace
@endinternal
**
@fn FunctionSpace::~FunctionSpace
Deletes this FunctionSpace
**
@fn FunctionSpace::getSupport
@return Returns the support of this
FunctionSpace
**
@fn FunctionSpace::getType
@return Return the @em type of
the Basis functions composing
this Function Space.
@see Basis::getType()
**
@fn FunctionSpace::getNFunctionPerVertex
@param element A MElement of the support
@return Returns the number of @em Vertex Based
Basis Functions, defined on the given element
**
@fn FunctionSpace::getNFunctionPerEdge
@param element A MElement of the support
@return Returns the number of @em Edge Based
Basis Functions, defined on the given element
**
@fn FunctionSpace::getNFunctionPerFace
@param element A MElement of the support
@return Returns the number of @em Face Based
Basis Functions, defined on the given element
**
@fn FunctionSpace::getNFunctionPerCell
@param element A MElement of the support
@return Returns the number of @em Cell Based
Basis Functions, defined on the given element
**
@fn vector<Dof> FunctionSpace::getKeys(const MElement& element) const
@param element A MElement
@return Returns all the Dof%s associated to the given MElement
**
@fn vector<Dof> FunctionSpace::getKeys(const MVertex& vertex) const
@param vertex A MVertex
@return Returns all the Dof%s associated to the given MVertex
**
@fn vector<Dof> FunctionSpace::getKeys(const MEdge& edge) const
@param edge A MEdge
@return Returns all the Dof%s associated to the given MEdge
**
@fn vector<Dof> FunctionSpace::getKeys(const MFace& face) const
@param face A MFace
@return Returns all the Dof%s associated to the given MFace
**
@fn FunctionSpace::getElementType
@param dof A Dof
@return Returns the @em type of the @em element,
to which the given Dof is @em associated
@note
Type is equal to:
@li @c 0, if the element is a @em Vertex
@li @c 1, if the element is an @em Edge
@li @c 2, if the element is a @em Face
@li @c 3, if the element is a @em Cell
@warning
There are no error recovery if
the Element is not in the Mesh
@todo
Error recovery if
the Element is not in the Mesh
**
@fn FunctionSpace::getElementGlobalId
@param dof A Dof
@return Returns the @em Mesh @em Global @em @c ID of
the Element, to which the given Dof is @em associated
@warning
There are no error recovery if
the Element is not in the Mesh
@todo
Error recovery if
the Element is not in the Mesh
**
@internal
@fn FunctionSpace::build
@param goe The GroupOfElement defining the support
of this FunctionSpace
@param basisType The Type of the Basis to use to build
this FunctionSpace
@param order The order of this FunctionSpace
Initializes a FunctionSpace with the given parameters
@endinternal
*/
//////////////////////
// Inline Functions //
//////////////////////
......@@ -90,4 +216,8 @@ inline unsigned int FunctionSpace::getNFunctionPerCell(const MElement& element)
return fPerCell;
}
inline int FunctionSpace::getElementGlobalId(const Dof& dof) const{
return dof.getEntity();
}
#endif
......@@ -3,6 +3,14 @@
#include "FunctionSpaceVector.h"
/**
@class FunctionSpaceEdge
@brief An Edge based Function Space
This class is an Edge based (1-Form) Function Space.
*/
class FunctionSpaceEdge : public FunctionSpaceVector{
public:
FunctionSpaceEdge(const GroupOfElement& goe, int order);
......@@ -15,4 +23,20 @@ class FunctionSpaceEdge : public FunctionSpaceVector{
const fullVector<double>& xyz) const;
};
/**
@fn FunctionSpaceEdge::FunctionSpaceEdge
@param goe The GroupOfElement defining the
@em support of this FunctionSpace
@param order The order of this FunctionSpace
Instantiates a new Edge based Function Space
(FunctionSpaceEdge) with the given parameters
**
@fn FunctionSpaceEdge::~FunctionSpaceEdge
Deletes this FunctionSpaceEdge
**
*/
#endif
......@@ -3,6 +3,14 @@
#include "FunctionSpaceScalar.h"
/**
@class FunctionSpaceNode
@brief A Nodal Function Space
This class is a Nodal (0-Form) Function Space.
*/
class FunctionSpaceNode : public FunctionSpaceScalar{
public:
FunctionSpaceNode(const GroupOfElement& goe, int order);
......@@ -15,4 +23,20 @@ class FunctionSpaceNode : public FunctionSpaceScalar{
const fullVector<double>& xyz) const;
};
/**
@fn FunctionSpaceNode::FunctionSpaceNode
@param goe The GroupOfElement defining the
@em support of this FunctionSpace
@param order The order of this FunctionSpace
Instantiates a new Nodal Function Space
(FunctionSpaceNode) with the given parameters
**
@fn FunctionSpaceNode::~FunctionSpaceNode
Deletes this FunctionSpaceNode
**
*/
#endif
......@@ -5,6 +5,21 @@
#include "BasisScalar.h"
#include "FunctionSpace.h"
/**
@interface FunctionSpaceScalar
@brief Common Interface of all Scalar FunctionSpaces
This is the @em common @em interface of
all @em Scalar FunctionSpaces.@n
A FunctionSpaceScalar can be @em interpolated.
@note
A ScalarFunctionSpace is an @em interface, so it
can't be instantiated.
*/
class FunctionSpaceScalar : public FunctionSpace{
public:
virtual ~FunctionSpaceScalar(void);
......@@ -18,6 +33,38 @@ class FunctionSpaceScalar : public FunctionSpace{
};
/**
@fn FunctionSpaceScalar::~FunctionSpaceScalar
Deletes this FunctionSpaceScalar
**
@fn FunctionSpaceScalar::interpolate
@param element The MElement to interpolate on
@param coef The coefficients of the interpolation
@param xyz The coordinate
(of point @em inside the given @c element)
of the interpolation
@return Returns the (scalar) interpolated value
@warning
If the given coordinate are not in the given
@c element @em Bad @em Things may happend
@todo
If the given coordinate are not in the given
@c element @em Bad @em Things may happend
---> check
**
@fn FunctionSpaceScalar::getBasis
@param element A MElement of the support
of this FunctionSpace
@return Returns the Basis (BasisScalar) associated
to the given MElement
*/
//////////////////////
// Inline Functions //
//////////////////////
......
......@@ -5,6 +5,21 @@
#include "BasisVector.h"
#include "FunctionSpace.h"
/**
@interface FunctionSpaceVector
@brief Common Interface of all Vectorial FunctionSpaces
This is the @em common @em interface of
all @em Vectorial FunctionSpaces.@n
A FunctionSpaceVector can be @em interpolated.
@note
A VectorFunctionSpace is an @em interface, so it
can't be instantiated.
*/
class FunctionSpaceVector : public FunctionSpace{
public:
virtual ~FunctionSpaceVector(void);
......@@ -18,6 +33,38 @@ class FunctionSpaceVector : public FunctionSpace{
};
/**
@fn FunctionSpaceVector::~FunctionSpaceVector
Deletes this FunctionSpaceVector
**
@fn FunctionSpaceVector::interpolate
@param element The MElement to interpolate on
@param coef The coefficients of the interpolation
@param xyz The coordinate
(of point @em inside the given @c element)
of the interpolation
@return Returns the (vectorial) interpolated value
@warning
If the given coordinate are not in the given
@c element @em Bad @em Things may happend
@todo
If the given coordinate are not in the given
@c element @em Bad @em Things may happend
---> check
**
@fn FunctionSpaceVector::getBasis
@param element A MElement of the support
of this FunctionSpace
@return Returns the Basis (BasisVector) associated
to the given MElement
*/
//////////////////////
// Inline Functions //
//////////////////////
......
......@@ -5,7 +5,7 @@
/**
@class HexEdgeBasis
@brief An Edge-Basis for Hexahedrons
@brief An Edge Basis for Hexahedrons
This class can instantiate an Edge-Based Basis
(high or low order) for Hexahedrons.@n
......@@ -17,8 +17,9 @@
class HexEdgeBasis: public BasisVector{
public:
//! Returns a new Edge-Basis for Hexahedrons of the given order
//! @param order The order of the Basis
//!
//! Returns a new Edge-Basis for Hexahedrons of the given order
HexEdgeBasis(const int order);
//! Deletes this Basis
......
......@@ -5,7 +5,7 @@
/**
@class HexNodeBasis
@brief A Node-Basis for Hexahedrons
@brief A Node Basis for Hexahedrons
This class can instantiate a Node-Based Basis
(high or low order) for Hexahedrons.@n
......@@ -17,8 +17,9 @@
class HexNodeBasis: public BasisScalar{
public:
//! Returns a new Node-Basis for Hexahedrons of the given order
//! @param order The order of the Basis
//!
//! Returns a new Node-Basis for Hexahedrons of the given order
HexNodeBasis(const int order);
//! @return Deletes this Basis
......
......@@ -5,7 +5,7 @@
/**
@class QuadEdgeBasis
@brief An Edge-Basis for Quads
@brief An Edge Basis for Quads
This class can instantiate an Edge-Based Basis
(high or low order) for Quads.@n
......@@ -17,8 +17,9 @@
class QuadEdgeBasis: public BasisVector{
public:
//! Returns a new Edge-Basis for Quads of the given order
//! @param order The order of the Basis
//!
//! Returns a new Edge-Basis for Quads of the given order
QuadEdgeBasis(const int order);
//! Deletes this Basis
......
......@@ -5,7 +5,7 @@
/**
@class QuadNodeBasis
@brief A Node-Basis for Quads
@brief A Node Basis for Quads
This class can instantiate a Node-Based Basis
(high or low order) for Quads.@n
......@@ -17,8 +17,9 @@
class QuadNodeBasis: public BasisScalar{
public:
//! Returns a new Node-Basis for Quads of the given order
//! @param order The order of the Basis
//!
//! Returns a new Node-Basis for Quads of the given order
QuadNodeBasis(const int order);
//! @return Deletes this Basis
......
......@@ -5,7 +5,7 @@
/**
@class TriEdgeBasis
@brief An Edge-Basis for Triangles
@brief An Edge Basis for Triangles
This class can instantiate an Edge-Based Basis
(high or low order) for Triangles.@n
......@@ -17,8 +17,9 @@
class TriEdgeBasis: public BasisVector{
public:
//! Returns a new Edge-Basis for Triangles of the given order
//! @param order The order of the Basis
//!
//! Returns a new Edge-Basis for Triangles of the given order
TriEdgeBasis(const int order);
//! Deletes this Basis
......
......@@ -5,7 +5,7 @@
/**
@class TriNodeBasis
@brief A Node-Basis for Triangles
@brief A Node Basis for Triangles
This class can instantiate a Node-Based Basis
(high or low order) for Triangles.@n
......@@ -17,8 +17,9 @@
class TriNodeBasis: public BasisScalar{
public:
//! Returns a new Node-Basis for Triangles of the given order
//! @param order The order of the Basis
//!
//! Returns a new Node-Basis for Triangles of the given order
TriNodeBasis(const int order);
//! Deletes this Basis
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment