73 bool validEntry =
false;
74 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(
75 !validEntry, Teuchos::Exceptions::InvalidParameterName,
76 "Error, the parameter {name=\"" <<
countStr_ <<
"\","
78 "\nis required in parameter (sub)list \""<< pl->name() <<
"\"."
79 "\n\nThe valid parameters and types are:\n"
81 <<
"Passed parameter list: \n" << pl->currentParametersString()
90 for(
int i=1;i<=numBCs;i++) {
94 std::string cond = pl->get<std::string>(ss.str());
97 std::string matcherType = matcherPair.first;
98 unsigned int matcherDim = matcherPair.second;
99 if(matcherType ==
"coord"){
101 }
else if(matcherType ==
"edge")
103 else if(matcherType ==
"face")
105 else if(matcherType ==
"all"){
155 TEUCHOS_TEST_FOR_EXCEPTION(count<0,std::logic_error,
156 "PeriodicBC requires a positive number (or none) of periodic boundary conditions.");
158 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::rcp(
new Teuchos::ParameterList);
161 pl->set<
bool>(
searchStr_,
false,
"Use bounding box search for GID match (requires STKSearch) or not");
163 for(
int k=1;k<=count;k++) {
164 std::stringstream ss;
167 pl->set<std::string>(ss.str(),
"MatchCondition bndry1;bndry2");
199 std::string::size_type endMatch = buildStr.find_first_of(
' ');
201 std::string matcher =
trim(buildStr.substr(0,endMatch));
203 std::string::size_type hyphenMatch = matcher.find_last_of(
'-');
205 TEUCHOS_TEST_FOR_EXCEPTION(hyphenMatch==std::string::npos,std::logic_error,
206 "Failed parsing parameter list: could not find periodic boundary "
207 "condition matcher \"" << matcher <<
"\" "
208 "in string \"" << buildStr <<
"\n"
209 "Matcher " << matcher <<
" requires a hyphen, e.g. x-coord, yz-edge\"");
211 std::string matcherType =
trim(matcher.substr(hyphenMatch+1,matcher.length()));
213 TEUCHOS_TEST_FOR_EXCEPTION((matcherType !=
"coord") && (matcherType !=
"edge") && (matcherType !=
"face") && (matcherType !=
"all"),std::logic_error,
214 "Failed parsing parameter list: could not find periodic boundary "
215 "condition matcher \"" << matcher <<
"\" "
216 "in string \"" << buildStr <<
"\n"
217 "Type " << matcherType <<
" is not a valid boundary condition type. Must be coord, edge, face, or all\"");
219 std::string matcherCoord =
trim(matcher.substr(0,hyphenMatch));
220 unsigned int matcherDim = 3;
221 if((matcherCoord ==
"x") || (matcherCoord ==
"y") || (matcherCoord ==
"z"))
224 return std::make_pair(matcherType,matcherDim);
229 std::string::size_type allPosition = buildStr.find(
"all");
231 std::string beforeType =
trim(buildStr.substr(0,allPosition));
232 std::string afterType =
trim(buildStr.substr(allPosition+3,buildStr.length()));
234 return beforeType + matcherType +
" " + afterType;
238 std::string & matcher,
239 std::string & bndry1,
240 std::string & bndry2)
const
242 std::string::size_type endMatch = buildStr.find_first_of(
' ');
243 std::string::size_type begBndry = buildStr.find_first_of(
';');
245 matcher =
trim(buildStr.substr(0,endMatch));
246 bndry1 =
trim(buildStr.substr(endMatch,begBndry-endMatch));
247 bndry2 =
trim(buildStr.substr(begBndry+1,buildStr.length()));
251 std::string & matcher,
252 std::vector<std::string> & params,
253 std::string & bndry1,
254 std::string & bndry2)
const
256 std::string::size_type endMatchAndParams = buildStr.find_first_of(
':');
257 std::string::size_type begBndry = buildStr.find_first_of(
';');
260 if(endMatchAndParams==std::string::npos) {
265 bndry1 =
trim(buildStr.substr(endMatchAndParams+1,begBndry-(endMatchAndParams+1)));
266 bndry2 =
trim(buildStr.substr(begBndry+1,buildStr.length()));
268 std::string matchAndParams =
trim(buildStr.substr(0,endMatchAndParams));
269 std::string::size_type endMatch = matchAndParams.find_first_of(
' ');
272 if(endMatch==std::string::npos) {
273 matcher = matchAndParams;
281 matcher =
trim(matchAndParams.substr(0,endMatch));
282 matchAndParams = matchAndParams.substr(endMatch+1);
284 std::string::size_type comma = matchAndParams.find_first_of(
',');
285 while(comma!=std::string::npos) {
286 std::string p =
trim(matchAndParams.substr(0,comma));
288 TEUCHOS_TEST_FOR_EXCEPTION(p.length()<1,std::logic_error,
289 "Error parsing periodic boundary condition \"" + buildStr +
"\"");
292 matchAndParams = matchAndParams.substr(comma+1);
293 comma = matchAndParams.find_first_of(
',');
296 std::string finalParam =
trim(matchAndParams);
297 if(finalParam.length()>0)
298 params.push_back(finalParam);