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

FunctionSpace::getForm() and FunctionSpace::getOrder()

parent e73fdfae
Branches
Tags
No related merge requests found
...@@ -20,9 +20,7 @@ FunctionSpace::~FunctionSpace(void){ ...@@ -20,9 +20,7 @@ FunctionSpace::~FunctionSpace(void){
delete basis[i]; delete basis[i];
} }
void FunctionSpace::build(GroupOfElement& goe, void FunctionSpace::build(GroupOfElement& goe, string family){
size_t order, size_t form, string family){
// Save GroupOfElement & Mesh // // Save GroupOfElement & Mesh //
this->goe = &goe; this->goe = &goe;
this->mesh = &(goe.getMesh()); this->mesh = &(goe.getMesh());
......
...@@ -46,8 +46,10 @@ class FunctionSpace{ ...@@ -46,8 +46,10 @@ class FunctionSpace{
size_t fPerFace; size_t fPerFace;
size_t fPerCell; size_t fPerCell;
// Scalar Field ? // // Differential From & Order //
bool scalar; bool scalar;
size_t form;
size_t order;
// Dofs // // Dofs //
std::set<Dof> dof; std::set<Dof> dof;
...@@ -56,11 +58,14 @@ class FunctionSpace{ ...@@ -56,11 +58,14 @@ class FunctionSpace{
public: public:
virtual ~FunctionSpace(void); virtual ~FunctionSpace(void);
const std::vector<const Basis*>& getBasis(const MElement& element) const; const Basis& getBasis(const MElement& element) const;
const Basis& getBasis(size_t i) const; const Basis& getBasis(size_t i) const;
GroupOfElement& getSupport(void) const; GroupOfElement& getSupport(void) const;
bool isScalar(void) const;
bool isScalar(void) const;
size_t getForm(void) const;
size_t getOrder(void) const;
std::vector<Dof> getUnorderedKeys(const MElement& element) const; std::vector<Dof> getUnorderedKeys(const MElement& element) const;
std::vector<Dof> getKeys(const MElement& element) const; std::vector<Dof> getKeys(const MElement& element) const;
...@@ -72,8 +77,8 @@ class FunctionSpace{ ...@@ -72,8 +77,8 @@ class FunctionSpace{
protected: protected:
FunctionSpace(void); FunctionSpace(void);
void build(GroupOfElement& goe,
size_t order, size_t form, std::string family); void build(GroupOfElement& goe, std::string family);
void buildDof(void); void buildDof(void);
}; };
...@@ -135,9 +140,8 @@ class FunctionSpace{ ...@@ -135,9 +140,8 @@ class FunctionSpace{
// Inline Functions // // Inline Functions //
////////////////////// //////////////////////
inline const std::vector<const Basis*>& inline const Basis& FunctionSpace::getBasis(const MElement& element) const{
FunctionSpace::getBasis(const MElement& element) const{ return *basis[element.getType()];
return basis;
} }
inline const Basis& FunctionSpace::getBasis(size_t i) const{ inline const Basis& FunctionSpace::getBasis(size_t i) const{
...@@ -152,6 +156,14 @@ inline bool FunctionSpace::isScalar(void) const{ ...@@ -152,6 +156,14 @@ inline bool FunctionSpace::isScalar(void) const{
return scalar; return scalar;
} }
inline size_t FunctionSpace::getForm(void) const{
return form;
}
inline size_t FunctionSpace::getOrder(void) const{
return order;
}
inline const std::set<Dof>& FunctionSpace::getAllDofs(void) const{ inline const std::set<Dof>& FunctionSpace::getAllDofs(void) const{
return dof; return dof;
} }
......
...@@ -2,32 +2,35 @@ ...@@ -2,32 +2,35 @@
#include "FunctionSpaceScalar.h" #include "FunctionSpaceScalar.h"
FunctionSpaceScalar::FunctionSpaceScalar(GroupOfElement& goe, size_t order){ FunctionSpaceScalar::FunctionSpaceScalar(GroupOfElement& goe, size_t order){
scalar = true; this->scalar = true;
build(goe, order, 0, "hierarchical"); this->form = 0;
this->order = order;
build(goe, "hierarchical");
} }
FunctionSpaceScalar::FunctionSpaceScalar(GroupOfElement& goe, size_t order, FunctionSpaceScalar::FunctionSpaceScalar(GroupOfElement& goe, size_t order,
std::string family){ std::string family){
scalar = true; this->scalar = true;
build(goe, order, 0, family); this->form = 0;
this->order = order;
build(goe, family);
} }
FunctionSpaceScalar::~FunctionSpaceScalar(void){ FunctionSpaceScalar::~FunctionSpaceScalar(void){
// Done by FunctionSpace // Done by FunctionSpace
} }
double FunctionSpaceScalar:: double FunctionSpaceScalar::interpolateInABC(const MElement& element,
interpolateInABC(const MElement& element, const std::vector<double>& coef,
const std::vector<double>& coef, double abc[3]) const{
double abc[3]) const{
// Element Type //
const int eType = element.getType();
// Get Basis Functions // // Get Basis Functions //
const size_t nFun = basis[eType]->getNFunction(); const Basis& basis = getBasis(element);
const size_t nFun = basis.getNFunction();
fullMatrix<double> fun(nFun, 1); fullMatrix<double> fun(nFun, 1);
basis[eType]->getFunctions(fun, element, abc[0], abc[1], abc[2]); basis.getFunctions(fun, element, abc[0], abc[1], abc[2]);
// Interpolate (in Reference Place) // // Interpolate (in Reference Place) //
double val = 0; double val = 0;
...@@ -48,14 +51,12 @@ interpolateDerivativeInABC(const MElement& element, ...@@ -48,14 +51,12 @@ interpolateDerivativeInABC(const MElement& element,
ReferenceSpaceManager::getJacobian(element, abc[0], abc[1], abc[2], invJac); ReferenceSpaceManager::getJacobian(element, abc[0], abc[1], abc[2], invJac);
invJac.invertInPlace(); invJac.invertInPlace();
// Element Type //
const int eType = element.getType();
// Get Basis Functions // // Get Basis Functions //
const size_t nFun = basis[eType]->getNFunction(); const Basis& basis = getBasis(element);
const size_t nFun = basis.getNFunction();
fullMatrix<double> fun(nFun, 3); fullMatrix<double> fun(nFun, 3);
basis[eType]->getDerivative(fun, element, abc[0], abc[1], abc[2]); basis.getDerivative(fun, element, abc[0], abc[1], abc[2]);
// Interpolate (in Reference Place) // // Interpolate (in Reference Place) //
fullMatrix<double> val(1, 3); fullMatrix<double> val(1, 3);
......
...@@ -2,14 +2,20 @@ ...@@ -2,14 +2,20 @@
#include "FunctionSpaceVector.h" #include "FunctionSpaceVector.h"
FunctionSpaceVector::FunctionSpaceVector(GroupOfElement& goe, size_t order){ FunctionSpaceVector::FunctionSpaceVector(GroupOfElement& goe, size_t order){
scalar = false; this->scalar = false;
build(goe, order, 1, "hierarchical"); this->form = 1;
this->order = order;
build(goe, "hierarchical");
} }
FunctionSpaceVector::FunctionSpaceVector(GroupOfElement& goe, size_t order, FunctionSpaceVector::FunctionSpaceVector(GroupOfElement& goe, size_t order,
std::string family){ std::string family){
scalar = false; this->scalar = false;
build(goe, order, 1, family); this->form = 1;
this->order = order;
build(goe, family);
} }
FunctionSpaceVector::~FunctionSpaceVector(void){ FunctionSpaceVector::~FunctionSpaceVector(void){
...@@ -26,14 +32,12 @@ interpolateInABC(const MElement& element, ...@@ -26,14 +32,12 @@ interpolateInABC(const MElement& element,
ReferenceSpaceManager::getJacobian(element, abc[0], abc[1], abc[2], invJac); ReferenceSpaceManager::getJacobian(element, abc[0], abc[1], abc[2], invJac);
invJac.invertInPlace(); invJac.invertInPlace();
// Element Type //
const int eType = element.getType();
// Get Basis Functions // // Get Basis Functions //
const size_t nFun = basis[eType]->getNFunction(); const Basis& basis = getBasis(element);
const size_t nFun = basis.getNFunction();
fullMatrix<double> fun(nFun, 3); fullMatrix<double> fun(nFun, 3);
basis[eType]->getFunctions(fun, element, abc[0], abc[1], abc[2]); basis.getFunctions(fun, element, abc[0], abc[1], abc[2]);
// Interpolate (in Reference Place) // // Interpolate (in Reference Place) //
fullMatrix<double> val(1, 3); fullMatrix<double> val(1, 3);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment