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
27char write_formatted_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Utilities/write_formatted.C,v 1.2 2014/10/13 08:53:32 j_novak Exp $" ;
28
29/*
30 * $Id: write_formatted.C,v 1.2 2014/10/13 08:53:32 j_novak Exp $
31 * $Log: write_formatted.C,v $
32 * Revision 1.2 2014/10/13 08:53:32 j_novak
33 * Lorene classes and functions now belong to the namespace Lorene.
34 *
35 * Revision 1.1 2004/05/13 21:31:06 e_gourgoulhon
36 * First version.
37 *
38 *
39 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Utilities/write_formatted.C,v 1.2 2014/10/13 08:53:32 j_novak Exp $
40 *
41 */
42
43// C++ headers
44#include "headcpp.h"
45
46// Lorene headers
47#include "tbl.h"
48
49// double version
50// --------------
51namespace Lorene {
52void write_formatted(const double& x, ostream& ost) {
53
54 ost.width(23) ; ost << x ;
55
56}
57
58
59// Tbl version
60// -----------
61void write_formatted(const Tbl& tb, ostream& ost) {
62
63 assert(tb.get_ndim() == 1) ;
64
65 for (int i=0; i<tb.get_taille(); i++) {
66 ost.width(23) ; ost << tb(i) ;
67 }
68
69}
70}
Lorene prototypes.
Definition app_hor.h:64