47 #include "Teuchos_ParameterListExceptions.hpp" 
   49 namespace panzer_stk {
 
   53    , condPrefix_(
"Periodic Condition ")
 
   57 const std::vector<Teuchos::RCP<const PeriodicBC_MatcherBase> > &
 
   66       bool validEntry = 
false;
 
   69         "Error, the parameter {name=\"" << 
countStr_ << 
"\"," 
   71         "\nis required in parameter (sub)list \""<< pl->
name() <<
"\"." 
   72         "\n\nThe valid parameters and types are:\n" 
   82    for(
int i=1;i<=numBCs;i++) {
 
   86       std::string cond = pl->
get<std::string>(ss.str());
 
   89       std::string matcherType = matcherPair.first;
 
   90       unsigned int matcherDim = matcherPair.second;
 
   91       if(matcherType == 
"coord"){
 
   93       }
else if(matcherType == 
"edge")
 
   95       else if(matcherType == 
"face")
 
   97       else if(matcherType == 
"all"){
 
  129    if(pl==Teuchos::null) {
 
  130       std::stringstream ss;
 
  135                    "Number of set periodic boundary conditions");
 
  136       pl->
set<std::string>(ss.str(),
"MatchCondition bndry1;bndry2",
 
  137                    "Boundary condition fairs formatted: <MatchCondition> <bndry1>;<bndry2>");
 
  146                       "PeriodicBC requires a positive number (or none) of periodic boundary conditions.");
 
  151    for(
int k=1;k<=count;k++) {
 
  152       std::stringstream ss;
 
  155       pl->
set<std::string>(ss.str(),
"MatchCondition bndry1;bndry2");
 
  166    std::string::size_type beg = s.find_first_not_of(
' ');
 
  168    return s.substr(beg,s.length()-beg);
 
  173    std::string::size_type 
end = s.find_last_not_of(
' ');
 
  175    return s.substr(0,end+1);
 
  178 static std::string 
trim(
const std::string & s)
 
  187    std::string::size_type endMatch = buildStr.find_first_of(
' ');
 
  189    std::string matcher = 
trim(buildStr.substr(0,endMatch));
 
  191    std::string::size_type hyphenMatch = matcher.find_last_of(
'-');
 
  194        "Failed parsing parameter list: could not find periodic boundary " 
  195        "condition matcher \"" << matcher << 
"\" " 
  196        "in string \"" << buildStr << 
"\n" 
  197        "Matcher " << matcher << 
" requires a hyphen, e.g. x-coord, yz-edge\"");
 
  199    std::string matcherType = 
trim(matcher.substr(hyphenMatch+1,matcher.length()));
 
  201    TEUCHOS_TEST_FOR_EXCEPTION((matcherType != 
"coord") && (matcherType != 
"edge") && (matcherType != 
"face") && (matcherType != 
"all"),std::logic_error,
 
  202        "Failed parsing parameter list: could not find periodic boundary " 
  203        "condition matcher \"" << matcher << 
"\" " 
  204        "in string \"" << buildStr << 
"\n" 
  205        "Type " << matcherType << 
" is not a valid boundary condition type. Must be coord, edge, face, or all\"");
 
  207    std::string matcherCoord = 
trim(matcher.substr(0,hyphenMatch));
 
  208    unsigned int matcherDim = 3;
 
  209    if((matcherCoord == 
"x") || (matcherCoord == 
"y") || (matcherCoord == 
"z"))
 
  212    return std::make_pair(matcherType,matcherDim);
 
  217    std::string::size_type allPosition = buildStr.find(
"all");
 
  219    std::string beforeType = 
trim(buildStr.substr(0,allPosition));
 
  220    std::string afterType = 
trim(buildStr.substr(allPosition+3,buildStr.length()));
 
  222    return beforeType + matcherType + 
" " + afterType;
 
  226                                              std::string & matcher,
 
  227                                              std::string & bndry1,
 
  228                                              std::string & bndry2)
 const 
  230    std::string::size_type endMatch = buildStr.find_first_of(
' ');
 
  231    std::string::size_type begBndry = buildStr.find_first_of(
';');
 
  233    matcher = 
trim(buildStr.substr(0,endMatch));
 
  234    bndry1 = 
trim(buildStr.substr(endMatch,begBndry-endMatch));
 
  235    bndry2 = 
trim(buildStr.substr(begBndry+1,buildStr.length()));
 
  239                                                          std::string & matcher,
 
  240                                                          std::vector<std::string> & params,
 
  241                                                          std::string & bndry1,
 
  242                                                          std::string & bndry2)
 const 
  244    std::string::size_type endMatchAndParams = buildStr.find_first_of(
':');
 
  245    std::string::size_type begBndry = buildStr.find_first_of(
';');
 
  248    if(endMatchAndParams==std::string::npos) {
 
  253    bndry1 = 
trim(buildStr.substr(endMatchAndParams+1,begBndry-(endMatchAndParams+1)));
 
  254    bndry2 = 
trim(buildStr.substr(begBndry+1,buildStr.length()));
 
  256    std::string matchAndParams = 
trim(buildStr.substr(0,endMatchAndParams));
 
  257    std::string::size_type endMatch = matchAndParams.find_first_of(
' ');
 
  260    if(endMatch==std::string::npos) {
 
  261       matcher = matchAndParams;
 
  269    matcher = 
trim(matchAndParams.substr(0,endMatch));
 
  270    matchAndParams = matchAndParams.substr(endMatch+1);
 
  272    std::string::size_type comma = matchAndParams.find_first_of(
',');
 
  273    while(comma!=std::string::npos) {
 
  274       std::string p = 
trim(matchAndParams.substr(0,comma));
 
  277                           "Error parsing periodic boundary condition \"" + buildStr + 
"\"");
 
  280       matchAndParams = matchAndParams.substr(comma+1);
 
  281       comma = matchAndParams.find_first_of(
',');
 
  284    std::string finalParam = 
trim(matchAndParams);
 
  285    if(finalParam.length()>0)
 
  286       params.push_back(finalParam);
 
  294    std::vector<std::string> params;
 
  295    std::string s_matcher, bndry1, bndry2;
 
  299    if(s_matcher==
"x-coord") {
 
  304    if(s_matcher==
"y-coord") {
 
  309    if(s_matcher==
"z-coord") {
 
  314    if(s_matcher==
"x-edge") {
 
  319    if(s_matcher==
"y-edge") {
 
  324    if(s_matcher==
"z-edge") {
 
  329    if(s_matcher==
"xy-coord" || s_matcher==
"yx-coord") {
 
  334    if(s_matcher==
"xz-coord" || s_matcher==
"zx-coord") {
 
  339    if(s_matcher==
"yz-coord" || s_matcher==
"zy-coord") {
 
  344    if(s_matcher==
"xy-edge" || s_matcher==
"yx-edge") {
 
  349    if(s_matcher==
"xz-edge" || s_matcher==
"zx-edge") {
 
  354    if(s_matcher==
"yz-edge" || s_matcher==
"zy-edge") {
 
  359    if(s_matcher==
"xy-face" || s_matcher==
"yx-face") {
 
  364    if(s_matcher==
"xz-face" || s_matcher==
"zx-face") {
 
  369    if(s_matcher==
"yz-face" || s_matcher==
"zy-face") {
 
  374    if(s_matcher==
"wx-coord") {
 
  379    if(s_matcher==
"wy-coord") {
 
  384    if(s_matcher==
"wx-edge") {
 
  389    if(s_matcher==
"wy-edge") {
 
  394    if(s_matcher==
"wx-face") {
 
  399    if(s_matcher==
"wy-face") {
 
  404    if(s_matcher==
"(xy)z-quarter-coord") {
 
  409    if(s_matcher==
"(yx)z-quarter-coord") {
 
  414    if(s_matcher==
"(xz)y-quarter-coord") {
 
  419    if(s_matcher==
"(zx)y-quarter-coord") {
 
  424    if(s_matcher==
"(yz)x-quarter-coord") {
 
  429    if(s_matcher==
"(zy)x-quarter-coord") {
 
  435        "Failed parsing parameter list: could not find periodic boundary " 
  436        "condition matcher \"" << s_matcher << 
"\" " 
  437        "in string \"" << buildStr << 
"\"");
 
  439    return Teuchos::null;
 
bool buildMatcher_Tokenize_withParams(const std::string &buildStr, std::string &matcher, std::vector< std::string > ¶ms, std::string &bndry1, std::string &bndry2) const 
 
RCP< const T > getConst() const 
 
const std::string & name() const 
 
const std::string countStr_
 
std::string currentParametersString() const 
 
T & get(const std::string &name, T def_value)
 
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
 
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &pl)
 
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
 
Teuchos::RCP< Teuchos::ParameterList > storedPL_
stored parameter list 
 
static std::string trim_right(const std::string &s)
 
std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > faceMatchers_
 
std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > matchers_
matchers constructed by "setParameterList" 
 
bool isParameter(const std::string &name) const 
 
const std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > & getMatchers() const 
 
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const 
 
const std::string condPrefix_
 
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
 
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
 
std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > edgeMatchers_
 
void buildMatcher_Tokenize(const std::string &buildStr, std::string &matcher, std::string &bndry1, std::string &bndry2) const 
 
std::string replaceMatcherType(const std::string &buildStr, const std::string &matcherType) const 
 
static std::string trim_left(const std::string &s)
 
void validateParameters(ParameterList const &validParamList, int const depth=1000, EValidateUsed const validateUsed=VALIDATE_USED_ENABLED, EValidateDefaults const validateDefaults=VALIDATE_DEFAULTS_ENABLED) const 
 
Teuchos::RCP< PeriodicBC_MatcherBase > buildPeriodicBC_Matcher(const std::string &left, const std::string &right, const Matcher &matcher, const std::string type="coord")
 
static std::string trim(const std::string &s)
 
std::pair< std::string, unsigned int > getMatcherTypeAndDim(const std::string &buildStr) const 
 
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
 
Teuchos::RCP< const PeriodicBC_MatcherBase > buildMatcher(const std::string &buildStr) const 
 
#define TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(throw_exception_test, Exception, msg)