Skip to content
Snippets Groups Projects
Commit a16f4011 authored by Boris Sedji's avatar Boris Sedji
Browse files

No commit message

No commit message
parent 2bc560bc
No related branches found
No related tags found
No related merge requests found
......@@ -16,14 +16,22 @@ public:
};
class groupOfElements {
public:
typedef std::set<MElement*> elementContainer;
typedef std::set<MVertex*> vertexContainer;
private:
protected:
vertexContainer _vertices;
elementContainer _elements;
elementContainer _parents;
public:
groupOfElements(){}
groupOfElements (int dim, int physical) {
addPhysical (dim, physical);
}
......@@ -52,16 +60,23 @@ public:
elementContainer::const_iterator end() const {
return _elements.end();
}
size_t size() const {
return _elements.size();
}
// FIXME : NOT VERY ELEGANT !!!
bool find (MElement *e) const {
bool find (MElement *e) const // if same parent but different physicals return true ?!
{
if (e->getParent() && _parents.find(e->getParent()) != _parents.end()) return true;
return (_elements.find(e) != _elements.end());
}
inline void insert (MElement *e) {
inline void insert (MElement *e)
{
_elements.insert(e);
if (e->getParent()){
_parents.insert(e->getParent());
for (int i = 0; i < e->getParent()->getNumVertices(); i++){
......@@ -76,4 +91,45 @@ public:
}
};
// child elements in pElem restricted to elements who have parent in sElem
class groupOfLagMultElements : public groupOfElements
{
private :
void fillElementContainer(groupOfElements &pElem, groupOfElements &sElem)
{
groupOfElements::elementContainer::iterator itp = pElem.begin();
for (;itp!=pElem.end(); itp++)
{
MElement *ep;
if ((*itp)->getParent())
{
if (sElem.find(*itp)) insert((*itp)) ; // warning : find method used to check if parent is in sElem
}
else std::cout << "groupOfLagMultElements : Warning, level set element has no parent ?! " << std::endl;
}
}
public :
groupOfLagMultElements(int dim, int physical, groupOfElements &sElem) : groupOfElements()
{
groupOfElements pElem(dim , physical);
fillElementContainer(pElem,sElem);
}
groupOfLagMultElements(int dim, int physical, std::vector < groupOfElements *> sElem) : groupOfElements()
{
groupOfElements pElem(dim , physical);
for (int i;i < sElem.size() ; i ++)
{
fillElementContainer(pElem,(*sElem[i]));
}
}
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment