799 typedef bg::model::point<NekDouble, 3, bg::cs::cartesian> BPoint;
800 typedef std::pair<BPoint, unsigned int> PointPair;
806 Array<OneD, Array<OneD, int> > vidmap;
811 vidmap = Array<OneD, Array<OneD, int> > (niso);
814 for(i = 0; i < niso; ++i)
818 m_ntris += iso[i]->m_ntris;
825 for(i = 0; i < niso; ++i)
829 m_nvert += iso[i]->m_nvert;
833 vector< vector<int> > isocon;
835 vector<int> global_to_unique_map;
836 global_to_unique_map.resize(m_nvert);
838 vector< pair<int,int> > global_to_iso_map;
839 global_to_iso_map.resize(m_nvert);
843 std::vector<PointPair> inPoints;
844 for(i = 0; i < niso; ++i)
846 for(id1 = 0; id1 < iso[i]->m_nvert; ++id1)
848 inPoints.push_back(PointPair(BPoint( iso[i]->
m_x[id1],
850 iso[i]->
m_z[id1]), id2));
851 global_to_unique_map[id2]=id2;
852 global_to_iso_map[id2] = make_pair(i,id1);
860 cout <<
"Process building tree ..." << endl;
864 bgi::rtree<PointPair, bgi::rstar<16> > rtree;
865 rtree.insert(inPoints.begin(), inPoints.end());
868 int unique_index = 0;
875 "Nearest verts",prog);
878 BPoint queryPoint = inPoints[i].first;
883 if(global_to_unique_map[i] < unique_index)
890 std::vector<PointPair> result;
891 rtree.query(bgi::nearest(queryPoint, 10), std::back_inserter(result));
897 for(id1 = 0; id1 < result.size(); ++id1)
899 NekDouble dist = bg::distance(queryPoint, result[id1].first);
902 id2 = result[id1].second;
905 if(global_to_unique_map[id2] <unique_index)
907 new_index = global_to_unique_map[id2];
913 new_index = unique_index;
918 global_to_unique_map[i] = new_index;
919 for(it = samept.begin(); it != samept.end(); ++it)
921 global_to_unique_map[*it] = new_index;
931 m_nvert = unique_index;
936 for(n = 0; n < niso; ++n)
938 for(i = 0; i < iso[n]->m_ntris; ++i,nelmt++)
942 m_vid[3*nelmt+j] = global_to_unique_map[iso[n]->m_vid[3*i+j]+cnt];
945 cnt += iso[n]->m_nvert;
955 for(i = 0; i < iso[0]->m_fields.size(); ++i)
960 for(n = 0; n < global_to_unique_map.size(); ++n)
963 m_x[global_to_unique_map[n]] = bg::get<0>(inPoints[n].first);
964 m_y[global_to_unique_map[n]] = bg::get<1>(inPoints[n].first);
965 m_z[global_to_unique_map[n]] = bg::get<2>(inPoints[n].first);
967 int isoid = global_to_iso_map[n].first;
968 int ptid = global_to_iso_map[n].second;
969 for(j = 0; j <
m_fields.size(); ++j)
971 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
static const NekDouble kNekZeroTol
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator