Commit aa464182 authored by Kirill Terekhov's avatar Kirill Terekhov

remove cell<->node connections

parent 9325de74
......@@ -305,7 +305,7 @@ int main(int argc,char ** argv)
for(Mesh::iteratorFace face = m->BeginFace(); face != m->EndFace(); ++face)
{
//~ std::cout << face->LocalID() << " / " << m->NumberOfFaces() << std::endl;
Element::Status s1,s2;
Element::Status s1 = Element::Any,s2 = Element::Any;
Cell r1 = face->BackCell();
Cell r2 = face->FrontCell();
if( ((!r1.isValid() || (s1 = r1->GetStatus()) == Element::Ghost)?0:1)+
......
......@@ -1488,11 +1488,11 @@ namespace INMOST
std::pair<Edge,bool> CreateEdge (const ElementArray<Node> & nodes);
std::pair<Face,bool> CreateFace (const ElementArray<Edge> & edges);
std::pair<Face,bool> CreateFace (const ElementArray<Node> & nodes);
std::pair<Cell,bool> CreateCell (const ElementArray<Face> & faces, const ElementArray<Node> & suggest_nodes_order = ElementArray<Node>(NULL));
std::pair<Cell,bool> CreateCell (const ElementArray<Node> & c_f_nodes, const integer * c_f_numnodes, integer num_c_faces,
const ElementArray<Node> & suggest_nodes_order = ElementArray<Node>(NULL));
std::pair<Cell,bool> CreateCell (const ElementArray<Node> & c_nodes, const integer * c_f_nodeinds, const integer * c_f_numnodes, integer num_c_faces,
const ElementArray<Node> & suggest_nodes_order = ElementArray<Node>(NULL));
std::pair<Cell,bool> CreateCell (const ElementArray<Face> & faces);//, const ElementArray<Node> & suggest_nodes_order = ElementArray<Node>(NULL));
std::pair<Cell,bool> CreateCell (const ElementArray<Node> & c_f_nodes, const integer * c_f_numnodes, integer num_c_faces);//,
//const ElementArray<Node> & suggest_nodes_order = ElementArray<Node>(NULL));
std::pair<Cell,bool> CreateCell (const ElementArray<Node> & c_nodes, const integer * c_f_nodeinds, const integer * c_f_numnodes, integer num_c_faces);//,
//const ElementArray<Node> & suggest_nodes_order = ElementArray<Node>(NULL));
std::pair<ElementSet,bool> CreateSet (std::string name);
/// Same as Mesh::CreateSet without checking existance of the set
std::pair<ElementSet,bool> CreateSetUnique (std::string name);
......
......@@ -234,14 +234,8 @@ namespace INMOST
lid = IntegerDF(lc[kt],set_id);
uconv.write_iValue(out,lid);
}
Element::adj_type & hc = HighConn(*it);
nhigh = static_cast<INMOST_DATA_ENUM_TYPE>(hc.size());
nhigh = 0;
uconv.write_iValue(out,nhigh);
for(Element::adj_type::size_type kt = 0; kt < hc.size(); ++kt)
{
lid = IntegerDF(hc[kt],set_id);
uconv.write_iValue(out,lid);
}
}
// Element Sets
......@@ -1259,7 +1253,8 @@ namespace INMOST
uconv.read_iValue(in,lid);
suggest_nodes.push_back(new_nodes[lid]);
}
new_cells[i] = CreateCell(sub_elements, suggest_nodes).first->GetHandle();
//new_cells[i] = CreateCell(sub_elements, suggest_nodes).first->GetHandle();
new_cells[i] = CreateCell(sub_elements).first->GetHandle();
sub_elements.clear();
suggest_nodes.clear();
}
......
......@@ -1882,7 +1882,8 @@ safe_output:
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first);
}
Cell c = CreateCell(c_faces,c_nodes).first;
//Cell c = CreateCell(c_faces,c_nodes).first;
Cell c = CreateCell(c_faces).first;
newcells[i] = c->GetHandle();
}
else
......@@ -1921,7 +1922,8 @@ safe_output:
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first);
}
Cell c = CreateCell(c_faces,c_nodes).first;
//Cell c = CreateCell(c_faces,c_nodes).first;
Cell c = CreateCell(c_faces).first;
newcells[i] = c->GetHandle();
}
else newcells[i] = CreateFace(c_nodes).first->GetHandle();
......@@ -1948,7 +1950,8 @@ safe_output:
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first);
}
Cell c = CreateCell(c_faces,c_nodes).first;
//Cell c = CreateCell(c_faces,c_nodes).first;
Cell c = CreateCell(c_faces).first;
newcells[i] = c->GetHandle();
}
else newcells[i] = CreateFace(c_nodes).first->GetHandle();
......
......@@ -674,7 +674,8 @@ namespace INMOST
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first);
}
Cell c = CreateCell(c_faces,hnodes).first;
//Cell c = CreateCell(c_faces,hnodes).first;
Cell c = CreateCell(c_faces).first;
newcells[q] = c->GetHandle();
}
else
......@@ -703,7 +704,8 @@ namespace INMOST
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first);
}
Cell c = CreateCell(c_faces, hnodes).first;
//Cell c = CreateCell(c_faces, hnodes).first;
Cell c = CreateCell(c_faces).first;
newcells[q] = c->GetHandle();
}
else
......@@ -733,7 +735,8 @@ namespace INMOST
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first);
}
Cell c = CreateCell(c_faces, hnodes).first;
//Cell c = CreateCell(c_faces, hnodes).first;
Cell c = CreateCell(c_faces).first;
newcells[q] = c->GetHandle();
}
else
......@@ -757,7 +760,8 @@ namespace INMOST
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first);
}
Cell c = CreateCell(c_faces, hnodes).first;
//Cell c = CreateCell(c_faces, hnodes).first;
Cell c = CreateCell(c_faces).first;
newcells[q] = c->GetHandle();
}
else
......
......@@ -141,7 +141,6 @@ namespace INMOST
if( jt == jend ) return false; //no matching edge
}
adj_type::size_type it = 1, iend = lc.size()-1;
bool corrected = false;
while(it < iend) //loop over edges
{
adj_type const & ilc = m->LowConn(lc[it]);
......@@ -168,20 +167,12 @@ namespace INMOST
HandleType temp = lc[it];
lc[it] = lc[jt];
lc[jt] = temp;
corrected = true;
break;
}
}
if( jt == jend ) return false; //no matching edge
}
}
if( corrected )
{
ElementArray<Node> nodes(GetMeshLink());
GetMeshLink()->RestoreCellNodes(GetHandle(),nodes);
Element::adj_type & hc = GetMeshLink()->HighConn(GetHandle());
hc.replace(hc.begin(),hc.end(),nodes.begin(),nodes.end());
}
//check that the loop is closed
adj_type const & ilc = m->LowConn(lc[iend]);
if( ilc.size() != 2 ) return false;
......@@ -305,20 +296,9 @@ namespace INMOST
{
assert(GetHandleElementType(GetHandle())==CELL);
Mesh * m = GetMeshLink();
if( !m->HideMarker() )
{
adj_type const & hc = m->HighConn(GetHandle());
return ElementArray<Node>(m,hc.data(),hc.data()+hc.size());
}
else
{
MarkerType hm = m->HideMarker();
ElementArray<Node> aret(m);
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( !m->GetMarker(hc[it],hm) ) aret.push_back(hc[it]);
return aret;
}
ElementArray<Node> ret(m);
m->RestoreCellNodes(GetHandle(),ret);
return ret;
}
......@@ -326,39 +306,19 @@ namespace INMOST
{
assert(GetHandleElementType(GetHandle())==CELL);
Mesh * m = GetMeshLink();
ElementArray<Node> aret(m);
if( !m->HideMarker() )
ElementArray<Node> aret(m), ret(m);
m->RestoreCellNodes(GetHandle(),ret);
if( isPrivate(mask) )
{
adj_type const & hc = m->HighConn(GetHandle());
if( isPrivate(mask) )
{
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( invert ^ m->GetPrivateMarker(hc[it],mask) )
aret.push_back(hc[it]);
}
else
{
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( invert ^ m->GetMarker(hc[it],mask) )
aret.push_back(hc[it]);
}
for(ElementArray<Node>::iterator it = ret.begin(); it != ret.end(); ++it)
if( invert ^ m->GetPrivateMarker(*it,mask) )
aret.push_back(*it);
}
else
{
MarkerType hm = m->HideMarker();
adj_type const & hc = m->HighConn(GetHandle());
if( isPrivate(mask) )
{
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( (invert ^ m->GetPrivateMarker(hc[it],mask)) && !m->GetMarker(hc[it],hm) )
aret.push_back(hc[it]);
}
else
{
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( (invert ^ m->GetMarker(hc[it],mask)) && !m->GetMarker(hc[it],hm) )
aret.push_back(hc[it]);
}
for(ElementArray<Node>::iterator it = ret.begin(); it != ret.end(); ++it)
if( invert ^ m->GetMarker(*it,mask) )
aret.push_back(*it);
}
return aret;
}
......
This diff is collapsed.
......@@ -594,9 +594,13 @@ namespace INMOST
void Mesh::ComputeGeometricType(HandleType h)
{
SetGeometricType(h,Element::Unset);
Element::adj_type const & lc = LowConn(h);
if( !lc.empty() )
SetGeometricType(h,ComputeGeometricType(GetHandleElementType(h),lc.data(),static_cast<integer>(lc.size())));
if( GetElementType() > NODE )
{
Element::adj_type const & lc = LowConn(h);
if( !lc.empty() )
SetGeometricType(h,ComputeGeometricType(GetHandleElementType(h),lc.data(),static_cast<integer>(lc.size())));
}
else SetGeometricType(h,Element::Vertex);
}
void Mesh::RecomputeGeometricData(HandleType e)
......@@ -620,7 +624,7 @@ namespace INMOST
{
if( GetHandleElementType(e) == CELL ) //then correct the normal
{
Element::adj_type & lc = LowConn(e);
Element::adj_type & lc = LowConn(e); //faces
for(Element::adj_type::iterator it = lc.begin(); it != lc.end(); ++it)
if( !GetMarker(*it,HideMarker()) )
{
......
......@@ -138,7 +138,25 @@ namespace INMOST
checkm = true;
if( m->GetMarker(set[0].e,m->HideMarker()) ) invm = true;
}
Element::adj_type & nodes = m->HighConn(set[0].e);
//Element::adj_type & nodes = m->HighConn(set[0].e);
std::vector<HandleType> nodes;
MarkerType mrk = m->CreatePrivateMarker();
Element::adj_type & faces = m->LowConn(set[0].e);
for(unsigned k = 0; k < faces.size(); ++k)
{
Element::adj_type & fedges = m->LowConn(faces[k]);
for(unsigned q = 0; q < fedges.size(); ++q)
{
Element::adj_type & enodes = m->LowConn(fedges[k]);
for(unsigned l = 0; l < enodes.size(); ++l) if( !m->GetMarker(enodes[l],mrk) )
{
nodes.push_back(enodes[l]);
m->SetMarker(enodes[l],mrk);
}
}
}
if( !nodes.empty() ) m->RemPrivateMarkerArray(&nodes[0],nodes.size(),mrk);
m->ReleasePrivateMarker(mrk);
bbox[0] = bbox[2] = bbox[4] = 1.0e20f;
bbox[1] = bbox[3] = bbox[5] = -1.0e20f;
if( checkm )
......
......@@ -201,8 +201,8 @@ namespace INMOST
memset(remember,0,sizeof(remember));
tag_coords = CreateTag("PROTECTED_COORD",DATA_REAL, NODE,NONE,dim);
tag_high_conn = CreateTag("PROTECTED_HIGH_CONN",DATA_REFERENCE,ESET|CELL|FACE|EDGE|NODE,NONE);
tag_low_conn = CreateTag("PROTECTED_LOW_CONN",DATA_REFERENCE,ESET|CELL|FACE|EDGE|NODE,NONE);
tag_high_conn = CreateTag("PROTECTED_HIGH_CONN",DATA_REFERENCE,ESET|FACE|EDGE|NODE,NONE);
tag_low_conn = CreateTag("PROTECTED_LOW_CONN",DATA_REFERENCE,ESET|CELL|FACE|EDGE,NONE);
tag_markers = CreateTag("PROTECTED_MARKERS",DATA_BULK,CELL|FACE|EDGE|NODE|ESET|MESH,NONE,MarkerFields);
tag_geom_type = CreateTag("PROTECTED_GEOM_TYPE",DATA_BULK,CELL|FACE|EDGE|NODE,NONE,1);
tag_setname = CreateTag("PROTECTED_SET_NAME",DATA_BULK,ESET,NONE);
......@@ -436,8 +436,8 @@ namespace INMOST
//setup system tags shortcuts
dim = other.dim;
tag_coords = CreateTag("PROTECTED_COORD",DATA_REAL, NODE,NONE,dim);
tag_high_conn = CreateTag("PROTECTED_HIGH_CONN",DATA_REFERENCE,ESET|CELL|FACE|EDGE|NODE,NONE);
tag_low_conn = CreateTag("PROTECTED_LOW_CONN",DATA_REFERENCE,ESET|CELL|FACE|EDGE|NODE,NONE);
tag_high_conn = CreateTag("PROTECTED_HIGH_CONN",DATA_REFERENCE,ESET|FACE|EDGE|NODE,NONE);
tag_low_conn = CreateTag("PROTECTED_LOW_CONN",DATA_REFERENCE,ESET|CELL|FACE|EDGE,NONE);
tag_markers = CreateTag("PROTECTED_MARKERS",DATA_BULK,CELL|FACE|EDGE|NODE|ESET|MESH,NONE,MarkerFields);
tag_geom_type = CreateTag("PROTECTED_GEOM_TYPE",DATA_BULK,CELL|FACE|EDGE|NODE,NONE,1);
tag_setname = CreateTag("PROTECTED_SET_NAME",DATA_BULK,ESET,NONE);
......@@ -565,8 +565,8 @@ namespace INMOST
//setup system tags shortcuts
dim = other.dim;
tag_coords = CreateTag("PROTECTED_COORD",DATA_REAL, NODE,NONE,dim);
tag_high_conn = CreateTag("PROTECTED_HIGH_CONN",DATA_REFERENCE,ESET|CELL|FACE|EDGE|NODE,NONE);
tag_low_conn = CreateTag("PROTECTED_LOW_CONN",DATA_REFERENCE,ESET|CELL|FACE|EDGE|NODE,NONE);
tag_high_conn = CreateTag("PROTECTED_HIGH_CONN",DATA_REFERENCE,ESET|FACE|EDGE|NODE,NONE);
tag_low_conn = CreateTag("PROTECTED_LOW_CONN",DATA_REFERENCE,ESET|CELL|FACE|EDGE,NONE);
tag_markers = CreateTag("PROTECTED_MARKERS",DATA_BULK,CELL|FACE|EDGE|NODE|ESET|MESH,NONE,MarkerFields);
tag_geom_type = CreateTag("PROTECTED_GEOM_TYPE",DATA_BULK,CELL|FACE|EDGE|NODE,NONE,1);
tag_setname = CreateTag("PROTECTED_SET_NAME",DATA_BULK,ESET,NONE);
......@@ -795,6 +795,7 @@ namespace INMOST
HandleType Mesh::FindSharedAdjacency(const HandleType * arr, enumerator s) const
{
if( s == 0 ) return InvalidHandle();
for(enumerator q = 0; q < s; ++q) assert(GetHandleElementType(arr[q]) != CELL);
if( !HideMarker() )
{
{
......@@ -1394,7 +1395,7 @@ namespace INMOST
}
std::pair<Cell,bool> Mesh::CreateCell(const ElementArray<Node> & c_f_nodes, const integer * c_f_sizes, integer s, const ElementArray<Node> & suggest_nodes_order)
std::pair<Cell,bool> Mesh::CreateCell(const ElementArray<Node> & c_f_nodes, const integer * c_f_sizes, integer s)//, const ElementArray<Node> & suggest_nodes_order)
{
ElementArray<Face> c_faces(this,s);
ElementArray<Node>::size_type j = 0;
......@@ -1403,11 +1404,11 @@ namespace INMOST
c_faces.at(i) = CreateFace(ElementArray<Node>(this, c_f_nodes.data()+j, c_f_nodes.data()+j + c_f_sizes[i])).first->GetHandle();
j += c_f_sizes[i];
}
return CreateCell(c_faces,suggest_nodes_order);
return CreateCell(c_faces);//,suggest_nodes_order);
}
std::pair<Cell, bool> Mesh::CreateCell(const ElementArray<Node> & c_f_nodes, const integer * c_f_nodeinds, const integer * c_f_numnodes, integer s, const ElementArray<Node> & suggest_nodes_order)
std::pair<Cell, bool> Mesh::CreateCell(const ElementArray<Node> & c_f_nodes, const integer * c_f_nodeinds, const integer * c_f_numnodes, integer s)//, const ElementArray<Node> & suggest_nodes_order)
{
integer j = 0;
ElementArray<Node> temp(this);
......@@ -1421,7 +1422,7 @@ namespace INMOST
j += c_f_numnodes[i];
temp.clear();
}
return CreateCell(c_faces,suggest_nodes_order);
return CreateCell(c_faces);//,suggest_nodes_order);
}
......@@ -1643,27 +1644,17 @@ namespace INMOST
Element::adj_type & ilc = LowConn(lc[i]);
for(Element::adj_type::size_type j = 0; j < ilc.size(); j++) //iterate over face edges
{
if( !GetPrivateMarker(ilc[j],mrk) )
Element::adj_type & jlc = LowConn(ilc[j]);
for(Element::adj_type::size_type k = 0; k < jlc.size(); k++) //iterator over edge nodes
{
Element::adj_type & jlc = LowConn(ilc[j]);
for(Element::adj_type::size_type k = 0; k < jlc.size(); k++) //iterator over edge nodes
if( !GetPrivateMarker(jlc[k],mrk) )
{
if( !GetPrivateMarker(jlc[k],mrk) )
{
SetPrivateMarker(jlc[k],mrk);
ret.push_back(jlc[k]);
}
SetPrivateMarker(jlc[k],mrk);
ret.push_back(jlc[k]);
}
SetPrivateMarker(ilc[j],mrk);
}
}
}
for(Element::adj_type::size_type i = 0; i < lc.size(); i++) //iterate over faces
{
Element::adj_type & ilc = LowConn(lc[i]);
for(Element::adj_type::size_type j = 0; j < ilc.size(); j++) //iterate over face edges
RemPrivateMarker(ilc[j],mrk);
}
}
else
{
......@@ -1673,29 +1664,19 @@ namespace INMOST
Element::adj_type & ilc = LowConn(lc[i]);
for(Element::adj_type::size_type j = 0; j < ilc.size(); j++) if( !Hidden(ilc[j]) ) //iterate over face edges
{
if( !GetPrivateMarker(ilc[j],mrk) )
Element::adj_type & jlc = LowConn(ilc[j]);
for(Element::adj_type::size_type k = 0; k < jlc.size(); k++) if( !Hidden(jlc[k]) ) //iterator over edge nodes
{
Element::adj_type & jlc = LowConn(ilc[j]);
for(Element::adj_type::size_type k = 0; k < jlc.size(); k++) if( !Hidden(jlc[k]) ) //iterator over edge nodes
if( !GetPrivateMarker(jlc[k], mrk) )
{
if( !GetPrivateMarker(jlc[k], mrk) )
{
SetPrivateMarker(jlc[k],mrk);
ret.push_back(jlc[k]);
}
SetPrivateMarker(jlc[k],mrk);
ret.push_back(jlc[k]);
}
SetPrivateMarker(ilc[j],mrk);
}
}
}
for(Element::adj_type::size_type i = 0; i < lc.size(); i++) if( !Hidden(lc[i]) ) //iterate over faces
{
Element::adj_type & ilc = LowConn(lc[i]);
for(Element::adj_type::size_type j = 0; j < ilc.size(); j++) if( !Hidden(ilc[j]) ) //iterate over face edges
RemPrivateMarker(ilc[j],mrk);
}
}
for(ElementArray<Node>::size_type it = 0; it < ret.size(); it++) ret[it]->RemPrivateMarker(mrk);
ret.RemPrivateMarker(mrk);
ReleasePrivateMarker(mrk);
break;
}
......@@ -1703,7 +1684,7 @@ namespace INMOST
}
std::pair<Cell,bool> Mesh::CreateCell(const ElementArray<Face> & c_faces, const ElementArray<Node> & c_nodes)
std::pair<Cell,bool> Mesh::CreateCell(const ElementArray<Face> & c_faces)//, const ElementArray<Node> & c_nodes)
{
HandleType he = InvalidHandle();
if( !c_faces.empty() )
......@@ -1732,95 +1713,9 @@ namespace INMOST
Element::adj_type & lc = LowConn(he);
lc.insert(lc.begin(),c_faces.begin(),c_faces.end());
ComputeGeometricType(he);
{
//bool halt = false; //DEBUG
if( c_nodes.empty() )
{
ElementArray<Node> nodes(this);
RestoreCellNodes(he,nodes);
for(ElementArray<Node>::size_type k = 0; k < nodes.size(); k++)
{
Element::adj_type & lc = LowConn(nodes.at(k));
#if defined(USE_OMP)
#pragma omp critical (node_low_conn)
#endif
lc.push_back(he);
}
Element::adj_type & hc = HighConn(he);
hc.insert(hc.begin(),nodes.begin(),nodes.end());
//DEBUG
/*
for(ElementArray<Node>::size_type i = 0; i < nodes.size(); i++)
{
if(!nodes[i]->CheckElementConnectivity())
{
nodes[i]->PrintElementConnectivity();
halt = true;
}
}
*/
//END DEBUG
}
else
{
for(ElementArray<Node>::size_type k = 0; k < c_nodes.size(); k++)
{
Element::adj_type & lc = LowConn(c_nodes.at(k));
#if defined(USE_OMP)
#pragma omp critical (node_low_conn)
#endif
lc.push_back(he);
}
Element::adj_type & hc = HighConn(he);
hc.insert(hc.begin(),c_nodes.begin(),c_nodes.end());
//DEBUG
/*
for(ElementArray<Face>::size_type i = 0; i < c_nodes.size(); i++)
{
if(!c_nodes[i]->CheckElementConnectivity())
{
c_nodes[i]->PrintElementConnectivity();
halt = true;
}
}
*/
//END DEBUG
}
//DEBUG
/*
if(!Element(this,he)->CheckElementConnectivity())
{
Element(this,he)->PrintElementConnectivity();
halt = true;
}
for(ElementArray<Face>::size_type i = 0; i < c_faces.size(); i++)
{
if( !c_faces[i]->CheckElementConnectivity() )
{
c_faces[i]->PrintElementConnectivity();
halt = true;
}
}
assert(!halt);
*/
//END DEBUG
SetMarker(he,NewMarker());
RecomputeGeometricData(he);
EndTopologyCheck(he,chk);
/*
chk |= EndTopologyCheck(he);
if( chk != 0 )
{
if( GetTopologyCheck(MARK_ON_ERROR) ) Integer(he, TopologyErrorTag()) = chk;
if( GetTopologyCheck(DELETE_ON_ERROR) ) { Destroy(he); he = InvalidHandle();}
if( GetTopologyCheck(THROW_EXCEPTION) ) throw TopologyCheckError;
}
*/
}
SetMarker(he,NewMarker());
RecomputeGeometricData(he);
EndTopologyCheck(he,chk);
}
return std::make_pair(Cell(this,he),true);
}
......
This diff is collapsed.
......@@ -95,7 +95,7 @@ namespace INMOST
}
}
}
for(ElementArray<Face>::size_type it = 0; it < aret.size(); it++) m->RemPrivateMarker(aret.at(it),mrk);
aret.RemPrivateMarker(mrk);
m->ReleasePrivateMarker(mrk);
return aret;
}
......@@ -170,7 +170,7 @@ namespace INMOST
}
}
}
for(ElementArray<Face>::size_type it = 0; it < aret.size(); it++) m->RemPrivateMarker(aret.at(it),mrk);
aret.RemPrivateMarker(mrk);
m->ReleasePrivateMarker(mrk);
return aret;
}
......@@ -179,20 +179,52 @@ namespace INMOST
{
assert(GetHandleElementType(GetHandle())==NODE);
Mesh * m = GetMeshLink();
ElementArray<Cell> aret(m);
MarkerType mrk = m->CreatePrivateMarker();
if( !m->HideMarker() )
{
adj_type const & lc = m->LowConn(GetHandle());
return ElementArray<Cell>(m,lc.data(),lc.data()+lc.size());
adj_type const & edges = m->HighConn(GetHandle()); // all edges
for(adj_type::const_iterator eit = edges.begin(); eit != edges.end(); ++eit)
{
adj_type const & faces = m->HighConn(*eit); // all faces of the edge
for(adj_type::const_iterator fit = faces.begin(); fit != faces.end(); ++fit)
{
adj_type const & cells = m->HighConn(*fit);
for(adj_type::const_iterator cit = cells.begin(); cit != cells.end(); ++cit)
{
if( !m->GetPrivateMarker(*cit,mrk) )
{
aret.push_back(*cit);
m->SetPrivateMarker(*cit,mrk);
}
}
}
}
}
else
{
MarkerType hm = m->HideMarker();
ElementArray<Cell> aret(m);
adj_type const & lc = m->LowConn(GetHandle());
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( !m->GetMarker(lc[it],hm) ) aret.push_back(lc[it]);
return aret;
adj_type const & edges = m->HighConn(GetHandle()); // all edges
for(adj_type::const_iterator eit = edges.begin(); eit != edges.end(); ++eit) if( !m->GetMarker(*eit,hm) )
{
adj_type const & faces = m->HighConn(*eit); // all faces of the edge
for(adj_type::const_iterator fit = faces.begin(); fit != faces.end(); ++fit) if( !m->GetMarker(*fit,hm) )
{
adj_type const & cells = m->HighConn(*fit);
for(adj_type::const_iterator cit = cells.begin(); cit != cells.end(); ++cit) if( !m->GetMarker(*cit,hm) )
{
if( !m->GetPrivateMarker(*cit,mrk) )
{
aret.push_back(*cit);
m->SetPrivateMarker(*cit,mrk);
}
}
}
}
}
aret.RemPrivateMarker(mrk);
m->ReleasePrivateMarker(mrk);
return aret;
}
ElementArray<Cell> Node::getCells(MarkerType mask, bool invert) const
......@@ -200,18 +232,48 @@ namespace INMOST
assert(GetHandleElementType(GetHandle())==NODE);
Mesh * m = GetMeshLink();
ElementArray<Cell> aret(m);
adj_type const & lc = m->LowConn(GetHandle());
MarkerType mrk = m->CreatePrivateMarker();
if( !m->HideMarker() )
{
if( isPrivate(mask) )
{
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( invert ^ m->GetPrivateMarker(lc[it],mask) ) aret.push_back(lc[it]);
adj_type const & edges = m->HighConn(GetHandle()); // all edges
for(adj_type::const_iterator eit = edges.begin(); eit != edges.end(); ++eit)
{
adj_type const & faces = m->HighConn(*eit); // all faces of the edge
for(adj_type::const_iterator fit = faces.begin(); fit != faces.end(); ++fit)
{
adj_type const & cells = m->HighConn(*fit);
for(adj_type::const_iterator cit = cells.begin(); cit != cells.end(); ++cit)
{
if( (invert ^ m->GetPrivateMarker(*cit,mask)) && !m->GetPrivateMarker(*cit,mrk) )
{
aret.push_back(*cit);
m->SetPrivateMarker(*cit,mrk);
}
}
}
}
}
else
{
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( invert ^ m->GetMarker(lc[it],mask) ) aret.push_back(lc[it]);
adj_type const & edges = m->HighConn(GetHandle()); // all edges
for(adj_type::const_iterator eit = edges.begin(); eit != edges.end(); ++eit)
{
adj_type const & faces = m->HighConn(*eit); // all faces of the edge
for(adj_type::const_iterator fit = faces.begin(); fit != faces.end(); ++fit)
{
adj_type const & cells = m->HighConn(*fit);
for(adj_type::const_iterator cit = cells.begin(); cit != cells.end(); ++cit)
{
if( (invert ^ m->GetMarker(*cit,mask)) && !m->GetPrivateMarker(*cit,mrk) )
{
aret.push_back(*cit);
m->SetPrivateMarker(*cit,mrk);
}
}
}
}
}
}
else
......@@ -219,15 +281,47 @@ namespace INMOST
MarkerType hm = m->HideMarker();
if( isPrivate(mask) )
{
for(adj_type::size_type it = 0; it < lc.size(); ++it)
if( (invert ^ m->GetPrivateMarker(lc[it],mask)) && !m->GetMarker(lc[it],hm) ) aret.push_back(lc[it]);
adj_type const & edges = m->HighConn(GetHandle()); // all edges
for(adj_type::const_iterator eit = edges.begin(); eit != edges.end(); ++eit) if( !m->GetMarker(*eit,hm) )
{
adj_type const & faces = m->HighConn(*eit); // all faces of the edge
for(adj_type::const_iterator fit = faces.begin(); fit != faces.end(); ++fit) if( !m->GetMarker(*fit,hm) )
{
adj_type const & cells = m->HighConn(*fit);
for(adj_type::const_iterator cit = cells.begin(); cit != cells.end(); ++cit) if( !m->GetMarker(*cit,hm) )
{
if( (invert ^ m->GetPrivateMarker(*cit,mask)) && !m->GetPrivateMarker(*cit,mrk) )
{
aret.push_back(*cit);
m->SetPrivateMarker(*cit,mrk);
}