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

Remove BasisLocal{Scalar,Vector,} -- Everything is in Basis now

parent 09eb039d
No related branches found
No related tags found
No related merge requests found
Showing
with 352 additions and 638 deletions
......@@ -11,6 +11,34 @@
A Basis is @em set of @em linearly @em independent Polynomial%s
(or Vector%s of Polynomial%s).@n
@note
The returned matrices are the result of the evaluation
of the basis functions (at @c N points).@n
The @c i-th row of these matrices is always refering to the
@c i-th function of the basis.@n
Depending on the nature of the returned value
(@em scalar or @em vector), the columns are organized
diferently.
For @em scalar values, we have:
@li The @c j-th column of the @c i-th row is
the evaluation of the @c i-th function at the @c j-th point
For @em vectorial values, we have:
@li The @c j-th column of the @c i-th row is
the @em first @em coordinate of
the evaluation of the @c i-th function at the @c 3 @c x @c j-th point
@li The @c (@c j-th @c + @c 1 @c ) column of the @c i-th row is
the @em second @em coordinate of
the evaluation of the @c i-th function at the @c 3 @c x @c j-th point
@li The @c (@c j-th @c + @c 2 @c ) column of the @c i-th row is
the @em third @em coordinate of
the evaluation of the @c i-th function at the @c 3 @c x @c j-th point
*/
class Basis{
......@@ -30,83 +58,219 @@ class Basis{
unsigned int nFunction;
public:
//! Deletes this Basis
//!
// Destructor //
virtual ~Basis(void);
//! @return Returns:
//! @li @c true, if this is a
//! @em scalar Basis
//! @li @c false, if this is a
//! @em vectorial Basis
//!
//! @note
//! Scalar basis are sets of
//! Polynomial%s@n
//! Vectorial basis are sets of
//! Vector%s of Polynomial%s
// Scalar & Local //
bool isScalar(void) const;
//! @return Returns:
//! @li @c true, if this is a
//! @em Local Basis
//! @li @c false, if this is a
//! @em Global Basis
bool isLocal(void) const;
//! @return Returns the @em polynomial @em order of the Basis
// Type of Basis //
unsigned int getOrder(void) const;
//! @return Returns the @em type of the Basis:
//! @li 0 for 0-form
//! @li 1 for 1-form
//! @li 2 for 2-form
//! @li 3 for 3-form
unsigned int getType(void) const;
//! @return Returns the @em dimension
//! (1D, 2D or 3D) of the Basis
unsigned int getDim(void) const;
//! @return Returns the number of @em Vertex
//! @em Based functions of this Basis
// Number of Functions //
unsigned int getNVertexBased(void) const;
//! @return Returns the number of @em Edge
//! @em Based functions of this Basis
unsigned int getNEdgeBased(void) const;
//! @return Returns the number of @em Face
//! @em Based functions of this Basis
unsigned int getNFaceBased(void) const;
//! @return Returns the number of @em Cell
//! @em Based functions of this Basis
unsigned int getNCellBased(void) const;
//! @return Returns the number of Polynomial%s
//! (or Vector%s of Polynomial%s) Functions
//! in this Basis
unsigned int getNFunction(void) const;
//! @return Returns the number of
//! @em orientation of this Basis
//! Reference Space
// Orientations //
virtual unsigned int getNOrientation(void) const = 0;
//! @param element A MElement
//! @return Returns a number charaterizing
//! the @em orientation of the given element
virtual unsigned int getOrientation(const MElement& element) const = 0;
// Direct Access to Evaluated Functions //
virtual fullMatrix<double>* getFunctions(const MElement& element,
double u, double v, double w) const = 0;
virtual fullMatrix<double>* getFunctions(unsigned int orientation,
double u, double v, double w) const = 0;
// Precompute Functions //
virtual void preEvaluateFunctions(const fullMatrix<double>& point) const = 0;
virtual void preEvaluateDerivatives(const fullMatrix<double>& point) const = 0;
// Access to Precomputed Functions //
virtual const fullMatrix<double>&
getPreEvaluatedFunctions(const MElement& element) const = 0;
virtual const fullMatrix<double>&
getPreEvaluatedDerivatives(const MElement& element) const = 0;
virtual const fullMatrix<double>&
getPreEvaluatedFunctions(unsigned int orientation) const = 0;
virtual const fullMatrix<double>&
getPreEvaluatedDerivatives(unsigned int orientation) const = 0;
protected:
//! @internal
//! Instantiate a new Basis
//!
//! @endinternal
// 'Constructor' //
Basis(void);
};
/**
@internal
@fn Basis::Basis
Instantiate a new Basis
@endinternal
**
@fn Basis::~Basis
Deletes this Basis
**
@fn Basis::isScalar
@return Returns:
@li @c true, if this is a
@em scalar Basis
@li @c false, if this is a
@em vectorial Basis
@note
Scalar basis are sets of
Polynomial%s@n
Vectorial basis are sets of
Vector%s of Polynomial%s
**
@fn Basis::isLocal
@return Returns:
@li @c true, if this is a
@em Local Basis
@li @c false, if this is a
@em Global Basis
**
@fn Basis::getOrder
@return Returns the @em polynomial @em order of the Basis
**
@fn Basis::getType
@return Returns the @em type of the Basis:
@li 0 for 0-form
@li 1 for 1-form
@li 2 for 2-form
@li 3 for 3-form
**
@fn Basis::getDim
@return Returns the @em dimension
(@c 1D, @c 2D or @c 3D) of the Basis
**
@fn Basis::getNVertexBased
@return Returns the number of @em Vertex
@em Based functions of this Basis
**
@fn Basis::getNEdgeBased
@return Returns the number of @em Edge
@em Based functions of this Basis
**
@fn Basis::getNFaceBased
@return Returns the number of @em Face
@em Based functions of this Basis
**
@fn Basis::getNCellBased
@return Returns the number of @em Cell
@em Based functions of this Basis
**
@fn Basis::getNFunction
@return Returns the number of Polynomial%s
(or Vector%s of Polynomial%s) Functions
in this Basis
**
@fn Basis::getNOrientation
@return Returns the number of
@em orientation of this Basis
Reference Space
**
@fn Basis::getOrientation
@param element A MElement
@return Returns a number charaterizing
the @em orientation of the given element
**
@fn Basis::getFunctions(unsigned int, double, double, double) const
@param orientation A natural number defining the reference space @em orientation
@param u A @c u coordinate in the reference space of this Basis
@param v A @c v coordinate in the reference space of this Basis
@param w A @c w coordinate in the reference space of this Basis
@return Instanciates a new fullMatrix<double> with the @em evaluation
of every basis function at the given coordinates, and for the
given orientation
@warning
The Instanciated Matrix must be deleted by the @em calling function
**
@fn Basis::getFunctions(const MElement&, double, double, double) const
@param element A MElement
@param u A @c u coordinate in the reference space of this Basis
@param v A @c v coordinate in the reference space of this Basis
@param w A @c w coordinate in the reference space of this Basis
@return Same as Basis::getFunction(Basis::getOrientation(@c element),
@c u, @c u, @c w)
**
@fn Basis::preEvaluateFunctions
@param point A Matrix with points coordinate
(each line is a point and got 3 coordinates, @em i.e. 3 rows)
@return Pre Evaluates every basis function at the given points
**
@fn Basis::preEvaluateDerivatives
@param point A Matrix with points coordinate
(each line is a point and got 3 coordinates, @em i.e. 3 rows)
@return Pre Evaluates every basis function @em derivative at the given points
@note
@li For 0-Form it computes the @em gradient
@li For 1-Form it computes the @em curl
@li For 2-Form it computes the @em divergence
@li For 3-Form it computes the @em ???
@todo What is the derivative of a 3-Form
(does it exists -- discontinous field nope ?) ?
**
@fn Basis::getPreEvaluatedFunctions(unsigned int) const
@param orientation A natural number defining the reference space @em orientation
@return Returns a Matrix with the PreEvaluated basis functions
(see Basis::preEvaluateFunctions()), with the given @em orientation
@note
If no PreEvaluation has been done before calling this function,
an Exception is thrown
**
@fn Basis::getPreEvaluatedDerivatives(unsigned int) const
@param orientation A natural number defining the reference space @em orientation
@return Returns a Matrix with the PreEvaluated basis functions @em derivatives
(see Basis::preEvaluateDerivatives()), with the given @em orientation
@note
If no PreEvaluation of the gradient has been done before calling this function,
an Exception is thrown
**
@fn Basis::getPreEvaluatedFunctions(const MElement&) const
@return Same as Basis::getPreEvaluatedFunctions(Basis::getOrientation(@c element))
**
@fn Basis::getPreEvaluatedDerivatives(const MElement&) const
@return Same as Basis::getPreEvaluatedDerivatives(Basis::getOrientation(@c element))
*/
//////////////////////
// Inline Functions //
//////////////////////
......
......@@ -5,6 +5,9 @@
using namespace std;
BasisHierarchicalScalar::BasisHierarchicalScalar(void){
// Scalar Basis ? //
scalar = true;
// Grad Basis //
hasGrad = false;
grad = NULL;
......@@ -46,6 +49,16 @@ BasisHierarchicalScalar::~BasisHierarchicalScalar(void){
}
}
unsigned int BasisHierarchicalScalar::
getNOrientation(void) const{
return refSpace->getNPermutation();
}
unsigned int BasisHierarchicalScalar::
getOrientation(const MElement& element) const{
return refSpace->getPermutation(element);
}
fullMatrix<double>* BasisHierarchicalScalar::
getFunctions(const MElement& element,
double u, double v, double w) const{
......@@ -111,7 +124,7 @@ preEvaluateFunctions(const fullMatrix<double>& point) const{
}
void BasisHierarchicalScalar::
preEvaluateGradFunctions(const fullMatrix<double>& point) const{
preEvaluateDerivatives(const fullMatrix<double>& point) const{
// Build Grad //
if(!hasGrad)
getGrad();
......@@ -161,8 +174,8 @@ getPreEvaluatedFunctions(const MElement& element) const{
}
const fullMatrix<double>& BasisHierarchicalScalar::
getPreEvaluatedGradFunctions(const MElement& element) const{
return getPreEvaluatedGradFunctions(refSpace->getPermutation(element));
getPreEvaluatedDerivatives(const MElement& element) const{
return getPreEvaluatedDerivatives(refSpace->getPermutation(element));
}
const fullMatrix<double>& BasisHierarchicalScalar::
......@@ -174,23 +187,13 @@ getPreEvaluatedFunctions(unsigned int orientation) const{
}
const fullMatrix<double>& BasisHierarchicalScalar::
getPreEvaluatedGradFunctions(unsigned int orientation) const{
getPreEvaluatedDerivatives(unsigned int orientation) const{
if(!preEvaluatedGrad)
throw Exception("getPreEvaluatedGradFunction: gradient has not been preEvaluated");
throw Exception("getPreEvaluatedDerivative: gradient has not been preEvaluated");
return *preEvaluatedGradFunction[orientation];
}
unsigned int BasisHierarchicalScalar::
getNOrientation(void) const{
return refSpace->getNPermutation();
}
unsigned int BasisHierarchicalScalar::
getOrientation(const MElement& element) const{
return refSpace->getPermutation(element);
}
void BasisHierarchicalScalar::getGrad(void) const{
// Alloc //
grad = new vector<Polynomial>**[nRefSpace];
......
......@@ -2,7 +2,7 @@
#define _BASISHIERARCHICALSCALAR_H_
#include <string>
#include "BasisLocalScalar.h"
#include "BasisLocal.h"
#include "Polynomial.h"
#include "ReferenceSpace.h"
......@@ -13,7 +13,7 @@
This is an interface for Hierarchical Scalar Local Basis.@n
*/
class BasisHierarchicalScalar: public BasisLocalScalar{
class BasisHierarchicalScalar: public BasisLocal{
protected:
// Orientation //
ReferenceSpace* refSpace;
......@@ -36,6 +36,9 @@ class BasisHierarchicalScalar: public BasisLocalScalar{
public:
virtual ~BasisHierarchicalScalar(void);
virtual unsigned int getNOrientation(void) const;
virtual unsigned int getOrientation(const MElement& element) const;
virtual fullMatrix<double>* getFunctions(const MElement& element,
double u, double v, double w) const;
......@@ -43,22 +46,19 @@ class BasisHierarchicalScalar: public BasisLocalScalar{
double u, double v, double w) const;
virtual void preEvaluateFunctions(const fullMatrix<double>& point) const;
virtual void preEvaluateGradFunctions(const fullMatrix<double>& point) const;
virtual void preEvaluateDerivatives(const fullMatrix<double>& point) const;
virtual const fullMatrix<double>&
getPreEvaluatedFunctions(const MElement& element) const;
virtual const fullMatrix<double>&
getPreEvaluatedGradFunctions(const MElement& element) const;
getPreEvaluatedDerivatives(const MElement& element) const;
virtual const fullMatrix<double>&
getPreEvaluatedFunctions(unsigned int orientation) const;
virtual const fullMatrix<double>&
getPreEvaluatedGradFunctions(unsigned int orientation) const;
virtual unsigned int getNOrientation(void) const;
virtual unsigned int getOrientation(const MElement& element) const;
getPreEvaluatedDerivatives(unsigned int orientation) const;
std::string toString(void) const;
......
......@@ -5,22 +5,19 @@
using namespace std;
BasisHierarchicalVector::BasisHierarchicalVector(void){
// Scalar Basis ?//
scalar = false;
// Curl Basis //
hasCurl = false;
curl = NULL;
// Div Basis //
hasDiv = false;
div = NULL;
// PreEvaluation //
preEvaluated = false;
preEvaluatedCurl = false;
preEvaluatedDiv = false;
preEvaluatedFunction = NULL;
preEvaluatedCurlFunction = NULL;
preEvaluatedDivFunction = NULL;
}
BasisHierarchicalVector::~BasisHierarchicalVector(void){
......@@ -36,18 +33,6 @@ BasisHierarchicalVector::~BasisHierarchicalVector(void){
delete[] curl;
}
// Div Basis //
if(hasDiv){
for(unsigned int i = 0; i < nRefSpace; i++){
for(unsigned int j = 0; j < nFunction; j++)
delete div[i][j];
delete[] div[i];
}
delete[] div;
}
// PreEvaluation //
if(preEvaluated){
for(unsigned int i = 0; i < nRefSpace; i++)
......@@ -64,6 +49,16 @@ BasisHierarchicalVector::~BasisHierarchicalVector(void){
}
}
unsigned int BasisHierarchicalVector::
getNOrientation(void) const{
return refSpace->getNPermutation();
}
unsigned int BasisHierarchicalVector::
getOrientation(const MElement& element) const{
return refSpace->getPermutation(element);
}
fullMatrix<double>* BasisHierarchicalVector::
getFunctions(const MElement& element,
double u, double v, double w) const{
......@@ -151,7 +146,7 @@ preEvaluateFunctions(const fullMatrix<double>& point) const{
}
void BasisHierarchicalVector::
preEvaluateCurlFunctions(const fullMatrix<double>& point) const{
preEvaluateDerivatives(const fullMatrix<double>& point) const{
// Build Curl //
if(!hasCurl)
getCurl();
......@@ -195,54 +190,14 @@ preEvaluateCurlFunctions(const fullMatrix<double>& point) const{
preEvaluatedCurl = true;
}
void BasisHierarchicalVector::
preEvaluateDivFunctions(const fullMatrix<double>& point) const{
// Build Div //
if(!hasDiv)
getDiv();
// Delete if older //
if(preEvaluatedDiv){
for(unsigned int i = 0; i < nRefSpace; i++)
delete preEvaluatedDivFunction[i];
delete[] preEvaluatedDivFunction;
}
// Alloc //
const unsigned int nPoint = point.size1();
preEvaluatedDivFunction = new fullMatrix<double>*[nRefSpace];
for(unsigned int i = 0; i < nRefSpace; i++)
preEvaluatedDivFunction[i] =
new fullMatrix<double>(nFunction, nPoint);
// Fill Matrix //
for(unsigned int i = 0; i < nRefSpace; i++)
for(unsigned int j = 0; j < nFunction; j++)
for(unsigned int k = 0; k < nPoint; k++)
(*preEvaluatedDivFunction[i])(j, k) =
div[i][j]->at(point(k, 0),
point(k, 1),
point(k, 2));
// PreEvaluated //
preEvaluatedDiv = true;
}
const fullMatrix<double>& BasisHierarchicalVector::
getPreEvaluatedFunctions(const MElement& element) const{
return getPreEvaluatedFunctions(refSpace->getPermutation(element));
}
const fullMatrix<double>& BasisHierarchicalVector::
getPreEvaluatedCurlFunctions(const MElement& element) const{
return getPreEvaluatedCurlFunctions(refSpace->getPermutation(element));
}
const fullMatrix<double>& BasisHierarchicalVector::
getPreEvaluatedDivFunctions(const MElement& element) const{
return getPreEvaluatedDivFunctions(refSpace->getPermutation(element));
getPreEvaluatedDerivatives(const MElement& element) const{
return getPreEvaluatedDerivatives(refSpace->getPermutation(element));
}
const fullMatrix<double>& BasisHierarchicalVector::
......@@ -254,31 +209,13 @@ getPreEvaluatedFunctions(unsigned int orientation) const{
}
const fullMatrix<double>& BasisHierarchicalVector::
getPreEvaluatedCurlFunctions(unsigned int orientation) const{
getPreEvaluatedDerivatives(unsigned int orientation) const{
if(!preEvaluatedCurl)
throw Exception("getPreEvaluatedCurlFunction: curl has not been preEvaluated");
throw Exception("getPreEvaluatedDerivative: curl has not been preEvaluated");
return *preEvaluatedCurlFunction[orientation];
}
const fullMatrix<double>& BasisHierarchicalVector::
getPreEvaluatedDivFunctions(unsigned int orientation) const{
if(!preEvaluatedDiv)
throw Exception("getPreEvaluatedDivFunction: divergence has not been preEvaluated");
return *preEvaluatedDivFunction[orientation];
}
unsigned int BasisHierarchicalVector::
getNOrientation(void) const{
return refSpace->getNPermutation();
}
unsigned int BasisHierarchicalVector::
getOrientation(const MElement& element) const{
return refSpace->getPermutation(element);
}
void BasisHierarchicalVector::getCurl(void) const{
// Alloc //
curl = new vector<Polynomial>**[nRefSpace];
......@@ -296,23 +233,6 @@ void BasisHierarchicalVector::getCurl(void) const{
hasCurl = true;
}
void BasisHierarchicalVector::getDiv(void) const{
// Alloc //
div = new Polynomial**[nRefSpace];
for(unsigned int s = 0; s < nRefSpace; s++)
div[s] = new Polynomial*[nFunction];
// Div //
for(unsigned int s = 0; s < nRefSpace; s++)
for(unsigned int f = 0 ; f < nFunction; f++)
div[s][f] =
new Polynomial(Polynomial::divergence(*basis[s][f]));
// Has Div //
hasDiv = true;
}
string BasisHierarchicalVector::toString(void) const{
stringstream stream;
unsigned int i = 0;
......
......@@ -2,7 +2,7 @@
#define _BASISHIERARCHICALVECTOR_H_
#include <string>
#include "BasisLocalVector.h"
#include "BasisLocal.h"
#include "Polynomial.h"
#include "ReferenceSpace.h"
......@@ -13,7 +13,7 @@
This is an interface for Hierarchical Vectorial Local Basis.@n
*/
class BasisHierarchicalVector: public BasisLocalVector{
class BasisHierarchicalVector: public BasisLocal{
protected:
// Orientation //
ReferenceSpace* refSpace;
......@@ -26,22 +26,19 @@ class BasisHierarchicalVector: public BasisLocalVector{
mutable bool hasCurl;
mutable std::vector<Polynomial>*** curl;
// Div Basis //
mutable bool hasDiv;
mutable Polynomial*** div;
// PreEvaluation //
mutable bool preEvaluated;
mutable bool preEvaluatedCurl;
mutable bool preEvaluatedDiv;
mutable fullMatrix<double>** preEvaluatedFunction;
mutable fullMatrix<double>** preEvaluatedCurlFunction;
mutable fullMatrix<double>** preEvaluatedDivFunction;
public:
virtual ~BasisHierarchicalVector(void);
virtual unsigned int getNOrientation(void) const;
virtual unsigned int getOrientation(const MElement& element) const;
virtual fullMatrix<double>* getFunctions(const MElement& element,
double u, double v, double w) const;
......@@ -49,29 +46,19 @@ class BasisHierarchicalVector: public BasisLocalVector{
double u, double v, double w) const;
virtual void preEvaluateFunctions(const fullMatrix<double>& point) const;
virtual void preEvaluateCurlFunctions(const fullMatrix<double>& point) const;
virtual void preEvaluateDivFunctions (const fullMatrix<double>& point) const;
virtual void preEvaluateDerivatives(const fullMatrix<double>& point) const;
virtual const fullMatrix<double>&
getPreEvaluatedFunctions(const MElement& element) const;
virtual const fullMatrix<double>&
getPreEvaluatedCurlFunctions(const MElement& element) const;
virtual const fullMatrix<double>&
getPreEvaluatedDivFunctions (const MElement& element)const;
getPreEvaluatedDerivatives(const MElement& element) const;
virtual const fullMatrix<double>&
getPreEvaluatedFunctions(unsigned int orientation) const;
virtual const fullMatrix<double>&
getPreEvaluatedCurlFunctions(unsigned int orientation) const;
virtual const fullMatrix<double>&
getPreEvaluatedDivFunctions(unsigned int orientation) const;
virtual unsigned int getNOrientation(void) const;
virtual unsigned int getOrientation(const MElement& element) const;
getPreEvaluatedDerivatives(unsigned int orientation) const;
std::string toString(void) const;
......@@ -80,7 +67,6 @@ class BasisHierarchicalVector: public BasisLocalVector{
private:
void getCurl(void) const;
void getDiv(void) const;
};
/**
......
......@@ -2,11 +2,22 @@
#include "BasisLagrange.h"
BasisLagrange::BasisLagrange(void){
scalar = true;
}
BasisLagrange::~BasisLagrange(void){
}
unsigned int BasisLagrange::
getNOrientation(void) const{
throw Exception("BasisLagrange::Not Implemented");
}
unsigned int BasisLagrange::
getOrientation(const MElement& element) const{
throw Exception("BasisLagrange::Not Implemented");
}
fullMatrix<double>* BasisLagrange::
getFunctions(const MElement& element,
double u, double v, double w) const{
......@@ -41,7 +52,7 @@ void BasisLagrange::preEvaluateFunctions(const fullMatrix<double>& point) const{
throw Exception("BasisLagrange::Not Implemented");
}
void BasisLagrange::preEvaluateGradFunctions(const fullMatrix<double>& point) const{
void BasisLagrange::preEvaluateDerivatives(const fullMatrix<double>& point) const{
throw Exception("BasisLagrange::Not Implemented");
}
......@@ -51,7 +62,7 @@ BasisLagrange::getPreEvaluatedFunctions(const MElement& element) const{
}
const fullMatrix<double>&
BasisLagrange::getPreEvaluatedGradFunctions(const MElement& element) const{
BasisLagrange::getPreEvaluatedDerivatives(const MElement& element) const{
throw Exception("BasisLagrange::Not Implemented");
}
......@@ -61,17 +72,7 @@ BasisLagrange::getPreEvaluatedFunctions(unsigned int orientation) const{
}
const fullMatrix<double>&
BasisLagrange::getPreEvaluatedGradFunctions(unsigned int orientation) const{
throw Exception("BasisLagrange::Not Implemented");
}
unsigned int BasisLagrange::
getNOrientation(void) const{
throw Exception("BasisLagrange::Not Implemented");
}
unsigned int BasisLagrange::
getOrientation(const MElement& element) const{
BasisLagrange::getPreEvaluatedDerivatives(unsigned int orientation) const{
throw Exception("BasisLagrange::Not Implemented");
}
......
#ifndef _BASISLAGRANGE_H_
#define _BASISLAGRANGE_H_
#include "BasisLocalScalar.h"
#include "BasisLocal.h"
#include "FunctionSpaceScalar.h"
#include "FunctionSpaceVector.h"
#include "fullMatrix.h"
......@@ -23,7 +23,7 @@
Add a method to get lagrange Point in polynomialBasis
*/
class BasisLagrange: public BasisLocalScalar{
class BasisLagrange: public BasisLocal{
protected:
polynomialBasis* lBasis; // Lagrange Basis
fullMatrix<double>* lPoint; // Lagrange Points
......@@ -31,6 +31,9 @@ class BasisLagrange: public BasisLocalScalar{
public:
virtual ~BasisLagrange(void);
virtual unsigned int getNOrientation(void) const;
virtual unsigned int getOrientation(const MElement& element) const;
virtual fullMatrix<double>* getFunctions(const MElement& element,
double u, double v, double w) const;
......@@ -38,22 +41,19 @@ class BasisLagrange: public BasisLocalScalar{
double u, double v, double w) const;
virtual void preEvaluateFunctions(const fullMatrix<double>& point) const;
virtual void preEvaluateGradFunctions(const fullMatrix<double>& point) const;
virtual void preEvaluateDerivatives(const fullMatrix<double>& point) const;
virtual const fullMatrix<double>&
getPreEvaluatedFunctions(const MElement& element) const;
virtual const fullMatrix<double>&
getPreEvaluatedGradFunctions(const MElement& element) const;
getPreEvaluatedDerivatives(const MElement& element) const;
virtual const fullMatrix<double>&
getPreEvaluatedFunctions(unsigned int orientation) const;
virtual const fullMatrix<double>&
getPreEvaluatedGradFunctions(unsigned int orientation) const;
virtual unsigned int getNOrientation(void) const;
virtual unsigned int getOrientation(const MElement& element) const;
getPreEvaluatedDerivatives(unsigned int orientation) const;
const fullMatrix<double>& getCoefficient(void) const;
const fullMatrix<double>& getMonomial(void) const;
......
#include "BasisLocalScalar.h"
BasisLocalScalar::BasisLocalScalar(void){
scalar = true;
}
BasisLocalScalar::~BasisLocalScalar(void){
}
#ifndef _BASISLOCALSCALAR_H_
#define _BASISLOCALSCALAR_H_
#include "BasisLocal.h"
#include "MElement.h"
#include "fullMatrix.h"
/**
@interface BasisLocalScalar
@brief Common Interface for all
@em Scalar Local Basis
This class is the @em common @em interface for all
@em scalar Local Basis.@n
*/
class BasisLocalScalar: public BasisLocal{
public:
virtual ~BasisLocalScalar(void);
virtual fullMatrix<double>* getFunctions(const MElement& element,
double u, double v, double w) const = 0;
virtual fullMatrix<double>* getFunctions(unsigned int orientation,
double u, double v, double w) const = 0;
virtual void preEvaluateFunctions (const fullMatrix<double>& point) const = 0;
virtual void preEvaluateGradFunctions(const fullMatrix<double>& point) const = 0;
virtual const fullMatrix<double>&
getPreEvaluatedFunctions(const MElement& element) const = 0;
virtual const fullMatrix<double>&
getPreEvaluatedGradFunctions(const MElement& element) const = 0;
virtual const fullMatrix<double>&
getPreEvaluatedFunctions(unsigned int orientation) const = 0;
virtual const fullMatrix<double>&
getPreEvaluatedGradFunctions(unsigned int orientation) const = 0;
protected:
BasisLocalScalar(void);
};
/**
@internal
@fn BasisLocalScalar::BasisLocalScalar
Instantiates a new BasisLocalScalar
@endinternal
**
@fn BasisLocalScalar::~BasisLocalScalar
Deletes this BasisLocalScalar
**
@fn BasisLocalScalar::getFunctions(const MElement&, double, double, double) const
@param element A MElement
@param u A @c u coordinate in the reference space of this BasisLocal
@param v A @c v coordinate in the reference space of this BasisLocal
@param w A @c w coordinate in the reference space of this BasisLocal
@return Instanciates a new Matrix with the @em evaluation
of every basis function at the given coordinates, and for the
given element @em orientation
@note
The returned Matrix if of size BasisLocalScalar::getNFunction() @c x 1
@warning
The Instanciated Matrix must be deleted by the @em calling function
**
@fn BasisLocalScalar::getFunctions(unsigned int, double, double, double) const
@param orientation A natural number defining the reference space @em orientation
@param u A @c u coordinate in the reference space of this BasisLocal
@param v A @c v coordinate in the reference space of this BasisLocal
@param w A @c w coordinate in the reference space of this BasisLocal
@return Instanciates a new fullMatrix<double> with the @em evaluation
of every basis function at the given coordinates, and for the
given orientation
@note
The returned Matrix if of size BasisLocalScalar::getNFunction() @c x 1
@warning
The Instanciated Matrix must be deleted by the @em calling function
**
@fn BasisLocalScalar::preEvaluateFunctions
@param point A Matrix with points coordinate (each line is a point and got 3 coordinates, @em i.e. 3 rows)
@return Pre Evaluates every basis function at the given points
**
@fn BasisLocalScalar::preEvaluateGradFunctions
@param point A Matrix with points coordinate (each line is a point and got 3 coordinates, @em i.e. 3 rows)
@return Pre Evaluates every basis function @em gradient at the given points
**
@fn BasisLocalScalar::getPreEvaluatedFunctions(const MElement&) const
@param element A MElement
@return Returns a Matrix with the PreEvaluated basis functions
(see BasisLocalFunction::preEvaluateFunctions()), with the given
element @em orientation
@note
The returned Matrix is of size BasisLocalScalar::getNFunction() @c x @c number @c of @c
PreEvaluated @c points
@note
If no PreEvaluation has been done before calling this function,
an Exception is thrown
**
@fn BasisLocalScalar::getPreEvaluatedGradFunctions(const MElement&) const
@param element A MElement
@return Returns a Matrix with the PreEvaluated basis functions @em gradient
(see BasisLocalFunction::preEvaluateGradFunctions()), with the given
element @em orientation
@note
The returned Matrix is of size BasisLocalScalar::getNFunction() @c x @c ( @c number @c of @c PreEvaluated @c points @c x @c 3 @c ) @n
Each row is a succession of values in 3 coordinates
@note
If no PreEvaluation of the gradient has been done before calling this function,
an Exception is thrown
**
@fn BasisLocalScalar::getPreEvaluatedFunctions(unsigned int) const
@param orientation A number definig the orientation of the reference space
@return Same as BasisLocalScalar::getPreEvaluatedFunctions(const MElement&) const
but the orientation is not given by en element but by a number (@c orientation)
**
@fn BasisLocalScalar::getPreEvaluatedGradFunctions(unsigned int) const
@param orientation A number definig the orientation of the reference space
@return Same as BasisLocalScalar::getPreEvaluatedGradFunctions(const MElement&) const
but the orientation is not given by en element but by a number (@c orientation)
*/
#endif
#include "BasisLocalVector.h"
BasisLocalVector::BasisLocalVector(void){
scalar = false;
}
BasisLocalVector::~BasisLocalVector(void){
}
#ifndef _BASISLOCALVECTOR_H_
#define _BASISLOCALVECTOR_H_
#include "BasisLocal.h"
#include "MElement.h"
#include "fullMatrix.h"
/**
@interface BasisLocalVector
@brief Common Interface for all
@em Vectorial Local Basis
This class is the @em common @em interface for all
@em vectorial Local Basis.@n
*/
class BasisLocalVector: public BasisLocal{
public:
virtual ~BasisLocalVector(void);
virtual fullMatrix<double>* getFunctions(const MElement& element,
double u, double v, double w) const = 0;
virtual fullMatrix<double>* getFunctions(unsigned int orientation,
double u, double v, double w) const = 0;
virtual void preEvaluateFunctions (const fullMatrix<double>& point) const = 0;
virtual void preEvaluateCurlFunctions(const fullMatrix<double>& point) const = 0;
virtual void preEvaluateDivFunctions (const fullMatrix<double>& point) const = 0;
virtual const fullMatrix<double>&
getPreEvaluatedFunctions(const MElement& element) const = 0;
virtual const fullMatrix<double>&
getPreEvaluatedCurlFunctions(const MElement& element) const = 0;
virtual const fullMatrix<double>&
getPreEvaluatedDivFunctions(const MElement& element) const = 0;
virtual const fullMatrix<double>&
getPreEvaluatedFunctions(unsigned int orientation) const = 0;
virtual const fullMatrix<double>&
getPreEvaluatedCurlFunctions(unsigned int orientation) const = 0;
virtual const fullMatrix<double>&
getPreEvaluatedDivFunctions(unsigned int orientation) const = 0;
protected:
BasisLocalVector(void);
};
/**
@internal
@fn BasisLocalVector::BasisLocalVector
Instantiates a new BasisLocalVector
@endinternal
**
@fn BasisLocalVector::~BasisLocalVector
Deletes this BasisLocalVector
**
@fn BasisLocalVector::getFunctions(const MElement&, double, double, double) const
@param element A MElement
@param u A @c u coordinate in the reference space of this BasisLocal
@param v A @c v coordinate in the reference space of this BasisLocal
@param w A @c w coordinate in the reference space of this BasisLocal
@return Instanciates a new Matrix with the @em evaluation
of every basis function at the given coordinates, and for the
given element @em orientation
@note
The returned Matrix if of size BasisLocalVector::getNFunction() @c x 3@n
Each row is a succession of values in 3 coordinates
@warning
The Instanciated Matrix must be deleted by the @em calling function
**
@fn BasisLocalVector::getFunctions(unsigned int, double, double, double) const
@param orientation A natural number defining the reference space @em orientation
@param u A @c u coordinate in the reference space of this BasisLocal
@param v A @c v coordinate in the reference space of this BasisLocal
@param w A @c w coordinate in the reference space of this BasisLocal
@return Instanciates a new fullMatrix<double> with the @em evaluation
of every basis function at the given coordinates, and for the
given orientation
@note
The returned Matrix if of size BasisLocalVector::getNFunction() @c x 3@n
Each row is a succession of values in 3 coordinates
@warning
The Instanciated Matrix must be deleted by the @em calling function
**
@fn BasisLocalVector::preEvaluateFunctions
@param point A Matrix with points coordinate (each line is a point and got 3 coordinates, @em i.e. 3 rows)
@return Pre Evaluates every basis function at the given points
**
@fn BasisLocalVector::preEvaluateCurlFunctions
@param point A Matrix with points coordinate (each line is a point and got 3 coordinates, @em i.e. 3 rows)
@return Pre Evaluates every basis function @em curl at the given points
**
@fn BasisLocalVector::preEvaluateDivFunctions
@param point A Matrix with points coordinate (each line is a point and got 3 coordinates, @em i.e. 3 rows)
@return Pre Evaluates every basis function @em divergence at the given points
**
@fn BasisLocalVector::getPreEvaluatedFunctions(const MElement&) const
@param element A MElement
@return Returns a Matrix with the PreEvaluated basis functions
(see BasisLocalFunction::preEvaluateFunctions()), with the given
element @em orientation
@note
The returned Matrix is of size BasisLocalVector::getNFunction() @c x @c ( @c number @c of @c PreEvaluated @c points @c x @c 3 @c ) @n
Each row is a succession of values in 3 coordinates
@note
If no PreEvaluation has been done before calling this function,
an Exception is thrown
**
@fn BasisLocalVector::getPreEvaluatedCurlFunctions(const MElement&) const
@param element A MElement
@return Returns a Matrix with the PreEvaluated basis functions @em curl
(see BasisLocalFunction::preEvaluateCurlFunctions()), with the given
element @em orientation
@note
The returned Matrix is of size BasisLocalVector::getNFunction() @c x @c ( @c number @c of @c PreEvaluated @c points @c x @c 3 @c ) @n
Each row is a succession of values in 3 coordinates
@note
If no PreEvaluation of the curl has been done before calling this function,
an Exception is thrown
**
@fn BasisLocalVector::getPreEvaluatedDivFunctions(const MElement&) const
@param element A MElement
@return Returns a Matrix with the PreEvaluated basis functions @em divergence
(see BasisLocalFunction::preEvaluateDivFunctions()), with the given
element @em orientation
@note
The returned Matrix is of size BasisLocalVector::getNFunction() @c x @c number @c of @c
PreEvaluated @c points
@note
If no PreEvaluation of the divergence has been done before calling this function,
an Exception is thrown
**
@fn BasisLocalVector::getPreEvaluatedFunctions(unsigned int) const
@param orientation A number definig the orientation of the reference space
@return Same as BasisLocalVector::getPreEvaluatedFunctions(const MElement&) const
but the orientation is not given by en element but by a number (@c orientation)
**
@fn BasisLocalVector::getPreEvaluatedCurlFunctions(unsigned int) const
@param orientation A number definig the orientation of the reference space
@return Same as BasisLocalVector::getPreEvaluatedCurlFunctions(const MElement&) const
but the orientation is not given by en element but by a number (@c orientation)
**
@fn BasisLocalVector::getPreEvaluatedDivFunctions(unsigned int) const
@param orientation A number definig the orientation of the reference space
@return Same as BasisLocalVector::getPreEvaluatedDivFunctions(const MElement&) const
but the orientation is not given by en element but by a number (@c orientation)
*/
#endif
......@@ -13,11 +13,8 @@ set(SRC
TetReferenceSpace.cpp
Basis.cpp
BasisGenerator.cpp
BasisLocal.cpp
BasisLocalScalar.cpp
BasisLocalVector.cpp
BasisGenerator.cpp
BasisLagrange.cpp
BasisHierarchicalScalar.cpp
......
#include <vector>
#include "BasisLocalVector.h"
#include "Mapper.h"
#include "FunctionSpaceEdge.h"
......@@ -10,10 +9,6 @@ FunctionSpaceEdge::FunctionSpaceEdge(const GroupOfElement& goe,
int order){
// Build 1Form Basis //
build(goe, 1, order);
// Init BasisVector //
localBasisVector =
static_cast<const BasisLocalVector*>(localBasis);
}
FunctionSpaceEdge::~FunctionSpaceEdge(void){
......@@ -41,7 +36,7 @@ interpolate(const MElement& element,
// Get Basis Functions //
fullMatrix<double>* fun =
localBasisVector->getFunctions(element, uvw[0], uvw[1], uvw[2]);
localBasis->getFunctions(element, uvw[0], uvw[1], uvw[2]);
const unsigned int nFun = fun->size1();
......@@ -78,7 +73,7 @@ interpolateInRefSpace(const MElement& element,
// Get Basis Functions //
fullMatrix<double>* fun =
localBasisVector->getFunctions(element, uvw(0), uvw(1), uvw(2));
localBasis->getFunctions(element, uvw(0), uvw(1), uvw(2));
const unsigned int nFun = fun->size1();
......
#include <vector>
#include "BasisLocalScalar.h"
#include "Mapper.h"
#include "FunctionSpaceNode.h"
......@@ -10,10 +9,6 @@ FunctionSpaceNode::FunctionSpaceNode(const GroupOfElement& goe,
int order){
// Build 0Form Basis //
build(goe, 0, order);
// Init BasisScalar //
localBasisScalar =
static_cast<const BasisLocalScalar*>(localBasis);
}
FunctionSpaceNode::~FunctionSpaceNode(void){
......@@ -36,7 +31,7 @@ interpolate(const MElement& element,
// Get Basis Functions //
fullMatrix<double>* fun =
localBasisScalar->getFunctions(element, uvw[0], uvw[1], uvw[2]);
localBasis->getFunctions(element, uvw[0], uvw[1], uvw[2]);
const unsigned int nFun = fun->size1();
......@@ -58,7 +53,7 @@ interpolateInRefSpace(const MElement& element,
// Get Basis Functions //
fullMatrix<double>* fun =
localBasisScalar->getFunctions(element, uvw(0), uvw(1), uvw(2));
localBasis->getFunctions(element, uvw(0), uvw(1), uvw(2));
const unsigned int nFun = fun->size1();
......
......@@ -2,7 +2,6 @@
#define _FUNCTIONSPACESCALAR_H_
#include "Exception.h"
#include "BasisLocalScalar.h"
#include "FunctionSpace.h"
/**
......@@ -23,9 +22,6 @@
class FunctionSpaceScalar : public FunctionSpace{
protected:
const BasisLocalScalar* localBasisScalar;
public:
virtual ~FunctionSpaceScalar(void);
......@@ -168,18 +164,18 @@ class FunctionSpaceScalar : public FunctionSpace{
inline void FunctionSpaceScalar::
preEvaluateLocalFunctions(const fullMatrix<double>& point) const{
localBasisScalar->preEvaluateFunctions(point);
localBasis->preEvaluateFunctions(point);
}
inline void FunctionSpaceScalar::
preEvaluateGradLocalFunctions(const fullMatrix<double>& point) const{
localBasisScalar->preEvaluateGradFunctions(point);
localBasis->preEvaluateDerivatives(point);
}
inline const fullMatrix<double>&
FunctionSpaceScalar::getEvaluatedLocalFunctions(const MElement& element) const{
try{
return localBasisScalar->getPreEvaluatedFunctions(element);
return localBasis->getPreEvaluatedFunctions(element);
}
catch(Exception& any){
......@@ -190,7 +186,7 @@ FunctionSpaceScalar::getEvaluatedLocalFunctions(const MElement& element) const{
inline const fullMatrix<double>&
FunctionSpaceScalar::getEvaluatedGradLocalFunctions(const MElement& element) const{
try{
return localBasisScalar->getPreEvaluatedGradFunctions(element);
return localBasis->getPreEvaluatedDerivatives(element);
}
catch(Exception& any){
......@@ -201,7 +197,7 @@ FunctionSpaceScalar::getEvaluatedGradLocalFunctions(const MElement& element) con
inline const fullMatrix<double>&
FunctionSpaceScalar::getEvaluatedLocalFunctions(unsigned int orientation) const{
try{
return localBasisScalar->getPreEvaluatedFunctions(orientation);
return localBasis->getPreEvaluatedFunctions(orientation);
}
catch(Exception& any){
......@@ -212,7 +208,7 @@ FunctionSpaceScalar::getEvaluatedLocalFunctions(unsigned int orientation) const{
inline const fullMatrix<double>&
FunctionSpaceScalar::getEvaluatedGradLocalFunctions(unsigned int orientation) const{
try{
return localBasisScalar->getPreEvaluatedGradFunctions(orientation);
return localBasis->getPreEvaluatedDerivatives(orientation);
}
catch(Exception& any){
......
......@@ -2,7 +2,6 @@
#define _FUNCTIONSPACEVECTOR_H_
#include "Exception.h"
#include "BasisLocalVector.h"
#include "FunctionSpace.h"
/**
......@@ -23,9 +22,6 @@
class FunctionSpaceVector : public FunctionSpace{
protected:
const BasisLocalVector* localBasisVector;
public:
virtual ~FunctionSpaceVector(void);
......@@ -205,23 +201,23 @@ class FunctionSpaceVector : public FunctionSpace{
inline void FunctionSpaceVector::
preEvaluateLocalFunctions(const fullMatrix<double>& point) const{
localBasisVector->preEvaluateFunctions(point);
localBasis->preEvaluateFunctions(point);
}
inline void FunctionSpaceVector::
preEvaluateCurlLocalFunctions(const fullMatrix<double>& point) const{
localBasisVector->preEvaluateCurlFunctions(point);
localBasis->preEvaluateDerivatives(point);
}
inline void FunctionSpaceVector::
preEvaluateDivLocalFunctions(const fullMatrix<double>& point) const{
localBasisVector->preEvaluateDivFunctions(point);
localBasis->preEvaluateDerivatives(point);
}
inline const fullMatrix<double>&
FunctionSpaceVector::getEvaluatedLocalFunctions(const MElement& element) const{
try{
return localBasisVector->getPreEvaluatedFunctions(element);
return localBasis->getPreEvaluatedFunctions(element);
}
catch(Exception& any){
......@@ -232,7 +228,7 @@ FunctionSpaceVector::getEvaluatedLocalFunctions(const MElement& element) const{
inline const fullMatrix<double>&
FunctionSpaceVector::getEvaluatedCurlLocalFunctions(const MElement& element) const{
try{
return localBasisVector->getPreEvaluatedCurlFunctions(element);
return localBasis->getPreEvaluatedDerivatives(element);
}
catch(Exception& any){
......@@ -243,7 +239,7 @@ FunctionSpaceVector::getEvaluatedCurlLocalFunctions(const MElement& element) con
inline const fullMatrix<double>&
FunctionSpaceVector::getEvaluatedDivLocalFunctions(const MElement& element) const{
try{
return localBasisVector->getPreEvaluatedFunctions(element);
return localBasis->getPreEvaluatedFunctions(element);
}
catch(Exception& any){
......@@ -254,7 +250,7 @@ FunctionSpaceVector::getEvaluatedDivLocalFunctions(const MElement& element) cons
inline const fullMatrix<double>&
FunctionSpaceVector::getEvaluatedLocalFunctions(unsigned int orientation) const{
try{
return localBasisVector->getPreEvaluatedFunctions(orientation);
return localBasis->getPreEvaluatedFunctions(orientation);
}
catch(Exception& any){
......@@ -265,7 +261,7 @@ FunctionSpaceVector::getEvaluatedLocalFunctions(unsigned int orientation) const{
inline const fullMatrix<double>&
FunctionSpaceVector::getEvaluatedCurlLocalFunctions(unsigned int orientation) const{
try{
return localBasisVector->getPreEvaluatedCurlFunctions(orientation);
return localBasis->getPreEvaluatedDerivatives(orientation);
}
catch(Exception& any){
......@@ -276,7 +272,7 @@ FunctionSpaceVector::getEvaluatedCurlLocalFunctions(unsigned int orientation) co
inline const fullMatrix<double>&
FunctionSpaceVector::getEvaluatedDivLocalFunctions(unsigned int orientation) const{
try{
return localBasisVector->getPreEvaluatedFunctions(orientation);
return localBasis->getPreEvaluatedFunctions(orientation);
}
catch(Exception& any){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment