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

Fix for getElementType()

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