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

Clever (but not super awesome) way to handle mutliple FS (dof type offset)

parent 164be46b
No related branches found
No related tags found
No related merge requests found
...@@ -13,8 +13,6 @@ const size_t FunctionSpace::nGeoType = 9; ...@@ -13,8 +13,6 @@ const size_t FunctionSpace::nGeoType = 9;
size_t FunctionSpace::nxtOffset = 0; size_t FunctionSpace::nxtOffset = 0;
FunctionSpace::FunctionSpace(void){ FunctionSpace::FunctionSpace(void){
offset = nxtOffset;
nxtOffset += 21;
} }
FunctionSpace::~FunctionSpace(void){ FunctionSpace::~FunctionSpace(void){
...@@ -24,6 +22,9 @@ FunctionSpace::~FunctionSpace(void){ ...@@ -24,6 +22,9 @@ FunctionSpace::~FunctionSpace(void){
} }
void FunctionSpace::build(const GroupOfElement& goe, string family){ void FunctionSpace::build(const GroupOfElement& goe, string family){
// Save Dof type offset //
offset = nxtOffset;
// Save GroupOfElement & Mesh // // Save GroupOfElement & Mesh //
this->goe = &goe; this->goe = &goe;
this->mesh = &(goe.getMesh()); this->mesh = &(goe.getMesh());
...@@ -79,6 +80,10 @@ void FunctionSpace::build(const GroupOfElement& goe, string family){ ...@@ -79,6 +80,10 @@ void FunctionSpace::build(const GroupOfElement& goe, string family){
// Build Dof // // Build Dof //
buildDof(); buildDof();
// Find next next offset //
size_t maxType = findMaxType();
nxtOffset += maxType + 1;
} }
void FunctionSpace::buildDof(void){ void FunctionSpace::buildDof(void){
...@@ -98,6 +103,22 @@ 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{ vector<Dof> FunctionSpace::getUnorderedKeys(const MElement& elem) const{
// Const_Cast // // Const_Cast //
MElement& element = const_cast<MElement&>(elem); MElement& element = const_cast<MElement&>(elem);
......
...@@ -30,7 +30,7 @@ class GroupOfElement; ...@@ -30,7 +30,7 @@ class GroupOfElement;
class FunctionSpace{ class FunctionSpace{
protected: protected:
// Number of possible geomtrical topologies // // Number of possible geomtrical topologies & Dof Type offset //
static const size_t nGeoType; static const size_t nGeoType;
static size_t nxtOffset; static size_t nxtOffset;
...@@ -79,8 +79,9 @@ class FunctionSpace{ ...@@ -79,8 +79,9 @@ class FunctionSpace{
protected: protected:
FunctionSpace(void); FunctionSpace(void);
void build(const GroupOfElement& goe, std::string family); void build(const GroupOfElement& goe, std::string family);
void buildDof(void); void buildDof(void);
size_t findMaxType(void);
std::vector<Dof> getUnorderedKeys(const MElement& element) const; std::vector<Dof> getUnorderedKeys(const MElement& element) const;
}; };
......
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