43 #include "Teuchos_RawParameterListHelpers.hpp"
46 #include "Teuchos_CommHelpers.hpp"
48 TEUCHOSCOMM_LIB_DLL_EXPORT
49 void Teuchos::updateParametersAndBroadcast(
50 const Ptr<ParameterList> &inParamList,
51 const Ptr<ParameterList> ¶mList,
52 const Comm<int> &comm,
57 if (comm.getSize()==1) {
58 if(overwrite) paramList->setParameters(*inParamList);
59 else paramList->setParametersNotAlreadySet(*inParamList);
62 if (comm.getRank()==root) {
63 XMLParameterListWriter w;
64 std::string xmlString =
toString(w.toXML(*inParamList));
65 int strsize =
static_cast<int>(xmlString.size());
66 broadcast<int, int>(comm, root, &strsize);
67 broadcast<int, char>(comm, root, strsize, &xmlString[0]);
72 broadcast<int, int>(comm, root, &strsize);
73 std::string xmlString;
74 xmlString.resize(strsize);
75 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...