From 2dae124a77a040fa9a23f2fcdbce68911fea641f Mon Sep 17 00:00:00 2001 From: Nicolas Marsic <nicolas.marsic@gmail.com> Date: Thu, 17 Jan 2013 13:28:38 +0000 Subject: [PATCH] Orientation in FunctionSpace.h --- FunctionSpace/Basis.h | 36 ++++--- FunctionSpace/BasisHierarchicalScalar.cpp | 68 ++++++++----- FunctionSpace/BasisHierarchicalScalar.h | 27 +++-- FunctionSpace/BasisHierarchicalVector.cpp | 93 ++++++++++------- FunctionSpace/BasisHierarchicalVector.h | 36 ++++--- FunctionSpace/BasisLagrange.cpp | 58 +++++++---- FunctionSpace/BasisLagrange.h | 41 +++++--- FunctionSpace/BasisLocalScalar.h | 40 ++++++-- FunctionSpace/BasisLocalVector.h | 62 ++++++++---- FunctionSpace/FunctionSpace.h | 65 ++++++++---- FunctionSpace/FunctionSpaceScalar.h | 88 +++++++++++----- FunctionSpace/FunctionSpaceVector.h | 117 +++++++++++++++++----- 12 files changed, 506 insertions(+), 225 deletions(-) diff --git a/FunctionSpace/Basis.h b/FunctionSpace/Basis.h index d729ec8e89..a0ae3dd131 100644 --- a/FunctionSpace/Basis.h +++ b/FunctionSpace/Basis.h @@ -1,13 +1,15 @@ #ifndef _BASIS_H_ #define _BASIS_H_ +#include "MElement.h" + /** @interface Basis @brief Common Interface of all Basis This class is the @em common @em interface for all Basis.@n - A Basis is @em set of @em linearly @em independent Polynomial%s + A Basis is @em set of @em linearly @em independent Polynomial%s (or Vector%s of Polynomial%s).@n */ @@ -33,23 +35,23 @@ class Basis{ virtual ~Basis(void); //! @return Returns: - //! @li @c true, if this is a + //! @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 + //! Scalar basis are sets of //! Polynomial%s@n - //! Vectorial basis are sets of - //! Vector%s of Polynomial%s + //! Vectorial basis are sets of + //! Vector%s of Polynomial%s bool isScalar(void) const; //! @return Returns: - //! @li @c true, if this is a - //! @em Local Basis + //! @li @c true, if this is a + //! @em Local Basis //! @li @c false, if this is a - //! @em Global Basis + //! @em Global Basis bool isLocal(void) const; //! @return Returns the @em polynomial @em order of the Basis @@ -61,8 +63,8 @@ class Basis{ //! @li 2 for 2-form //! @li 3 for 3-form unsigned int getType(void) const; - - //! @return Returns the @em dimension + + //! @return Returns the @em dimension //! (1D, 2D or 3D) of the Basis unsigned int getDim(void) const; @@ -82,11 +84,21 @@ class Basis{ //! @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 + //! @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 + 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; + protected: //! @internal //! Instantiate a new Basis diff --git a/FunctionSpace/BasisHierarchicalScalar.cpp b/FunctionSpace/BasisHierarchicalScalar.cpp index d56e1297ac..7c50c5ab8f 100644 --- a/FunctionSpace/BasisHierarchicalScalar.cpp +++ b/FunctionSpace/BasisHierarchicalScalar.cpp @@ -23,10 +23,10 @@ BasisHierarchicalScalar::~BasisHierarchicalScalar(void){ for(unsigned int i = 0; i < nRefSpace; i++){ for(unsigned int j = 0; j < nFunction; j++) delete grad[i][j]; - + delete[] grad[i]; } - + delete[] grad; } @@ -41,15 +41,15 @@ BasisHierarchicalScalar::~BasisHierarchicalScalar(void){ if(preEvaluatedGrad){ for(unsigned int i = 0; i < nRefSpace; i++) delete preEvaluatedGradFunction[i]; - + delete[] preEvaluatedGradFunction; } } fullMatrix<double>* BasisHierarchicalScalar:: -getFunctions(const MElement& element, +getFunctions(const MElement& element, double u, double v, double w) const{ - + // Alloc Memory // fullMatrix<double>* values = new fullMatrix<double>(nFunction, 1); @@ -59,7 +59,7 @@ getFunctions(const MElement& element, // Fill Matrix // for(unsigned int i = 0; i < nFunction; i++) (*values)(i, 0) = basis[orientation][i]->at(u, v, w); - + // Return // return values; } @@ -67,14 +67,14 @@ getFunctions(const MElement& element, fullMatrix<double>* BasisHierarchicalScalar:: getFunctions(unsigned int orientation, double u, double v, double w) const{ - + // Alloc Memory // fullMatrix<double>* values = new fullMatrix<double>(nFunction, 1); // Fill Matrix // for(unsigned int i = 0; i < nFunction; i++) (*values)(i, 0) = basis[orientation][i]->at(u, v, w); - + // Return // return values; } @@ -85,7 +85,7 @@ preEvaluateFunctions(const fullMatrix<double>& point) const{ if(preEvaluated){ for(unsigned int i = 0; i < nRefSpace; i++) delete preEvaluatedFunction[i]; - + delete[] preEvaluatedFunction; } @@ -94,14 +94,14 @@ preEvaluateFunctions(const fullMatrix<double>& point) const{ preEvaluatedFunction = new fullMatrix<double>*[nRefSpace]; for(unsigned int i = 0; i < nRefSpace; i++) - preEvaluatedFunction[i] = + preEvaluatedFunction[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++) - (*preEvaluatedFunction[i])(j, k) = + (*preEvaluatedFunction[i])(j, k) = basis[i][j]->at(point(k, 0), point(k, 1), point(k, 2)); @@ -120,17 +120,17 @@ preEvaluateGradFunctions(const fullMatrix<double>& point) const{ if(preEvaluatedGrad){ for(unsigned int i = 0; i < nRefSpace; i++) delete preEvaluatedGradFunction[i]; - + delete[] preEvaluatedGradFunction; } // Alloc // const unsigned int nPoint = point.size1(); - const unsigned int nPoint3 = nPoint * 3; + const unsigned int nPoint3 = nPoint * 3; preEvaluatedGradFunction = new fullMatrix<double>*[nRefSpace]; for(unsigned int i = 0; i < nRefSpace; i++) - preEvaluatedGradFunction[i] = + preEvaluatedGradFunction[i] = new fullMatrix<double>(nFunction, nPoint3); // Fill Matrix // @@ -143,32 +143,52 @@ preEvaluateGradFunctions(const fullMatrix<double>& point) const{ point(k, 0), point(k, 1), point(k, 2)); - + (*preEvaluatedGradFunction[i])(j, 3 * k) = tmp(0); (*preEvaluatedGradFunction[i])(j, 3 * k + 1) = tmp(1); (*preEvaluatedGradFunction[i])(j, 3 * k + 2) = tmp(2); } } } - + // PreEvaluated // - preEvaluatedGrad = true; + preEvaluatedGrad = true; } const fullMatrix<double>& BasisHierarchicalScalar:: getPreEvaluatedFunctions(const MElement& element) const{ + return getPreEvaluatedFunctions(refSpace->getPermutation(element)); +} + +const fullMatrix<double>& BasisHierarchicalScalar:: +getPreEvaluatedGradFunctions(const MElement& element) const{ + return getPreEvaluatedGradFunctions(refSpace->getPermutation(element)); +} + +const fullMatrix<double>& BasisHierarchicalScalar:: +getPreEvaluatedFunctions(unsigned int orientation) const{ if(!preEvaluated) throw Exception("getPreEvaluatedFunction: function has not been preEvaluated"); - return *preEvaluatedFunction[refSpace->getPermutation(element)]; + return *preEvaluatedFunction[orientation]; } const fullMatrix<double>& BasisHierarchicalScalar:: -getPreEvaluatedGradFunctions(const MElement& element) const{ +getPreEvaluatedGradFunctions(unsigned int orientation) const{ if(!preEvaluatedGrad) throw Exception("getPreEvaluatedGradFunction: gradient has not been preEvaluated"); - return *preEvaluatedGradFunction[refSpace->getPermutation(element)]; + 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{ @@ -181,7 +201,7 @@ void BasisHierarchicalScalar::getGrad(void) const{ // Grad // for(unsigned int s = 0; s < nRefSpace; s++) for(unsigned int f = 0 ; f < nFunction; f++) - grad[s][f] = + grad[s][f] = new vector<Polynomial>(basis[s][f]->gradient()); // Has Grad // @@ -200,17 +220,17 @@ string BasisHierarchicalScalar::toString(void) const{ stream << "Edge Based:" << endl; for(; i < nVertex + nEdge; i++) - stream << "f(" << i + 1 << ") = " + stream << "f(" << i + 1 << ") = " << basis[refSpace][i]->toString() << endl; stream << "Face Based:" << endl; for(; i < nVertex + nEdge + nFace; i++) - stream << "f(" << i + 1 << ") = " + stream << "f(" << i + 1 << ") = " << basis[refSpace][i]->toString() << endl; stream << "Cell Based:" << endl; for(; i < nVertex + nEdge + nFace + nCell; i++) - stream << "f(" << i + 1 << ") = " + stream << "f(" << i + 1 << ") = " << basis[refSpace][i]->toString() << endl; return stream.str(); diff --git a/FunctionSpace/BasisHierarchicalScalar.h b/FunctionSpace/BasisHierarchicalScalar.h index 8275324888..d5901da837 100644 --- a/FunctionSpace/BasisHierarchicalScalar.h +++ b/FunctionSpace/BasisHierarchicalScalar.h @@ -9,7 +9,7 @@ /** @interface BasisHierarchicalScalar @brief Interface for Hierarchical Scalar Local Basis - + This is an interface for Hierarchical Scalar Local Basis.@n */ @@ -35,8 +35,8 @@ class BasisHierarchicalScalar: public BasisLocalScalar{ public: virtual ~BasisHierarchicalScalar(void); - - virtual fullMatrix<double>* getFunctions(const MElement& element, + + virtual fullMatrix<double>* getFunctions(const MElement& element, double u, double v, double w) const; virtual fullMatrix<double>* getFunctions(unsigned int orientation, @@ -45,12 +45,21 @@ class BasisHierarchicalScalar: public BasisLocalScalar{ virtual void preEvaluateFunctions (const fullMatrix<double>& point) const; virtual void preEvaluateGradFunctions(const fullMatrix<double>& point) const; - virtual const fullMatrix<double>& + virtual const fullMatrix<double>& getPreEvaluatedFunctions(const MElement& element) const; - virtual const fullMatrix<double>& + virtual const fullMatrix<double>& getPreEvaluatedGradFunctions(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; + std::string toString(void) const; protected: @@ -63,18 +72,18 @@ class BasisHierarchicalScalar: public BasisLocalScalar{ /** @internal @fn BasisHierarchicalScalar::BasisHierarchicalScalar - + Instanciates an new BasisHierarchicalScalar @endinternal ** @fn BasisHierarchicalScalar::~BasisHierarchicalScalar - + Deletes this BasisHierarchicalScalar ** - @fn BasisHierarchicalScalar::toString - @return Returns a string describing this + @fn BasisHierarchicalScalar::toString + @return Returns a string describing this BasisHierarchicalScalar */ diff --git a/FunctionSpace/BasisHierarchicalVector.cpp b/FunctionSpace/BasisHierarchicalVector.cpp index 84e08e529c..0c1be9289b 100644 --- a/FunctionSpace/BasisHierarchicalVector.cpp +++ b/FunctionSpace/BasisHierarchicalVector.cpp @@ -29,7 +29,7 @@ BasisHierarchicalVector::~BasisHierarchicalVector(void){ for(unsigned int i = 0; i < nRefSpace; i++){ for(unsigned int j = 0; j < nFunction; j++) delete curl[i][j]; - + delete[] curl[i]; } @@ -41,7 +41,7 @@ BasisHierarchicalVector::~BasisHierarchicalVector(void){ for(unsigned int i = 0; i < nRefSpace; i++){ for(unsigned int j = 0; j < nFunction; j++) delete div[i][j]; - + delete[] div[i]; } @@ -59,15 +59,15 @@ BasisHierarchicalVector::~BasisHierarchicalVector(void){ if(preEvaluatedCurl){ for(unsigned int i = 0; i < nRefSpace; i++) delete preEvaluatedCurlFunction[i]; - + delete[] preEvaluatedCurlFunction; } } fullMatrix<double>* BasisHierarchicalVector:: -getFunctions(const MElement& element, +getFunctions(const MElement& element, double u, double v, double w) const{ - + // Alloc Memory // fullMatrix<double>* values = new fullMatrix<double>(nFunction, 3); @@ -76,9 +76,9 @@ getFunctions(const MElement& element, // Fill Vector // for(unsigned int i = 0; i < nFunction; i++){ - fullVector<double> eval = + fullVector<double> eval = Polynomial::at(*basis[orientation][i], u, v, w); - + (*values)(i, 0) = eval(0); (*values)(i, 1) = eval(1); (*values)(i, 2) = eval(2); @@ -89,17 +89,17 @@ getFunctions(const MElement& element, } fullMatrix<double>* BasisHierarchicalVector:: -getFunctions(unsigned int orientation, +getFunctions(unsigned int orientation, double u, double v, double w) const{ - + // Alloc Memory // fullMatrix<double>* values = new fullMatrix<double>(nFunction, 3); // Fill Vector // for(unsigned int i = 0; i < nFunction; i++){ - fullVector<double> eval = + fullVector<double> eval = Polynomial::at(*basis[orientation][i], u, v, w); - + (*values)(i, 0) = eval(0); (*values)(i, 1) = eval(1); (*values)(i, 2) = eval(2); @@ -115,7 +115,7 @@ preEvaluateFunctions(const fullMatrix<double>& point) const{ if(preEvaluated){ for(unsigned int i = 0; i < nRefSpace; i++) delete preEvaluatedFunction[i]; - + delete[] preEvaluatedFunction; } @@ -125,7 +125,7 @@ preEvaluateFunctions(const fullMatrix<double>& point) const{ preEvaluatedFunction = new fullMatrix<double>*[nRefSpace]; for(unsigned int i = 0; i < nRefSpace; i++) - preEvaluatedFunction[i] = + preEvaluatedFunction[i] = new fullMatrix<double>(nFunction, nPoint3); // Fill Matrix // @@ -138,7 +138,7 @@ preEvaluateFunctions(const fullMatrix<double>& point) const{ point(k, 0), point(k, 1), point(k, 2)); - + (*preEvaluatedFunction[i])(j, 3 * k) = tmp(0); (*preEvaluatedFunction[i])(j, 3 * k + 1) = tmp(1); (*preEvaluatedFunction[i])(j, 3 * k + 2) = tmp(2); @@ -160,17 +160,17 @@ preEvaluateCurlFunctions(const fullMatrix<double>& point) const{ if(preEvaluatedCurl){ for(unsigned int i = 0; i < nRefSpace; i++) delete preEvaluatedCurlFunction[i]; - + delete[] preEvaluatedCurlFunction; } // Alloc // const unsigned int nPoint = point.size1(); - const unsigned int nPoint3 = nPoint * 3; + const unsigned int nPoint3 = nPoint * 3; preEvaluatedCurlFunction = new fullMatrix<double>*[nRefSpace]; for(unsigned int i = 0; i < nRefSpace; i++) - preEvaluatedCurlFunction[i] = + preEvaluatedCurlFunction[i] = new fullMatrix<double>(nFunction, nPoint3); // Fill Matrix // @@ -183,16 +183,16 @@ preEvaluateCurlFunctions(const fullMatrix<double>& point) const{ point(k, 0), point(k, 1), point(k, 2)); - + (*preEvaluatedCurlFunction[i])(j, 3 * k) = tmp(0); (*preEvaluatedCurlFunction[i])(j, 3 * k + 1) = tmp(1); (*preEvaluatedCurlFunction[i])(j, 3 * k + 2) = tmp(2); } } } - + // PreEvaluated // - preEvaluatedCurl = true; + preEvaluatedCurl = true; } void BasisHierarchicalVector:: @@ -205,7 +205,7 @@ preEvaluateDivFunctions(const fullMatrix<double>& point) const{ if(preEvaluatedDiv){ for(unsigned int i = 0; i < nRefSpace; i++) delete preEvaluatedDivFunction[i]; - + delete[] preEvaluatedDivFunction; } @@ -214,44 +214,69 @@ preEvaluateDivFunctions(const fullMatrix<double>& point) const{ preEvaluatedDivFunction = new fullMatrix<double>*[nRefSpace]; for(unsigned int i = 0; i < nRefSpace; i++) - preEvaluatedDivFunction[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) = + (*preEvaluatedDivFunction[i])(j, k) = div[i][j]->at(point(k, 0), point(k, 1), point(k, 2)); - + // PreEvaluated // - preEvaluatedDiv = true; + 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)); +} + +const fullMatrix<double>& BasisHierarchicalVector:: +getPreEvaluatedFunctions(unsigned int orientation) const{ if(!preEvaluated) throw Exception("getPreEvaluatedFunction: function has not been preEvaluated"); - return *preEvaluatedFunction[refSpace->getPermutation(element)]; + return *preEvaluatedFunction[orientation]; } const fullMatrix<double>& BasisHierarchicalVector:: -getPreEvaluatedCurlFunctions(const MElement& element) const{ +getPreEvaluatedCurlFunctions(unsigned int orientation) const{ if(!preEvaluatedCurl) throw Exception("getPreEvaluatedCurlFunction: curl has not been preEvaluated"); - return *preEvaluatedCurlFunction[refSpace->getPermutation(element)]; + return *preEvaluatedCurlFunction[orientation]; } const fullMatrix<double>& BasisHierarchicalVector:: -getPreEvaluatedDivFunctions(const MElement& element) const{ +getPreEvaluatedDivFunctions(unsigned int orientation) const{ if(!preEvaluatedDiv) throw Exception("getPreEvaluatedDivFunction: divergence has not been preEvaluated"); - return *preEvaluatedDivFunction[refSpace->getPermutation(element)]; + 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{ @@ -264,7 +289,7 @@ void BasisHierarchicalVector::getCurl(void) const{ // Curl // for(unsigned int s = 0; s < nRefSpace; s++) for(unsigned int f = 0 ; f < nFunction; f++) - curl[s][f] = + curl[s][f] = new vector<Polynomial>(Polynomial::curl(*basis[s][f])); // Has Curl // @@ -281,7 +306,7 @@ void BasisHierarchicalVector::getDiv(void) const{ // Div // for(unsigned int s = 0; s < nRefSpace; s++) for(unsigned int f = 0 ; f < nFunction; f++) - div[s][f] = + div[s][f] = new Polynomial(Polynomial::divergence(*basis[s][f])); // Has Div // @@ -302,7 +327,7 @@ string BasisHierarchicalVector::toString(void) const{ stream << "Edge Based:" << endl; for(; i < nVertex + nEdge; i++) - stream << " f(" << i + 1 << ") = " << endl + stream << " f(" << i + 1 << ") = " << endl << "\t[ " << (*basis[refSpace][i])[0].toString() << " ]" << endl << "\t[ " << (*basis[refSpace][i])[1].toString() << " ]" << endl << "\t[ " << (*basis[refSpace][i])[2].toString() << " ]" << endl; @@ -313,7 +338,7 @@ string BasisHierarchicalVector::toString(void) const{ << "\t[ " << (*basis[refSpace][i])[0].toString() << " ]" << endl << "\t[ " << (*basis[refSpace][i])[1].toString() << " ]" << endl << "\t[ " << (*basis[refSpace][i])[2].toString() << " ]" << endl; - + stream << "Cell Based:" << endl; for(; i < nVertex + nEdge + nFace + nCell; i++) stream << " f(" << i + 1 << ") = " << endl diff --git a/FunctionSpace/BasisHierarchicalVector.h b/FunctionSpace/BasisHierarchicalVector.h index 1add10aa92..bef7cab6e0 100644 --- a/FunctionSpace/BasisHierarchicalVector.h +++ b/FunctionSpace/BasisHierarchicalVector.h @@ -9,7 +9,7 @@ /** @interface BasisHierarchicalVector @brief Interface for Hierarchical Vectorial Local Basis - + This is an interface for Hierarchical Vectorial Local Basis.@n */ @@ -41,26 +41,38 @@ class BasisHierarchicalVector: public BasisLocalVector{ public: virtual ~BasisHierarchicalVector(void); - - virtual fullMatrix<double>* getFunctions(const MElement& element, + + virtual fullMatrix<double>* getFunctions(const MElement& element, double u, double v, double w) const; - virtual fullMatrix<double>* getFunctions(unsigned int orientation, + virtual fullMatrix<double>* getFunctions(unsigned int orientation, 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 const fullMatrix<double>& + + virtual const fullMatrix<double>& getPreEvaluatedFunctions(const MElement& element) const; - virtual const fullMatrix<double>& + virtual const fullMatrix<double>& getPreEvaluatedCurlFunctions(const MElement& element) const; - virtual const fullMatrix<double>& + virtual const fullMatrix<double>& getPreEvaluatedDivFunctions (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; + std::string toString(void) const; protected: @@ -74,18 +86,18 @@ class BasisHierarchicalVector: public BasisLocalVector{ /** @internal @fn BasisHierarchicalVector::BasisHierarchicalVector - + Instanciates an new BasisHierarchicalVector @endinternal ** @fn BasisHierarchicalVector::~BasisHierarchicalVector - + Deletes this BasisHierarchicalVector ** - @fn BasisHierarchicalVector::toString - @return Returns a string describing this + @fn BasisHierarchicalVector::toString + @return Returns a string describing this BasisHierarchicalVector */ diff --git a/FunctionSpace/BasisLagrange.cpp b/FunctionSpace/BasisLagrange.cpp index f79d787324..d05bd4cd1b 100644 --- a/FunctionSpace/BasisLagrange.cpp +++ b/FunctionSpace/BasisLagrange.cpp @@ -8,12 +8,12 @@ BasisLagrange::~BasisLagrange(void){ } fullMatrix<double>* BasisLagrange:: -getFunctions(const MElement& element, +getFunctions(const MElement& element, double u, double v, double w) const{ throw Exception("BasisLagrange::Not Implemented"); } -fullMatrix<double>* BasisLagrange::getFunctions(unsigned int orientation, +fullMatrix<double>* BasisLagrange::getFunctions(unsigned int orientation, double u, double v, double w) const{ throw Exception("BasisLagrange::Not Implemented"); @@ -29,9 +29,9 @@ fullMatrix<double>* BasisLagrange::getFunctions(unsigned int orientation, point(0, 2) = w; lBasis->f(point, tmp); - + *values = tmp.transpose(); // Otherwise not coherent with df !! - + // Return // return values; */ @@ -45,37 +45,57 @@ void BasisLagrange::preEvaluateGradFunctions(const fullMatrix<double>& point) co throw Exception("BasisLagrange::Not Implemented"); } -const fullMatrix<double>& +const fullMatrix<double>& BasisLagrange::getPreEvaluatedFunctions(const MElement& element) const{ throw Exception("BasisLagrange::Not Implemented"); } - -const fullMatrix<double>& + +const fullMatrix<double>& BasisLagrange::getPreEvaluatedGradFunctions(const MElement& element) const{ throw Exception("BasisLagrange::Not Implemented"); } +const fullMatrix<double>& +BasisLagrange::getPreEvaluatedFunctions(unsigned int orientation) const{ + throw Exception("BasisLagrange::Not Implemented"); +} + +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{ + throw Exception("BasisLagrange::Not Implemented"); +} + std::vector<double> BasisLagrange:: project(const MElement& element, const std::vector<double>& coef, const FunctionSpaceScalar& fSpace){ - + // Init New Coefs // const unsigned int size = lPoint->size1(); std::vector<double> newCoef(size); - + // Interpolation at Lagrange Points // for(unsigned int i = 0; i < size; i++){ fullVector<double> uvw(3); uvw(0) = (*lPoint)(i, 0); uvw(1) = (*lPoint)(i, 1); uvw(2) = (*lPoint)(i, 2); - - newCoef[i] = fSpace.interpolateInRefSpace(element, - coef, + + newCoef[i] = fSpace.interpolateInRefSpace(element, + coef, uvw); } - + // Return ; return newCoef; } @@ -84,23 +104,23 @@ std::vector<fullVector<double> > BasisLagrange:: project(const MElement& element, const std::vector<double>& coef, const FunctionSpaceVector& fSpace){ - + // Init New Coefs // const unsigned int size = lPoint->size1(); std::vector<fullVector<double> > newCoef(size); - + // Interpolation at Lagrange Points // for(unsigned int i = 0; i < size; i++){ fullVector<double> uvw(3); uvw(0) = (*lPoint)(i, 0); uvw(1) = (*lPoint)(i, 1); uvw(2) = (*lPoint)(i, 2); - - newCoef[i] = fSpace.interpolateInRefSpace(element, - coef, + + newCoef[i] = fSpace.interpolateInRefSpace(element, + coef, uvw); } - + // Return ; return newCoef; } diff --git a/FunctionSpace/BasisLagrange.h b/FunctionSpace/BasisLagrange.h index 513d7074a6..8c5b2a2a78 100644 --- a/FunctionSpace/BasisLagrange.h +++ b/FunctionSpace/BasisLagrange.h @@ -10,15 +10,15 @@ /** @interface BasisLagrange @brief Interface for Lagrange Basis - + This is an interface for Lagrange Basis.@n - + These Local Scalar Basis allow a @em Coefficient Matrix, and a Monomial Matrix, to be consulted.@n - + A vector from an Other Basis (set of Functions) can also be projected into a Lagrange Basis.@n - + @todo Add a method to get lagrange Point in polynomialBasis */ @@ -31,34 +31,43 @@ class BasisLagrange: public BasisLocalScalar{ public: virtual ~BasisLagrange(void); - virtual fullMatrix<double>* getFunctions(const MElement& element, + virtual fullMatrix<double>* getFunctions(const MElement& element, double u, double v, double w) const; - virtual fullMatrix<double>* getFunctions(unsigned int orientation, + virtual fullMatrix<double>* getFunctions(unsigned int orientation, double u, double v, double w) const; virtual void preEvaluateFunctions (const fullMatrix<double>& point) const; virtual void preEvaluateGradFunctions(const fullMatrix<double>& point) const; - virtual const fullMatrix<double>& + virtual const fullMatrix<double>& getPreEvaluatedFunctions(const MElement& element) const; - - virtual const fullMatrix<double>& + + virtual const fullMatrix<double>& getPreEvaluatedGradFunctions(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; + const fullMatrix<double>& getCoefficient(void) const; const fullMatrix<double>& getMonomial(void) const; - - std::vector<double> + + std::vector<double> project(const MElement& element, const std::vector<double>& coef, const FunctionSpaceScalar& fSpace); - - std::vector<fullVector<double> > + + std::vector<fullVector<double> > project(const MElement& element, const std::vector<double>& coef, const FunctionSpaceVector& fSpace); - + protected: BasisLagrange(void); }; @@ -67,13 +76,13 @@ class BasisLagrange: public BasisLocalScalar{ /** @internal @fn BasisLagrange::BasisLagrange - + Instanciates an new BasisLagrange @endinternal ** @fn BasisLagrange::~BasisLagrange - + Deletes this BasisLagrange ** diff --git a/FunctionSpace/BasisLocalScalar.h b/FunctionSpace/BasisLocalScalar.h index 53a88039e9..4546da1bb9 100644 --- a/FunctionSpace/BasisLocalScalar.h +++ b/FunctionSpace/BasisLocalScalar.h @@ -7,10 +7,10 @@ /** @interface BasisLocalScalar - @brief Common Interface for all + @brief Common Interface for all @em Scalar Local Basis - This class is the @em common @em interface for all + This class is the @em common @em interface for all @em scalar Local Basis.@n */ @@ -18,21 +18,27 @@ class BasisLocalScalar: public BasisLocal{ public: virtual ~BasisLocalScalar(void); - virtual fullMatrix<double>* getFunctions(const MElement& element, + virtual fullMatrix<double>* getFunctions(const MElement& element, double u, double v, double w) const = 0; - virtual fullMatrix<double>* getFunctions(unsigned int orientation, + 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>& + virtual const fullMatrix<double>& getPreEvaluatedFunctions(const MElement& element) const = 0; - - virtual const fullMatrix<double>& + + 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); }; @@ -41,13 +47,13 @@ class BasisLocalScalar: public BasisLocal{ /** @internal @fn BasisLocalScalar::BasisLocalScalar - + Instantiates a new BasisLocalScalar @endinternal ** @fn BasisLocalScalar::~BasisLocalScalar - + Deletes this BasisLocalScalar ** @@ -93,7 +99,7 @@ class BasisLocalScalar: public BasisLocal{ @return Pre Evaluates every basis function @em gradient at the given points ** - @fn BasisLocalScalar::getPreEvaluatedFunctions + @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 @@ -108,7 +114,7 @@ class BasisLocalScalar: public BasisLocal{ an Exception is thrown ** - @fn BasisLocalScalar::getPreEvaluatedGradFunctions + @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 @@ -121,6 +127,18 @@ class BasisLocalScalar: public BasisLocal{ @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 diff --git a/FunctionSpace/BasisLocalVector.h b/FunctionSpace/BasisLocalVector.h index 448184aa6c..78d618733a 100644 --- a/FunctionSpace/BasisLocalVector.h +++ b/FunctionSpace/BasisLocalVector.h @@ -7,10 +7,10 @@ /** @interface BasisLocalVector - @brief Common Interface for all + @brief Common Interface for all @em Vectorial Local Basis - This class is the @em common @em interface for all + This class is the @em common @em interface for all @em vectorial Local Basis.@n */ @@ -18,25 +18,34 @@ class BasisLocalVector: public BasisLocal{ public: virtual ~BasisLocalVector(void); - virtual fullMatrix<double>* getFunctions(const MElement& element, + virtual fullMatrix<double>* getFunctions(const MElement& element, double u, double v, double w) const = 0; - virtual fullMatrix<double>* getFunctions(unsigned int orientation, + 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>& + + virtual const fullMatrix<double>& getPreEvaluatedFunctions(const MElement& element) const = 0; - virtual const fullMatrix<double>& + virtual const fullMatrix<double>& getPreEvaluatedCurlFunctions(const MElement& element) const = 0; - virtual const fullMatrix<double>& + 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); }; @@ -45,13 +54,13 @@ class BasisLocalVector: public BasisLocal{ /** @internal @fn BasisLocalVector::BasisLocalVector - + Instantiates a new BasisLocalVector @endinternal ** @fn BasisLocalVector::~BasisLocalVector - + Deletes this BasisLocalVector ** @@ -66,7 +75,7 @@ class BasisLocalVector: public BasisLocal{ @note The returned Matrix if of size BasisLocalVector::getNFunction() @c x 3@n - Each row is a succession of values in 3 coordinates + Each row is a succession of values in 3 coordinates @warning The Instanciated Matrix must be deleted by the @em calling function @@ -83,7 +92,7 @@ class BasisLocalVector: public BasisLocal{ @note The returned Matrix if of size BasisLocalVector::getNFunction() @c x 3@n - Each row is a succession of values in 3 coordinates + Each row is a succession of values in 3 coordinates @warning The Instanciated Matrix must be deleted by the @em calling function @@ -104,7 +113,7 @@ class BasisLocalVector: public BasisLocal{ @return Pre Evaluates every basis function @em divergence at the given points ** - @fn BasisLocalVector::getPreEvaluatedFunctions + @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 @@ -112,14 +121,14 @@ class BasisLocalVector: public BasisLocal{ @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 + 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 + @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 @@ -127,14 +136,14 @@ class BasisLocalVector: public BasisLocal{ @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 + 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::getPreEvaluatedFunctions + @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 @@ -148,6 +157,23 @@ class BasisLocalVector: public BasisLocal{ 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 diff --git a/FunctionSpace/FunctionSpace.h b/FunctionSpace/FunctionSpace.h index a9a1cc9c30..60fdc83a15 100644 --- a/FunctionSpace/FunctionSpace.h +++ b/FunctionSpace/FunctionSpace.h @@ -21,19 +21,19 @@ /** @interface FunctionSpace @brief Common Interface of all Function Spaces - + This is the @em common @em interface of all Function Spaces.@n - A FunctionSpace is defined on a @em support, + 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. A FunctionSpace is also responsible for the generation of all the Dof%s and GroupOfDof%s related to its geometrical @em Support. - - @todo + + @todo Allow Hybrid Mesh */ @@ -55,8 +55,8 @@ class FunctionSpace{ std::set<const Dof*, DofComparator>* dof; std::vector<GroupOfDof*>* group; std::map< - const MElement*, - const GroupOfDof*, ElementComparator>* eToGod; + const MElement*, + const GroupOfDof*, ElementComparator>* eToGod; public: virtual ~FunctionSpace(void); @@ -81,11 +81,14 @@ class FunctionSpace{ const GroupOfDof& getGoDFromElement(const MElement& element) const; + unsigned int getNOrientation(void) const; + unsigned int getOrientation(const MElement& element) const; + unsigned int dofNumber(void) const; unsigned int groupNumber(void) const; protected: - // Init + // Init FunctionSpace(void); void build(const GroupOfElement& goe, @@ -93,7 +96,7 @@ class FunctionSpace{ // Dof void buildDof(void); - void insertDof(Dof& d, GroupOfDof* god); + void insertDof(Dof& d, GroupOfDof* god); }; @@ -109,7 +112,7 @@ class FunctionSpace{ ** @fn FunctionSpace::getSupport - @return Returns the support of this + @return Returns the support of this FunctionSpace ** @@ -120,7 +123,7 @@ class FunctionSpace{ @fn FunctionSpace::getType @return Return the @em type of - the Basis functions composing + the Basis functions composing this Function Space. @see Basis::getType() ** @@ -137,19 +140,19 @@ class FunctionSpace{ @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 @@ -160,17 +163,17 @@ class FunctionSpace{ @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 @@ -188,20 +191,34 @@ class FunctionSpace{ @fn FunctionSpace::getGoDFromElement @param element An Element of the FunctionSpace Support - @return Returns the @em GroupOfDof%s associated to + @return Returns the @em GroupOfDof%s associated to the given @em Element @note If the given Element is not in the FunctionSpace Support, an Exception is thrown - ** + ** + + @fn FunctionSpace::getNOrientation + @return Returns the number of + @em orientations of the + FunctionSpace reference space + @todo Multiple basis + ** + + @fn FunctionSpace::getOrientation + @param element A MElement + @return Returns a number charaterizing + the @em orientation of the given element + @todo Multiple basis + ** @fn FunctionSpace::dofNumber - @return Returns the number of Dof%s + @return Returns the number of Dof%s given by FunctionSpace::getAllDofs() ** @fn FunctionSpace::groupNumber - @return Returns the number of GroupOfDof%s + @return Returns the number of GroupOfDof%s given by FunctionSpace::getAllGroups() ** */ @@ -243,6 +260,14 @@ inline unsigned int FunctionSpace::getNFunctionPerCell(const MElement& element) return fPerCell; } +inline unsigned int FunctionSpace::getNOrientation(void) const{ + return localBasis->getNOrientation(); +} + +inline unsigned int FunctionSpace::getOrientation(const MElement& element) const{ + return localBasis->getOrientation(element); +} + inline unsigned int FunctionSpace::dofNumber(void) const{ return dof->size(); } diff --git a/FunctionSpace/FunctionSpaceScalar.h b/FunctionSpace/FunctionSpaceScalar.h index e3066a2a53..3bd4f65797 100644 --- a/FunctionSpace/FunctionSpaceScalar.h +++ b/FunctionSpace/FunctionSpaceScalar.h @@ -8,7 +8,7 @@ /** @interface FunctionSpaceScalar @brief Common Interface of all Scalar FunctionSpaces - + This is the @em common @em interface of all @em Scalar FunctionSpaces.@n @@ -29,16 +29,16 @@ class FunctionSpaceScalar : public FunctionSpace{ public: virtual ~FunctionSpaceScalar(void); - virtual double - interpolate(const MElement& element, + virtual double + interpolate(const MElement& element, const std::vector<double>& coef, const fullVector<double>& xyz) const = 0; - virtual double - interpolateInRefSpace(const MElement& element, + virtual double + interpolateInRefSpace(const MElement& element, const std::vector<double>& coef, const fullVector<double>& uvw) const = 0; - + void preEvaluateLocalFunctions(const fullMatrix<double>& point) const; void preEvaluateGradLocalFunctions(const fullMatrix<double>& point) const; @@ -47,7 +47,13 @@ class FunctionSpaceScalar : public FunctionSpace{ const fullMatrix<double>& getEvaluatedGradLocalFunctions(const MElement& element) const; - + + const fullMatrix<double>& + getEvaluatedLocalFunctions(unsigned int orientation) const; + + const fullMatrix<double>& + getEvaluatedGradLocalFunctions(unsigned int orientation) const; + protected: FunctionSpaceScalar(void); }; @@ -61,7 +67,7 @@ class FunctionSpaceScalar : public FunctionSpace{ @fn FunctionSpaceScalar::interpolate @param element The MElement to interpolate on @param coef The coefficients of the interpolation - @param xyz The coordinate + @param xyz The coordinate (of point @em inside the given @c element) of the interpolation in the @em Physical Space @@ -70,7 +76,7 @@ class FunctionSpaceScalar : public FunctionSpace{ @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 @@ -80,7 +86,7 @@ class FunctionSpaceScalar : public FunctionSpace{ @fn FunctionSpaceScalar::interpolateInRefSpace @param element The MElement to interpolate on @param coef The coefficients of the interpolation - @param uvw The coordinate + @param uvw The coordinate (of point @em inside the given @c element) of the interpolation in the @em Reference Space @@ -89,7 +95,7 @@ class FunctionSpaceScalar : public FunctionSpace{ @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 @@ -110,7 +116,7 @@ class FunctionSpaceScalar : public FunctionSpace{ @fn FunctionSpaceScalar::preEvaluateGradLocalFunctions @param point A set of @c 3D Points - Precomputes the @em Gradient of the Local Functions + Precomputes the @em Gradient of the Local Functions of this FunctionSpace at the given Points. @note Each row of @c point is a new Point, @@ -118,29 +124,43 @@ class FunctionSpaceScalar : public FunctionSpace{ 3 columns) ** - @fn FunctionSpaceScalar::getEvaluatedLocalFunctions + @fn FunctionSpaceScalar::getEvaluatedLocalFunctions(const MElement&) const @param element A MElement - @return Returns the @em values of the @em precomputed + @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 - FunctionSpaceScalar::preEvaluateLocalFunctions(), + FunctionSpaceScalar::preEvaluateLocalFunctions(), if not an Exception will be thrown ** - @fn FunctionSpaceScalar::getEvaluatedGradLocalFunctions + @fn FunctionSpaceScalar::getEvaluatedGradLocalFunctions(const MElement&) const @param element A MElement - @return Returns the @em values of the @em precomputed + @return Returns the @em values of the @em precomputed @em Gradients of the Basis Functions associated to the given element (with correct @em closure) - + @note The returned values @em must be computed by - FunctionSpaceScalar::preEvaluateGradLocalFunctions(), + FunctionSpaceScalar::preEvaluateGradLocalFunctions(), if not an Exception will be thrown - */ + ** + + @fn FunctionSpaceScalar::getEvaluatedLocalFunctions(unsigned int) const + @param orientation A number definig the orientation of the reference space + @return Same as + FunctionSpaceScalar::getEvaluatedLocalFunctions(const MElement&) const + but the orientation is not given by en element but by a number (@c orientation) + ** + + @fn FunctionSpaceScalar::getEvaluatedGradLocalFunctions(unsigned int) const + @param orientation A number definig the orientation of the reference space + @return Same as + FunctionSpaceScalar::getEvaluatedGradLocalFunctions(const MElement&) const + but the orientation is not given by en element but by a number (@c orientation) +*/ ////////////////////// // Inline Functions // @@ -161,7 +181,7 @@ FunctionSpaceScalar::getEvaluatedLocalFunctions(const MElement& element) const{ try{ return localBasisScalar->getPreEvaluatedFunctions(element); } - + catch(Exception& any){ throw Exception("Local Basis Functions not PreEvaluated"); } @@ -172,7 +192,29 @@ FunctionSpaceScalar::getEvaluatedGradLocalFunctions(const MElement& element) con try{ return localBasisScalar->getPreEvaluatedGradFunctions(element); } - + + catch(Exception& any){ + throw Exception("Gradient of Local Basis Functions not PreEvaluated"); + } +} + +inline const fullMatrix<double>& +FunctionSpaceScalar::getEvaluatedLocalFunctions(unsigned int orientation) const{ + try{ + return localBasisScalar->getPreEvaluatedFunctions(orientation); + } + + catch(Exception& any){ + throw Exception("Local Basis Functions not PreEvaluated"); + } +} + +inline const fullMatrix<double>& +FunctionSpaceScalar::getEvaluatedGradLocalFunctions(unsigned int orientation) const{ + try{ + return localBasisScalar->getPreEvaluatedGradFunctions(orientation); + } + catch(Exception& any){ throw Exception("Gradient of Local Basis Functions not PreEvaluated"); } diff --git a/FunctionSpace/FunctionSpaceVector.h b/FunctionSpace/FunctionSpaceVector.h index a61a5203e8..838f30ee49 100644 --- a/FunctionSpace/FunctionSpaceVector.h +++ b/FunctionSpace/FunctionSpaceVector.h @@ -8,7 +8,7 @@ /** @interface FunctionSpaceVector @brief Common Interface of all Vectorial FunctionSpaces - + This is the @em common @em interface of all @em Vectorial FunctionSpaces.@n @@ -29,20 +29,20 @@ class FunctionSpaceVector : public FunctionSpace{ public: virtual ~FunctionSpaceVector(void); - virtual fullVector<double> - interpolate(const MElement& element, + virtual fullVector<double> + interpolate(const MElement& element, const std::vector<double>& coef, const fullVector<double>& xyz) const = 0; - virtual fullVector<double> - interpolateInRefSpace(const MElement& element, + virtual fullVector<double> + interpolateInRefSpace(const MElement& element, const std::vector<double>& coef, const fullVector<double>& uvw) const = 0; void preEvaluateLocalFunctions(const fullMatrix<double>& point) const; void preEvaluateCurlLocalFunctions(const fullMatrix<double>& point) const; void preEvaluateDivLocalFunctions(const fullMatrix<double>& point) const; - + const fullMatrix<double>& getEvaluatedLocalFunctions(const MElement& element) const; @@ -52,6 +52,15 @@ class FunctionSpaceVector : public FunctionSpace{ const fullMatrix<double>& getEvaluatedDivLocalFunctions(const MElement& element) const; + const fullMatrix<double>& + getEvaluatedLocalFunctions(unsigned int orientation) const; + + const fullMatrix<double>& + getEvaluatedCurlLocalFunctions(unsigned int orientation) const; + + const fullMatrix<double>& + getEvaluatedDivLocalFunctions(unsigned int orientation) const; + protected: FunctionSpaceVector(void); }; @@ -65,7 +74,7 @@ class FunctionSpaceVector : public FunctionSpace{ @fn FunctionSpaceVector::interpolate @param element The MElement to interpolate on @param coef The coefficients of the interpolation - @param xyz The coordinate + @param xyz The coordinate (of point @em inside the given @c element) of the interpolation in the @em Physical Space @@ -74,7 +83,7 @@ class FunctionSpaceVector : public FunctionSpace{ @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 @@ -84,7 +93,7 @@ class FunctionSpaceVector : public FunctionSpace{ @fn FunctionSpaceVector::interpolateInRefSpace @param element The MElement to interpolate on @param coef The coefficients of the interpolation - @param uvw The coordinate + @param uvw The coordinate (of point @em inside the given @c element) of the interpolation in the @em Reference Space @@ -93,7 +102,7 @@ class FunctionSpaceVector : public FunctionSpace{ @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 @@ -114,7 +123,7 @@ class FunctionSpaceVector : public FunctionSpace{ @fn FunctionSpaceVector::preEvaluateCurlLocalFunctions @param point A set of @c 3D Points - Precomputes the @em Curl of the Local Functions + 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, @@ -125,7 +134,7 @@ class FunctionSpaceVector : public FunctionSpace{ @fn FunctionSpaceVector::preEvaluateDivLocalFunctions @param point A set of @c 3D Points - Precomputes the @em Divergence of the Local Functions + 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, @@ -133,40 +142,61 @@ class FunctionSpaceVector : public FunctionSpace{ 3 columns) ** - @fn FunctionSpaceVector::getEvaluatedLocalFunctions + @fn FunctionSpaceVector::getEvaluatedLocalFunctions(const MElement&) const @param element A MElement - @return Returns the @em values of the @em precomputed + @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(), + FunctionSpaceVector::preEvaluateLocalFunctions(), if not an Exception will be thrown ** - @fn FunctionSpaceVector::getEvaluatedCurlLocalFunctions + @fn FunctionSpaceVector::getEvaluatedCurlLocalFunctions(const MElement&) const @param element A MElement - @return Returns the @em values of the @em precomputed + @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(), + FunctionSpaceVector::preEvaluateCurlLocalFunctions(), if not an Exception will be thrown ** - @fn FunctionSpaceVector::getEvaluatedDivLocalFunctions + @fn FunctionSpaceVector::getEvaluatedDivLocalFunctions(const MElement&) const @param element A MElement - @return Returns the @em values of the @em precomputed + @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(), + FunctionSpaceVector::preEvaluateDivLocalFunctions(), if not an Exception will be thrown + ** + + @fn FunctionSpaceVector::getEvaluatedLocalFunctions(unsigned int) const + @param orientation A number definig the orientation of the reference space + @return Same as + FunctionSpaceVector::getEvaluatedLocalFunctions(const MElement&) const + but the orientation is not given by en element but by a number (@c orientation) + ** + + @fn FunctionSpaceVector::getEvaluatedCurlLocalFunctions(unsigned int) const + @param orientation A number definig the orientation of the reference space + @return Same as + FunctionSpaceVector::getEvaluatedCurlLocalFunctions(const MElement&) const + but the orientation is not given by en element but by a number (@c orientation) + ** + + @fn FunctionSpaceVector::getEvaluatedDivLocalFunctions(unsigned int) const + @param orientation A number definig the orientation of the reference space + @return Same as + FunctionSpaceVector::getEvaluatedDivLocalFunctions(const MElement&) const + but the orientation is not given by en element but by a number (@c orientation) */ ////////////////////// @@ -193,7 +223,7 @@ FunctionSpaceVector::getEvaluatedLocalFunctions(const MElement& element) const{ try{ return localBasisVector->getPreEvaluatedFunctions(element); } - + catch(Exception& any){ throw Exception("Local Basis Functions not PreEvaluated"); } @@ -204,7 +234,7 @@ FunctionSpaceVector::getEvaluatedCurlLocalFunctions(const MElement& element) con try{ return localBasisVector->getPreEvaluatedCurlFunctions(element); } - + catch(Exception& any){ throw Exception("Curl of Local Basis Functions not PreEvaluated"); } @@ -215,7 +245,40 @@ FunctionSpaceVector::getEvaluatedDivLocalFunctions(const MElement& element) cons try{ return localBasisVector->getPreEvaluatedFunctions(element); } - + + catch(Exception& any){ + throw Exception("Divergence of Local Basis Functions not PreEvaluated"); + } +} + +inline const fullMatrix<double>& +FunctionSpaceVector::getEvaluatedLocalFunctions(unsigned int orientation) const{ + try{ + return localBasisVector->getPreEvaluatedFunctions(orientation); + } + + catch(Exception& any){ + throw Exception("Local Basis Functions not PreEvaluated"); + } +} + +inline const fullMatrix<double>& +FunctionSpaceVector::getEvaluatedCurlLocalFunctions(unsigned int orientation) const{ + try{ + return localBasisVector->getPreEvaluatedCurlFunctions(orientation); + } + + catch(Exception& any){ + throw Exception("Curl of Local Basis Functions not PreEvaluated"); + } +} + +inline const fullMatrix<double>& +FunctionSpaceVector::getEvaluatedDivLocalFunctions(unsigned int orientation) const{ + try{ + return localBasisVector->getPreEvaluatedFunctions(orientation); + } + catch(Exception& any){ throw Exception("Divergence of Local Basis Functions not PreEvaluated"); } -- GitLab