43 #include "Teuchos_Tuple.hpp"
47 #include "PanzerAdaptersSTK_config.hpp"
50 #include "Teuchos_FancyOStream.hpp"
54 namespace panzer_stk {
55 namespace periodic_helpers {
57 template <
typename Matcher>
61 const Matcher & matcher,
const std::string type_)
67 std::vector<std::string> matchedSides;
68 std::vector<std::pair<size_t,size_t> > previousMatches;
77 template <
typename Matcher>
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);
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()) );
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);
152 template<
typename Matcher>
void
158 for (
auto && sphereIdSideA : searchVectorSideA )
159 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