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

Synchronize

parent 665ff828
...@@ -441,7 +441,13 @@ namespace INMOST ...@@ -441,7 +441,13 @@ namespace INMOST
//implemented in modify.cpp //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 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 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 Delete (); // if true then element was deleted, otherwise it was hidden
bool Hidden () const; bool Hidden () const;
bool New () const; bool New () const;
...@@ -1005,10 +1011,10 @@ namespace INMOST ...@@ -1005,10 +1011,10 @@ namespace INMOST
template<typename EType> template<typename EType>
void PutElements(const ElementArray<EType> & elems) const {PutElements(elems.data(),static_cast<enumerator>(elems.size()));} 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. /// 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; void AddElement(HandleType e) const;
/// Put one element with checking of the existance of duplicate. /// 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());} void AddElement(const Storage & e) const {AddElement(e->GetHandle());}
/// Add multiple elements with checking of the existance of duplicate. /// Add multiple elements 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.
...@@ -1141,7 +1147,7 @@ namespace INMOST ...@@ -1141,7 +1147,7 @@ namespace INMOST
void SetPrivateMarkerElements(MarkerType m, ElementType etype = ESET|CELL|FACE|EDGE|NODE) const; void SetPrivateMarkerElements(MarkerType m, ElementType etype = ESET|CELL|FACE|EDGE|NODE) const;
/// Remove markers from all the elements of given type /// Remove markers from all the elements of given type
void RemMarkerElements(MarkerType m, ElementType etype = ESET|CELL|FACE|EDGE|NODE) const; void RemMarkerElements(MarkerType m, ElementType etype = ESET|CELL|FACE|EDGE|NODE) const;
void RemPrivateMarkerElements(MarkerType m, ElementType etype = ESET|CELL|FACE|EDGE|NODE) const; void RemPrivateMarkerElements(MarkerType m, ElementType etype = ESET|CELL|FACE|EDGE|NODE) const;
class iterator class iterator
{ {
Mesh * m; Mesh * m;
...@@ -1195,9 +1201,15 @@ namespace INMOST ...@@ -1195,9 +1201,15 @@ namespace INMOST
/// Get total number of elements /// Get total number of elements
enumerator Size() const; enumerator Size() const;
/// Remove all elements, clear all data, removes sorted marker /// Remove all elements, clear all data, removes sorted marker
void Clear() const; void Clear();
/// Remove the set and resolve it's ierarchical structure /// Remove the set and resolve it's ierarchical structure.
bool DeleteSet(); /// 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;} __INLINE const ElementSet & InvalidElementSet() {static ElementSet ret(NULL,InvalidHandle()); return ret;}
...@@ -1863,7 +1875,7 @@ namespace INMOST ...@@ -1863,7 +1875,7 @@ namespace INMOST
/// @see Element::getAsCell /// @see Element::getAsCell
/// @see Element::getAsSet /// @see Element::getAsSet
reference_array ReferenceArrayDV (HandleType h, const Tag & tag) {AssertsDV(h,tag,DATA_REFERENCE); return reference_array(this,*static_cast<inner_reference_array*>(MGetDenseLink(h,tag)));} reference_array ReferenceArrayDV (HandleType h, const Tag & tag) {AssertsDV(h,tag,DATA_REFERENCE); return reference_array(this,*static_cast<inner_reference_array*>(MGetDenseLink(h,tag)));}
/// Returns an array of element remote handles in dense array of variable size. /// Returns an array of element remote handles in dense array of variable size.
/// If you don't know any hint information about tag data you should not use this function. /// If you don't know any hint information about tag data you should not use this function.
/// ///
/// Asserts will fire in debug mode if assumption that data is dense and variable is incorrect, /// Asserts will fire in debug mode if assumption that data is dense and variable is incorrect,
...@@ -1890,42 +1902,42 @@ namespace INMOST ...@@ -1890,42 +1902,42 @@ namespace INMOST
remote_reference_array RemoteReferenceArrayDV(HandleType h, const Tag & tag) {AssertsDV(h,tag,DATA_REMOTE_REFERENCE); return remote_reference_array(*static_cast<inner_remote_reference_array*>(MGetDenseLink(h,tag)));} remote_reference_array RemoteReferenceArrayDV(HandleType h, const Tag & tag) {AssertsDV(h,tag,DATA_REMOTE_REFERENCE); return remote_reference_array(*static_cast<inner_remote_reference_array*>(MGetDenseLink(h,tag)));}
#if defined(USE_AUTODIFF) #if defined(USE_AUTODIFF)
var & Variable (HandleType h, const Tag & tag); var & Variable (HandleType h, const Tag & tag);
var & VariableDF (HandleType h, const Tag & tag) {AssertsDF(h,tag,DATA_VARIABLE); return static_cast<var *>(MGetDenseLink(h,tag))[0];} var & VariableDF (HandleType h, const Tag & tag) {AssertsDF(h,tag,DATA_VARIABLE); return static_cast<var *>(MGetDenseLink(h,tag))[0];}
var & VariableDV (HandleType h, const Tag & tag) {AssertsDV(h,tag,DATA_VARIABLE); return static_cast<inner_variable_array *>(MGetDenseLink(h,tag))->at_safe(0);} var & VariableDV (HandleType h, const Tag & tag) {AssertsDV(h,tag,DATA_VARIABLE); return static_cast<inner_variable_array *>(MGetDenseLink(h,tag))->at_safe(0);}
var_array VariableArray (HandleType h, const Tag & tag); var_array VariableArray (HandleType h, const Tag & tag);
var_array VariableArrayDF (HandleType h, const Tag & tag) {AssertsDF(h,tag,DATA_VARIABLE); return var_array(static_cast<var *>(MGetDenseLink(h,tag)),tag.GetSize());} var_array VariableArrayDF (HandleType h, const Tag & tag) {AssertsDF(h,tag,DATA_VARIABLE); return var_array(static_cast<var *>(MGetDenseLink(h,tag)),tag.GetSize());}
var_array VariableArrayDV (HandleType h, const Tag & tag) {AssertsDV(h,tag,DATA_VARIABLE); return var_array(*static_cast<inner_variable_array*>(MGetDenseLink(h,tag)));} var_array VariableArrayDV (HandleType h, const Tag & tag) {AssertsDV(h,tag,DATA_VARIABLE); return var_array(*static_cast<inner_variable_array*>(MGetDenseLink(h,tag)));}
#endif #endif
/// Set a marker on the element represented by handle. /// Set a marker on the element represented by handle.
/// @param h element handle /// @param h element handle
/// @param n stores byte number and byte bit mask that represent marker /// @param n stores byte number and byte bit mask that represent marker
void SetMarker (HandleType h,MarkerType n) {assert(!isPrivate(n)); static_cast<bulk *>(MGetDenseLink(h,MarkersTag()))[n >> MarkerShift] |= static_cast<bulk>(n & MarkerMask);} void SetMarker (HandleType h,MarkerType n) {assert(!isPrivate(n)); static_cast<bulk *>(MGetDenseLink(h,MarkersTag()))[n >> MarkerShift] |= static_cast<bulk>(n & MarkerMask);}
void SetPrivateMarker (HandleType h,MarkerType n); void SetPrivateMarker (HandleType h,MarkerType n);
/// Set a marker on the set of handles. /// Set a marker on the set of handles.
/// @param h set of handles /// @param h set of handles
/// @param n number of handles /// @param n number of handles
/// @param m stores byte number and byte bit mask that represent marker /// @param m stores byte number and byte bit mask that represent marker
/// @see Mesh::SetMarker /// @see Mesh::SetMarker
void SetMarkerArray (const HandleType * h, enumerator n, MarkerType m) {for(enumerator i = 0; i < n; ++i) if( h[i] != InvalidHandle() )SetMarker(h[i],m);} void SetMarkerArray (const HandleType * h, enumerator n, MarkerType m) {for(enumerator i = 0; i < n; ++i) if( h[i] != InvalidHandle() )SetMarker(h[i],m);}
void SetPrivateMarkerArray (const HandleType * h, enumerator n, MarkerType m) {for(enumerator i = 0; i < n; ++i) if( h[i] != InvalidHandle() )SetPrivateMarker(h[i],m);} void SetPrivateMarkerArray (const HandleType * h, enumerator n, MarkerType m) {for(enumerator i = 0; i < n; ++i) if( h[i] != InvalidHandle() )SetPrivateMarker(h[i],m);}
/// Check whether the marker is set one the element. /// Check whether the marker is set one the element.
/// @param h element handle /// @param h element handle
/// @param n stores byte number and byte bit mask that represent marker /// @param n stores byte number and byte bit mask that represent marker
bool GetMarker (HandleType h,MarkerType n) const {assert(!isPrivate(n)); return (static_cast<const bulk *>(MGetDenseLink(h,MarkersTag()))[n >> MarkerShift] & static_cast<bulk>(n & MarkerMask)) != 0;} bool GetMarker (HandleType h,MarkerType n) const {assert(!isPrivate(n)); return (static_cast<const bulk *>(MGetDenseLink(h,MarkersTag()))[n >> MarkerShift] & static_cast<bulk>(n & MarkerMask)) != 0;}
bool GetPrivateMarker (HandleType h,MarkerType n) const; bool GetPrivateMarker (HandleType h,MarkerType n) const;
/// Remove the marker from the element. /// Remove the marker from the element.
/// @param h element handle /// @param h element handle
/// @param n stores byte number and byte bit mask that represent marker /// @param n stores byte number and byte bit mask that represent marker
void RemMarker (HandleType h,MarkerType n) {assert(!isPrivate(n)); static_cast<bulk *>(MGetDenseLink(h,MarkersTag()))[n >> MarkerShift] &= ~static_cast<bulk>(n & MarkerMask);} void RemMarker (HandleType h,MarkerType n) {assert(!isPrivate(n)); static_cast<bulk *>(MGetDenseLink(h,MarkersTag()))[n >> MarkerShift] &= ~static_cast<bulk>(n & MarkerMask);}
void RemPrivateMarker (HandleType h,MarkerType n); void RemPrivateMarker (HandleType h,MarkerType n);
/// Remove the marker from the set of handles. /// Remove the marker from the set of handles.
/// @param h set of handles /// @param h set of handles
/// @param n number of handles /// @param n number of handles
/// @param m stores byte number and byte bit mask that represent marker /// @param m stores byte number and byte bit mask that represent marker
/// @see Mesh::RemMarker /// @see Mesh::RemMarker
void RemMarkerArray (const HandleType * h, enumerator n, MarkerType m) {for(enumerator i = 0; i < n; ++i) if( h[i] != InvalidHandle() ) RemMarker(h[i],m);} void RemMarkerArray (const HandleType * h, enumerator n, MarkerType m) {for(enumerator i = 0; i < n; ++i) if( h[i] != InvalidHandle() ) RemMarker(h[i],m);}
void RemPrivateMarkerArray (const HandleType * h, enumerator n, MarkerType m) {for(enumerator i = 0; i < n; ++i) if( h[i] != InvalidHandle() ) RemPrivateMarker(h[i],m);} void RemPrivateMarkerArray (const HandleType * h, enumerator n, MarkerType m) {for(enumerator i = 0; i < n; ++i) if( h[i] != InvalidHandle() ) RemPrivateMarker(h[i],m);}
/// Remove all the markers from the element /// Remove all the markers from the element
void ClearMarkerSpace (HandleType h); void ClearMarkerSpace (HandleType h);
/// Get a copy of the bytes that store markers on the element. /// Get a copy of the bytes that store markers on the element.
...@@ -3004,7 +3016,7 @@ namespace INMOST ...@@ -3004,7 +3016,7 @@ namespace INMOST
bool remember[5][3]; bool remember[5][3];
private: private:
void RestoreGeometricTags(); void RestoreGeometricTags();
void RepairGeometricTags(); void RepairGeometricTags();
bool HideGeometricData (GeometricData type, ElementType mask) {return remember[type][ElementNum(mask)-1] = false;} bool HideGeometricData (GeometricData type, ElementType mask) {return remember[type][ElementNum(mask)-1] = false;}
bool ShowGeometricData (GeometricData type, ElementType mask) {return remember[type][ElementNum(mask)-1] = true;} bool ShowGeometricData (GeometricData type, ElementType mask) {return remember[type][ElementNum(mask)-1] = true;}
public: public:
...@@ -3053,7 +3065,7 @@ namespace INMOST ...@@ -3053,7 +3065,7 @@ namespace INMOST
/// (done, check and compare) /// (done, check and compare)
/// 2. parent/child elements in set would not be replaced or reconnected, this may lead to wrong behavior /// 2. parent/child elements in set would not be replaced or reconnected, this may lead to wrong behavior
/// (done, check and compare) /// (done, check and compare)
/// @see Element::Old /// @see Element::Old
void ApplyModification (); //modify DATA_REFERENCE, tags so that links to hidden elements are converted to NULL and removed from sets void ApplyModification (); //modify DATA_REFERENCE, tags so that links to hidden elements are converted to NULL and removed from sets
/// This function is not yet implemented. It should correctly resolve parallel state of /// This function is not yet implemented. It should correctly resolve parallel state of
/// newly created elements, provide them valid global identificators, resolve owners of /// newly created elements, provide them valid global identificators, resolve owners of
......
...@@ -1714,10 +1714,10 @@ namespace INMOST ...@@ -1714,10 +1714,10 @@ namespace INMOST
return (lc.size() - (hc.size() - high_conn_reserved)); return (lc.size() - (hc.size() - high_conn_reserved));
} }
void ElementSet::Clear() const void ElementSet::Clear()
{ {
Mesh * m = GetMeshLink(); Mesh * m = GetMeshLink();
if( HaveParent() ) GetParent()->RemChild(self()); if( HaveParent() ) GetParent()->RemChild(self());
Element::adj_type & lc = m->LowConn(GetHandle()); Element::adj_type & lc = m->LowConn(GetHandle());
Element::adj_type & hc = m->HighConn(GetHandle()); Element::adj_type & hc = m->HighConn(GetHandle());
hc.resize(ElementSet::high_conn_reserved); hc.resize(ElementSet::high_conn_reserved);
...@@ -1725,11 +1725,30 @@ namespace INMOST ...@@ -1725,11 +1725,30 @@ namespace INMOST
BulkDF(m->SetComparatorTag()) = UNSORTED_COMPARATOR; BulkDF(m->SetComparatorTag()) = UNSORTED_COMPARATOR;
} }
bool ElementSet::DeleteSet() bool ElementSet::DeleteSet()
{ {
Clear(); Clear();
return Delete(); 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 #endif
...@@ -441,37 +441,37 @@ namespace INMOST ...@@ -441,37 +441,37 @@ namespace INMOST
} }
} }
void Mesh::RepairGeometricTags() void Mesh::RepairGeometricTags()
{ {
if( HaveTag("GEOM_UTIL_MEASURE") ) if( HaveTag("GEOM_UTIL_MEASURE") )
{ {
measure_tag = GetTag("GEOM_UTIL_MEASURE"); measure_tag = GetTag("GEOM_UTIL_MEASURE");
for(ElementType etype = EDGE; etype <= CELL; etype = NextElementType(etype)) for(ElementType etype = EDGE; etype <= CELL; etype = NextElementType(etype))
if( measure_tag.isDefined(etype) && !HaveGeometricData(MEASURE,etype) ) if( measure_tag.isDefined(etype) && !HaveGeometricData(MEASURE,etype) )
ShowGeometricData(MEASURE,etype); ShowGeometricData(MEASURE,etype);
} }
if( HaveTag("GEOM_UTIL_CENTROID") ) if( HaveTag("GEOM_UTIL_CENTROID") )
{ {
centroid_tag = GetTag("GEOM_UTIL_CENTROID"); centroid_tag = GetTag("GEOM_UTIL_CENTROID");
for(ElementType etype = EDGE; etype <= CELL; etype = NextElementType(etype)) for(ElementType etype = EDGE; etype <= CELL; etype = NextElementType(etype))
if( centroid_tag.isDefined(etype) && !HaveGeometricData(CENTROID,etype) ) if( centroid_tag.isDefined(etype) && !HaveGeometricData(CENTROID,etype) )
ShowGeometricData(CENTROID,etype); ShowGeometricData(CENTROID,etype);
} }
if( HaveTag("GEOM_UTIL_BARYCENTER") ) if( HaveTag("GEOM_UTIL_BARYCENTER") )
{ {
barycenter_tag = GetTag("GEOM_UTIL_BARYCENTER"); barycenter_tag = GetTag("GEOM_UTIL_BARYCENTER");
for(ElementType etype = EDGE; etype <= CELL; etype = NextElementType(etype)) for(ElementType etype = EDGE; etype <= CELL; etype = NextElementType(etype))
if( barycenter_tag.isDefined(etype) && !HaveGeometricData(BARYCENTER,etype) ) if( barycenter_tag.isDefined(etype) && !HaveGeometricData(BARYCENTER,etype) )
ShowGeometricData(BARYCENTER,etype); ShowGeometricData(BARYCENTER,etype);
} }
if( HaveTag("GEOM_UTIL_NORMAL") ) if( HaveTag("GEOM_UTIL_NORMAL") )
{ {
normal_tag = GetTag("GEOM_UTIL_NORMAL"); normal_tag = GetTag("GEOM_UTIL_NORMAL");
for(ElementType etype = EDGE; etype <= CELL; etype = NextElementType(etype)) for(ElementType etype = EDGE; etype <= CELL; etype = NextElementType(etype))
if( normal_tag.isDefined(etype) && !HaveGeometricData(NORMAL,etype) ) if( normal_tag.isDefined(etype) && !HaveGeometricData(NORMAL,etype) )
ShowGeometricData(NORMAL,etype); ShowGeometricData(NORMAL,etype);
} }
} }
void Mesh::PrepareGeometricData(GeomParam table) void Mesh::PrepareGeometricData(GeomParam table)
{ {
......
...@@ -1439,7 +1439,7 @@ namespace INMOST ...@@ -1439,7 +1439,7 @@ namespace INMOST
} }
//RemoveGhost(); //RemoveGhost();
#else //USE_PARALLEL_STORAGE #else //USE_MPI
AssignGlobalID(CELL | FACE | EDGE | NODE); AssignGlobalID(CELL | FACE | EDGE | NODE);
#endif //USE_MPI #endif //USE_MPI
EXIT_FUNC(); 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