43#include "Teuchos_Tuple.hpp"
44#include "Teuchos_RCP.hpp"
47#include "PanzerAdaptersSTK_config.hpp"
50#include "Teuchos_FancyOStream.hpp"
55namespace periodic_helpers {
57template <
typename Matcher>
58Teuchos::RCP<std::vector<std::pair<size_t,size_t> > >
61 const Matcher & matcher,
const std::string type_)
67 std::vector<std::string> matchedSides;
68 std::vector<std::pair<size_t,size_t> > previousMatches;
77template <
typename Matcher>
78Teuchos::RCP<std::vector<std::pair<size_t,size_t> > >
81 const Matcher & matcher,
const std::vector<std::string> & matchedSides,
82 const std::vector<std::pair<size_t,size_t> > & previousMatches,
83 const std::string type_)
91 SphereIdVector coordsIdsA, coordsIdsB;
92 std::vector<SearchId> IDsToRemap;
97 auto error = matcher.getAbsoluteTolerance();
99 fillLocalSearchVector(mesh,coordsIdsA,error,sideA,type_,
true,matchedSides,IDsToRemap);
100 fillLocalSearchVector(mesh,coordsIdsB,error,sideB,type_,
false);
106 std::vector<double> centroidA = computeGlobalCentroid(mesh,sideA);
112 SearchPairVector results;
113 stk::search::coarse_search(coordsIdsA,coordsIdsB,stk::search::KDTREE,mesh.
getBulkData()->parallel(),results);
123 Teuchos::RCP<std::vector<std::pair<size_t,size_t> > > myMap
124 = Teuchos::rcp(
new std::vector<std::pair<size_t,size_t>>());
126 for (
size_t i=0; i<results.size(); ++i) {
127 if (results[i].first.proc() == myRank) {
129 (*myMap).emplace_back(
130 std::pair<size_t,size_t>(results[i].first.id().id(),results[i].second.id().id()) );
134 TEUCHOS_TEST_FOR_EXCEPTION((*myMap).size()!=coordsIdsA.size(),std::logic_error,
135 "matchPeriodicSidesSearch: error in local match. "
136 "Number of matched IDs not equal to number of requested matches!");
138 if (matchedSides.size()>0) {
141 updateMapping(myMap,previousMatches,IDsToRemap,mesh);
142 }
else if (previousMatches.size()>0) {
145 appendMapping(myMap,previousMatches);
152template<
typename Matcher>
void
158 for (
auto && sphereIdSideA : searchVectorSideA )
159 matcher.transform(&sphereIdSideA.first.center()[0],centroidSideB);
Teuchos::RCP< stk::mesh::BulkData > getBulkData() const
Teuchos::RCP< std::vector< std::pair< size_t, size_t > > > matchPeriodicSidesSearch(const std::string &sideA, const std::string &sideB, const STK_Interface &mesh, const Matcher &matcher, const std::string type_)
void transformLocalSearchVector(SphereIdVector &searchVectorSideA, const Matcher &matcher, const std::vector< double > ¢roidSideB)