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

Cleaning

parent 76f39b15
Branches
Tags
No related merge requests found
#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
......
#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();
}
......@@ -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{
......
#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();
}
......@@ -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{
......
#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();
}
......@@ -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
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment