Commit beaa8c79 authored by Kirill Terekhov's avatar Kirill Terekhov
Browse files

Synchronize

parent 665ff828
......@@ -441,7 +441,13 @@ namespace INMOST
//implemented in modify.cpp
bool Hide () const; // if true then element was hidden, works only inside BeginModification and EndModification, on EndModification all Hidden elements are deleted
bool Show () const; // if true then element was recovered
/// \warning This function will not resolve an ierarchical strucutre of ElementSet, use ElemnetSet::DeleteSet instead
/// Remove element from mesh.
/// If you call this function inside modification phase, see Mesh::BeginModification and Mesh::EndModification,
/// and the element was not created during modification phase (not marked as Element::New),
/// then the element will not be actually destroyed but hidden.
/// You can restore all the hidden elements by using Mesh::ToggleModification.
/// \warning This function will not resolve an ierarchical strucutre of ElementSet, use ElemnetSet::DeleteSet instead.
/// @return Returns true if the element was actually destroyed. Returns false if the element was hidden.
bool Delete (); // if true then element was deleted, otherwise it was hidden
bool Hidden () const;
bool New () const;
......@@ -1005,10 +1011,10 @@ namespace INMOST
template<typename EType>
void PutElements(const ElementArray<EType> & elems) const {PutElements(elems.data(),static_cast<enumerator>(elems.size()));}
/// Put one element with checking of the existance of duplicate.
/// Preserves order for sorted set, thus may be expensive
/// Preserves order for sorted set, thus may be expensive.
void AddElement(HandleType e) const;
/// Put one element with checking of the existance of duplicate.
/// Preserves order for sorted set, thus may be expensive
/// Preserves order for sorted set, thus may be expensive.
void AddElement(const Storage & e) const {AddElement(e->GetHandle());}
/// Add multiple elements with checking of the existance of duplicate.
/// Preserves order for sorted set, thus may be expensive.
......@@ -1195,9 +1201,15 @@ namespace INMOST
/// Get total number of elements
enumerator Size() const;
/// Remove all elements, clear all data, removes sorted marker
void Clear() const;
/// Remove the set and resolve it's ierarchical structure
void Clear();
/// Remove the set and resolve it's ierarchical structure.
/// This will not remove childrens of the tree.
/// To remove set as a tree, see ElementSet::DeleteSetTree.
/// @return Same as Element::Delete.
bool DeleteSet();
/// Remove the set and all it's children.
/// @return Same as Element::Delete.
bool DeleteSetTree();
};
__INLINE const ElementSet & InvalidElementSet() {static ElementSet ret(NULL,InvalidHandle()); return ret;}
......
......@@ -1714,7 +1714,7 @@ namespace INMOST
return (lc.size() - (hc.size() - high_conn_reserved));
}
void ElementSet::Clear() const
void ElementSet::Clear()
{
Mesh * m = GetMeshLink();
if( HaveParent() ) GetParent()->RemChild(self());
......@@ -1730,6 +1730,25 @@ namespace INMOST
Clear();
return Delete();
}
bool ElementSet::DeleteSetTree()
{
Mesh * m = GetMeshLink();
if( HaveParent() ) GetParent()->RemChild(self());
Element::adj_type & lc = m->LowConn(GetHandle());
Element::adj_type & hc = m->HighConn(GetHandle());
for(enumerator k = 0; k < lc.size(); ++k)
if( lc[k] != InvalidHandle() )
{
ElementSet child = ElementSet(m,lc[k]);
hParent(m->HighConn(child->GetHandle())) = InvalidHandle();
child->DeleteSetTree();
}
hc.resize(ElementSet::high_conn_reserved);
lc.clear();
BulkDF(m->SetComparatorTag()) = UNSORTED_COMPARATOR;
return Delete();
}
}
#endif
......@@ -1439,7 +1439,7 @@ namespace INMOST
}
//RemoveGhost();
#else //USE_PARALLEL_STORAGE
#else //USE_MPI
AssignGlobalID(CELL | FACE | EDGE | NODE);
#endif //USE_MPI
EXIT_FUNC();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment