Commit 97ea10c7 authored by Kirill Terekhov's avatar Kirill Terekhov
Browse files

some updates

Moving connections, markers, geometric type, sparse data from Storage
class to TagManager class by using standard handling of mesh data.
parent 0a715fdf
......@@ -221,7 +221,7 @@ namespace INMOST
lval = (e->GetElementType() & reinterpret_cast<ElementType>(var.left))? 1.0 : -1.0;
return lval;
case AD_COND_MARK:
lval = e->GetMarker(reinterpret_cast<MIDType>(var.left))? 1.0 : -1.0;
lval = e->GetMarker(reinterpret_cast<MarkerType>(var.left))? 1.0 : -1.0;
return lval;
case AD_COND:
lval = Evaluate(*var.left, e, user_data);
......@@ -477,7 +477,7 @@ namespace INMOST
assert(var.op != AD_NONE);
switch (var.op)
{
case AD_COND_MARK: return e->GetMarker(reinterpret_cast<MIDType>(var.left)) ? 1.0 : -1.0;
case AD_COND_MARK: return e->GetMarker(reinterpret_cast<MarkerType>(var.left)) ? 1.0 : -1.0;
case AD_COND_TYPE: return (e->GetElementType() & reinterpret_cast<ElementType>(var.left)) ? 1.0 : -1.0;
case AD_COND: return Evaluate(*(Evaluate(*var.left, e, user_data) > 0.0 ? var.right->left : var.right->right), e, user_data)*var.coef;
case AD_PLUS: return (Evaluate(*var.left, e, user_data) + Evaluate(*var.right, e, user_data))*var.coef;
......@@ -560,7 +560,7 @@ namespace INMOST
return ret;
}
//register stencil that can be got from tags
INMOST_DATA_ENUM_TYPE Automatizator::RegisterStencil(std::string name, Tag elements_tag, Tag coefs_tag, MIDType domain_mask)
INMOST_DATA_ENUM_TYPE Automatizator::RegisterStencil(std::string name, Tag elements_tag, Tag coefs_tag, MarkerType domain_mask)
{
INMOST_DATA_ENUM_TYPE ret = reg_stencils.size() + AD_STNCL;
stencil_kind_domain st;
......@@ -575,7 +575,7 @@ namespace INMOST
return ret;
}
//register stencil that can be got from function
INMOST_DATA_ENUM_TYPE Automatizator::RegisterStencil(std::string name, stencil_callback func, MIDType domain_mask)
INMOST_DATA_ENUM_TYPE Automatizator::RegisterStencil(std::string name, stencil_callback func, MarkerType domain_mask)
{
INMOST_DATA_ENUM_TYPE ret = reg_stencils.size() + AD_STNCL;
stencil_kind_domain st;
......@@ -601,7 +601,7 @@ namespace INMOST
}
/// set data of tag t defined on domain_mask to be dynamic data
/// don't register tag twice
INMOST_DATA_ENUM_TYPE Automatizator::RegisterDynamicTag(Tag t, ElementType typemask, MIDType domain_mask)
INMOST_DATA_ENUM_TYPE Automatizator::RegisterDynamicTag(Tag t, ElementType typemask, MarkerType domain_mask)
{
tagpair p;
p.d.domain_mask = domain_mask;
......@@ -766,7 +766,7 @@ namespace INMOST
}
/// register tag, data for which don't change through iterations
/// don't register tag twice
INMOST_DATA_ENUM_TYPE Automatizator::RegisterStaticTag(Tag t, MIDType domain_mask)
INMOST_DATA_ENUM_TYPE Automatizator::RegisterStaticTag(Tag t, MarkerType domain_mask)
{
INMOST_DATA_ENUM_TYPE ret = reg_ctags.size() + AD_CTAG;
tagdomain d;
......
......@@ -42,31 +42,37 @@ namespace INMOST
adjacent<Node> Cell::getNodes()
{
if( !GetMeshLink()->HideMarker() )
return adjacent<Node>(high_conn.begin(),high_conn.end());
{
adj_type & hc = HighConn();
return adjacent<Node>(hc.data(),hc.data()+hc.size());
}
else
{
MIDType hm = GetMeshLink()->HideMarker();
MarkerType hm = GetMeshLink()->HideMarker();
adjacent<Node> aret;
for(adj_iterator it = high_conn.begin(); it != high_conn.end(); ++it)
if( !(*it)->GetMarker(hm) ) aret.push_back((*it));
adj_type & hc = HighConn();
for(adj_type::enumerator it = 0; it < hc.size(); ++it)
if( !hc[it]->GetMarker(hm) ) aret.push_back(hc[it]);
return aret;
}
}
adjacent<Node> Cell::getNodes(MIDType mask, bool invert)
adjacent<Node> Cell::getNodes(MarkerType mask, bool invert)
{
adjacent<Node> aret;
if( !GetMeshLink()->HideMarker() )
{
for(adj_iterator it = high_conn.begin(); it != high_conn.end(); ++it)
if( invert ^ (*it)->GetMarker(mask) ) aret.push_back((*it));
adj_type & hc = HighConn();
for(adj_type::enumerator it = 0; it < hc.size(); ++it)
if( invert ^ hc[it]->GetMarker(mask) ) aret.push_back(hc[it]);
}
else
{
MIDType hm = GetMeshLink()->HideMarker();
for(adj_iterator it = high_conn.begin(); it != high_conn.end(); ++it)
if( (invert ^ (*it)->GetMarker(mask)) && !(*it)->GetMarker(hm) ) aret.push_back((*it));
MarkerType hm = GetMeshLink()->HideMarker();
adj_type & hc = HighConn();
for(adj_type::enumerator it = 0; it < hc.size(); ++it)
if( (invert ^ hc[it]->GetMarker(mask)) && !hc[it]->GetMarker(hm) ) aret.push_back(hc[it]);
}
return aret;
}
......@@ -78,90 +84,106 @@ namespace INMOST
{
if( GetElementDimension() == 2 ) // This cell is 2d face
{
aret.reserve(low_conn.size());
Element * q = low_conn[0]; //edge 0
aret.push_back(q->low_conn[0]); //node 0
aret.push_back(q->low_conn[1]); //node 1
Element * r = low_conn[1]; //edge 1
if( aret.data()[0] == r->low_conn[0] || aret.data()[0] == r->low_conn[1] )
adj_type & lc = LowConn();
aret.reserve(lc.size());
Element * q = lc[0]; //edge 0
adj_type & qlc = q->LowConn();
aret.push_back(qlc[0]); //node 0
aret.push_back(qlc[1]); //node 1
Element * r = lc[1]; //edge 1
adj_type & rlc = r->LowConn();
if( aret.data()[0] == rlc[0] || aret.data()[0] == rlc[1] )
{
Edge * temp = aret.data()[0];
aret.data()[0] = aret.data()[1];
aret.data()[1] = temp;
}
adj_iterator it = low_conn.begin()+1, iend = low_conn.end()-1;
while(it != iend) //loop over edges
{
if( &aret.back() == (*it)->low_conn[0] ) aret.push_back((*it)->low_conn[1]);
else aret.push_back((*it)->low_conn[0]);
++it;
}
adj_type::enumerator it = 1, iend = lc.size()-1;
while(it < iend) //loop over edges
{
adj_type & ilc = lc[it]->LowConn();
if( &aret.back() == ilc[0] ) aret.push_back(ilc[1]);
else aret.push_back(ilc[0]);
++it;
}
}
else
{
Mesh * m = GetMeshLink();
MIDType mrk = m->CreateMarker();
for(Element::adj_iterator it = low_conn.begin(); it != low_conn.end(); it++) //faces
for(Element::adj_iterator jt = (*it)->low_conn.begin(); jt != (*it)->low_conn.end(); jt++) //edges
if( !(*jt)->GetMarker(mrk))
MarkerType mrk = m->CreateMarker();
adj_type & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); it++) //faces
{
adj_type & ilc = lc[it]->LowConn();
for(adj_type::enumerator jt = 0; jt < ilc.size(); jt++) //edges
if( !ilc[jt]->GetMarker(mrk))
{
aret.push_back(*jt);
(*jt)->SetMarker(mrk);
aret.push_back(ilc[jt]);
ilc[jt]->SetMarker(mrk);
}
for(adjacent<Edge>::iterator it = aret.begin(); it != aret.end(); it++)
it->RemMarker(mrk);
}
for(adjacent<Edge>::enumerator it = 0; it < aret.size(); it++)
aret[it].RemMarker(mrk);
m->ReleaseMarker(mrk);
}
}
else
{
MIDType hm = GetMeshLink()->HideMarker();
MarkerType hm = GetMeshLink()->HideMarker();
if( GetElementDimension() == 2 ) // This cell is 2d face
{
INMOST_DATA_ENUM_TYPE i = static_cast<INMOST_DATA_ENUM_TYPE>(-1),
k = static_cast<INMOST_DATA_ENUM_TYPE>(-1),
k1 = static_cast<INMOST_DATA_ENUM_TYPE>(-1), k2;
aret.reserve(low_conn.size());
i = Mesh::getNext(&low_conn[0],low_conn.size(),i,hm);
Element * q = low_conn[i]; //edge 0
k = Mesh::getNext(&q->low_conn[0],q->low_conn.size(),k,hm);
aret.push_back(q->low_conn[k]); //node 0
k = Mesh::getNext(&q->low_conn[0],q->low_conn.size(),k,hm);
aret.push_back(q->low_conn[k]); //node 1
i = Mesh::getNext(&low_conn[0],low_conn.size(),i,hm);
Element * r = low_conn[i]; //edge 1
k1 = Mesh::getNext(&q->low_conn[0],q->low_conn.size(),k1,hm);
k2 = Mesh::getNext(&q->low_conn[0],q->low_conn.size(),k1,hm);
if( aret.data()[0] == r->low_conn[k1] || aret.data()[0] == r->low_conn[k2] )
adj_type & lc = LowConn();
aret.reserve(lc.size());
i = Mesh::getNext(lc.data(),lc.size(),i,hm);
Element * q = lc[i]; //edge 0
adj_type & qlc = q->LowConn();
k = Mesh::getNext(qlc.data(),qlc.size(),k,hm);
aret.push_back(qlc[k]); //node 0
k = Mesh::getNext(qlc.data(),qlc.size(),k,hm);
aret.push_back(qlc[k]); //node 1
i = Mesh::getNext(lc.data(),lc.size(),i,hm);
Element * r = lc[i]; //edge 1
adj_type & rlc = r->LowConn();
k1 = Mesh::getNext(rlc.data(),rlc.size(),k1,hm);
k2 = Mesh::getNext(rlc.data(),rlc.size(),k1,hm);
if( aret.data()[0] == rlc[k1] || aret.data()[0] == rlc[k2] )
{
Edge * temp = aret.data()[0];
aret.data()[0] = aret.data()[1];
aret.data()[1] = temp;
}
adj_iterator it = low_conn.begin()+1, iend = low_conn.end()-1;
while(it != iend) if( !(*it)->GetMarker(hm) ) //loop over edges
adj_type::enumerator it = 1, iend = lc.size()-1;
while(it < iend) if( !lc[it]->GetMarker(hm) ) //loop over edges
{
adj_type & ilc = lc[it]->LowConn();
k1 = static_cast<INMOST_DATA_ENUM_TYPE>(-1);
k1 = Mesh::getNext(&(*it)->low_conn[0],(*it)->low_conn.size(),k1,hm);
k2 = Mesh::getNext(&(*it)->low_conn[0],(*it)->low_conn.size(),k1,hm);
if( &aret.back() == (*it)->low_conn[k1] ) aret.push_back((*it)->low_conn[k2]);
else aret.push_back((*it)->low_conn[k1]);
k1 = Mesh::getNext(ilc.data(),ilc.size(),k1,hm);
k2 = Mesh::getNext(ilc.data(),ilc.size(),k1,hm);
if( &aret.back() == ilc[k1] ) aret.push_back(ilc[k2]);
else aret.push_back(ilc[k1]);
++it;
}
}
else
{
Mesh * m = GetMeshLink();
MIDType mrk = m->CreateMarker();
for(Element::adj_iterator it = low_conn.begin(); it != low_conn.end(); it++) if( !(*it)->GetMarker(hm) ) //faces
for(Element::adj_iterator jt = (*it)->low_conn.begin(); jt != (*it)->low_conn.end(); jt++) if( !(*jt)->GetMarker(hm) )//edges
if( !(*jt)->GetMarker(mrk))
MarkerType mrk = m->CreateMarker();
adj_type & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); it++) if( !lc[it]->GetMarker(hm) ) //faces
{
adj_type & ilc = lc[it]->LowConn();
for(adj_type::enumerator jt = 0; jt < ilc.size(); jt++) if( !ilc[jt]->GetMarker(hm) )//edges
if( !ilc[jt]->GetMarker(mrk))
{
aret.push_back(*jt);
(*jt)->SetMarker(mrk);
aret.push_back(ilc[jt]);
ilc[jt]->SetMarker(mrk);
}
for(adjacent<Edge>::iterator it = aret.begin(); it != aret.end(); it++)
it->RemMarker(mrk);
}
for(adjacent<Edge>::enumerator it = 0; it < aret.size(); it++)
aret[it].RemMarker(mrk);
m->ReleaseMarker(mrk);
}
}
......@@ -169,22 +191,25 @@ namespace INMOST
}
adjacent<Edge> Cell::getEdges(MIDType mask, bool invert)
adjacent<Edge> Cell::getEdges(MarkerType mask, bool invert)
{
adjacent<Edge> aret;
if( !GetMeshLink()->HideMarker() )
{
if( GetElementDimension() == 2 ) // This cell is 2d face
{
aret.reserve(low_conn.size());
adj_type & lc = LowConn();
aret.reserve(lc.size());
Element * last, * first;
Element * q = low_conn[0]; //edge 0
if( invert ^ q->low_conn[0]->GetMarker(mask) ) aret.push_back(q->low_conn[0]); //node 0
if( invert ^ q->low_conn[1]->GetMarker(mask) ) aret.push_back(q->low_conn[1]); //node 1
first = q->low_conn[0];
last = q->low_conn[1];
Element * r = low_conn[1]; //edge 1
if( first == r->low_conn[0] || first == r->low_conn[1] )
Element * q = lc[0]; //edge 0
adj_type & qlc = q->LowConn();
if( invert ^ qlc[0]->GetMarker(mask) ) aret.push_back(qlc[0]); //node 0
if( invert ^ qlc[1]->GetMarker(mask) ) aret.push_back(qlc[1]); //node 1
first = qlc[0];
last = qlc[1];
Element * r = lc[1]; //edge 1
adj_type & rlc = r->LowConn();
if( first == rlc[0] || first == rlc[1] )
{
last = first;
if( aret.size() > 1 )
......@@ -194,61 +219,62 @@ namespace INMOST
aret.data()[1] = temp;
}
}
adj_iterator it = low_conn.begin()+1, iend = low_conn.end()-1;
while(it != iend) //loop over edges
{
if( last == (*it)->low_conn[0] )
{
last = (*it)->low_conn[1];
if( invert ^ last->GetMarker(mask) ) aret.push_back(last);
}
else
{
last = (*it)->low_conn[0];
if( invert ^ last->GetMarker(mask) ) aret.push_back(last);
}
++it;
}
adj_type::enumerator it = 1, iend = lc.size()-1;
while(it < iend) //loop over edges
{
adj_type & ilc = lc[it]->LowConn();
if( last == ilc[0] ) last = ilc[1];
else last = ilc[0];
if( invert ^ last->GetMarker(mask) ) aret.push_back(last);
++it;
}
}
else
{
Mesh * m = GetMeshLink();
MIDType mrk = m->CreateMarker();
for(Element::adj_iterator it = low_conn.begin(); it != low_conn.end(); it++) //faces
for(Element::adj_iterator jt = (*it)->low_conn.begin(); jt != (*it)->low_conn.end(); jt++) //edges
if( (invert ^ (*jt)->GetMarker(mask)) && !(*jt)->GetMarker(mrk))
MarkerType mrk = m->CreateMarker();
adj_type & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); it++) //faces
{
adj_type & ilc = lc[it]->LowConn();
for(adj_type::enumerator jt = 0; jt != ilc.size(); jt++) //edges
if( (invert ^ ilc[jt]->GetMarker(mask)) && !ilc[jt]->GetMarker(mrk))
{
aret.push_back(*jt);
(*jt)->SetMarker(mrk);
aret.push_back(ilc[jt]);
ilc[jt]->SetMarker(mrk);
}
for(adjacent<Edge>::iterator it = aret.begin(); it != aret.end(); it++)
it->RemMarker(mrk);
}
for(adjacent<Edge>::enumerator it = 0; it != aret.size(); it++)
aret[it].RemMarker(mrk);
m->ReleaseMarker(mrk);
}
}
else
{
MIDType hm = GetMeshLink()->HideMarker();
MarkerType hm = GetMeshLink()->HideMarker();
if( GetElementDimension() == 2 ) // This cell is 2d face
{
INMOST_DATA_ENUM_TYPE i = static_cast<INMOST_DATA_ENUM_TYPE>(-1),
k = static_cast<INMOST_DATA_ENUM_TYPE>(-1),
k1 = static_cast<INMOST_DATA_ENUM_TYPE>(-1), k2;
Element * last, * first;
aret.reserve(low_conn.size());
i = Mesh::getNext(&low_conn[0],low_conn.size(),i,hm);
Element * q = low_conn[i]; //edge 0
k = Mesh::getNext(&q->low_conn[0],q->low_conn.size(),k,hm);
if( invert ^ q->low_conn[k]->GetMarker(mask) ) aret.push_back(q->low_conn[k]); //node 0
first = q->low_conn[k];
k = Mesh::getNext(&q->low_conn[0],q->low_conn.size(),k,hm);
if( invert ^ q->low_conn[k]->GetMarker(mask) ) aret.push_back(q->low_conn[k]); //node 1
last = q->low_conn[k];
i = Mesh::getNext(&low_conn[0],low_conn.size(),i,hm);
Element * r = low_conn[i]; //edge 1
k1 = Mesh::getNext(&q->low_conn[0],q->low_conn.size(),k1,hm);
k2 = Mesh::getNext(&q->low_conn[0],q->low_conn.size(),k1,hm);
if( first == r->low_conn[k1] || first == r->low_conn[k2] )
adj_type & lc = LowConn();
aret.reserve(lc.size());
i = Mesh::getNext(lc.data(),lc.size(),i,hm);
Element * q = lc[i]; //edge 0
adj_type & qlc = q->LowConn();
k = Mesh::getNext(qlc.data(),qlc.size(),k,hm);
if( invert ^ qlc[k]->GetMarker(mask) ) aret.push_back(qlc[k]); //node 0
first = qlc[k];
k = Mesh::getNext(qlc.data(),qlc.size(),k,hm);
if( invert ^ qlc[k]->GetMarker(mask) ) aret.push_back(qlc[k]); //node 1
last = qlc[k];
i = Mesh::getNext(lc.data(),lc.size(),i,hm);
Element * r = lc[i]; //edge 1
adj_type & rlc = r->LowConn();
k1 = Mesh::getNext(rlc.data(),rlc.size(),k1,hm);
k2 = Mesh::getNext(rlc.data(),rlc.size(),k1,hm);
if( first == rlc[k1] || first == rlc[k2] )
{
last = first;
if( aret.size() > 1 )
......@@ -258,38 +284,35 @@ namespace INMOST
aret.data()[1] = temp;
}
}
adj_iterator it = low_conn.begin()+1, iend = low_conn.end()-1;
while(it != iend) if( !(*it)->GetMarker(hm) ) //loop over edges
adj_type::enumerator it = 1, iend = lc.size()-1;
while(it != iend) if( !lc[it]->GetMarker(hm) ) //loop over edges
{
adj_type & ilc = lc[it]->LowConn();
k1 = static_cast<INMOST_DATA_ENUM_TYPE>(-1);
k1 = Mesh::getNext(&(*it)->low_conn[0],(*it)->low_conn.size(),k1,hm);
k2 = Mesh::getNext(&(*it)->low_conn[0],(*it)->low_conn.size(),k1,hm);
if( last == (*it)->low_conn[k1] )
{
last = (*it)->low_conn[k2];
if( invert ^ last->GetMarker(mask) ) aret.push_back(last);
}
else
{
last = (*it)->low_conn[k1];
if( invert ^ last->GetMarker(mask) ) aret.push_back(last);
}
k1 = Mesh::getNext(ilc.data(),ilc.size(),k1,hm);
k2 = Mesh::getNext(ilc.data(),ilc.size(),k1,hm);
if( last == ilc[k1] ) last = ilc[k2];
else last = ilc[k1];
if( invert ^ last->GetMarker(mask) ) aret.push_back(last);
++it;
}
}
else
{
Mesh * m = GetMeshLink();
MIDType mrk = m->CreateMarker();
for(Element::adj_iterator it = low_conn.begin(); it != low_conn.end(); it++) if( !(*it)->GetMarker(hm) ) //faces
for(Element::adj_iterator jt = (*it)->low_conn.begin(); jt != (*it)->low_conn.end(); jt++) if( !(*jt)->GetMarker(hm) )//edges
if( (invert ^ (*jt)->GetMarker(mask)) && !(*jt)->GetMarker(mrk))
MarkerType mrk = m->CreateMarker();
adj_type & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); it++) if( !lc[it]->GetMarker(hm) ) //faces
{
adj_type & ilc = lc[it]->LowConn();
for(adj_type::enumerator jt = 0; jt < ilc.size(); jt++) if( !ilc[jt]->GetMarker(hm) )//edges
if( (invert ^ ilc[jt]->GetMarker(mask)) && !ilc[jt]->GetMarker(mrk))
{
aret.push_back(*jt);
(*jt)->SetMarker(mrk);
aret.push_back(ilc[jt]);
ilc[jt]->SetMarker(mrk);
}
for(adjacent<Edge>::iterator it = aret.begin(); it != aret.end(); it++)
it->RemMarker(mrk);
}
for(adjacent<Edge>::enumerator it = 0; it < aret.size(); it++) aret[it].RemMarker(mrk);
m->ReleaseMarker(mrk);
}
}
......@@ -299,31 +322,37 @@ namespace INMOST
adjacent<Face> Cell::getFaces()
{
if( !GetMeshLink()->HideMarker() )
return adjacent<Face>(low_conn.begin(),low_conn.end());
{
adj_type & lc = LowConn();
return adjacent<Face>(lc.data(),lc.data()+lc.size());
}
else
{
MIDType hm = GetMeshLink()->HideMarker();
MarkerType hm = GetMeshLink()->HideMarker();
adjacent<Face> aret;
for(adj_iterator it = low_conn.begin(); it != low_conn.end(); ++it)
if( !(*it)->GetMarker(hm) ) aret.push_back((*it));
adj_type & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); ++it)
if( !lc[it]->GetMarker(hm) ) aret.push_back(lc[it]);
return aret;
}
}
adjacent<Face> Cell::getFaces(MIDType mask, bool invert)
adjacent<Face> Cell::getFaces(MarkerType mask, bool invert)
{
adjacent<Face> aret;
if( !GetMeshLink()->HideMarker() )
{
for(adj_iterator it = low_conn.begin(); it != low_conn.end(); ++it)
if( invert ^ (*it)->GetMarker(mask) ) aret.push_back((*it));
adj_type & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); ++it)
if( invert ^ lc[it]->GetMarker(mask) ) aret.push_back(lc[it]);
}
else
{
MIDType hm = GetMeshLink()->HideMarker();
for(adj_iterator it = low_conn.begin(); it != low_conn.end(); ++it)
if( (invert ^ (*it)->GetMarker(mask)) && !(*it)->GetMarker(hm) ) aret.push_back((*it));
MarkerType hm = GetMeshLink()->HideMarker();
adj_type & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); ++it)
if( (invert ^ lc[it]->GetMarker(mask)) && !lc[it]->GetMarker(hm) ) aret.push_back(lc[it]);
}
return aret;
}
......
This diff is collapsed.
......@@ -32,18 +32,20 @@ namespace INMOST
{
if( !GetMeshLink()->HideMarker() )
{
if( low_conn.empty() )
adj_type const & lc = LowConn();
if( lc.empty() )
return NULL;
return low_conn.front()->getAsNode();
return lc.front()->getAsNode();
}
else
{
if( !low_conn.empty() )
adj_type const & lc = LowConn();
if( !lc.empty() )
{
INMOST_DATA_ENUM_TYPE i = static_cast<INMOST_DATA_ENUM_TYPE>(-1);
MIDType hm = GetMeshLink()->HideMarker();
i = Mesh::getNext(&low_conn[0],low_conn.size(),i,hm);
if( i != low_conn.size() ) return low_conn[i]->getAsNode();
MarkerType hm = GetMeshLink()->HideMarker();
i = Mesh::getNext(lc.data(),lc.size(),i,hm);
if( i != lc.size() ) return lc[i]->getAsNode();
}
return NULL;
}
......@@ -52,19 +54,21 @@ namespace INMOST
{
if( !GetMeshLink()->HideMarker() )
{
if( low_conn.size() < 2 )
adj_type const & lc = LowConn();
if( lc.size() < 2 )
return NULL;
return low_conn.back()->getAsNode();
return lc.back()->getAsNode();
}
else
{
if( !low_conn.empty() )
adj_type const & lc = LowConn();
if( !lc.empty() )
{
INMOST_DATA_ENUM_TYPE i = static_cast<INMOST_DATA_ENUM_TYPE>(-1);
MIDType hm = GetMeshLink()->HideMarker();
i = Mesh::getNext(&low_conn[0],low_conn.size(),i,hm);
i = Mesh::getNext(&low_conn[0],low_conn.size(),i,hm);
if( i != low_conn.size() ) return low_conn[i]->getAsNode();
MarkerType hm = GetMeshLink()->HideMarker();
i = Mesh::getNext(lc.data(),lc.size(),i,hm);
i = Mesh::getNext(lc.data(),lc.size(),i,hm);
if( i != lc.size() ) return lc[i]->getAsNode();
}
return NULL;
}
......@@ -73,30 +77,36 @@ namespace INMOST
adjacent<Node> Edge::getNodes()
{
if( !GetMeshLink()->HideMarker() )
return adjacent<Node>(low_conn.begin(),low_conn.end());
{
adj_type & lc = LowConn();
return adjacent<Node>(lc.data(),lc.data()+lc.size());
}
else
{
MIDType hm = GetMeshLink()->HideMarker();
MarkerType hm = GetMeshLink()->HideMarker();
adjacent<Node> aret;
for(adj_iterator it = low_conn.begin(); it != low_conn.end(); ++it)
if( !(*it)->GetMarker(hm) ) aret.push_back((*it));
adj_type const & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); ++it)
if( !lc[it]->GetMarker(hm) ) aret.push_back(lc[it]);
return aret;
}
}