763 Array<OneD, Array<OneD, int> > vidmap;
768 vidmap = Array<OneD, Array<OneD, int> > (niso);
771 for(i = 0; i < niso; ++i)
775 m_ntris += iso[i]->m_ntris;
782 for(i = 0; i < niso; ++i)
786 m_nvert += iso[i]->m_nvert;
790 vector< vector<int> > isocon;
797 vector<Array<OneD, NekDouble> > sph(niso);
798 Array<OneD, NekDouble> rng(6);
799 for(i = 0; i < niso; ++i)
801 sph[i] = Array<OneD, NekDouble>(4);
804 rng[0] = rng[3] = iso[i]->m_x[0];
805 rng[1] = rng[4] = iso[i]->m_x[1];
806 rng[2] = rng[5] = iso[i]->m_x[2];
808 for(id1 = 1; id1 < iso[i]->m_nvert;++id1)
810 rng[0] = min(rng[0],iso[i]->
m_x[i]);
811 rng[1] = min(rng[1],iso[i]->
m_y[i]);
812 rng[2] = min(rng[2],iso[i]->
m_z[i]);
814 rng[3] = max(rng[3],iso[i]->
m_x[i]);
815 rng[4] = max(rng[4],iso[i]->
m_y[i]);
816 rng[5] = max(rng[5],iso[i]->
m_z[i]);
820 sph[i][0] = (rng[3]+rng[0])/2.0;
821 sph[i][1] = (rng[4]+rng[1])/2.0;
822 sph[i][2] = (rng[5]+rng[2])/2.0;
825 sph[i][3] = sqrt((rng[3]-rng[0])*(rng[3]-rng[0]) +
826 (rng[4]-rng[1])*(rng[4]-rng[1]) +
827 (rng[5]-rng[2])*(rng[5]-rng[2]));
830 for(i = 0; i < niso; ++i)
832 for(j = i; j < niso; ++j)
834 NekDouble diff=sqrt((sph[i][0]-sph[j][0])*(sph[i][0]-sph[j][0])+
835 (sph[i][1]-sph[j][1])*(sph[i][1]-sph[j][1])+
836 (sph[i][2]-sph[j][2])*(sph[i][2]-sph[j][2]));
839 if(diff < sph[i][3] + sph[j][3])
841 isocon[i].push_back(j);
849 for(i = 0; i < niso; ++i)
851 vidmap[i] = Array<OneD, int>(iso[i]->m_nvert,-1);
857 for(i = 0; i < niso; ++i)
859 totiso += isocon[i].size();
865 cout <<
"Progress Bar totiso: " << totiso << endl;
867 for(i = 0; i < niso; ++i)
869 for(n = 0; n < isocon[i].size(); ++n, ++cnt)
872 if(verbose && totiso >= 40)
877 int con = isocon[i][n];
878 for(id1 = 0; id1 < iso[i]->m_nvert; ++id1)
881 if(verbose && totiso < 40)
891 for(id2 = start; id2 < iso[con]->m_nvert; ++id2)
894 if((vidmap[con][id2] == -1)||(vidmap[i][id1] == -1))
897 iso[i]->
m_z[id1], iso[con]->
m_x[id2],
898 iso[con]->
m_y[id2],iso[con]->
m_z[id2]))
900 if((vidmap[i][id1] == -1) &&
901 (vidmap[con][id2] != -1))
903 vidmap[i][id1] = vidmap[con][id2];
905 else if((vidmap[con][id2] == -1) &&
906 (vidmap[i][id1] != -1))
908 vidmap[con][id2] = vidmap[i][id1];
910 else if((vidmap[con][id2] == -1) &&
911 (vidmap[i][id1] == -1))
913 vidmap[i][id1] = vidmap[con][id2] = nvert++;
921 for(id1 = 0; id1 < iso[i]->m_nvert;++id1)
923 if(vidmap[i][id1] == -1)
925 vidmap[i][id1] = nvert++;
933 for(n = 0; n < niso; ++n)
935 for(i = 0; i < iso[n]->m_ntris; ++i,nelmt++)
939 m_vid[3*nelmt+j] = vidmap[n][iso[n]->m_vid[3*i+j]];
951 for(i = 0; i < iso[0]->m_fields.size(); ++i)
957 for(n = 0; n < niso; ++n)
959 for(i = 0; i < iso[n]->m_nvert; ++i)
961 m_x[vidmap[n][i]] = iso[n]->m_x[i];
962 m_y[vidmap[n][i]] = iso[n]->m_y[i];
963 m_z[vidmap[n][i]] = iso[n]->m_z[i];
965 for(j = 0; j <
m_fields.size(); ++j)
967 m_fields[j][vidmap[n][i]] = iso[n]->m_fields[j][i];
vector< vector< NekDouble > > m_fields
bool same(NekDouble x1, NekDouble y1, NekDouble z1, NekDouble x2, NekDouble y2, NekDouble z2)
void PrintProgressbar(const int position, const int goal, const string message)
Prints a progressbar.