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

Fix for getElementType()

parent 6f9f7314
No related branches found
No related tags found
No related merge requests found
#include "FunctionSpace.h" #include "FunctionSpace.h"
#include "BasisGenerator.h" #include "BasisGenerator.h"
using namespace std; using namespace std;
FunctionSpace::FunctionSpace(void){ FunctionSpace::FunctionSpace(void){
...@@ -31,7 +32,8 @@ void FunctionSpace::build(const GroupOfElement& goe, ...@@ -31,7 +32,8 @@ void FunctionSpace::build(const GroupOfElement& goe,
basis = BasisGenerator::generate(elementType, basis = BasisGenerator::generate(elementType,
basisType, basisType,
order); order);
// Number of *Per* Entity functions //
fPerVertex = basis->getNVertexBased() / nVertex; fPerVertex = basis->getNVertexBased() / nVertex;
// NB: fPreVertex = 0 *or* 1 // NB: fPreVertex = 0 *or* 1
...@@ -124,18 +126,27 @@ vector<Dof> FunctionSpace::getKeys(const MElement& elem) const{ ...@@ -124,18 +126,27 @@ vector<Dof> FunctionSpace::getKeys(const MElement& elem) const{
} }
int FunctionSpace::getElementType(const Dof& dof) const{ int FunctionSpace::getElementType(const Dof& dof) const{
const unsigned int type = dof.getType(); // Get Entity //
const unsigned int entity = dof.getEntity();
if(type < fPerVertex) // Vertex Based // 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; return 0;
else if(type < fPerEdge) // Edge Based // Edge Based
else if(entity < nVertex + nEdge)
return 1; return 1;
else if(type < fPerFace) // Face Based // Face Based
else if(entity < nVertex + nEdge + nFace)
return 2; return 2;
else // Cell Based // Cell Based
else
return 3; return 3;
} }
...@@ -44,6 +44,7 @@ class FunctionSpace{ ...@@ -44,6 +44,7 @@ class FunctionSpace{
unsigned int fPerEdge; unsigned int fPerEdge;
unsigned int fPerFace; unsigned int fPerFace;
unsigned int fPerCell; unsigned int fPerCell;
unsigned int type; unsigned int type;
public: public:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment