diff --git a/src/Utility/Utilities.C b/src/Utility/Utilities.C index 8b00e6dd..3437a0b7 100644 --- a/src/Utility/Utilities.C +++ b/src/Utility/Utilities.C @@ -17,10 +17,6 @@ #include #include -#ifdef HAVE_MPI -#include -#endif - void utl::parseIntegers (std::vector& values, const char* argv) { @@ -155,6 +151,18 @@ bool utl::getAttribute (const TiXmlElement* xml, const char* att, int& val) } +bool utl::getAttribute (const TiXmlElement* xml, const char* att, char& val, + bool useIntValue) +{ + if (xml && xml->Attribute(att)) + val = useIntValue ? atoi(xml->Attribute(att)) : xml->Attribute(att)[0]; + else + return false; + + return true; +} + + bool utl::getAttribute (const TiXmlElement* xml, const char* att, size_t& val) { if (xml && xml->Attribute(att)) @@ -356,18 +364,6 @@ size_t utl::find_closest (const std::vector& a, Real v) } -void utl::printSyncronized (std::ostream& out, const std::stringstream& str, - int pid) -{ - out << std::flush; -#ifdef HAVE_MPI - MPI_Barrier(MPI_COMM_WORLD); -#endif - if (pid == 0) - out << str.str(); -} - - std::string utl::adjustRight (size_t width, const std::string& s, const std::string& suffix) { diff --git a/src/Utility/Utilities.h b/src/Utility/Utilities.h index 9841ccc1..7dcde37a 100644 --- a/src/Utility/Utilities.h +++ b/src/Utility/Utilities.h @@ -16,7 +16,6 @@ #include "matrix.h" #include -#include #include #include #include @@ -70,6 +69,15 @@ namespace utl //! \return \e true if the attribute \a att is found in \a xml, //! otherwise \e false bool getAttribute(const TiXmlElement* xml, const char* att, int& val); + //! \brief Extracts a char attribute value from the specified XML-element. + //! \param[in] xml Pointer to XML-element to extract from + //! \param[in] att The attribute tag + //! \param[out] val The attribute value + //! \param[in] useIntValue If \e true, convert the value to an integer + //! \return \e true if the attribute \a att is found in \a xml, + //! otherwise \e false + bool getAttribute(const TiXmlElement* xml, const char* att, char& val, + bool useIntValue = true); //! \brief Extracts a size_t attribute value from the specified XML-element. //! \param[in] xml Pointer to XML-element to extract from //! \param[in] att The attribute tag @@ -179,16 +187,6 @@ namespace utl //! input. If this is not the case the method will deliver incorrect result. size_t find_closest(const std::vector& a, Real v); - //! \brief Prints a string stream to an output stream. - //! \param out The output stream to print to - //! \param[in] str The string stream to print - //! \param[in] pid The PID of this process (only process 0 will print) - //! - //! \details This method makes sure to flush the output stream - //! across all processes up front. - void printSyncronized(std::ostream& out, - const std::stringstream& str, int pid); - //! \brief Right-justifies the input string to the given total \a width. std::string adjustRight(size_t width, const std::string& s, const std::string& suffix = " : ");