tenseur_compare.C

00001 /*
00002  *  File to compare two tensors
00003  *
00004  */
00005 
00006 /*
00007  *   Copyright (c) 2003 Francois Limousin
00008  *
00009  *   This file is part of LORENE.
00010  *
00011  *   LORENE is free software; you can redistribute it and/or modify
00012  *   it under the terms of the GNU General Public License version 2
00013  *   as published by the Free Software Foundation.
00014  *
00015  *   LORENE is distributed in the hope that it will be useful,
00016  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *   GNU General Public License for more details.
00019  *
00020  *   You should have received a copy of the GNU General Public License
00021  *   along with LORENE; if not, write to the Free Software
00022  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  */
00025 
00026 char tenseur_compare_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_compare.C,v 1.2 2004/05/27 07:17:19 p_grandclement Exp $" ;
00027 
00028 /*
00029  * $Id: tenseur_compare.C,v 1.2 2004/05/27 07:17:19 p_grandclement Exp $
00030  * $Log: tenseur_compare.C,v $
00031  * Revision 1.2  2004/05/27 07:17:19  p_grandclement
00032  * Correction of some shadowed variables
00033  *
00034  * Revision 1.1  2003/06/20 15:01:49  f_limousin
00035  * *** empty log message ***
00036  *
00037  * Revision 1.2  2001/12/11 06:44:41  e_gourgoulhon
00038  * template files
00039  *
00040  *
00041  *
00042  * $Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_compare.C,v 1.2 2004/05/27 07:17:19 p_grandclement Exp $
00043  *
00044  */
00045 
00046 // C headers
00047 #include "math.h"
00048 
00049 // Lorene headers
00050 #include "tenseur.h"
00051 
00052 
00053 void Tenseur::compare(const Tenseur& tens, const char* name) {
00054   assert ( valence == tens.get_valence() ) ;
00055 
00056   cout << "----------------------------------------------" << endl ;
00057   cout << "Comparison of " << name << " : " << endl << endl ;
00058 
00059   if (valence == 0) {
00060     Cmp comp = tens() ;
00061     Cmp tmp = (*this)() ;
00062     tmp.compare(comp, name) ;
00063   }
00064     
00065   if (valence == 1) {
00066     Cmp comp0 = tens(0) ;
00067     Cmp comp1 = tens(1) ;
00068     Cmp comp2 = tens(2) ;
00069 
00070     Cmp tmp0 = (*this)(0) ;
00071     Cmp tmp1 = (*this)(1) ;
00072     Cmp tmp2 = (*this)(2) ;
00073 
00074     tmp0.compare(comp0, name, 0) ;
00075     tmp1.compare(comp1, name, 1) ;
00076     tmp2.compare(comp2, name, 2) ;
00077   }
00078 
00079    if (valence == 2) {
00080     Cmp comp00 = tens(0,0) ;
00081     Cmp comp01 = tens(0,1) ;
00082     Cmp comp02 = tens(0,2) ;
00083     Cmp comp10 = tens(1,0) ;
00084     Cmp comp11 = tens(1,1) ;
00085     Cmp comp12 = tens(1,2) ;
00086     Cmp comp20 = tens(2,0) ;
00087     Cmp comp21 = tens(2,1) ;
00088     Cmp comp22 = tens(2,2) ;
00089 
00090     Cmp tmp00 = (*this)(0,0) ;
00091     Cmp tmp01 = (*this)(0,1) ;
00092     Cmp tmp02 = (*this)(0,2) ;
00093     Cmp tmp10 = (*this)(1,0) ;
00094     Cmp tmp11 = (*this)(1,1) ;
00095     Cmp tmp12 = (*this)(1,2) ;
00096     Cmp tmp20 = (*this)(2,0) ;
00097     Cmp tmp21 = (*this)(2,1) ;
00098     Cmp tmp22 = (*this)(2,2) ;
00099 
00100     tmp00.compare(comp00, name, 0, 0) ;
00101     tmp01.compare(comp01, name, 0, 1) ;
00102     tmp02.compare(comp02, name, 0, 2) ;
00103     tmp10.compare(comp10, name, 1, 0) ;
00104     tmp11.compare(comp11, name, 1, 1) ;
00105     tmp12.compare(comp12, name, 1, 2) ;
00106     tmp20.compare(comp20, name, 2, 0) ;
00107     tmp21.compare(comp21, name, 2, 1) ;
00108     tmp22.compare(comp22, name, 2, 2) ;
00109 }
00110 
00111    if (valence > 2 ) {
00112      abort() ;
00113    }
00114 }
00115 
00116 void Tenseur::compare(FILE* fich, const char* name_i) {
00117 
00118   Mg3d mg(fich) ;
00119   Map_et mpg(mg, fich) ;
00120 
00121   Tenseur tens(mpg, mpg.get_bvect_cart(), fich) ;
00122 
00123   compare(tens, name_i) ;
00124 
00125 
00126 }

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