11 #include "Teuchos_Tuple.hpp"
15 #include "PanzerAdaptersSTK_config.hpp"
18 #include "Teuchos_FancyOStream.hpp"
22 namespace panzer_stk {
23 namespace periodic_helpers {
25 template <
typename Matcher>
29 const Matcher & matcher,
const std::string type_)
35 std::vector<std::string> matchedSides;
36 std::vector<std::pair<size_t,size_t> > previousMatches;
45 template <
typename Matcher>
49 const Matcher & matcher,
const std::vector<std::string> & matchedSides,
50 const std::vector<std::pair<size_t,size_t> > & previousMatches,
51 const std::string type_)
59 SphereIdVector coordsIdsA, coordsIdsB;
60 std::vector<SearchId> IDsToRemap;
65 auto error = matcher.getAbsoluteTolerance();
67 fillLocalSearchVector(mesh,coordsIdsA,error,sideA,type_,
true,matchedSides,IDsToRemap);
68 fillLocalSearchVector(mesh,coordsIdsB,error,sideB,type_,
false);
74 std::vector<double> centroidA = computeGlobalCentroid(mesh,sideA);
80 SearchPairVector results;
81 stk::search::coarse_search(coordsIdsA,coordsIdsB,stk::search::KDTREE,mesh.
getBulkData()->parallel(),results);
92 =
Teuchos::rcp(
new std::vector<std::pair<size_t,size_t>>());
94 for (
size_t i=0; i<results.size(); ++i) {
95 if (results[i].first.proc() == myRank) {
97 (*myMap).emplace_back(
98 std::pair<size_t,size_t>(results[i].first.id().id(),results[i].second.id().id()) );
103 "matchPeriodicSidesSearch: error in local match. "
104 "Number of matched IDs not equal to number of requested matches!");
106 if (matchedSides.size()>0) {
109 updateMapping(myMap,previousMatches,IDsToRemap,mesh);
110 }
else if (previousMatches.size()>0) {
113 appendMapping(myMap,previousMatches);
120 template<
typename Matcher>
void
126 for (
auto && sphereIdSideA : searchVectorSideA )
127 matcher.transform(&sphereIdSideA.first.center()[0],centroidSideB);
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_)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void transformLocalSearchVector(SphereIdVector &searchVectorSideA, const Matcher &matcher, const std::vector< double > ¢roidSideB)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< stk::mesh::BulkData > getBulkData() const