X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=src%2Fgromacs%2Fselection%2Findexutil.cpp;h=8aecd065e7ed9199bc4e74abb0a4d0d4e245aab9;hb=180cf1538ad2b19bd6b4108662adc4a519565fcb;hp=2e85724ac4d8e43ee679f2e55269a643fb5c03eb;hpb=1d597ac0415f9a847715ef65daa55fe1312bd59f;p=alexxy%2Fgromacs.git diff --git a/src/gromacs/selection/indexutil.cpp b/src/gromacs/selection/indexutil.cpp index 2e85724ac4..8aecd065e7 100644 --- a/src/gromacs/selection/indexutil.cpp +++ b/src/gromacs/selection/indexutil.cpp @@ -56,6 +56,8 @@ #include "gromacs/utility/exceptions.h" #include "gromacs/utility/gmxassert.h" #include "gromacs/utility/smalloc.h" +#include "gromacs/utility/stringutil.h" +#include "gromacs/utility/textwriter.h" /******************************************************************** * gmx_ana_indexgrps_t functions @@ -261,18 +263,19 @@ gmx_ana_indexgrps_find(gmx_ana_index_t *dest, std::string *destName, } /*! - * \param[in] fp Where to print the output. + * \param[in] writer Writer to use for output. * \param[in] g Index groups to print. * \param[in] maxn Maximum number of indices to print * (-1 = print all, 0 = print only names). */ void -gmx_ana_indexgrps_print(FILE *fp, gmx_ana_indexgrps_t *g, int maxn) +gmx_ana_indexgrps_print(gmx::TextWriter *writer, gmx_ana_indexgrps_t *g, int maxn) { for (int i = 0; i < g->nr; ++i) { - fprintf(fp, " Group %2d \"%s\" ", i, g->names[i].c_str()); - gmx_ana_index_dump(fp, &g->g[i], maxn); + writer->writeString(gmx::formatString(" Group %2d \"%s\" ", + i, g->names[i].c_str())); + gmx_ana_index_dump(writer, &g->g[i], maxn); } } @@ -394,34 +397,32 @@ gmx_ana_index_copy(gmx_ana_index_t *dest, gmx_ana_index_t *src, bool bAlloc) } /*! - * \param[in] fp Where to print the output. + * \param[in] writer Writer to use for output. * \param[in] g Index group to print. * \param[in] maxn Maximum number of indices to print (-1 = print all). */ void -gmx_ana_index_dump(FILE *fp, gmx_ana_index_t *g, int maxn) +gmx_ana_index_dump(gmx::TextWriter *writer, gmx_ana_index_t *g, int maxn) { - int j, n; - - fprintf(fp, "(%d atoms)", g->isize); + writer->writeString(gmx::formatString("(%d atoms)", g->isize)); if (maxn != 0) { - fprintf(fp, ":"); - n = g->isize; + writer->writeString(":"); + int n = g->isize; if (maxn >= 0 && n > maxn) { n = maxn; } - for (j = 0; j < n; ++j) + for (int j = 0; j < n; ++j) { - fprintf(fp, " %d", g->index[j]+1); + writer->writeString(gmx::formatString(" %d", g->index[j]+1)); } if (n < g->isize) { - fprintf(fp, " ..."); + writer->writeString(" ..."); } } - fprintf(fp, "\n"); + writer->writeLine(); } int