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) ...@@ -305,7 +305,7 @@ int main(int argc,char ** argv)
for(Mesh::iteratorFace face = m->BeginFace(); face != m->EndFace(); ++face) for(Mesh::iteratorFace face = m->BeginFace(); face != m->EndFace(); ++face)
{ {
//~ std::cout << face->LocalID() << " / " << m->NumberOfFaces() << std::endl; //~ 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 r1 = face->BackCell();
Cell r2 = face->FrontCell(); Cell r2 = face->FrontCell();
if( ((!r1.isValid() || (s1 = r1->GetStatus()) == Element::Ghost)?0:1)+ if( ((!r1.isValid() || (s1 = r1->GetStatus()) == Element::Ghost)?0:1)+
......
...@@ -1488,11 +1488,11 @@ namespace INMOST ...@@ -1488,11 +1488,11 @@ namespace INMOST
std::pair<Edge,bool> CreateEdge (const ElementArray<Node> & nodes); 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<Edge> & edges);
std::pair<Face,bool> CreateFace (const ElementArray<Node> & nodes); 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<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, 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)); //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, 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)); //const ElementArray<Node> & suggest_nodes_order = ElementArray<Node>(NULL));
std::pair<ElementSet,bool> CreateSet (std::string name); std::pair<ElementSet,bool> CreateSet (std::string name);
/// Same as Mesh::CreateSet without checking existance of the set /// Same as Mesh::CreateSet without checking existance of the set
std::pair<ElementSet,bool> CreateSetUnique (std::string name); std::pair<ElementSet,bool> CreateSetUnique (std::string name);
......
...@@ -234,14 +234,8 @@ namespace INMOST ...@@ -234,14 +234,8 @@ namespace INMOST
lid = IntegerDF(lc[kt],set_id); lid = IntegerDF(lc[kt],set_id);
uconv.write_iValue(out,lid); uconv.write_iValue(out,lid);
} }
Element::adj_type & hc = HighConn(*it); nhigh = 0;
nhigh = static_cast<INMOST_DATA_ENUM_TYPE>(hc.size());
uconv.write_iValue(out,nhigh); 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 // Element Sets
...@@ -1259,7 +1253,8 @@ namespace INMOST ...@@ -1259,7 +1253,8 @@ namespace INMOST
uconv.read_iValue(in,lid); uconv.read_iValue(in,lid);
suggest_nodes.push_back(new_nodes[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(); sub_elements.clear();
suggest_nodes.clear(); suggest_nodes.clear();
} }
......
...@@ -1882,7 +1882,8 @@ safe_output: ...@@ -1882,7 +1882,8 @@ safe_output:
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle(); f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first); 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(); newcells[i] = c->GetHandle();
} }
else else
...@@ -1921,7 +1922,8 @@ safe_output: ...@@ -1921,7 +1922,8 @@ safe_output:
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle(); f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first); 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(); newcells[i] = c->GetHandle();
} }
else newcells[i] = CreateFace(c_nodes).first->GetHandle(); else newcells[i] = CreateFace(c_nodes).first->GetHandle();
...@@ -1948,7 +1950,8 @@ safe_output: ...@@ -1948,7 +1950,8 @@ safe_output:
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle(); f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first); 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(); newcells[i] = c->GetHandle();
} }
else newcells[i] = CreateFace(c_nodes).first->GetHandle(); else newcells[i] = CreateFace(c_nodes).first->GetHandle();
......
...@@ -674,7 +674,8 @@ namespace INMOST ...@@ -674,7 +674,8 @@ namespace INMOST
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle(); f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first); 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(); newcells[q] = c->GetHandle();
} }
else else
...@@ -703,7 +704,8 @@ namespace INMOST ...@@ -703,7 +704,8 @@ namespace INMOST
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle(); f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first); 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(); newcells[q] = c->GetHandle();
} }
else else
...@@ -733,7 +735,8 @@ namespace INMOST ...@@ -733,7 +735,8 @@ namespace INMOST
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle(); f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first); 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(); newcells[q] = c->GetHandle();
} }
else else
...@@ -757,7 +760,8 @@ namespace INMOST ...@@ -757,7 +760,8 @@ namespace INMOST
f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle(); f_edges.at(1) = CreateEdge(e_nodes).first->GetHandle();
c_faces.push_back(CreateFace(f_edges).first); 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(); newcells[q] = c->GetHandle();
} }
else else
......
...@@ -141,7 +141,6 @@ namespace INMOST ...@@ -141,7 +141,6 @@ namespace INMOST
if( jt == jend ) return false; //no matching edge if( jt == jend ) return false; //no matching edge
} }
adj_type::size_type it = 1, iend = lc.size()-1; adj_type::size_type it = 1, iend = lc.size()-1;
bool corrected = false;
while(it < iend) //loop over edges while(it < iend) //loop over edges
{ {
adj_type const & ilc = m->LowConn(lc[it]); adj_type const & ilc = m->LowConn(lc[it]);
...@@ -168,20 +167,12 @@ namespace INMOST ...@@ -168,20 +167,12 @@ namespace INMOST
HandleType temp = lc[it]; HandleType temp = lc[it];
lc[it] = lc[jt]; lc[it] = lc[jt];
lc[jt] = temp; lc[jt] = temp;
corrected = true;
break; break;
} }
} }
if( jt == jend ) return false; //no matching edge 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 //check that the loop is closed
adj_type const & ilc = m->LowConn(lc[iend]); adj_type const & ilc = m->LowConn(lc[iend]);
if( ilc.size() != 2 ) return false; if( ilc.size() != 2 ) return false;
...@@ -305,20 +296,9 @@ namespace INMOST ...@@ -305,20 +296,9 @@ namespace INMOST
{ {
assert(GetHandleElementType(GetHandle())==CELL); assert(GetHandleElementType(GetHandle())==CELL);
Mesh * m = GetMeshLink(); Mesh * m = GetMeshLink();
if( !m->HideMarker() ) ElementArray<Node> ret(m);
{ m->RestoreCellNodes(GetHandle(),ret);
adj_type const & hc = m->HighConn(GetHandle()); return ret;
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;
}
} }
...@@ -326,39 +306,19 @@ namespace INMOST ...@@ -326,39 +306,19 @@ namespace INMOST
{ {
assert(GetHandleElementType(GetHandle())==CELL); assert(GetHandleElementType(GetHandle())==CELL);
Mesh * m = GetMeshLink(); Mesh * m = GetMeshLink();
ElementArray<Node> aret(m); ElementArray<Node> aret(m), ret(m);
if( !m->HideMarker() ) m->RestoreCellNodes(GetHandle(),ret);
if( isPrivate(mask) )
{ {
adj_type const & hc = m->HighConn(GetHandle()); for(ElementArray<Node>::iterator it = ret.begin(); it != ret.end(); ++it)
if( isPrivate(mask) ) if( invert ^ m->GetPrivateMarker(*it,mask) )
{ aret.push_back(*it);
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]);
}
} }
else else
{ {
MarkerType hm = m->HideMarker(); for(ElementArray<Node>::iterator it = ret.begin(); it != ret.end(); ++it)
adj_type const & hc = m->HighConn(GetHandle()); if( invert ^ m->GetMarker(*it,mask) )
if( isPrivate(mask) ) aret.push_back(*it);
{
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]);
}
} }
return aret; return aret;
} }
......
This diff is collapsed.
...@@ -594,9 +594,13 @@ namespace INMOST ...@@ -594,9 +594,13 @@ namespace INMOST
void Mesh::ComputeGeometricType(HandleType h) void Mesh::ComputeGeometricType(HandleType h)
{ {
SetGeometricType(h,Element::Unset); SetGeometricType(h,Element::Unset);
Element::adj_type const & lc = LowConn(h); if( GetElementType() > NODE )
if( !lc.empty() ) {
SetGeometricType(h,ComputeGeometricType(GetHandleElementType(h),lc.data(),static_cast<integer>(lc.size()))); 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) void Mesh::RecomputeGeometricData(HandleType e)
...@@ -620,7 +624,7 @@ namespace INMOST ...@@ -620,7 +624,7 @@ namespace INMOST
{ {
if( GetHandleElementType(e) == CELL ) //then correct the normal 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) for(Element::adj_type::iterator it = lc.begin(); it != lc.end(); ++it)
if( !GetMarker(*it,HideMarker()) ) if( !GetMarker(*it,HideMarker()) )
{ {
......
...@@ -138,7 +138,25 @@ namespace INMOST ...@@ -138,7 +138,25 @@ namespace INMOST
checkm = true; checkm = true;
if( m->GetMarker(set[0].e,m->HideMarker()) ) invm = 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[0] = bbox[2] = bbox[4] = 1.0e20f;
bbox[1] = bbox[3] = bbox[5] = -1.0e20f; bbox[1] = bbox[3] = bbox[5] = -1.0e20f;
if( checkm ) if( checkm )
......
...@@ -201,8 +201,8 @@ namespace INMOST ...@@ -201,8 +201,8 @@ namespace INMOST
memset(remember,0,sizeof(remember)); memset(remember,0,sizeof(remember));
tag_coords = CreateTag("PROTECTED_COORD",DATA_REAL, NODE,NONE,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_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|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_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_geom_type = CreateTag("PROTECTED_GEOM_TYPE",DATA_BULK,CELL|FACE|EDGE|NODE,NONE,1);
tag_setname = CreateTag("PROTECTED_SET_NAME",DATA_BULK,ESET,NONE); tag_setname = CreateTag("PROTECTED_SET_NAME",DATA_BULK,ESET,NONE);
...@@ -436,8 +436,8 @@ namespace INMOST ...@@ -436,8 +436,8 @@ namespace INMOST
//setup system tags shortcuts //setup system tags shortcuts
dim = other.dim; dim = other.dim;
tag_coords = CreateTag("PROTECTED_COORD",DATA_REAL, NODE,NONE,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_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|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_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_geom_type = CreateTag("PROTECTED_GEOM_TYPE",DATA_BULK,CELL|FACE|EDGE|NODE,NONE,1);
tag_setname = CreateTag("PROTECTED_SET_NAME",DATA_BULK,ESET,NONE); tag_setname = CreateTag("PROTECTED_SET_NAME",DATA_BULK,ESET,NONE);
...@@ -565,8 +565,8 @@ namespace INMOST ...@@ -565,8 +565,8 @@ namespace INMOST
//setup system tags shortcuts //setup system tags shortcuts
dim = other.dim; dim = other.dim;
tag_coords = CreateTag("PROTECTED_COORD",DATA_REAL, NODE,NONE,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_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|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_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_geom_type = CreateTag("PROTECTED_GEOM_TYPE",DATA_BULK,CELL|FACE|EDGE|NODE,NONE,1);
tag_setname = CreateTag("PROTECTED_SET_NAME",DATA_BULK,ESET,NONE); tag_setname = CreateTag("PROTECTED_SET_NAME",DATA_BULK,ESET,NONE);
...@@ -795,6 +795,7 @@ namespace INMOST ...@@ -795,6 +795,7 @@ namespace INMOST
HandleType Mesh::FindSharedAdjacency(const HandleType * arr, enumerator s) const HandleType Mesh::FindSharedAdjacency(const HandleType * arr, enumerator s) const
{ {
if( s == 0 ) return InvalidHandle(); if( s == 0 ) return InvalidHandle();
for(enumerator q = 0; q < s; ++q) assert(GetHandleElementType(arr[q]) != CELL);
if( !HideMarker() ) if( !HideMarker() )
{ {
{ {
...@@ -1394,7 +1395,7 @@ namespace INMOST ...@@ -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<Face> c_faces(this,s);
ElementArray<Node>::size_type j = 0; ElementArray<Node>::size_type j = 0;
...@@ -1403,11 +1404,11 @@ namespace INMOST ...@@ -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(); 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]; 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; integer j = 0;
ElementArray<Node> temp(this); ElementArray<Node> temp(this);
...@@ -1421,7 +1422,7 @@ namespace INMOST ...@@ -1421,7 +1422,7 @@ namespace INMOST
j += c_f_numnodes[i]; j += c_f_numnodes[i];
temp.clear(); temp.clear();
} }
return CreateCell(c_faces,suggest_nodes_order); return CreateCell(c_faces);//,suggest_nodes_order);
} }
...@@ -1643,27 +1644,17 @@ namespace INMOST ...@@ -1643,27 +1644,17 @@ namespace INMOST
Element::adj_type & ilc = LowConn(lc[i]); Element::adj_type & ilc = LowConn(lc[i]);
for(Element::adj_type::size_type j = 0; j < ilc.size(); j++) //iterate over face edges 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]); if( !GetPrivateMarker(jlc[k],mrk) )
for(Element::adj_type::size_type k = 0; k < jlc.size(); k++) //iterator over edge nodes
{ {
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 else
{ {
...@@ -1673,29 +1664,19 @@ namespace INMOST ...@@ -1673,29 +1664,19 @@ namespace INMOST
Element::adj_type & ilc = LowConn(lc[i]); 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 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]); if( !GetPrivateMarker(jlc[k], mrk) )
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) ) 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); ReleasePrivateMarker(mrk);
break; break;
} }
...@@ -1703,7 +1684,7 @@ namespace INMOST ...@@ -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(); HandleType he = InvalidHandle();
if( !c_faces.empty() ) if( !c_faces.empty() )
...@@ -1732,95 +1713,9 @@ namespace INMOST ...@@ -1732,95 +1713,9 @@ namespace INMOST
Element::adj_type & lc = LowConn(he); Element::adj_type & lc = LowConn(he);
lc.insert(lc.begin(),c_faces.begin(),c_faces.end()); lc.insert(lc.begin(),c_faces.begin(),c_faces.end());
ComputeGeometricType(he); ComputeGeometricType(he);
{ SetMarker(he,NewMarker());
//bool halt = false; //DEBUG RecomputeGeometricData(he);
if( c_nodes.empty() ) EndTopologyCheck(he,chk);
{
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;
}
*/
}
} }
return std::make_pair(Cell(this,he),true); return std::make_pair(Cell(this,he),true);
} }
......
This diff is collapsed.
...@@ -95,7 +95,7 @@ namespace INMOST ...@@ -95,7 +95,7 @@ namespace INMOST
} }
}