Debian Codegraph @

Export/C++/Source/write_lines.C

raw
1 /*
2 * Writes a C array in an ostream with a fixed number of items per line
3 *
4 */
5
6 /*
7 * Copyright (c) 2002 Eric Gourgoulhon
8 *
9 * This file is part of LORENE.
10 *
11 * LORENE is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
13 * as published by the Free Software Foundation.
14 *
15 * LORENE is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with LORENE; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26
27 char write_lines_C[] = "$Header: /cvsroot/Lorene/Export/C++/Source/write_lines.C,v 1.4 2014/10/13 08:54:06 j_novak Exp $" ;
28
29 /*
30 * $Id: write_lines.C,v 1.4 2014/10/13 08:54:06 j_novak Exp $
31 * $Log: write_lines.C,v $
32 * Revision 1.4 2014/10/13 08:54:06 j_novak
33 * Lorene classes and functions now belong to the namespace Lorene.
34 *
35 * Revision 1.3 2006/09/12 08:04:07 j_novak
36 * Removal of the include path Export/C++/Include, updating of the relevant
37 * source files in Export/C++/Source.
38 *
39 * Revision 1.2 2003/01/09 11:08:00 j_novak
40 * headcpp.h is now compliant with C++ norm.
41 * The include files have been ordered, as well as the local_settings_linux
42 *
43 * Revision 1.1 2002/01/11 17:03:02 e_gourgoulhon
44 * Exportation of binary neutron stars configuration to a Cartesian grid
45 *
46 *
47 * $Header: /cvsroot/Lorene/Export/C++/Source/write_lines.C,v 1.4 2014/10/13 08:54:06 j_novak Exp $
48 *
49 */
50
51 #include "headcpp.h"
52
53 namespace Lorene {
54 void write_lines(ostream& fich, int dpl, const double* pdata, int np) {
55
56 int nlines = np / dpl ; // number of filled lines
57 int reste = np - nlines * dpl ; // number of remaining data
58
59 for (int line = 0; line < nlines; line++) {
60 for (int i=0; i<dpl; i++) {
61 fich << *pdata << " " ;
62 pdata++ ;
63 }
64 fich << endl ;
65 }
66 for (int i=0; i<reste; i++) {
67 fich << *pdata << " " ;
68 pdata++ ;
69 }
70 fich << endl ;
71
72 }
73
74 }