Commit 7121d55a authored by Kirill Terekhov's avatar Kirill Terekhov
Browse files

a lot of fixes

parent 96a9a0ad
#include "amesh.h"
#include <iomanip>
#include <set>
#include "../../Source/Misc/base64.h"
//using namespace std;
//from inmost
//std::string base64_encode(unsigned char const* buf, unsigned int bufLen);
std::string base64_encode_(unsigned char const* buf, unsigned int bufLen)
{
static const std::string base64_chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
std::string ret;
int i = 0;
int j = 0;
unsigned char char_array_3[3];
unsigned char char_array_4[4];
while (bufLen--)
{
char_array_3[i++] = *(buf++);
if (i == 3)
{
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
char_array_4[3] = char_array_3[2] & 0x3f;
for(i = 0; (i <4) ; i++)
ret += base64_chars[char_array_4[i]];
i = 0;
}
}
if (i)
{
for(j = i; j < 3; j++)
char_array_3[j] = '\0';
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
char_array_4[3] = char_array_3[2] & 0x3f;
for (j = 0; (j < i + 1); j++)
ret += base64_chars[char_array_4[j]];
while((i++ < 3))
ret += '=';
}
return ret;
}
/// todo:
/// 1. coarsment
/// 2. strategy for faces/edges with faults
/// 3. geom model support
/// 3. geom model supportbn
/// 4. make class abstract virtual for user implementation of refinement and coarsment indicators
/// see in code todo:
namespace INMOST
......@@ -352,6 +400,7 @@ namespace INMOST
if( root == InvalidElement() )
{
root = m->CreateSetUnique("ROOT_SET").first;
root.SetExchange(ElementSet::SYNC_ELEMENTS_SHARED);
level[root] = 0;
for(Mesh::iteratorCell it = m->BeginCell(); it != m->EndCell(); ++it)
{
......@@ -361,6 +410,7 @@ namespace INMOST
}
}
if( !m->HaveGlobalID(CELL) ) m->AssignGlobalID(CELL); //for unique set names
m->ResolveSets();
}
AdaptiveMesh::AdaptiveMesh(Mesh & _m) : m(&_m)
......@@ -385,13 +435,42 @@ namespace INMOST
//as extension of class mesh in limited code span
}
void AdaptiveMesh::CheckParentSet()
{
std::cout << rank << " enter " << __FUNCTION__ << std::endl;
int err = 0;
for(Mesh::iteratorCell it = m->BeginCell(); it != m->EndCell(); ++it)
{
if( parent_set[*it] == InvalidHandle() )
{
std::cout << m->GetProcessorRank() << " parent set not valid on CELL:" << it->LocalID() << " " << Element::StatusName(it->GetStatus()) << " " << level[*it] << std::endl;
err++;
}
else if( GetHandleElementType(parent_set[*it]) != ESET )
{
std::cout << m->GetProcessorRank() << " parent set is something else " << ElementTypeName(GetHandleElementType(parent_set[*it])) << ":" << GetHandleID(parent_set[*it]) << " on CELL:" << it->LocalID() << " " << Element::StatusName(it->GetStatus()) << " " << level[*it] << std::endl;
err++;
}
}
err = m->Integrate(err);
if( err )
{
std::cout << rank << " error in " << __FUNCTION__ << std::endl;
exit(-1);
}
std::cout << rank << " exit " << __FUNCTION__ << std::endl;
}
bool AdaptiveMesh::Refine(TagInteger & indicator)
{
std::cout << rank << " enter " << __FUNCTION__ << std::endl;
static int call_counter = 0;
int ret = 0; //return number of refined cells
//initialize tree structure
m->CheckCentroids(__FILE__,__LINE__);
PrepareSet();
CheckParentSet();
int schedule_counter = 1; //indicates order in which refinement will be scheduled
int scheduled = 1; //indicates that at least one element was scheduled on current sweep
//0. Extend indicator for edges and faces
......@@ -450,7 +529,7 @@ namespace INMOST
if( scheduled ) schedule_counter++;
}
m->ExchangeData(indicator,CELL | FACE | EDGE,0);
m->Save("indicator.pmf");
//m->Save("indicator.pmf");
//6.Refine
m->BeginModification();
while(schedule_counter)
......@@ -613,14 +692,38 @@ namespace INMOST
//clean up structure, so that other cells can use it
edge_hanging_nodes[kt].DelData(internal_face_edges);
}
//if( c.GlobalID() == 228 )
//{
// double cnt[3];
// c.Centroid(cnt);
// std::cout << "Split CELL:" << c.LocalID() << " " << c.GlobalID() << " " << Element::StatusName(c.GetStatus()) << " " << cnt[0] << " " << cnt[1] << " " << cnt[2] << std::endl;
//
//}
//split the cell
ElementArray<Cell> new_cells = Cell::SplitCell(c,internal_faces,0);
//retrive parent set
ElementSet parent(m,parent_set[c]);
//create set corresponding to old coarse cell
Storage::real cnt[3];
c.Centroid(cnt);
std::stringstream set_name;
set_name << parent.GetName() << "_C" << c.GlobalID(); //rand may be unsafe
//set_name << parent.GetName() << "_C" << c.GlobalID(); //rand may be unsafe
set_name << base64_encode_((unsigned char *)cnt,3*sizeof(double)/sizeof(unsigned char));
/*
ElementSet check_set = m->GetSet(set_name.str());
if( check_set.isValid() )
{
std::cout << rank << " set " << set_name.str() << " for cell " << c.GlobalID() << " " << Element::StatusName(c.GetStatus()) << " already exists" << std::endl;
if( check_set->HaveParent() )
std::cout << rank << " parent is " << check_set->GetParent()->GetName() << " cell parent is " << parent.GetName() << std::endl;
std::cout << rank << " Elements: ";
for(ElementSet::iterator it = check_set.Begin(); it != check_set.End(); ++it)
std::cout << ElementTypeName(it->GetElementType()) << ":" << it->LocalID() << "," << it->GlobalID() << "," << Element::StatusName(c.GetStatus()) << "," << level[*it] << " ";
std::cout << std::endl;
}
*/
ElementSet cell_set = m->CreateSetUnique(set_name.str()).first;
cell_set->SetExchange(ElementSet::SYNC_ELEMENTS_ALL);
level[cell_set] = level[c]+1;
//set up increased level for the new cells
for(ElementArray<Cell>::size_type kt = 0; kt < new_cells.size(); ++kt)
......@@ -629,7 +732,18 @@ namespace INMOST
cell_set.PutElement(new_cells[kt]);
parent_set[new_cells[kt]] = cell_set.GetHandle();
}
/*
if( check_set.isValid() )
{
std::cout << rank << " Elements: ";
for(ElementSet::iterator it = check_set.Begin(); it != check_set.End(); ++it)
std::cout << ElementTypeName(it->GetElementType()) << ":" << it->LocalID() << "," << it->GlobalID() << "," << Element::StatusName(c.GetStatus()) << "," << level[*it] << " ";
std::cout << std::endl;
}
*/
//if( !cell_set->HaveParent() )
parent.AddChild(cell_set);
//else assert(cell_set->GetParent() == parent);
//increment number of refined cells
ret++;
}
......@@ -712,7 +826,7 @@ namespace INMOST
//ExchangeData(hanging_nodes,CELL | FACE,0);
//m->ResolveSets();
m->CheckCentroids();
m->CheckCentroids(__FILE__,__LINE__);
//m->BeginModification();
// m->ExchangeGhost(1,NODE,marker_new); // Construct Ghost cells in 2 layers connected via nodes
......@@ -720,10 +834,16 @@ namespace INMOST
//m->ApplyModification();
//m->EndModification();
//PrintSet();
//m->ResolveSets();
m->ExchangeData(hanging_nodes,CELL | FACE,0);
m->ExchangeData(parent_set,CELL,0);
//restore face orientation
m->CheckCentroids(__FILE__,__LINE__);
m->ExchangeData(parent_set,CELL,0);
m->CheckCentroids(__FILE__,__LINE__);
m->ResolveSets();
m->CheckCentroids(__FILE__,__LINE__);
m->ExchangeData(parent_set,CELL,0);
m->CheckCentroids(__FILE__,__LINE__);
//restore face orientation
//BUG: bad orientation not fixed automatically
int nfixed = 0;
for(Mesh::iteratorFace it = m->BeginFace(); it != m->EndFace(); ++it)
......@@ -733,8 +853,18 @@ namespace INMOST
nfixed++;
}
//std::cout << "Face " << it->LocalID() << " oriented incorrectly " << std::endl;
if( nfixed ) std::cout << "fixed " << nfixed << " faces" << std::endl;
if( nfixed ) std::cout << rank << " fixed " << nfixed << " faces" << std::endl;
/*
for(Mesh::iteratorCell it = m->BeginCell(); it != m->EndCell(); ++it)
{
if( parent_set[*it] == InvalidHandle() )
std::cout << m->GetProcessorRank() << " parent set not valid on CELL:" << it->LocalID() << " " << Element::StatusName(it->GetStatus()) << std::endl;
else if( GetHandleElementType(parent_set[*it]) != ESET )
std::cout << m->GetProcessorRank() << " parent set is something else " << ElementTypeName(GetHandleElementType(parent_set[*it])) << ":" << GetHandleID(parent_set[*it]) << " on CELL:" << it->LocalID() << " " << Element::StatusName(it->GetStatus()) << std::endl;
}
*/
std::cout << rank << " check parent_set at end" << std::endl;
CheckParentSet();
//ExchangeData(hanging_nodes,CELL | FACE,0);
//cout << rank << ": After end " << std::endl;
......@@ -761,6 +891,7 @@ namespace INMOST
void AdaptiveMesh::SynchronizeIndicated(TagInteger& indicator)
{
if (m->GetProcessorsNumber() == 1) return;
std::cout << rank << " enter " << __FUNCTION__ << std::endl;
int rank = m->GetProcessorRank();
// Check all sets. All elements in sets must be indicated. At first we check indicator in local processor, and second integrate data
......@@ -804,19 +935,21 @@ namespace INMOST
}
cout << rank << " Sets: \n" << ss.str() << endl;
*/
std::cout << rank << " exit " << __FUNCTION__ << std::endl;
}
bool AdaptiveMesh::Coarse(TagInteger & indicator)
{
std::cout << rank << " enter " << __FUNCTION__ << std::endl;
SynchronizeIndicated(indicator);
//return false;
m->CheckCentroids(__FILE__,__LINE__);
static int call_counter = 0;
//return number of coarsened cells
int ret = 0;
//initialize tree structure
PrepareSet();
SynchronizeIndicated(indicator);
CheckParentSet();
int schedule_counter = 1; //indicates order in which refinement will be scheduled
int scheduled = 1, unscheduled = 0; //indicates that at least one element was scheduled on current sweep
//TagInteger coarsened = CreateTag("COARSENED",DATA_INTEGER,CELL,NONE,1);
......@@ -1126,7 +1259,7 @@ namespace INMOST
//done
m->EndModification();
m->CheckCentroids();
m->CheckCentroids(__FILE__,__LINE__);
//CheckCentroids();
//cleanup null links to hanging nodes
for(ElementType etype = FACE; etype <= CELL; etype = NextElementType(etype))
......@@ -1140,11 +1273,21 @@ namespace INMOST
arr.resize(jt);
}
}
//m->ResolveSets();
m->CheckCentroids(__FILE__,__LINE__);
m->ExchangeData(hanging_nodes,CELL | FACE,0);
m->CheckCentroids(__FILE__,__LINE__);
m->ExchangeData(parent_set,CELL,0);
m->CheckCentroids(__FILE__,__LINE__);
m->ResolveSets();
m->CheckCentroids(__FILE__,__LINE__);
m->ExchangeData(parent_set,CELL,0);
m->CheckCentroids(__FILE__,__LINE__);
//cleanup null links in sets
CleanupSets(root);
CheckParentSet();
//restore face orientation
//BUG: bad orientation not fixed automatically
......
......@@ -15,6 +15,7 @@ namespace INMOST
int size;
/// Prepare sets for coarsements.
/// Do not do this in constructor, since mesh may contain no cells.
void CheckParentSet();
void PrepareSet();
void PrintSetLocal(std::string offset, ElementSet it, std::stringstream& ss);
void SynchronizeIndicated(TagInteger& indicator);
......
......@@ -98,17 +98,18 @@ int main(int argc, char ** argv)
std::cout << "k " << k << " refcnt " << refcnt << " " << r*k << " < r < " << r*(k+1) << " numref " << numref << " cells " << m.NumberOfCells() << std::endl;
int res = am.Refine(indicator);
res = m.Integrate(res);
if (!res) break;
/*
{
res = m.Integrate(res);
if (!res) break;
if( false )
{
std::stringstream file;
file << "ref_" << k << "_" << refcnt << ".pvtk";
m.Save(file.str());
if( m.GetProcessorRank() == 0 )
std::cout << "Save " << file.str() << std::endl;
std::cout << "Save " << file.str() << std::endl;
}
*/
}
refcnt++;
}
......@@ -142,13 +143,23 @@ int main(int argc, char ** argv)
int res = am.Coarse(indicator);
res = m.Integrate(res);
if( !res ) break;
if( false )
{
std::stringstream file;
file << "crs_" << k << "_" << refcnt << ".pvtk";
m.Save(file.str());
if( m.GetProcessorRank() == 0 )
std::cout << "Save " << file.str() << std::endl;
}
}
refcnt++;
}
while(numref);
if( false )
{
TagInteger tag_owner = m.CreateTag("OWN",DATA_INTEGER,CELL,NONE,1);
TagInteger tag_owner0 = m.GetTag("OWNER_PROCESSOR");
......@@ -164,6 +175,7 @@ int main(int argc, char ** argv)
if( m.GetProcessorRank() == 0 )
std::cout << "Save " << file.str() << std::endl;
}
else if( m.GetProcessorRank() == 0 ) std::cout << "step " << k << std::endl;
}
}
else std::cout << "Usage: " << argv[0] << " mesh_file [max_levels=2]" << std::endl;
......
......@@ -954,8 +954,12 @@ namespace INMOST
static const ComparatorType UNSORTED_COMPARATOR = 0;
static const ComparatorType GLOBALID_COMPARATOR = 1;
static const ComparatorType CENTROID_COMPARATOR = 2;
static const ComparatorType HIERARCHY_COMPARATOR = 3;
static const ComparatorType HIERARCHY_COMPARATOR= 3;
static const ComparatorType HANDLE_COMPARATOR = 4;
typedef INMOST_DATA_BULK_TYPE ExchangeType;
static const ExchangeType SYNC_ELEMENTS_NONE = 0; //elements are not synced in parallel set
static const ExchangeType SYNC_ELEMENTS_ALL = 1; //all elements are synchronized in parallel set
static const ExchangeType SYNC_ELEMENTS_SHARED= 2; //only shared elements are present
ElementSet () : Element() {}
ElementSet (Mesh * m, HandleType h) : Element(m,h) {}
ElementSet (Mesh * m, HandleType * h) : Element(m,h) {}
......@@ -1144,9 +1148,12 @@ namespace INMOST
///
/// \todo
/// !TODO 52 - check radix sort on big endian computer
/// @param comp one of the comparators from description
/// @param comp one of the comparators from description.
/// @see Mesh::SetComparatorTag
void SortSet(ComparatorType comp) const;
/// Sets the synchronization regime for set elements
/// @param comp one of the synchronization types from description.
void SetExchange(ExchangeType comp) const;
/// Perform binary search by global id. In set sorted with GLOBALID_COMPARATOR in O(log(n)) time
/// otherwise search needs O(n) comparisons
Element FindElementByGlobalID(integer global_id) const;
......@@ -1221,6 +1228,8 @@ namespace INMOST
void Erase(iterator beg, iterator end) const;
/// Retrieve current set comparator
ComparatorType GetComparator() const;
/// Retrieve current set exchange type
ExchangeType GetExchange() const;
/// Compact holes in inner representation
void ReorderEmpty() const;
/// Is there any elements in the set
......@@ -1275,6 +1284,7 @@ namespace INMOST
Tag tag_geom_type;
Tag tag_setname;
Tag tag_setcomparator;
Tag tag_setexchange;
MeshState m_state;
integer dim;
HandleType last_created;
......@@ -1290,7 +1300,7 @@ namespace INMOST
Tag tag_bridge;
Tag tag_redistribute;
private:
double dist(Cell a, Cell b);
//double dist(Cell a, Cell b);
void AllocatePrivateMarkers();
void DeallocatePrivateMarkers();
__INLINE static sparse_rec mkrec (const Tag & t) {sparse_rec ret; ret.tag = t.mem; ret.rec = NULL; return ret;}
......@@ -1386,6 +1396,7 @@ namespace INMOST
__INLINE const Tag & ProcessorsTag () const {return tag_processors;}
__INLINE const Tag & SetNameTag () const {return tag_setname;}
__INLINE const Tag & SetComparatorTag () const {return tag_setcomparator;}
__INLINE const Tag & SetExchangeTag () const {return tag_setexchange;}
/// Don't put this shortcut to any function directly, as it creates tag inside
/// assign to other object of type Tag and put this object to functions.
__INLINE Tag RedistributeTag () {return CreateTag("TEMPORARY_NEW_OWNER",DATA_INTEGER,CELL,NONE,1);}
......@@ -2225,6 +2236,7 @@ namespace INMOST
Random(const Random & other);
unsigned int Number();
} randomizer;
public:
class elements_by_type
{
private:
......@@ -2235,8 +2247,12 @@ namespace INMOST
~elements_by_type(){}
element_set & operator [](int i){ return container[i]; }
const element_set & operator [](int i) const { return container[i]; }
bool empty() {bool ret = true; for(int i = 0; i < 5 && ret; i++) ret &= container[i].empty(); return ret;}
int size() {unsigned ret = 0; for(int i = 0; i < 5; ++i) ret += container[i].size(); return ret;}
};
typedef std::map<int, elements_by_type > parallel_storage;
typedef std::map<int, elements_by_type > proc_elements_by_type;
private:
#if defined(USE_PARALLEL_STORAGE)
parallel_storage shared_elements;
......@@ -2258,9 +2274,9 @@ namespace INMOST
void ComputeSharedProcs ();
proc_elements ComputeSharedSkinSet(ElementType bridge, MarkerType marker = 0);
void PackTagData (const Tag & tag, const elements_by_type & elements, int destination, ElementType mask, MarkerType select, buffer_type & buffer);
void UnpackTagData (const Tag & tag, const elements_by_type & elements, int source, ElementType mask, MarkerType select, buffer_type & buffer, int & position, ReduceOperation op, proc_elements * send_elements = NULL);
void PackElementsData (element_set & input, buffer_type & buffer, int destination, const std::vector<std::string> & tag_list);
void UnpackElementsData (element_set & output, buffer_type & buffer, int source, int & position, std::vector<std::string> & tag_list);
void UnpackTagData (const Tag & tag, const elements_by_type & elements, int source, ElementType mask, MarkerType select, buffer_type & buffer, int & position, ReduceOperation op, proc_elements_by_type * send_elements = NULL);
void PackElementsData (elements_by_type & input, buffer_type & buffer, int destination, const std::vector<std::string> & tag_list);
void UnpackElementsData (elements_by_type & output, buffer_type & buffer, int source, int & position, std::vector<std::string> & tag_list);
void PrepareReceiveInner(Prepare todo, exch_buffer_type & send_bufs, exch_buffer_type & recv_bufs);
void ExchangeDataInnerBegin(const tag_set & tag, const parallel_storage & from, const parallel_storage & to, ElementType mask, MarkerType select, exchange_data & storage);
void ExchangeDataInnerEnd(const tag_set & tag, const parallel_storage & from, const parallel_storage & to, ElementType mask, MarkerType select, ReduceOperation op, exchange_data & storage);
......@@ -2268,7 +2284,7 @@ namespace INMOST
std::vector<int> FinishRequests (std::vector<INMOST_MPI_Request> & recv_reqs);
void SortParallelStorage(parallel_storage & ghost, parallel_storage & shared,ElementType mask);
void GatherParallelStorage(parallel_storage & ghost, parallel_storage & shared, ElementType mask);
void InformElementsOwners(proc_elements & send_elements, exchange_data & storage);
void InformElementsOwners(proc_elements_by_type & send_elements, exchange_data & storage);
public:
//bool FindSharedGhost(int global_id, INMOST_DATA_INTEGER_TYPE el_type_num, HandleType& res);
#if defined(USE_PARALLEL_WRITE_TIME)
......@@ -3172,7 +3188,7 @@ namespace INMOST
enumerator Count (const HandleType * arr, enumerator size, MarkerType marker) const;
void EquilibrateGhost (bool only_new = false); //Use in ResolveShared
//void CheckFaces();
void CheckCentroids();
void CheckCentroids(std::string file, int line);
//implemented in mesh.cpp
private:
Tag tag_topologyerror;
......
......@@ -215,13 +215,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::iterator it = lc.begin(); it != lc.end(); ++it)
if( (GetHandleElementType(*it) & etype) && !m->GetMarker(*it,hm) ) //check for type filters invalid handles
if( *it != InvalidHandle() && (GetHandleElementType(*it) & etype) && !m->GetMarker(*it,hm) ) //check for type filters invalid handles
m->SetPrivateMarker(*it,mrk);
}
else
{
for(Element::adj_type::iterator it = lc.begin(); it != lc.end(); ++it)//check for type filters invalid handles
if( GetHandleElementType(*it) & etype )
if( *it != InvalidHandle() && (GetHandleElementType(*it) & etype) )
m->SetPrivateMarker(*it,mrk);
}
}
......@@ -234,13 +234,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::iterator it = lc.begin(); it != lc.end(); ++it)
if( (GetHandleElementType(*it) & etype) && !m->GetMarker(*it,hm) )//check for type filters invalid handles
if( *it != InvalidHandle() && (GetHandleElementType(*it) & etype) && !m->GetMarker(*it,hm) )//check for type filters invalid handles
m->RemMarker(*it,mrk);
}
else
{
for(Element::adj_type::iterator it = lc.begin(); it != lc.end(); ++it)//check for type filters invalid handles
if( GetHandleElementType(*it) & etype )
if( *it != InvalidHandle() && (GetHandleElementType(*it) & etype) )
m->RemMarker(*it,mrk);
}
}
......@@ -253,13 +253,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::iterator it = lc.begin(); it != lc.end(); ++it)
if( (GetHandleElementType(*it) & etype) && !m->GetMarker(*it,hm) )//check for type filters invalid handles
if( *it != InvalidHandle() && (GetHandleElementType(*it) & etype) && !m->GetMarker(*it,hm) )//check for type filters invalid handles
m->RemPrivateMarker(*it,mrk);
}
else
{
for(Element::adj_type::iterator it = lc.begin(); it != lc.end(); ++it)//check for type filters invalid handles
if( GetHandleElementType(*it) & etype )
if( *it != InvalidHandle() && (GetHandleElementType(*it) & etype) )
m->RemPrivateMarker(*it,mrk);
}
}
......@@ -275,13 +275,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & etype) && !m->GetMarker(lc[it],hm) )//check for type filters invalid handles
if( lc[it] != InvalidHandle() && (GetHandleElementType(lc[it]) & etype) && !m->GetMarker(lc[it],hm) )//check for type filters invalid handles
ret.push_back(lc[it]);
}
else
{
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)//check for type filters invalid handles
if( GetHandleElementType(lc[it]) & etype )
if( lc[it] != InvalidHandle() && (GetHandleElementType(lc[it]) & etype) )
ret.push_back(lc[it]);
}
return ret;
......@@ -297,13 +297,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & etype) && !m->GetMarker(lc[it],hm) )//check for type filters invalid handles
if( lc[it] != InvalidHandle() && (GetHandleElementType(lc[it]) & etype) && !m->GetMarker(lc[it],hm) )//check for type filters invalid handles
++ret;
}
else
{
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)//check for type filters invalid handles
if( GetHandleElementType(lc[it]) & etype )
if( lc[it] != InvalidHandle() && (GetHandleElementType(lc[it]) & etype) )
++ret;
}
return ret;
......@@ -319,13 +319,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & etype) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
if( lc[it] != InvalidHandle() && (GetHandleElementType(lc[it]) & etype) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
ret.push_back(lc[it]);
}
else
{
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & etype) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
if( lc[it] != InvalidHandle() && (GetHandleElementType(lc[it]) & etype) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
ret.push_back(lc[it]);
}
return ret;
......@@ -341,13 +341,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & etype) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
if( lc[it] != InvalidHandle() && (GetHandleElementType(lc[it]) & etype) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
++ret;
}
else
{
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & etype) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
if( lc[it] != InvalidHandle() && (GetHandleElementType(lc[it]) & etype) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
++ret;
}
return ret;
......@@ -363,13 +363,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & NODE) && !m->GetMarker(lc[it],hm) )//check for type filters invalid handles
if( lc[it] != InvalidHandle() && (GetHandleElementType(lc[it]) & NODE) && !m->GetMarker(lc[it],hm) )//check for type filters invalid handles
ret.push_back(lc[it]);