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

PreEvaluation of FunctionSpaceVector Functions -- All Simulations (vector and...

PreEvaluation of FunctionSpaceVector Functions -- All Simulations (vector and scalar) with PreEvaluation -- Seems OK
parent f8a5e02a
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,8 @@ FunctionSpaceScalar::FunctionSpaceScalar(void){
locPreEvaluated = false;
gradPreEvaluated = false;
evalLoc = NULL;
evalGrad = NULL;
}
FunctionSpaceScalar::~FunctionSpaceScalar(void){
......
......@@ -157,7 +157,7 @@ class FunctionSpaceScalar : public FunctionSpace{
to the given element (with correct @em closure)
@note
The returned values must be computed by
The returned values @em must be computed by
FunctionSpaceScalar::preEvaluateLocalFunctions(),
if not an Exception will be thrown
**
......@@ -169,7 +169,7 @@ class FunctionSpaceScalar : public FunctionSpace{
to the given element (with correct @em closure)
@note
The returned values must be computed by
The returned values @em must be computed by
FunctionSpaceScalar::preEvaluateGradLocalFunctions(),
if not an Exception will be thrown
*/
......
......@@ -8,6 +8,13 @@ FunctionSpaceVector::FunctionSpaceVector(void){
hasDiv = false;
divBasis = NULL;
locPreEvaluated = false;
curlPreEvaluated = false;
divPreEvaluated = false;
evalLoc = NULL;
evalCurl = NULL;
evalDiv = NULL;
}
FunctionSpaceVector::~FunctionSpaceVector(void){
......@@ -16,4 +23,68 @@ FunctionSpaceVector::~FunctionSpaceVector(void){
if(hasDiv)
delete divBasis;
if(locPreEvaluated)
delete evalLoc;
if(curlPreEvaluated)
delete evalCurl;
if(divPreEvaluated)
delete evalDiv;
}
void FunctionSpaceVector::
preEvaluateLocalFunctions(fullMatrix<double>& points){
// Delete Old Struct (if any) //
if(locPreEvaluated)
delete evalLoc;
// New Struct //
evalLoc = new EvaluatedBasisVector(*basisVector, points);
// PreEvaluated //
locPreEvaluated = true;
}
void FunctionSpaceVector::
preEvaluateCurlLocalFunctions(fullMatrix<double>& points){
// Got Curl Basis ? //
// --> mutable data
// --> Just a 'cache memory'
if(!hasCurl){
curlBasis = new CurlBasis(*basisVector);
hasCurl = true;
}
// Delete Old Struct (if any) //
if(curlPreEvaluated)
delete evalCurl;
// New Struct //
evalCurl = new EvaluatedBasisVector(*curlBasis, points);
// PreEvaluated //
curlPreEvaluated = true;
}
void FunctionSpaceVector::
preEvaluateDivLocalFunctions(fullMatrix<double>& points){
// Got Div Basis ? //
// --> mutable data
// --> Just a 'cache memory'
if(!hasDiv){
divBasis = new DivBasis(*basisVector);
hasDiv = true;
}
// Delete Old Struct (if any) //
if(divPreEvaluated)
delete evalDiv;
// New Struct //
evalDiv = new EvaluatedBasisScalar(*divBasis, points);
// PreEvaluated //
divPreEvaluated = true;
}
......@@ -2,9 +2,12 @@
#define _FUNCTIONSPACEVECTOR_H_
#include "fullMatrix.h"
#include "Exception.h"
#include "BasisVector.h"
#include "CurlBasis.h"
#include "DivBasis.h"
#include "EvaluatedBasisScalar.h"
#include "EvaluatedBasisVector.h"
#include "FunctionSpace.h"
/**
......@@ -34,6 +37,14 @@ class FunctionSpaceVector : public FunctionSpace{
mutable bool hasDiv;
mutable DivBasis* divBasis;
bool locPreEvaluated;
bool curlPreEvaluated;
bool divPreEvaluated;
EvaluatedBasisVector* evalLoc;
EvaluatedBasisVector* evalCurl;
EvaluatedBasisScalar* evalDiv;
public:
virtual ~FunctionSpaceVector(void);
......@@ -56,6 +67,19 @@ class FunctionSpaceVector : public FunctionSpace{
const std::vector<const Polynomial*>
getDivLocalFunctions(const MElement& element) const;
void preEvaluateLocalFunctions(fullMatrix<double>& points);
void preEvaluateCurlLocalFunctions(fullMatrix<double>& points);
void preEvaluateDivLocalFunctions(fullMatrix<double>& points);
const std::vector<const std::vector<fullVector<double> >*>
getEvaluatedLocalFunctions(const MElement& element) const;
const std::vector<const std::vector<fullVector<double> >*>
getEvaluatedCurlLocalFunctions(const MElement& element) const;
const std::vector<const std::vector<double>*>
getEvaluatedDivLocalFunctions(const MElement& element) const;
protected:
FunctionSpaceVector(void);
};
......@@ -122,6 +146,75 @@ class FunctionSpaceVector : public FunctionSpace{
@return Returns the @em divergence
of the basis functions associated
to the given element (with correct @em closure)
**
@fn FunctionSpaceVector::preEvaluateLocalFunctions
@param points A set of @c 3D Points
Precomputes the Local Functions of this FunctionSpace
at the given Points.
@note Each row of @c point is a new Point,
and each column is a coordinate (for a total of
3 columns)
**
@fn FunctionSpaceVector::preEvaluateCurlLocalFunctions
@param points A set of @c 3D Points
Precomputes the @em Curl of the Local Functions
of this FunctionSpace at the given Points.
@note Each row of @c point is a new Point,
and each column is a coordinate (for a total of
3 columns)
**
@fn FunctionSpaceVector::preEvaluateDivLocalFunctions
@param points A set of @c 3D Points
Precomputes the @em Divergence of the Local Functions
of this FunctionSpace at the given Points.
@note Each row of @c point is a new Point,
and each column is a coordinate (for a total of
3 columns)
**
@fn FunctionSpaceVector::getEvaluatedLocalFunctions
@param element A MElement
@return Returns the @em values of the @em precomputed
Basis Functions associated
to the given element (with correct @em closure)
@note
The returned values @em must be computed by
FunctionSpaceVector::preEvaluateLocalFunctions(),
if not an Exception will be thrown
**
@fn FunctionSpaceVector::getEvaluatedCurlLocalFunctions
@param element A MElement
@return Returns the @em values of the @em precomputed
@em Curls of the Basis Functions associated
to the given element (with correct @em closure)
@note
The returned values @em must be computed by
FunctionSpaceVector::preEvaluateCurlLocalFunctions(),
if not an Exception will be thrown
**
@fn FunctionSpaceVector::getEvaluatedDivLocalFunctions
@param element A MElement
@return Returns the @em values of the @em precomputed
@em Divergences of the Basis Functions associated
to the given element (with correct @em closure)
@note
The returned values @em must be computed by
FunctionSpaceVector::preEvaluateDivLocalFunctions(),
if not an Exception will be thrown
*/
//////////////////////
......@@ -161,4 +254,28 @@ FunctionSpaceVector::getDivLocalFunctions(const MElement& element) const{
return locBasis(element, *divBasis);
}
inline const std::vector<const std::vector<fullVector<double> >*>
FunctionSpaceVector::getEvaluatedLocalFunctions(const MElement& element) const{
if(!locPreEvaluated)
throw Exception("Local Basis Functions not PreEvaluated");
return locEvalBasis(element, *evalLoc);
}
inline const std::vector<const std::vector<fullVector<double> >*>
FunctionSpaceVector::getEvaluatedCurlLocalFunctions(const MElement& element) const{
if(!curlPreEvaluated)
throw Exception("Curls of Local Basis Functions not PreEvaluated");
return locEvalBasis(element, *evalCurl);
}
inline const std::vector<const std::vector<double>*>
FunctionSpaceVector::getEvaluatedDivLocalFunctions(const MElement& element) const{
if(!divPreEvaluated)
throw Exception("Divergences of Local Basis Functions not PreEvaluated");
return locEvalBasis(element, *evalDiv);
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment