795 typedef bg::model::point<NekDouble, 3, bg::cs::cartesian> BPoint;
796 typedef std::pair<BPoint, unsigned int> PointPair;
802 Array<OneD, Array<OneD, int> > vidmap;
807 vidmap = Array<OneD, Array<OneD, int> > (niso);
810 for(i = 0; i < niso; ++i)
814 m_ntris += iso[i]->m_ntris;
821 for(i = 0; i < niso; ++i)
825 m_nvert += iso[i]->m_nvert;
829 vector< vector<int> > isocon;
831 vector<int> global_to_unique_map;
832 global_to_unique_map.resize(m_nvert);
834 vector< pair<int,int> > global_to_iso_map;
835 global_to_iso_map.resize(m_nvert);
839 std::vector<PointPair> inPoints;
840 for(i = 0; i < niso; ++i)
842 for(id1 = 0; id1 < iso[i]->m_nvert; ++id1)
844 inPoints.push_back(PointPair(BPoint( iso[i]->
m_x[id1],
846 iso[i]->
m_z[id1]), id2));
847 global_to_unique_map[id2]=id2;
848 global_to_iso_map[id2] = make_pair(i,id1);
856 cout <<
"Process building tree ..." << endl;
860 bgi::rtree<PointPair, bgi::rstar<16> > rtree;
861 rtree.insert(inPoints.begin(), inPoints.end());
864 int unique_index = 0;
871 "Nearest verts",prog);
874 BPoint queryPoint = inPoints[i].first;
879 if(global_to_unique_map[i] < unique_index)
886 std::vector<PointPair> result;
887 rtree.query(bgi::nearest(queryPoint, 10), std::back_inserter(result));
893 for(id1 = 0; id1 < result.size(); ++id1)
895 NekDouble dist = bg::distance(queryPoint, result[id1].first);
898 id2 = result[id1].second;
901 if(global_to_unique_map[id2] <unique_index)
903 new_index = global_to_unique_map[id2];
909 new_index = unique_index;
914 global_to_unique_map[i] = new_index;
915 for(it = samept.begin(); it != samept.end(); ++it)
917 global_to_unique_map[*it] = new_index;
927 m_nvert = unique_index;
932 for(n = 0; n < niso; ++n)
934 for(i = 0; i < iso[n]->m_ntris; ++i,nelmt++)
938 m_vid[3*nelmt+j] = global_to_unique_map[iso[n]->m_vid[3*i+j]+cnt];
941 cnt += iso[n]->m_nvert;
951 for(i = 0; i < iso[0]->m_fields.size(); ++i)
956 for(n = 0; n < global_to_unique_map.size(); ++n)
959 m_x[global_to_unique_map[n]] = bg::get<0>(inPoints[n].first);
960 m_y[global_to_unique_map[n]] = bg::get<1>(inPoints[n].first);
961 m_z[global_to_unique_map[n]] = bg::get<2>(inPoints[n].first);
963 int isoid = global_to_iso_map[n].first;
964 int ptid = global_to_iso_map[n].second;
965 for(j = 0; j <
m_fields.size(); ++j)
967 m_fields[j][global_to_unique_map[n]] = iso[isoid]->
int PrintProgressbar(const int position, const int goal, const string message, int lastprogress=-1)
Prints a progressbar.
vector< vector< NekDouble > > m_fields
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
const NekDouble SQ_PNT_TOL