LORENE
write_formatted.C
1/*
2 * Formatted file output for double's and Tbl's.
3 *
4 *
5 */
6
7/*
8 * Copyright (c) 2004 Eric Gourgoulhon
9 *
10 * This file is part of LORENE.
11 *
12 * LORENE is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2
14 * as published by the Free Software Foundation.
15 *
16 * LORENE is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with LORENE; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27
28
29/*
30 * $Id: write_formatted.C,v 1.3 2016/12/05 16:18:11 j_novak Exp $
31 * $Log: write_formatted.C,v $
32 * Revision 1.3 2016/12/05 16:18:11 j_novak
33 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
34 *
35 * Revision 1.2 2014/10/13 08:53:32 j_novak
36 * Lorene classes and functions now belong to the namespace Lorene.
37 *
38 * Revision 1.1 2004/05/13 21:31:06 e_gourgoulhon
39 * First version.
40 *
41 *
42 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Utilities/write_formatted.C,v 1.3 2016/12/05 16:18:11 j_novak Exp $
43 *
44 */
45
46// C++ headers
47#include "headcpp.h"
48
49// Lorene headers
50#include "tbl.h"
51
52// double version
53// --------------
54namespace Lorene {
55void write_formatted(const double& x, ostream& ost) {
56
57 ost.width(23) ; ost << x ;
58
59}
60
61
62// Tbl version
63// -----------
64void write_formatted(const Tbl& tb, ostream& ost) {
65
66 assert(tb.get_ndim() == 1) ;
67
68 for (int i=0; i<tb.get_taille(); i++) {
69 ost.width(23) ; ost << tb(i) ;
70 }
71
72}
73}
Basic array class.
Definition tbl.h:161
Lorene prototypes.
Definition app_hor.h:67
Coord x
x coordinate centered on the grid
Definition map.h:738