diff --git a/FunctionSpace/FunctionSpace.cpp b/FunctionSpace/FunctionSpace.cpp index de6c25173c003b6e829b36cc9ff9a86cc0b34dd3..4089a3eac8f9af8127422a626610db40316c1c6f 100644 --- a/FunctionSpace/FunctionSpace.cpp +++ b/FunctionSpace/FunctionSpace.cpp @@ -13,8 +13,6 @@ const size_t FunctionSpace::nGeoType = 9; size_t FunctionSpace::nxtOffset = 0; FunctionSpace::FunctionSpace(void){ - offset = nxtOffset; - nxtOffset += 21; } FunctionSpace::~FunctionSpace(void){ @@ -24,6 +22,9 @@ FunctionSpace::~FunctionSpace(void){ } void FunctionSpace::build(const GroupOfElement& goe, string family){ + // Save Dof type offset // + offset = nxtOffset; + // Save GroupOfElement & Mesh // this->goe = &goe; this->mesh = &(goe.getMesh()); @@ -79,6 +80,10 @@ void FunctionSpace::build(const GroupOfElement& goe, string family){ // Build Dof // buildDof(); + + // Find next next offset // + size_t maxType = findMaxType(); + nxtOffset += maxType + 1; } void FunctionSpace::buildDof(void){ @@ -98,6 +103,22 @@ void FunctionSpace::buildDof(void){ } } +size_t FunctionSpace::findMaxType(void){ + // Maximum type // + size_t maxType = 0; + + // Iterate for dof // + const set<Dof>::iterator end = dof.end(); + set<Dof>::iterator it = dof.begin(); + + for(; it != end; it++) + // If this type is bigger, it becomes the new 'maxType' + if(it->getType() > maxType) + maxType = it->getType(); + + return maxType; +} + vector<Dof> FunctionSpace::getUnorderedKeys(const MElement& elem) const{ // Const_Cast // MElement& element = const_cast<MElement&>(elem); diff --git a/FunctionSpace/FunctionSpace.h b/FunctionSpace/FunctionSpace.h index 470f0f6c9244a17e46b6f31e0b3cac3de6318eb9..8053238ba4b1b156e220740d69f45841a99945fa 100644 --- a/FunctionSpace/FunctionSpace.h +++ b/FunctionSpace/FunctionSpace.h @@ -30,7 +30,7 @@ class GroupOfElement; class FunctionSpace{ protected: - // Number of possible geomtrical topologies // + // Number of possible geomtrical topologies & Dof Type offset // static const size_t nGeoType; static size_t nxtOffset; @@ -79,8 +79,9 @@ class FunctionSpace{ protected: FunctionSpace(void); - void build(const GroupOfElement& goe, std::string family); - void buildDof(void); + void build(const GroupOfElement& goe, std::string family); + void buildDof(void); + size_t findMaxType(void); std::vector<Dof> getUnorderedKeys(const MElement& element) const; };