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
{
MarkerType mrk = CreatePrivateMarker();
const ElementArray<Face> faces = c->getFaces();
Face face = faces[0];
ret.reserve(8);
{
const ElementArray<Node> verts = face->getNodes();
if( face->FaceOrientedOutside(c) )
const ElementArray<Node> verts = faces[0]->getNodes();
if( faces[0]->FaceOrientedOutside(c) )
ret.insert(ret.end(),verts.rbegin(),verts.rend());
else
ret.insert(ret.end(),verts.begin(),verts.end());
......@@ -1497,8 +1496,6 @@ namespace INMOST
else assert(false); //this should not happen
r++;
}
ret[inspos[0]].SetPrivateMarker(mrk);
ret[inspos[1]].SetPrivateMarker(mrk);
}
}
ret.RemPrivateMarker(mrk);
......@@ -1515,20 +1512,16 @@ namespace INMOST
{
MarkerType mrk = CreatePrivateMarker();
ret.reserve(6);
Face face;
const ElementArray<Face> faces = c->getFaces();
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
{
face = faces[i];
break;
}
{
const ElementArray<Node> verts = face->getNodes();
if( face->FaceOrientedOutside(c) )
ret.insert(ret.end(),verts.rbegin(),verts.rend());
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());
ret.insert(ret.end(), verts.begin(), verts.end());
break;
}
ret.SetPrivateMarker(mrk);
ret.resize(6);
......@@ -1570,21 +1563,17 @@ namespace INMOST
case Element::Pyramid:
{
ret.reserve(5);
Face face;
MarkerType mrk = CreatePrivateMarker();
const ElementArray<Face> faces = c->getFaces();
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
{
face = faces[i];
break;
}
{
const ElementArray<Node> verts = face->getNodes();
if( face->FaceOrientedOutside(c) )
ret.insert(ret.begin(),verts.rbegin(),verts.rend());
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());
ret.insert(ret.begin(), verts.begin(), verts.end());
break;
}
ret.SetPrivateMarker(mrk);
for(ElementArray<Face>::size_type i = 0; i < faces.size(); i++) //go over faces
......
......@@ -1350,7 +1350,7 @@ namespace INMOST
if( n->GetStatus() != Element::Ghost ) 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< real > cluster_center(K*3,0.0);
std::vector< real > cluster_center_old(K*3);
......@@ -1766,7 +1766,7 @@ namespace INMOST
counts[k] = npoints[k];
}
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);
}
#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