Commit 07d81fc9 authored by Kirill Terekhov's avatar Kirill Terekhov

fix std::vector assert in partitioner on visual studio; fix algorithm for RestoreCellNodes

parent 86430507
...@@ -1462,11 +1462,10 @@ namespace INMOST ...@@ -1462,11 +1462,10 @@ namespace INMOST
{ {
MarkerType mrk = CreatePrivateMarker(); MarkerType mrk = CreatePrivateMarker();
const ElementArray<Face> faces = c->getFaces(); const ElementArray<Face> faces = c->getFaces();
Face face = faces[0];
ret.reserve(8); ret.reserve(8);
{ {
const ElementArray<Node> verts = face->getNodes(); const ElementArray<Node> verts = faces[0]->getNodes();
if( face->FaceOrientedOutside(c) ) if( faces[0]->FaceOrientedOutside(c) )
ret.insert(ret.end(),verts.rbegin(),verts.rend()); ret.insert(ret.end(),verts.rbegin(),verts.rend());
else else
ret.insert(ret.end(),verts.begin(),verts.end()); ret.insert(ret.end(),verts.begin(),verts.end());
...@@ -1497,8 +1496,6 @@ namespace INMOST ...@@ -1497,8 +1496,6 @@ namespace INMOST
else assert(false); //this should not happen else assert(false); //this should not happen
r++; r++;
} }
ret[inspos[0]].SetPrivateMarker(mrk);
ret[inspos[1]].SetPrivateMarker(mrk);
} }
} }
ret.RemPrivateMarker(mrk); ret.RemPrivateMarker(mrk);
...@@ -1515,21 +1512,17 @@ namespace INMOST ...@@ -1515,21 +1512,17 @@ namespace INMOST
{ {
MarkerType mrk = CreatePrivateMarker(); MarkerType mrk = CreatePrivateMarker();
ret.reserve(6); ret.reserve(6);
Face face;
const ElementArray<Face> faces = c->getFaces(); const ElementArray<Face> faces = c->getFaces();
for(ElementArray<Face>::size_type i = 0; i < faces.size(); i++) //iterate over faces for(ElementArray<Face>::size_type i = 0; i < faces.size(); i++) //iterate over faces
if( faces[i].nbAdjElements(EDGE) == 3 ) //number of edges in i-th face if( faces[i].nbAdjElements(EDGE) == 3 ) //number of edges in i-th face
{ {
face = faces[i]; const ElementArray<Node> verts = faces[i]->getNodes();
if (faces[i]->FaceOrientedOutside(c))
ret.insert(ret.end(), verts.rbegin(), verts.rend());
else
ret.insert(ret.end(), verts.begin(), verts.end());
break; break;
} }
{
const ElementArray<Node> verts = face->getNodes();
if( face->FaceOrientedOutside(c) )
ret.insert(ret.end(),verts.rbegin(),verts.rend());
else
ret.insert(ret.end(),verts.begin(),verts.end());
}
ret.SetPrivateMarker(mrk); ret.SetPrivateMarker(mrk);
ret.resize(6); ret.resize(6);
for(ElementArray<Face>::size_type k = 0; k < faces.size(); ++k) for(ElementArray<Face>::size_type k = 0; k < faces.size(); ++k)
...@@ -1570,22 +1563,18 @@ namespace INMOST ...@@ -1570,22 +1563,18 @@ namespace INMOST
case Element::Pyramid: case Element::Pyramid:
{ {
ret.reserve(5); ret.reserve(5);
Face face;
MarkerType mrk = CreatePrivateMarker(); MarkerType mrk = CreatePrivateMarker();
const ElementArray<Face> faces = c->getFaces(); const ElementArray<Face> faces = c->getFaces();
for(ElementArray<Face>::size_type i = 0; i < faces.size(); i++) //go over faces for(ElementArray<Face>::size_type i = 0; i < faces.size(); i++) //go over faces
if( faces[i].nbAdjElements(EDGE) == 4 ) //check if number of edges = 4 if( faces[i].nbAdjElements(EDGE) == 4 ) //check if number of edges = 4
{ {
face = faces[i]; const ElementArray<Node> verts = faces[i]->getNodes();
if (faces[i]->FaceOrientedOutside(c))
ret.insert(ret.begin(), verts.rbegin(), verts.rend());
else
ret.insert(ret.begin(), verts.begin(), verts.end());
break; break;
} }
{
const ElementArray<Node> verts = face->getNodes();
if( face->FaceOrientedOutside(c) )
ret.insert(ret.begin(),verts.rbegin(),verts.rend());
else
ret.insert(ret.begin(),verts.begin(),verts.end());
}
ret.SetPrivateMarker(mrk); ret.SetPrivateMarker(mrk);
for(ElementArray<Face>::size_type i = 0; i < faces.size(); i++) //go over faces for(ElementArray<Face>::size_type i = 0; i < faces.size(); i++) //go over faces
if( faces[i].nbAdjElements(NODE) == 3 ) if( faces[i].nbAdjElements(NODE) == 3 )
......
...@@ -1350,7 +1350,7 @@ namespace INMOST ...@@ -1350,7 +1350,7 @@ namespace INMOST
if( n->GetStatus() != Element::Ghost ) total_points++; if( n->GetStatus() != Element::Ghost ) total_points++;
} }
std::vector< idx > points_node(total_points); std::vector< idx > points_node(total_points);
std::vector< real > points_center(total_points*3); std::vector< real > points_center(std::max(total_points*3,1));
std::vector< idx > points_cluster(total_points,-1); std::vector< idx > points_cluster(total_points,-1);
std::vector< real > cluster_center(K*3,0.0); std::vector< real > cluster_center(K*3,0.0);
std::vector< real > cluster_center_old(K*3); std::vector< real > cluster_center_old(K*3);
...@@ -1766,7 +1766,7 @@ namespace INMOST ...@@ -1766,7 +1766,7 @@ namespace INMOST
counts[k] = npoints[k]; counts[k] = npoints[k];
} }
total_points = counts[m->GetProcessorRank()]; total_points = counts[m->GetProcessorRank()];
points_cluster.resize(total_points); points_cluster.resize(std::max(total_points,1));
MPI_Scatterv(&points_cluster_global[0],&counts[0],&displs[0],MPI_IDXT,&points_cluster[0],total_points,MPI_IDXT,0,MPI_COMM_WORLD); MPI_Scatterv(&points_cluster_global[0],&counts[0],&displs[0],MPI_IDXT,&points_cluster[0],total_points,MPI_IDXT,0,MPI_COMM_WORLD);
} }
#endif #endif
......
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