765 Array<OneD, Array<OneD, int> > vidmap;
770 vidmap = Array<OneD, Array<OneD, int> > (niso);
773 for(i = 0; i < niso; ++i)
777 m_ntris += iso[i]->m_ntris;
784 for(i = 0; i < niso; ++i)
788 m_nvert += iso[i]->m_nvert;
792 vector< vector<int> > isocon;
799 vector<Array<OneD, NekDouble> > sph(niso);
800 Array<OneD, NekDouble> rng(6);
801 for(i = 0; i < niso; ++i)
803 sph[i] = Array<OneD, NekDouble>(4);
806 rng[0] = rng[3] = iso[i]->m_x[0];
807 rng[1] = rng[4] = iso[i]->m_x[1];
808 rng[2] = rng[5] = iso[i]->m_x[2];
810 for(id1 = 1; id1 < iso[i]->m_nvert;++id1)
812 rng[0] = min(rng[0],iso[i]->
m_x[i]);
813 rng[1] = min(rng[1],iso[i]->
m_y[i]);
814 rng[2] = min(rng[2],iso[i]->
m_z[i]);
816 rng[3] = max(rng[3],iso[i]->
m_x[i]);
817 rng[4] = max(rng[4],iso[i]->
m_y[i]);
818 rng[5] = max(rng[5],iso[i]->
m_z[i]);
822 sph[i][0] = (rng[3]+rng[0])/2.0;
823 sph[i][1] = (rng[4]+rng[1])/2.0;
824 sph[i][2] = (rng[5]+rng[2])/2.0;
827 sph[i][3] = sqrt((rng[3]-rng[0])*(rng[3]-rng[0]) +
828 (rng[4]-rng[1])*(rng[4]-rng[1]) +
829 (rng[5]-rng[2])*(rng[5]-rng[2]));
832 for(i = 0; i < niso; ++i)
834 for(j = i; j < niso; ++j)
836 NekDouble diff=sqrt((sph[i][0]-sph[j][0])*(sph[i][0]-sph[j][0])+
837 (sph[i][1]-sph[j][1])*(sph[i][1]-sph[j][1])+
838 (sph[i][2]-sph[j][2])*(sph[i][2]-sph[j][2]));
841 if(diff < sph[i][3] + sph[j][3])
843 isocon[i].push_back(j);
851 for(i = 0; i < niso; ++i)
853 vidmap[i] = Array<OneD, int>(iso[i]->m_nvert,-1);
859 for(i = 0; i < niso; ++i)
861 totiso += isocon[i].size();
867 cout <<
"Progress Bar totiso: " << totiso << endl;
869 for(i = 0; i < niso; ++i)
871 for(n = 0; n < isocon[i].size(); ++n, ++cnt)
874 if(verbose && totiso >= 40)
879 int con = isocon[i][n];
880 for(id1 = 0; id1 < iso[i]->m_nvert; ++id1)
883 if(verbose && totiso < 40)
893 for(id2 = start; id2 < iso[con]->m_nvert; ++id2)
896 if((vidmap[con][id2] == -1)||(vidmap[i][id1] == -1))
899 iso[i]->
m_z[id1], iso[con]->
m_x[id2],
900 iso[con]->
m_y[id2],iso[con]->
m_z[id2]))
902 if((vidmap[i][id1] == -1) &&
903 (vidmap[con][id2] != -1))
905 vidmap[i][id1] = vidmap[con][id2];
907 else if((vidmap[con][id2] == -1) &&
908 (vidmap[i][id1] != -1))
910 vidmap[con][id2] = vidmap[i][id1];
912 else if((vidmap[con][id2] == -1) &&
913 (vidmap[i][id1] == -1))
915 vidmap[i][id1] = vidmap[con][id2] = nvert++;
923 for(id1 = 0; id1 < iso[i]->m_nvert;++id1)
925 if(vidmap[i][id1] == -1)
927 vidmap[i][id1] = nvert++;
935 for(n = 0; n < niso; ++n)
937 for(i = 0; i < iso[n]->m_ntris; ++i,nelmt++)
941 m_vid[3*nelmt+j] = vidmap[n][iso[n]->m_vid[3*i+j]];
953 for(i = 0; i < iso[0]->m_fields.size(); ++i)
959 for(n = 0; n < niso; ++n)
961 for(i = 0; i < iso[n]->m_nvert; ++i)
963 m_x[vidmap[n][i]] = iso[n]->m_x[i];
964 m_y[vidmap[n][i]] = iso[n]->m_y[i];
965 m_z[vidmap[n][i]] = iso[n]->m_z[i];
967 for(j = 0; j <
m_fields.size(); ++j)
969 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.