41 bool validEntry =
false;
42 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(
43 !validEntry, Teuchos::Exceptions::InvalidParameterName,
44 "Error, the parameter {name=\"" <<
countStr_ <<
"\","
46 "\nis required in parameter (sub)list \""<< pl->name() <<
"\"."
47 "\n\nThe valid parameters and types are:\n"
49 <<
"Passed parameter list: \n" << pl->currentParametersString()
58 for(
int i=1;i<=numBCs;i++) {
62 std::string cond = pl->get<std::string>(ss.str());
65 std::string matcherType = matcherPair.first;
66 unsigned int matcherDim = matcherPair.second;
67 if(matcherType ==
"coord"){
69 }
else if(matcherType ==
"edge")
71 else if(matcherType ==
"face")
73 else if(matcherType ==
"all"){
123 TEUCHOS_TEST_FOR_EXCEPTION(count<0,std::logic_error,
124 "PeriodicBC requires a positive number (or none) of periodic boundary conditions.");
126 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::rcp(
new Teuchos::ParameterList);
129 pl->set<
bool>(
searchStr_,
false,
"Use bounding box search for GID match (requires STKSearch) or not");
131 for(
int k=1;k<=count;k++) {
132 std::stringstream ss;
135 pl->set<std::string>(ss.str(),
"MatchCondition bndry1;bndry2");
167 std::string::size_type endMatch = buildStr.find_first_of(
' ');
169 std::string matcher =
trim(buildStr.substr(0,endMatch));
171 std::string::size_type hyphenMatch = matcher.find_last_of(
'-');
173 TEUCHOS_TEST_FOR_EXCEPTION(hyphenMatch==std::string::npos,std::logic_error,
174 "Failed parsing parameter list: could not find periodic boundary "
175 "condition matcher \"" << matcher <<
"\" "
176 "in string \"" << buildStr <<
"\n"
177 "Matcher " << matcher <<
" requires a hyphen, e.g. x-coord, yz-edge\"");
179 std::string matcherType =
trim(matcher.substr(hyphenMatch+1,matcher.length()));
181 TEUCHOS_TEST_FOR_EXCEPTION((matcherType !=
"coord") && (matcherType !=
"edge") && (matcherType !=
"face") && (matcherType !=
"all"),std::logic_error,
182 "Failed parsing parameter list: could not find periodic boundary "
183 "condition matcher \"" << matcher <<
"\" "
184 "in string \"" << buildStr <<
"\n"
185 "Type " << matcherType <<
" is not a valid boundary condition type. Must be coord, edge, face, or all\"");
187 std::string matcherCoord =
trim(matcher.substr(0,hyphenMatch));
188 unsigned int matcherDim = 3;
189 if((matcherCoord ==
"x") || (matcherCoord ==
"y") || (matcherCoord ==
"z"))
192 return std::make_pair(matcherType,matcherDim);
197 std::string::size_type allPosition = buildStr.find(
"all");
199 std::string beforeType =
trim(buildStr.substr(0,allPosition));
200 std::string afterType =
trim(buildStr.substr(allPosition+3,buildStr.length()));
202 return beforeType + matcherType +
" " + afterType;
206 std::string & matcher,
207 std::string & bndry1,
208 std::string & bndry2)
const
210 std::string::size_type endMatch = buildStr.find_first_of(
' ');
211 std::string::size_type begBndry = buildStr.find_first_of(
';');
213 matcher =
trim(buildStr.substr(0,endMatch));
214 bndry1 =
trim(buildStr.substr(endMatch,begBndry-endMatch));
215 bndry2 =
trim(buildStr.substr(begBndry+1,buildStr.length()));
219 std::string & matcher,
220 std::vector<std::string> & params,
221 std::string & bndry1,
222 std::string & bndry2)
const
224 std::string::size_type endMatchAndParams = buildStr.find_first_of(
':');
225 std::string::size_type begBndry = buildStr.find_first_of(
';');
228 if(endMatchAndParams==std::string::npos) {
233 bndry1 =
trim(buildStr.substr(endMatchAndParams+1,begBndry-(endMatchAndParams+1)));
234 bndry2 =
trim(buildStr.substr(begBndry+1,buildStr.length()));
236 std::string matchAndParams =
trim(buildStr.substr(0,endMatchAndParams));
237 std::string::size_type endMatch = matchAndParams.find_first_of(
' ');
240 if(endMatch==std::string::npos) {
241 matcher = matchAndParams;
249 matcher =
trim(matchAndParams.substr(0,endMatch));
250 matchAndParams = matchAndParams.substr(endMatch+1);
252 std::string::size_type comma = matchAndParams.find_first_of(
',');
253 while(comma!=std::string::npos) {
254 std::string p =
trim(matchAndParams.substr(0,comma));
256 TEUCHOS_TEST_FOR_EXCEPTION(p.length()<1,std::logic_error,
257 "Error parsing periodic boundary condition \"" + buildStr +
"\"");
260 matchAndParams = matchAndParams.substr(comma+1);
261 comma = matchAndParams.find_first_of(
',');
264 std::string finalParam =
trim(matchAndParams);
265 if(finalParam.length()>0)
266 params.push_back(finalParam);