diff --git a/Cantera/src/base/Array.h b/Cantera/src/base/Array.h index 191c50ac3..17770b804 100755 --- a/Cantera/src/base/Array.h +++ b/Cantera/src/base/Array.h @@ -38,7 +38,19 @@ namespace Cantera { public: + //! Type definition for the iterator class that is + //! can be used by Array2D types. + /*! + * this is just equal to vector_fp iterator. + */ typedef vector_fp::iterator iterator; + + + //! Type definition for the const_iterator class that is + //! can be used by Array2D types. + /*! + * this is just equal to vector_fp const_iterator. + */ typedef vector_fp::const_iterator const_iterator; /** @@ -128,14 +140,26 @@ namespace Cantera { } } - /// set the values in column m to those in array col + //! Set the values in column m to those in array col + /*! + * A(i,m) = col(i) + * + * @param m Column to set + * @param col pointer to a col vector + */ void setColumn(int m, doublereal* col) { for (int i = 0; i < m_nrows; i++) { m_data[m_nrows*m + i] = col[i]; } } - /// get the values in column m + //! Get the values in column m + /*! + * col(i) = A(i,m) + * + * @param m Column to set + * @param col pointer to a col vector that will be returned + */ void getColumn(int m, doublereal* col) { for (int i = 0; i < m_nrows; i++) { col[i] = m_data[m_nrows*m + i]; @@ -172,7 +196,9 @@ namespace Cantera { /** * Allows retrieving elements using the syntax x = A(i,j). */ - doublereal operator() ( int i, int j) const {return value(i,j);} + doublereal operator() (int i, int j) const { + return value(i,j); + } //! Returns a changeable reference to position in the matrix /*! @@ -182,7 +208,18 @@ namespace Cantera { * @param j The column index */ doublereal& value( int i, int j) {return m_data[m_nrows*j + i];} - doublereal value( int i, int j) const {return m_data[m_nrows*j + i];} + + //! Returns the value of a single matrix entry + /*! + * This is a key entry. Returns the value of the matrix position (i,j) + * element. + * + * @param i The row index + * @param j The column index + */ + doublereal value(int i, int j) const { + return m_data[m_nrows*j + i]; + } /// Number of rows size_t nRows() const { return m_nrows; } @@ -208,10 +245,25 @@ namespace Cantera { /// Return a const reference to the data vector const vector_fp& data() const { return m_data; } - /// Return a pointer to the top of column j, columns are contiguous - /// in memory + //! Return a pointer to the top of column j, columns are contiguous + //! in memory + /*! + * @param j Value of the column + * + * @return Returns a pointer to the top of the column + */ doublereal * ptrColumn(int j) { return &(m_data[m_nrows*j]); } - const doublereal * ptrColumn(int j) const { return &(m_data[m_nrows*j]); } + + //! Return a const pointer to the top of column j, columns are contiguous + //! in memory + /*! + * @param j Value of the column + * + * @return Returns a const pointer to the top of the column + */ + const doublereal * ptrColumn(int j) const { + return &(m_data[m_nrows*j]); + } protected: @@ -225,7 +277,16 @@ namespace Cantera { int m_ncols; }; - /// output the array + //! Output the current contents of the Array2D object + /*! + * Example of usage: + * s << m << endl; + * + * @param s Reference to the ostream to write to + * @param m Object of type Array2D that you are querying + * + * @return Returns a reference to the ostream. + */ inline std::ostream& operator<<(std::ostream& s, const Array2D& m) { int nr = static_cast(m.nRows()); int nc = static_cast(m.nColumns()); diff --git a/Cantera/src/base/misc.cpp b/Cantera/src/base/misc.cpp index 692d90bb0..f0a9d8e8e 100755 --- a/Cantera/src/base/misc.cpp +++ b/Cantera/src/base/misc.cpp @@ -1519,10 +1519,6 @@ protected: app()->writelog(msg); } - void writelogAM(const std::string& msg) { - app()->writelog(msg); - } - // Write a message to the screen void Application::Messages::writelog(const std::string& msg) { logwriter->write(msg); @@ -1532,9 +1528,6 @@ protected: void writelog(const char* msg) { app()->writelog(msg); } - void writelogAM(const char* msg) { - app()->writelog(msg); - } // Write a message to the screen void Application::Messages::writelog(const char* pszmsg) { diff --git a/Cantera/src/base/vec_functions.h b/Cantera/src/base/vec_functions.h index 074ff9d69..bee171468 100755 --- a/Cantera/src/base/vec_functions.h +++ b/Cantera/src/base/vec_functions.h @@ -39,9 +39,13 @@ namespace Cantera { std::copy(x.begin(), x.begin() + n, y.begin()); } - /** - * Divide each element of x by the corresponding element of y. + //! Divide each element of x by the corresponding element of y. + /*! * This function replaces x[n] by x[n]/y[n], for 0 <= n < x.size() + * + * @param x Numerator object of the division operation with template type T + * At the end of the calculation, it contains the result. + * @param y Denominator object of the division template type T */ template inline void divide_each(T& x, const T& y) { @@ -49,9 +53,15 @@ namespace Cantera { x.begin(), std::divides()); } - /** - * multiply each element of x by the corresponding element of y. + //! Multiply each element of x by the corresponding element of y. + /*! * This function replaces x[n] by x[n]*y[n], for 0 <= n < x.size() + * This is a templated function with just one template type. + * + * @param x First object of the multiplication with template type T + * At the end of the calculation, it contains the result. + * @param y Second object of the multiplication with template type T + * */ template inline void multiply_each(T& x, const T& y) { @@ -59,32 +69,52 @@ namespace Cantera { x.begin(), std::multiplies()); } - /** - * Multiply each element of x by scale_factor. + //! Multiply each element of x by scale_factor. + /*! + * This function replaces x[n] by x[n]*scale_factor, for 0 <= n < x.size() + * + * @param x First object of the multiplication with template type T + * At the end of the calculation, it contains the result. + * @param scale_factor scale factor with template type S */ template inline void scale(T& x, S scale_factor) { scale(x.begin(), x.end(), x.begin(), scale_factor); } - /** + //! Return the templated dot product of two objects + /*! * Returns the sum of x[n]*y[n], for 0 <= n < x.size(). + * + * @param x First object of the dot product with template type T + * At the end of the calculation, it contains the result. + * @param y Second object of the dot product with template type T */ template inline doublereal dot_product(const T& x, const T& y) { return std::inner_product(x.begin(), x.end(), y.begin(), 0.0); } + //! Returns the templated dot ratio of two objects /** * Returns the sum of x[n]/y[n], for 0 <= n < x.size(). + * + * @param x First object of the dot product with template type T + * At the end of the calculation, it contains the result. + * @param y Second object of the dot product with template type T */ template inline doublereal dot_ratio(const T& x, const T& y) { return _dot_ratio(x.begin(), x.end(), y.begin(), 0.0); } + //! Returns a templated addition operation of two objects /** * Replaces x[n] by x[n] + y[n] for 0 <= n < x.size() + * + * @param x First object of the addition with template type T + * At the end of the calculation, it contains the result. + * @param y Second object of the addition with template type T */ template inline void add_each(T& x, const T& y) { @@ -119,9 +149,13 @@ namespace Cantera { return start_value; } - /** - * Finds the entry in a vector with maximum absolute - * value, and return this value. + + //! Finds the entry in a vector with maximum absolute + //! value, and return this value. + /*! + * @param v Vector to be queried for maximum value, with template type T + * + * @return Returns an object of type T that is the maximum value, */ template inline T absmax(const std::vector& v) {