bool ParameterListCallbackBlocked<LocalOrdinalT,GlobalOrdinalT,Node>::handlesRequest(const Teko::RequestMesg & rm) { // check if is a parameter list message, and that the parameter // list contains the right fields if(rm.getName()=="Parameter List") { bool isHandled = true; Teuchos::RCP<const Teuchos::ParameterList> pl = rm.getParameterList(); std::string field; if(pl->isType<std::string>("x-coordinates")) { field = pl->get<std::string>("x-coordinates"); if(!isField(field)) { return false; } } if(pl->isType<std::string>("y-coordinates")) { // we assume that the fields must be the same if(field != pl->get<std::string>("y-coordinates")) { return false; } } if(pl->isType<std::string>("z-coordinates")) { // we assume that the fields must be the same if(field != pl->get<std::string>("z-coordinates")) { return false; } } return isHandled; } else return false; }
bool ParameterListCallback<LocalOrdinalT,GlobalOrdinalT,Node>::handlesRequest(const Teko::RequestMesg & rm) { // check if is a parameter list message, and that the parameter // list contains the right fields if(rm.getName()=="Parameter List") return true; else return false; }
void ParameterListCallbackBlocked<LocalOrdinalT,GlobalOrdinalT,Node>::preRequest(const Teko::RequestMesg & rm) { TEUCHOS_ASSERT(handlesRequest(rm)); // design by contract const std::string & field = getHandledField(*rm.getParameterList()); int block = blocked_ugi_->getFieldBlock(blocked_ugi_->getFieldNum(field)); // empty...nothing to do buildArrayToVector(block,field); buildCoordinates(field); }
Teuchos::RCP<Teuchos::ParameterList> ParameterListCallback<LocalOrdinalT,GlobalOrdinalT,Node>::request(const Teko::RequestMesg & rm) { TEUCHOS_ASSERT(handlesRequest(rm)); // design by contract // loop over parameter list and set the field by a particular key Teuchos::RCP<Teuchos::ParameterList> outputPL = rcp(new Teuchos::ParameterList); Teuchos::RCP<const Teuchos::ParameterList> inputPL = rm.getParameterList(); Teuchos::ParameterList::ConstIterator itr; for(itr=inputPL->begin();itr!=inputPL->end();++itr) setFieldByKey(itr->first,*outputPL); return outputPL; }
Teuchos::RCP<Teuchos::ParameterList> ParameterListCallbackBlocked<LocalOrdinalT,GlobalOrdinalT,Node>::request(const Teko::RequestMesg & rm) { TEUCHOS_ASSERT(handlesRequest(rm)); // design by contract // loop over parameter list and set the field by a particular key Teuchos::RCP<Teuchos::ParameterList> outputPL = rcp(new Teuchos::ParameterList); Teuchos::RCP<const Teuchos::ParameterList> inputPL = rm.getParameterList(); Teuchos::ParameterList::ConstIterator itr; for(itr=inputPL->begin();itr!=inputPL->end();++itr) { std::string * str_ptr = 0; // just used as a template specifier std::string field = inputPL->entry(itr).getValue(str_ptr); setFieldByKey(itr->first,field,*outputPL); } return outputPL; }