diff --git a/FunctionSpace/FunctionSpace.cpp b/FunctionSpace/FunctionSpace.cpp index 538bc66cd04c80d72c1bf85ff898a92e6a2c6f22..770a5813eace6de3ca026c85e7e038dd8ea18bc0 100644 --- a/FunctionSpace/FunctionSpace.cpp +++ b/FunctionSpace/FunctionSpace.cpp @@ -1,6 +1,7 @@ #include "FunctionSpace.h" #include "BasisGenerator.h" + using namespace std; FunctionSpace::FunctionSpace(void){ @@ -31,7 +32,8 @@ void FunctionSpace::build(const GroupOfElement& goe, basis = BasisGenerator::generate(elementType, 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(); - 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; - 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; } - diff --git a/FunctionSpace/FunctionSpace.h b/FunctionSpace/FunctionSpace.h index 45664d422de925ce4a6fc94c30d746a53228eb03..420ba7bc86bfbdc8429e3b2b88c2ab1c4aa0a7a1 100644 --- a/FunctionSpace/FunctionSpace.h +++ b/FunctionSpace/FunctionSpace.h @@ -44,6 +44,7 @@ class FunctionSpace{ unsigned int fPerEdge; unsigned int fPerFace; unsigned int fPerCell; + unsigned int type; public: