783 Array<OneD, Array<OneD, int> > vidmap;
788 vidmap = Array<OneD, Array<OneD, int> > (niso);
791 for(i = 0; i < niso; ++i)
795 m_ntris += iso[i]->m_ntris;
802 for(i = 0; i < niso; ++i)
806 m_nvert += iso[i]->m_nvert;
810 vector< vector<int> > isocon;
817 vector<Array<OneD, NekDouble> > sph(niso);
818 Array<OneD, NekDouble> rng(6);
819 for(i = 0; i < niso; ++i)
821 sph[i] = Array<OneD, NekDouble>(4);
824 rng[0] = rng[3] = iso[i]->m_x[0];
825 rng[1] = rng[4] = iso[i]->m_x[1];
826 rng[2] = rng[5] = iso[i]->m_x[2];
828 for(id1 = 1; id1 < iso[i]->m_nvert;++id1)
830 rng[0] = min(rng[0],iso[i]->
m_x[i]);
831 rng[1] = min(rng[1],iso[i]->
m_y[i]);
832 rng[2] = min(rng[2],iso[i]->
m_z[i]);
834 rng[3] = max(rng[3],iso[i]->
m_x[i]);
835 rng[4] = max(rng[4],iso[i]->
m_y[i]);
836 rng[5] = max(rng[5],iso[i]->
m_z[i]);
840 sph[i][0] = (rng[3]+rng[0])/2.0;
841 sph[i][1] = (rng[4]+rng[1])/2.0;
842 sph[i][2] = (rng[5]+rng[2])/2.0;
845 sph[i][3] = sqrt((rng[3]-rng[0])*(rng[3]-rng[0]) +
846 (rng[4]-rng[1])*(rng[4]-rng[1]) +
847 (rng[5]-rng[2])*(rng[5]-rng[2]));
850 for(i = 0; i < niso; ++i)
852 for(j = i; j < niso; ++j)
854 NekDouble diff=sqrt((sph[i][0]-sph[j][0])*(sph[i][0]-sph[j][0])+
855 (sph[i][1]-sph[j][1])*(sph[i][1]-sph[j][1])+
856 (sph[i][2]-sph[j][2])*(sph[i][2]-sph[j][2]));
859 if(diff < sph[i][3] + sph[j][3])
861 isocon[i].push_back(j);
869 for(i = 0; i < niso; ++i)
871 vidmap[i] = Array<OneD, int>(iso[i]->m_nvert,-1);
877 for(i = 0; i < niso; ++i)
879 totiso += isocon[i].size();
885 cout <<
"Progress Bar totiso: " << totiso << endl;
887 for(i = 0; i < niso; ++i)
889 for(n = 0; n < isocon[i].size(); ++n, ++cnt)
892 if(verbose && totiso >= 40)
897 int con = isocon[i][n];
898 for(id1 = 0; id1 < iso[i]->m_nvert; ++id1)
901 if(verbose && totiso < 40)
911 for(id2 = start; id2 < iso[con]->m_nvert; ++id2)
914 if((vidmap[con][id2] == -1)||(vidmap[i][id1] == -1))
917 iso[i]->
m_z[id1], iso[con]->
m_x[id2],
918 iso[con]->
m_y[id2],iso[con]->
m_z[id2]))
920 if((vidmap[i][id1] == -1) &&
921 (vidmap[con][id2] != -1))
923 vidmap[i][id1] = vidmap[con][id2];
925 else if((vidmap[con][id2] == -1) &&
926 (vidmap[i][id1] != -1))
928 vidmap[con][id2] = vidmap[i][id1];
930 else if((vidmap[con][id2] == -1) &&
931 (vidmap[i][id1] == -1))
933 vidmap[i][id1] = vidmap[con][id2] = nvert++;
941 for(id1 = 0; id1 < iso[i]->m_nvert;++id1)
943 if(vidmap[i][id1] == -1)
945 vidmap[i][id1] = nvert++;
953 for(n = 0; n < niso; ++n)
955 for(i = 0; i < iso[n]->m_ntris; ++i,nelmt++)
959 m_vid[3*nelmt+j] = vidmap[n][iso[n]->m_vid[3*i+j]];
971 for(i = 0; i < iso[0]->m_fields.size(); ++i)
977 for(n = 0; n < niso; ++n)
979 for(i = 0; i < iso[n]->m_nvert; ++i)
981 m_x[vidmap[n][i]] = iso[n]->m_x[i];
982 m_y[vidmap[n][i]] = iso[n]->m_y[i];
983 m_z[vidmap[n][i]] = iso[n]->m_z[i];
985 for(j = 0; j <
m_fields.size(); ++j)
987 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.