676 for(i = 0; i < niso; ++i)
680 m_ntris += iso[i]->m_ntris;
687 for(i = 0; i < niso; ++i)
691 m_nvert += iso[i]->m_nvert;
695 vector< vector<int> > isocon;
702 vector<Array<OneD, NekDouble> > sph(niso);
704 for(i = 0; i < niso; ++i)
709 rng[0] = rng[3] = iso[i]->m_x[0];
710 rng[1] = rng[4] = iso[i]->m_x[1];
711 rng[2] = rng[5] = iso[i]->m_x[2];
713 for(id1 = 1; id1 < iso[i]->m_nvert;++id1)
715 rng[0] = min(rng[0],iso[i]->
m_x[i]);
716 rng[1] = min(rng[1],iso[i]->
m_y[i]);
717 rng[2] = min(rng[2],iso[i]->
m_z[i]);
719 rng[3] = max(rng[3],iso[i]->
m_x[i]);
720 rng[4] = max(rng[4],iso[i]->
m_y[i]);
721 rng[5] = max(rng[5],iso[i]->
m_z[i]);
725 sph[i][0] = (rng[3]+rng[0])/2.0;
726 sph[i][1] = (rng[4]+rng[1])/2.0;
727 sph[i][2] = (rng[5]+rng[2])/2.0;
730 sph[i][3] = sqrt((rng[3]-rng[0])*(rng[3]-rng[0]) +
731 (rng[4]-rng[1])*(rng[4]-rng[1]) +
732 (rng[5]-rng[2])*(rng[5]-rng[2]));
735 for(i = 0; i < niso; ++i)
737 for(j = i+1; j < niso; ++j)
739 NekDouble diff=sqrt((sph[i][0]-sph[j][0])*(sph[i][0]-sph[j][0])+
740 (sph[i][1]-sph[j][1])*(sph[i][1]-sph[j][1])+
741 (sph[i][2]-sph[j][2])*(sph[i][2]-sph[j][2]));
744 if(diff < sph[i][3] + sph[j][3])
746 isocon[i].push_back(j);
753 for(i = 0; i < niso; ++i)
759 cout <<
"GlobalCondense: Matching Vertices [" << endl << flush;
763 for(i = 0; i < niso; ++i)
765 for(n = 0; n < isocon[i].size(); ++n)
767 int con = isocon[i][n];
768 totpts += iso[i]->m_nvert*iso[con]->m_nvert;
771 int totchk = totpts/50;
773 for(i = 0; i < niso; ++i)
775 for(n = 0; n < isocon[i].size(); ++n)
777 int con = isocon[i][n];
778 for(id1 = 0; id1 < iso[i]->m_nvert; ++id1)
780 for(id2 = 0; id2 < iso[con]->m_nvert; ++id2, ++cnt)
784 cout <<cnt_out <<
"%" <<
'\r' << flush;
788 if((vidmap[con][id2] == -1)||(vidmap[i][id1] == -1))
791 iso[i]->
m_z[id1], iso[con]->
m_x[id2],
792 iso[con]->
m_y[id2],iso[con]->
m_z[id2]))
794 if((vidmap[i][id1] == -1) &&
795 (vidmap[con][id2] != -1))
797 vidmap[i][id1] = vidmap[con][id2];
799 else if((vidmap[con][id2] == -1) &&
800 (vidmap[i][id1] != -1))
802 vidmap[con][id2] = vidmap[i][id1];
804 else if((vidmap[con][id2] == -1) &&
805 (vidmap[i][id1] == -1))
807 vidmap[i][id1] = vidmap[con][id2] = nvert++;
815 for(id1 = 0; id1 < iso[i]->m_nvert;++id1)
817 if(vidmap[i][id1] == -1)
819 vidmap[i][id1] = nvert++;
823 cout <<endl <<
"]"<<endl;
828 for(n = 0; n < niso; ++n)
830 for(i = 0; i < iso[n]->m_ntris; ++i,nelmt++)
834 m_vid[3*nelmt+j] = vidmap[n][iso[n]->m_vid[3*i+j]];
846 for(i = 0; i < iso[0]->m_fields.size(); ++i)
853 for(n = 0; n < niso; ++n)
855 for(i = 0; i < iso[n]->m_nvert; ++i)
857 m_x[vidmap[n][i]] = iso[n]->m_x[i];
858 m_y[vidmap[n][i]] = iso[n]->m_y[i];
859 m_z[vidmap[n][i]] = iso[n]->m_z[i];
861 for(j = 0; j <
m_fields.size(); ++j)
863 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)