diff --git a/FunctionSpace/Basis.h b/FunctionSpace/Basis.h index e3b6647aeca08f551aaeae40ca46a1d38351c461..4c272d9988e2ebc93bc9b7cfc75ab6cfc614f4ee 100644 --- a/FunctionSpace/Basis.h +++ b/FunctionSpace/Basis.h @@ -1,6 +1,8 @@ #ifndef _BASIS_H_ #define _BASIS_H_ +#include <string> + /** @interface Basis @brief Common Interface of all Basis @@ -81,6 +83,9 @@ class Basis{ //! (or Vector%s of Polynomial%s) in the Basis int getSize(void) const; + //! @return Returns the Basis String + virtual std::string toString(void) const = 0; + protected: //! @internal //! Instantiate a new Basis diff --git a/FunctionSpace/BasisScalar.cpp b/FunctionSpace/BasisScalar.cpp index e902527ff83168f8c2fb0593af5f0422edb8bcbf..bf2851f452cc44dba16d1de11d13523c329edb1b 100644 --- a/FunctionSpace/BasisScalar.cpp +++ b/FunctionSpace/BasisScalar.cpp @@ -1,8 +1,20 @@ +#include <sstream> #include "BasisScalar.h" +using namespace std; + BasisScalar::BasisScalar(void){ scalar = true; } BasisScalar::~BasisScalar(void){ } + +string BasisScalar::toString(void) const{ + stringstream stream; + + for(int i = 0; i < size; i++) + stream << (*basis)[i]->toString() << endl; + + return stream.str(); +} diff --git a/FunctionSpace/BasisScalar.h b/FunctionSpace/BasisScalar.h index 79b32e70ad438eb9f1b4cced66f4cd9bc82af5f7..2b5380377147e138c5300c5d7d6087f256d2a08c 100644 --- a/FunctionSpace/BasisScalar.h +++ b/FunctionSpace/BasisScalar.h @@ -37,6 +37,8 @@ class BasisScalar: public Basis{ //! defining this (scalar) Basis, for the given closure const std::vector<const Polynomial*>& getFunctions(unsigned int closure) const; + virtual std::string toString(void) const; + protected: //! @internal //! Instantiates a new BasisScalar @@ -49,13 +51,6 @@ class BasisScalar: public Basis{ // Inline Functions // ////////////////////// -inline -const std::vector<const Polynomial*>& BasisScalar:: -getFunctions(void) const{ - - return *basis; -} - inline const std::vector<const Polynomial*>& BasisScalar:: getFunctions(unsigned int closure) const{ diff --git a/FunctionSpace/BasisVector.cpp b/FunctionSpace/BasisVector.cpp index e1d389822e737f0931e275861a4f366468e75bd5..6eea126b472f214b22ffe5e4ab676eb90ed9ed3e 100644 --- a/FunctionSpace/BasisVector.cpp +++ b/FunctionSpace/BasisVector.cpp @@ -1,8 +1,23 @@ +#include <sstream> #include "BasisVector.h" +using namespace std; + BasisVector::BasisVector(void){ scalar = false; } BasisVector::~BasisVector(void){ } + +string BasisVector::toString(void) const{ + stringstream stream; + + for(int i = 0; i < size; i++) + stream << "[" << (*basis)[i]->at(0).toString() << "]" << endl + << "[" << (*basis)[i]->at(1).toString() << "]" << endl + << "[" << (*basis)[i]->at(2).toString() << "]" << endl + << endl; + + return stream.str(); +} diff --git a/FunctionSpace/BasisVector.h b/FunctionSpace/BasisVector.h index 6344f5229c6ea5dde4ae0617c137a587384f07c9..66831266d4f2a3fa7c83303a222df62aef21f49d 100644 --- a/FunctionSpace/BasisVector.h +++ b/FunctionSpace/BasisVector.h @@ -28,16 +28,14 @@ class BasisVector: public Basis{ //! virtual ~BasisVector(void); - //! @return Returns the set of @em Polynomial%s - //! defining this (vectorial) Basis - const std::vector<const std::vector<Polynomial>*>& getFunctions(void) const; - //! @param closure A natural number //! @return Returns the set of @em Polynomial%s //! defining this (scalar) Basis, for the given closure const std::vector<const std::vector<Polynomial>*>& getFunctions(unsigned int closure) const; + virtual std::string toString(void) const; + protected: //! @internal //! Instantiate a new BasisVector @@ -50,13 +48,6 @@ class BasisVector: public Basis{ // Inline Functions // ////////////////////// -inline -const std::vector<const std::vector<Polynomial>*>& BasisVector:: -getFunctions(void) const{ - - return *basis; -} - inline const std::vector<const std::vector<Polynomial>*>& BasisVector:: getFunctions(unsigned int closure) const{ diff --git a/FunctionSpace/FunctionSpace.cpp b/FunctionSpace/FunctionSpace.cpp index 496ab8899d2cf8796d8c266c2b642f9e1f154d9a..d30040297e206cb620a0cfddba6a6aa506d9c86d 100644 --- a/FunctionSpace/FunctionSpace.cpp +++ b/FunctionSpace/FunctionSpace.cpp @@ -1,7 +1,7 @@ +#include <sstream> #include "FunctionSpace.h" #include "BasisGenerator.h" - using namespace std; FunctionSpace::FunctionSpace(void){ @@ -193,28 +193,6 @@ vector<Dof> FunctionSpace::getKeys(const MElement& elem) const{ return myDof; } -int FunctionSpace::getElementType(const Dof& dof) const{ - // Get Entity // - const unsigned int entity = dof.getEntity(); - - // Total Number of Entities // - const unsigned int nVertex = mesh->getVertexNumber(); - const unsigned int nEdge = mesh->getEdgeNumber(); - const unsigned int nFace = mesh->getFaceNumber(); - - // Vertex Based - if(entity < nVertex) - return 0; - - // Edge Based - else if(entity < nVertex + nEdge) - return 1; - - // Face Based - else if(entity < nVertex + nEdge + nFace) - return 2; - - // Cell Based - else - return 3; +string FunctionSpace::toString(void) const{ + return basis->toString(); } diff --git a/FunctionSpace/FunctionSpace.h b/FunctionSpace/FunctionSpace.h index 79faa45b5eebffaa5a5a69d4d194b25ae830da19..e945a8dbb9646a05218c1f361cfa0779368f0ed5 100644 --- a/FunctionSpace/FunctionSpace.h +++ b/FunctionSpace/FunctionSpace.h @@ -3,6 +3,7 @@ #include <map> #include <vector> +#include <string> #include "Basis.h" #include "Dof.h" @@ -66,8 +67,7 @@ class FunctionSpace{ std::vector<Dof> getKeys(const MEdge& edge) const; std::vector<Dof> getKeys(const MFace& face) const; - int getElementType(const Dof& dof) const; - int getElementGlobalId(const Dof& dof) const; + std::string toString(void) const; protected: FunctionSpace(void); @@ -145,40 +145,9 @@ class FunctionSpace{ @param face A MFace @return Returns all the Dof%s associated to the given MFace ** - - @fn FunctionSpace::getElementType - @param dof A Dof - @return Returns the @em type of the @em element, - to which the given Dof is @em associated - - @note - Type is equal to: - @li @c 0, if the element is a @em Vertex - @li @c 1, if the element is an @em Edge - @li @c 2, if the element is a @em Face - @li @c 3, if the element is a @em Cell - - @warning - There are no error recovery if - the Element is not in the Mesh - @todo - Error recovery if - the Element is not in the Mesh - ** - - @fn FunctionSpace::getElementGlobalId - @param dof A Dof - @return Returns the @em Mesh @em Global @em @c ID of - the Element, to which the given Dof is @em associated - - @warning - There are no error recovery if - the Element is not in the Mesh - - @todo - Error recovery if - the Element is not in the Mesh + @fn FunctionSpace::toString + @return Returns the FunctionSpace string ** @internal @@ -191,6 +160,13 @@ class FunctionSpace{ Initializes a FunctionSpace with the given parameters @endinternal + ** + + @internal + @fn FunctionSpace::closure + + Compute closure for Basis Functions + @endinternal */ @@ -222,8 +198,4 @@ inline unsigned int FunctionSpace::getNFunctionPerCell(const MElement& element) return fPerCell; } -inline int FunctionSpace::getElementGlobalId(const Dof& dof) const{ - return dof.getEntity(); -} - #endif diff --git a/FunctionSpace/FunctionSpaceScalar.h b/FunctionSpace/FunctionSpaceScalar.h index 85f5f21e381a93f3020ec97adac62f37e86a7c93..7f1b536cb382db8f2b4e386919195484367fb168 100644 --- a/FunctionSpace/FunctionSpaceScalar.h +++ b/FunctionSpace/FunctionSpaceScalar.h @@ -60,6 +60,12 @@ class FunctionSpaceScalar : public FunctionSpace{ ---> check ** + @fn FunctionSpaceScalar::getLocalFunctions + @param element A MElement + @return Returns the basis functions associated + to the given element (with correct @em closure) + ** + @fn FunctionSpaceScalar::getBasis @param element A MElement of the support of this FunctionSpace diff --git a/FunctionSpace/FunctionSpaceVector.h b/FunctionSpace/FunctionSpaceVector.h index 8c7f5fb3ae4d62b30a8bc6fdc490212403b32bf7..30d2ddb9140a9b6ce11cebdbe7b80e1bbfdd8dce 100644 --- a/FunctionSpace/FunctionSpaceVector.h +++ b/FunctionSpace/FunctionSpaceVector.h @@ -60,6 +60,12 @@ class FunctionSpaceVector : public FunctionSpace{ ---> check ** + @fn FunctionSpaceVector::getLocalFunctions + @param element A MElement + @return Returns the basis functions associated + to the given element (with correct @em closure) + ** + @fn FunctionSpaceVector::getBasis @param element A MElement of the support of this FunctionSpace