10 #include "Teuchos_RawParameterListHelpers.hpp"
13 #include "Teuchos_CommHelpers.hpp"
15 TEUCHOSCOMM_LIB_DLL_EXPORT
16 void Teuchos::updateParametersAndBroadcast(
17 const Ptr<ParameterList> &inParamList,
18 const Ptr<ParameterList> ¶mList,
19 const Comm<int> &comm,
24 if (comm.getSize()==1) {
25 if(overwrite) paramList->setParameters(*inParamList);
26 else paramList->setParametersNotAlreadySet(*inParamList);
29 if (comm.getRank()==root) {
30 XMLParameterListWriter w;
31 std::string xmlString =
toString(w.toXML(*inParamList));
32 int strsize =
static_cast<int>(xmlString.size());
33 broadcast<int, int>(comm, root, &strsize);
34 broadcast<int, char>(comm, root, strsize, &xmlString[0]);
39 broadcast<int, int>(comm, root, &strsize);
40 std::string xmlString;
41 xmlString.resize(strsize);
42 broadcast<int, char>(comm, root, strsize, &xmlString[0]);
std::string toString(const any &rhs)
Converts the value in any to a std::string.
Writes a ParameterList to an XML object.
Additional ParameterList XML helper functions including parallel support.
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT void updateParametersFromXmlString(const std::string &xmlStr, const Ptr< ParameterList > ¶mList, bool overwrite=true)
Reads XML parameters from a std::string and updates those already in the given parameter list...