49 const std::string &xmlFileName,
50 const Ptr<ParameterList> ¶mList,
51 const Comm<int> &comm,
55 if (comm.getSize()==1)
58 if (comm.getRank()==0) {
59 XMLParameterListReader xmlPLReader;
60 xmlPLReader.setAllowsDuplicateSublists(
false );
62 XMLObject xmlParams = xmlFile.getObject();
63 std::string xmlString =
toString(xmlParams);
64 int strsize =
static_cast<int>(xmlString.size());
65 broadcast<int, int>(comm, 0, &strsize);
66 broadcast<int, char>(comm, 0, strsize, &xmlString[0]);
71 broadcast<int, int>(comm, 0, &strsize);
72 std::string xmlString;
73 xmlString.resize(strsize);
74 broadcast<int, char>(comm, 0, strsize, &xmlString[0]);
Additional ParameterList XML helper functions including parallel support.
Writes an XML object to a parameter list.
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.
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT void updateParametersFromXmlFile(const std::string &xmlFileName, const Ptr< ParameterList > ¶mList)
Reads XML parameters from a file and updates those already in the given parameter list.
TEUCHOSCOMM_LIB_DLL_EXPORT void updateParametersFromXmlFileAndBroadcast(const std::string &xmlFileName, const Ptr< ParameterList > ¶mList, const Comm< int > &comm, bool overwrite=true)
On processor rank = 0, reads XML parameters from a file and broadcasts them to all other processors....
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object,...
std::string toString(const HashSet< Key > &h)