Strip extra spaces from code.
[voro++.git] / branches / 2d / src / common.cc
blob30047cd2a6da7ba7ee29b50b6bef8d3646bc6baf
1 // Voro++, a 3D cell-based Voronoi library
2 //
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : May 18th 2011
7 /** \file common.cc
8 * \brief Implementations of the small helper functions. */
10 #include "common.hh"
12 namespace voro {
14 /** \brief Prints a vector of integers.
16 * Prints a vector of integers.
17 * \param[in] v the vector to print.
18 * \param[in] fp the file stream to print to. */
19 void voro_print_vector(vector<int> &v,FILE *fp) {
20 int k(0),s(v.size());
21 while(k+4<s) {
22 fprintf(fp,"%d %d %d %d ",v[k],v[k+1],v[k+2],v[k+3]);
23 k+=4;
25 if(k+3<=s) {
26 if(k+4==s) fprintf(fp,"%d %d %d %d",v[k],v[k+1],v[k+2],v[k+3]);
27 else fprintf(fp,"%d %d %d",v[k],v[k+1],v[k+2]);
28 } else {
29 if(k+2==s) fprintf(fp,"%d %d",v[k],v[k+1]);
30 else fprintf(fp,"%d",v[k]);
34 /** \brief Prints a vector of doubles.
36 * Prints a vector of doubles.
37 * \param[in] v the vector to print.
38 * \param[in] fp the file stream to print to. */
39 void voro_print_vector(vector<double> &v,FILE *fp) {
40 int k(0),s(v.size());
41 while(k+4<s) {
42 fprintf(fp,"%g %g %g %g ",v[k],v[k+1],v[k+2],v[k+3]);
43 k+=4;
45 if(k+3<=s) {
46 if(k+4==s) fprintf(fp,"%g %g %g %g",v[k],v[k+1],v[k+2],v[k+3]);
47 else fprintf(fp,"%g %g %g",v[k],v[k+1],v[k+2]);
48 } else {
49 if(k+2==s) fprintf(fp,"%g %g",v[k],v[k+1]);
50 else fprintf(fp,"%g",v[k]);