write_formatted.C

00001 /*
00002  *  Formatted file output for double's and Tbl's.
00003  *
00004  *
00005  */
00006 
00007 /*
00008  *   Copyright (c) 2004  Eric Gourgoulhon
00009  *
00010  *   This file is part of LORENE.
00011  *
00012  *   LORENE is free software; you can redistribute it and/or modify
00013  *   it under the terms of the GNU General Public License version 2
00014  *   as published by the Free Software Foundation.
00015  *
00016  *   LORENE is distributed in the hope that it will be useful,
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *   GNU General Public License for more details.
00020  *
00021  *   You should have received a copy of the GNU General Public License
00022  *   along with LORENE; if not, write to the Free Software
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  *
00025  */
00026 
00027 char write_formatted_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Utilities/write_formatted.C,v 1.1 2004/05/13 21:31:06 e_gourgoulhon Exp $" ;
00028 
00029 /*
00030  * $Id: write_formatted.C,v 1.1 2004/05/13 21:31:06 e_gourgoulhon Exp $
00031  * $Log: write_formatted.C,v $
00032  * Revision 1.1  2004/05/13 21:31:06  e_gourgoulhon
00033  * First version.
00034  *
00035  *
00036  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Utilities/write_formatted.C,v 1.1 2004/05/13 21:31:06 e_gourgoulhon Exp $
00037  *
00038  */
00039 
00040 // C++ headers
00041 #include "headcpp.h"
00042 
00043 // Lorene headers
00044 #include "tbl.h"
00045 
00046 // double version 
00047 // --------------
00048 void write_formatted(const double& x, ostream& ost) { 
00049 
00050     ost.width(23) ; ost << x ; 
00051     
00052 }
00053 
00054 
00055 // Tbl version
00056 // -----------
00057 void write_formatted(const Tbl& tb, ostream& ost) { 
00058 
00059     assert(tb.get_ndim() == 1) ; 
00060     
00061     for (int i=0; i<tb.get_taille(); i++) {
00062         ost.width(23) ; ost << tb(i) ; 
00063     }
00064     
00065 }

Generated on Tue Feb 7 01:35:21 2012 for LORENE by  doxygen 1.4.6