param.C

00001 /*
00002  *  Methods of class Param
00003  *
00004  *   (see file param.h for documentation)
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 1999-2005 Eric Gourgoulhon
00010  *   Copyright (c) 2000-2003 Jerome Novak
00011  *
00012  *   This file is part of LORENE.
00013  *
00014  *   LORENE is free software; you can redistribute it and/or modify
00015  *   it under the terms of the GNU General Public License as published by
00016  *   the Free Software Foundation; either version 2 of the License, or
00017  *   (at your option) any later version.
00018  *
00019  *   LORENE is distributed in the hope that it will be useful,
00020  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  *   GNU General Public License for more details.
00023  *
00024  *   You should have received a copy of the GNU General Public License
00025  *   along with LORENE; if not, write to the Free Software
00026  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027  *
00028  */
00029 
00030 
00031 char param_C[] = "$Header: /cvsroot/Lorene/C++/Source/Param/param.C,v 1.7 2006/06/15 08:15:39 j_novak Exp $" ;
00032 
00033 /*
00034  * $Id: param.C,v 1.7 2006/06/15 08:15:39 j_novak Exp $
00035  * $Log: param.C,v $
00036  * Revision 1.7  2006/06/15 08:15:39  j_novak
00037  * Removed members linked to Qtenseur objects.
00038  * Added members for Matrice objects.
00039  *
00040  * Revision 1.6  2005/08/13 16:11:44  m_saijo
00041  * Added storage of a Star
00042  *
00043  * Revision 1.5  2005/03/24 21:56:31  e_gourgoulhon
00044  * Added storage of a Scalar.
00045  *
00046  * Revision 1.4  2003/09/25 12:08:03  j_novak
00047  * Tensors can be stored in Param objects
00048  *
00049  * Revision 1.3  2002/10/16 14:37:12  j_novak
00050  * Reorganization of #include instructions of standard C++, in order to
00051  * use experimental version 3 of gcc.
00052  *
00053  * Revision 1.2  2002/09/19 09:52:42  j_novak
00054  * Added objects Qtenseur and Qmetrique for 4D tensor and metric handling.
00055  *
00056  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00057  * LORENE
00058  *
00059  * Revision 1.8  2001/10/11  07:44:27  eric
00060  * Ajout du stokage des Etoile's
00061  *
00062  * Revision 1.7  2000/10/24  14:55:20  novak
00063  * Added the function clean_all()
00064  *
00065  * Revision 1.6  2000/05/25 12:40:47  eric
00066  *  MODIFICATION MAJEURE: pour les int et les double, ce sont desormais les
00067  * dresses qui sont stokees, et non plus les nombres eux-memes
00068  * (le traitement des int et des double est donc desormais completement
00069  * aligne sur celui des Tbl, Cmp, etc...)
00070  *
00071  * Revision 1.5  1999/12/29  13:10:54  eric
00072  *  Ajout du stokage des Mtbl_cf.
00073  *
00074  * Revision 1.4  1999/12/27  12:17:02  eric
00075  * Ajout du stokage des mappings (class Map).
00076  *
00077  * Revision 1.3  1999/12/16  10:28:25  eric
00078  * Ajout des membres modifiables.
00079  * Par defaut, les objets listes sont const.
00080  *
00081  * Revision 1.2  1999/12/15  16:23:22  eric
00082  * Changement de l'ordre des arguments dans add_*
00083  * Argument par defaut: position = 0
00084  * Ajout du stokage des int et des double.
00085  *
00086  * Revision 1.1  1999/12/13  14:36:00  eric
00087  * Initial revision
00088  *
00089  *
00090  * $Header: /cvsroot/Lorene/C++/Source/Param/param.C,v 1.7 2006/06/15 08:15:39 j_novak Exp $
00091  *
00092  */
00093 
00094 // Headers C
00095 #include <stdlib.h>
00096 #include <assert.h>
00097 
00098 // Headers Lorene
00099 #include "param.h"
00100 #include "tenseur.h"
00101 #include "tensor.h"
00102 #include "matrice.h"
00103 
00104             //------------------------//
00105             //  Constructor   //
00106             //------------------------//
00107 
00108 Param::Param() : n_int(0), 
00109                  n_int_mod(0),
00110          n_double(0), 
00111          n_double_mod(0), 
00112          n_tbl(0), 
00113          n_tbl_mod(0), 
00114          n_itbl(0), 
00115          n_itbl_mod(0), 
00116          n_matrice(0), 
00117          n_matrice_mod(0), 
00118          n_cmp(0), 
00119          n_cmp_mod(0), 
00120          n_tenseur(0),
00121          n_tenseur_mod(0), 
00122          n_map(0), 
00123          n_mtbl_cf(0), 
00124          n_scalar(0),
00125          n_scalar_mod(0),
00126          n_tensor(0),
00127          n_tensor_mod(0),
00128          n_etoile(0),
00129                  n_star(0)
00130          {}
00131 
00132 
00133             //----------------------//
00134             //  Destructor  //
00135             //----------------------//
00136 
00137 Param::~Param(){
00138 
00139     if (n_int > 0)  delete [] p_int ; 
00140     if (n_int_mod > 0)  delete [] p_int_mod ; 
00141     if (n_double > 0)  delete [] p_double ; 
00142     if (n_double_mod > 0)  delete [] p_double_mod ; 
00143     if (n_tbl > 0)  delete [] p_tbl ; 
00144     if (n_tbl_mod > 0)  delete [] p_tbl_mod ; 
00145     if (n_itbl > 0) delete [] p_itbl ; 
00146     if (n_itbl_mod > 0) delete [] p_itbl_mod ; 
00147     if (n_matrice > 0)  delete [] p_matrice ; 
00148     if (n_matrice_mod > 0)  delete [] p_matrice_mod ; 
00149     if (n_cmp > 0)  delete [] p_cmp ; 
00150     if (n_cmp_mod > 0)  delete [] p_cmp_mod ; 
00151     if (n_tenseur > 0) delete [] p_tenseur ; 
00152     if (n_tenseur_mod > 0) delete [] p_tenseur_mod ; 
00153     if (n_map > 0)  delete [] p_map ; 
00154     if (n_mtbl_cf > 0)  delete [] p_mtbl_cf ; 
00155     if (n_scalar > 0) delete [] p_scalar ; 
00156     if (n_scalar_mod > 0) delete [] p_scalar_mod ; 
00157     if (n_tensor > 0) delete [] p_tensor ; 
00158     if (n_tensor_mod > 0) delete [] p_tensor_mod ; 
00159     if (n_etoile > 0)  delete [] p_etoile ; 
00160     if (n_star > 0)  delete [] p_star ;
00161 }
00162  
00163             //------------------------------------//
00164             //        cleaning the memory     //
00165             //------------------------------------//
00166 
00167 void Param::clean_all() {
00168 
00169   for (int i=0; i<n_int_mod; i++) 
00170     if (p_int_mod[i] != 0x0) {
00171       delete p_int_mod[i] ;
00172       p_int_mod[i] = 0x0 ;
00173     }
00174 
00175   for (int i=0; i<n_double_mod; i++) 
00176     if (p_double_mod[i] != 0x0) {
00177       delete p_double_mod[i] ;
00178       p_double_mod[i] = 0x0 ;
00179     }
00180 
00181   for (int i=0; i<n_tbl_mod; i++) 
00182     if (p_tbl_mod[i] != 0x0) { 
00183       delete p_tbl_mod[i] ;
00184       p_tbl_mod[i] = 0x0 ;
00185     }
00186 
00187   for (int i=0; i<n_itbl_mod; i++) 
00188     if (p_itbl_mod[i] != 0x0) {
00189       delete p_itbl_mod[i] ;
00190       p_itbl_mod[i] = 0x0 ;
00191     }
00192 
00193   for (int i=0; i<n_matrice_mod; i++) 
00194     if (p_matrice_mod[i] != 0x0) { 
00195       delete p_matrice_mod[i] ;
00196       p_matrice_mod[i] = 0x0 ;
00197     }
00198 
00199   for (int i=0; i<n_cmp_mod; i++) 
00200     if (p_cmp_mod[i] != 0x0) {
00201       delete p_cmp_mod[i] ;
00202       p_cmp_mod[i] = 0x0 ;
00203     }
00204 
00205   for (int i=0; i<n_tenseur_mod; i++) 
00206     if (p_tenseur_mod[i] != 0x0) {
00207       delete p_tenseur_mod[i] ;
00208       p_tenseur_mod[i] = 0x0 ;
00209     }
00210 
00211   for (int i=0; i<n_scalar_mod; i++) 
00212     if (p_scalar_mod[i] != 0x0) {
00213       delete p_scalar_mod[i] ;
00214       p_scalar_mod[i] = 0x0 ;
00215     }
00216 
00217   for (int i=0; i<n_tensor_mod; i++) 
00218     if (p_tensor_mod[i] != 0x0) {
00219       delete p_tensor_mod[i] ;
00220       p_tensor_mod[i] = 0x0 ;
00221     }
00222 }
00223 
00224 
00225             //------------------------------------//
00226             //      int storage       //
00227             //------------------------------------//
00228 
00229 // Total number of stored int
00230 // --------------------------
00231 
00232 int Param::get_n_int() const {
00233     return n_int ; 
00234 }
00235 
00236 // Addition  
00237 // --------
00238             
00239 void Param::add_int(const int& ti, int index){
00240     
00241     if (index >= n_int) {    // p_int must be rescaled
00242                 
00243         int n_int_nouveau = index + 1 ; 
00244         const int** p_int_nouveau = new const int*[n_int_nouveau] ; 
00245         
00246        
00247         // Copy of the previous addresses  
00248         for (int i=0; i<n_int; i++) {
00249         p_int_nouveau[i] = p_int[i] ; 
00250         }
00251         
00252         
00253         // The intermediate addresses are set to 0x0
00254         for (int i=n_int; i<index; i++) {
00255         p_int_nouveau[i] = 0x0 ; 
00256         }
00257         
00258         // The new address 
00259         p_int_nouveau[index] = &ti ; 
00260         
00261         // Update 
00262         if (n_int > 0) delete [] p_int ; 
00263         p_int = p_int_nouveau ; 
00264         n_int = n_int_nouveau ; 
00265         
00266     }
00267     else {
00268     
00269         if (p_int[index] != 0x0) {
00270         cout << "Param::add_int : the position " << index 
00271              << " is already occupied !" << endl ; 
00272         abort() ; 
00273         }
00274         else{
00275         p_int[index] = &ti ; 
00276         }
00277         
00278     }   
00279     
00280 }
00281 
00282 // Extraction 
00283 // ----------
00284             
00285 const int& Param::get_int(int index) const {
00286 
00287     assert(index >= 0) ;
00288     assert(index < n_int) ; 
00289     
00290     return *(p_int[index]) ; 
00291 
00292 } 
00293             
00294             //------------------------------------//
00295             //      double storage        //
00296             //------------------------------------//
00297 
00298 // Total number of stored doubles
00299 // ------------------------------
00300 
00301 int Param::get_n_double() const {
00302     return n_double ; 
00303 }
00304 
00305 // Addition  
00306 // --------
00307             
00308 void Param::add_double(const double& ti, int index){
00309     
00310     if (index >= n_double) {    // p_double must be rescaled
00311                 
00312         int n_double_nouveau = index + 1 ; 
00313         const double** p_double_nouveau = 
00314                     new const double*[n_double_nouveau] ; 
00315         
00316        
00317         // Copy of the previous addresses  
00318         for (int i=0; i<n_double; i++) {
00319         p_double_nouveau[i] = p_double[i] ; 
00320         }
00321                 
00322         // The intermediate addresses are set to 0x0
00323         for (int i=n_double; i<index; i++) {
00324         p_double_nouveau[i] = 0x0 ; 
00325         }
00326         
00327         // The new address 
00328         p_double_nouveau[index] = &ti ; 
00329         
00330         // Update 
00331         if (n_double > 0) delete [] p_double ; 
00332         p_double = p_double_nouveau ; 
00333         n_double = n_double_nouveau ; 
00334         
00335     }
00336     else {
00337     
00338         if (p_double[index] != 0x0) {
00339         cout << "Param::add_double : the position " << index 
00340              << " is already occupied !" << endl ; 
00341         abort() ; 
00342         }
00343         else{
00344         p_double[index] = &ti ; 
00345         }
00346         
00347     }   
00348     
00349 }
00350 
00351 // Extraction 
00352 // ----------
00353             
00354 const double& Param::get_double(int index) const {
00355 
00356     assert(index >= 0) ;
00357     assert(index < n_double) ; 
00358     
00359     return *(p_double[index]) ; 
00360 
00361 } 
00362             
00363 
00364             //------------------------------------//
00365             //       Modifiable int storage   //
00366             //------------------------------------//
00367 
00368 // Total number of stored addresses
00369 // --------------------------------
00370 
00371 int Param::get_n_int_mod() const {
00372     return n_int_mod ; 
00373 }
00374 
00375 // Addition  
00376 // --------
00377             
00378 void Param::add_int_mod(int& ti, int index){
00379     
00380     if (index >= n_int_mod) {    // p_int_mod must be rescaled
00381                 
00382         int n_int_nouveau = index + 1 ; 
00383         int** p_int_nouveau = new int*[n_int_nouveau] ; 
00384         
00385        
00386         // Copy of the previous addresses  
00387         for (int i=0; i<n_int_mod; i++) {
00388         p_int_nouveau[i] = p_int_mod[i] ; 
00389         }
00390         
00391         // The intermediate addresses are set to 0x0
00392         for (int i=n_int_mod; i<index; i++) {
00393         p_int_nouveau[i] = 0x0 ; 
00394         }
00395         
00396         // The new address 
00397         p_int_nouveau[index] = &ti ; 
00398         
00399         // Update 
00400         if (n_int_mod > 0) delete [] p_int_mod ; 
00401         p_int_mod = p_int_nouveau ; 
00402         n_int_mod = n_int_nouveau ; 
00403         
00404     }
00405     else {
00406     
00407         if (p_int_mod[index] != 0x0) {
00408         cout << "Param::add_int_mod : the position " << index 
00409              << " is already occupied !" << endl ; 
00410         abort() ; 
00411         }
00412         else{
00413         p_int_mod[index] = &ti ; 
00414         }
00415         
00416     }   
00417     
00418 }
00419 
00420 // Extraction 
00421 // ----------
00422             
00423 int& Param::get_int_mod(int index) const {
00424 
00425     assert(index >= 0) ;
00426     assert(index < n_int_mod) ; 
00427     
00428     return *(p_int_mod[index]) ; 
00429 
00430 } 
00431             
00432             //------------------------------------//
00433             //   Modifiable double storage    //
00434             //------------------------------------//
00435 
00436 // Total number of stored addresses
00437 // --------------------------------
00438 
00439 int Param::get_n_double_mod() const {
00440     return n_double_mod ; 
00441 }
00442 
00443 // Addition  
00444 // --------
00445             
00446 void Param::add_double_mod(double& ti, int index){
00447     
00448     if (index >= n_double_mod) {    // p_double_mod must be rescaled
00449                 
00450         int n_double_nouveau = index + 1 ; 
00451         double** p_double_nouveau = new double*[n_double_nouveau] ; 
00452         
00453        
00454         // Copy of the previous addresses  
00455         for (int i=0; i<n_double_mod; i++) {
00456         p_double_nouveau[i] = p_double_mod[i] ; 
00457         }
00458         
00459         // The intermediate addresses are set to 0x0
00460         for (int i=n_double_mod; i<index; i++) {
00461         p_double_nouveau[i] = 0x0 ; 
00462         }
00463         
00464         // The new address 
00465         p_double_nouveau[index] = &ti ; 
00466         
00467         // Update 
00468         if (n_double_mod > 0) delete [] p_double_mod ; 
00469         p_double_mod = p_double_nouveau ; 
00470         n_double_mod = n_double_nouveau ; 
00471         
00472     }
00473     else {
00474     
00475         if (p_double_mod[index] != 0x0) {
00476         cout << "Param::add_double_mod : the position " << index 
00477              << " is already occupied !" << endl ; 
00478         abort() ; 
00479         }
00480         else{
00481         p_double_mod[index] = &ti ; 
00482         }
00483         
00484     }   
00485     
00486 }
00487 
00488 // Extraction 
00489 // ----------
00490             
00491 double& Param::get_double_mod(int index) const {
00492 
00493     assert(index >= 0) ;
00494     assert(index < n_double_mod) ; 
00495     
00496     return *(p_double_mod[index]) ; 
00497 
00498 } 
00499             
00500 
00501             //------------------------------------//
00502             //      Tbl storage       //
00503             //------------------------------------//
00504 
00505 // Total number of stored addresses
00506 // --------------------------------
00507 
00508 int Param::get_n_tbl() const {
00509     return n_tbl ; 
00510 }
00511 
00512 // Addition  
00513 // --------
00514             
00515 void Param::add_tbl(const Tbl& ti, int index){
00516     
00517     if (index >= n_tbl) {    // p_tbl must be rescaled
00518                 
00519         int n_tbl_nouveau = index + 1 ; 
00520         const Tbl** p_tbl_nouveau = new const Tbl*[n_tbl_nouveau] ; 
00521         
00522        
00523         // Copy of the previous addresses  
00524         for (int i=0; i<n_tbl; i++) {
00525         p_tbl_nouveau[i] = p_tbl[i] ; 
00526         }
00527         
00528         // The intermediate addresses are set to 0x0
00529         for (int i=n_tbl; i<index; i++) {
00530         p_tbl_nouveau[i] = 0x0 ; 
00531         }
00532         
00533         // The new address 
00534         p_tbl_nouveau[index] = &ti ; 
00535         
00536         // Update 
00537         if (n_tbl > 0) delete [] p_tbl ; 
00538         p_tbl = p_tbl_nouveau ; 
00539         n_tbl = n_tbl_nouveau ; 
00540         
00541     }
00542     else {
00543     
00544         if (p_tbl[index] != 0x0) {
00545         cout << "Param::add_tbl : the position " << index 
00546              << " is already occupied !" << endl ; 
00547         abort() ; 
00548         }
00549         else{
00550         p_tbl[index] = &ti ; 
00551         }
00552         
00553     }   
00554     
00555 }
00556 
00557 // Extraction 
00558 // ----------
00559             
00560 const Tbl& Param::get_tbl(int index) const {
00561 
00562     assert(index >= 0) ;
00563     assert(index < n_tbl) ; 
00564     
00565     return *(p_tbl[index]) ; 
00566 
00567 } 
00568             
00569 
00570             //------------------------------------//
00571             //      Modifiable Tbl storage    //
00572             //------------------------------------//
00573 
00574 // Total number of stored addresses
00575 // --------------------------------
00576 
00577 int Param::get_n_tbl_mod() const {
00578     return n_tbl_mod ; 
00579 }
00580 
00581 // Addition  
00582 // --------
00583             
00584 void Param::add_tbl_mod(Tbl& ti, int index){
00585     
00586     if (index >= n_tbl_mod) {    // p_tbl_mod must be rescaled
00587                 
00588         int n_tbl_nouveau = index + 1 ; 
00589         Tbl** p_tbl_nouveau = new Tbl*[n_tbl_nouveau] ; 
00590         
00591        
00592         // Copy of the previous addresses  
00593         for (int i=0; i<n_tbl_mod; i++) {
00594         p_tbl_nouveau[i] = p_tbl_mod[i] ; 
00595         }
00596         
00597         // The intermediate addresses are set to 0x0
00598         for (int i=n_tbl_mod; i<index; i++) {
00599         p_tbl_nouveau[i] = 0x0 ; 
00600         }
00601         
00602         // The new address 
00603         p_tbl_nouveau[index] = &ti ; 
00604         
00605         // Update 
00606         if (n_tbl_mod > 0) delete [] p_tbl_mod ; 
00607         p_tbl_mod = p_tbl_nouveau ; 
00608         n_tbl_mod = n_tbl_nouveau ; 
00609         
00610     }
00611     else {
00612     
00613         if (p_tbl_mod[index] != 0x0) {
00614         cout << "Param::add_tbl_mod : the position " << index 
00615              << " is already occupied !" << endl ; 
00616         abort() ; 
00617         }
00618         else{
00619         p_tbl_mod[index] = &ti ; 
00620         }
00621         
00622     }   
00623     
00624 }
00625 
00626 // Extraction 
00627 // ----------
00628             
00629 Tbl& Param::get_tbl_mod(int index) const {
00630 
00631     assert(index >= 0) ;
00632     assert(index < n_tbl_mod) ; 
00633     
00634     return *(p_tbl_mod[index]) ; 
00635 
00636 } 
00637 
00638             
00639             //------------------------------------//
00640             //      Itbl storage          //
00641             //------------------------------------//
00642 
00643 // Total number of stored addresses
00644 // --------------------------------
00645 
00646 int Param::get_n_itbl() const {
00647     return n_itbl ; 
00648 }
00649 
00650 // Addition  
00651 // --------
00652             
00653 void Param::add_itbl(const Itbl& ti, int index){
00654     
00655     if (index >= n_itbl) {    // p_itbl must be rescaled
00656                 
00657         int n_itbl_nouveau = index + 1 ; 
00658         const Itbl** p_itbl_nouveau = new const Itbl*[n_itbl_nouveau] ; 
00659         
00660        
00661         // Copy of the previous addresses  
00662         for (int i=0; i<n_itbl; i++) {
00663         p_itbl_nouveau[i] = p_itbl[i] ; 
00664         }
00665         
00666         // The intermediate addresses are set to 0x0
00667         for (int i=n_itbl; i<index; i++) {
00668         p_itbl_nouveau[i] = 0x0 ; 
00669         }
00670         
00671         // The new address 
00672         p_itbl_nouveau[index] = &ti ; 
00673         
00674         // Update 
00675         if (n_itbl > 0) delete [] p_itbl ; 
00676         p_itbl = p_itbl_nouveau ; 
00677         n_itbl = n_itbl_nouveau ; 
00678         
00679     }
00680     else {
00681     
00682         if (p_itbl[index] != 0x0) {
00683         cout << "Param::add_itbl : the position " << index 
00684              << " is already occupied !" << endl ; 
00685         abort() ; 
00686         }
00687         else{
00688         p_itbl[index] = &ti ; 
00689         }
00690         
00691     }   
00692     
00693 }
00694 
00695 // Extraction 
00696 // ----------
00697             
00698 const Itbl& Param::get_itbl(int index) const {
00699 
00700     assert(index >= 0) ;
00701     assert(index < n_itbl) ; 
00702     
00703     return *(p_itbl[index]) ; 
00704 
00705 } 
00706             
00707 
00708             //------------------------------------//
00709             //      Modifiable Itbl storage   //
00710             //------------------------------------//
00711 
00712 // Total number of stored addresses
00713 // --------------------------------
00714 
00715 int Param::get_n_itbl_mod() const {
00716     return n_itbl_mod ; 
00717 }
00718 
00719 // Addition  
00720 // --------
00721             
00722 void Param::add_itbl_mod(Itbl& ti, int index){
00723     
00724     if (index >= n_itbl_mod) {    // p_itbl_mod must be rescaled
00725                 
00726         int n_itbl_nouveau = index + 1 ; 
00727         Itbl** p_itbl_nouveau = new Itbl*[n_itbl_nouveau] ; 
00728         
00729        
00730         // Copy of the previous addresses  
00731         for (int i=0; i<n_itbl_mod; i++) {
00732         p_itbl_nouveau[i] = p_itbl_mod[i] ; 
00733         }
00734         
00735         // The intermediate addresses are set to 0x0
00736         for (int i=n_itbl_mod; i<index; i++) {
00737         p_itbl_nouveau[i] = 0x0 ; 
00738         }
00739         
00740         // The new address 
00741         p_itbl_nouveau[index] = &ti ; 
00742         
00743         // Update 
00744         if (n_itbl_mod > 0) delete [] p_itbl_mod ; 
00745         p_itbl_mod = p_itbl_nouveau ; 
00746         n_itbl_mod = n_itbl_nouveau ; 
00747         
00748     }
00749     else {
00750     
00751         if (p_itbl_mod[index] != 0x0) {
00752         cout << "Param::add_itbl_mod : the position " << index 
00753              << " is already occupied !" << endl ; 
00754         abort() ; 
00755         }
00756         else{
00757         p_itbl_mod[index] = &ti ; 
00758         }
00759         
00760     }   
00761     
00762 }
00763 
00764 // Extraction 
00765 // ----------
00766             
00767 Itbl& Param::get_itbl_mod(int index) const {
00768 
00769     assert(index >= 0) ;
00770     assert(index < n_itbl_mod) ; 
00771     
00772     return *(p_itbl_mod[index]) ; 
00773 
00774 } 
00775             
00776             //------------------------------------//
00777             //      Matrice storage       //
00778             //------------------------------------//
00779 
00780 // Total number of stored addresses
00781 // --------------------------------
00782 
00783 int Param::get_n_matrice() const {
00784     return n_matrice ; 
00785 }
00786 
00787 // Addition  
00788 // --------
00789             
00790 void Param::add_matrice(const Matrice& ti, int index){
00791     
00792     if (index >= n_matrice) {    // p_matrice must be rescaled
00793                 
00794         int n_matrice_nouveau = index + 1 ; 
00795         const Matrice** p_matrice_nouveau = new const Matrice*[n_matrice_nouveau] ; 
00796         
00797        
00798         // Copy of the previous addresses  
00799         for (int i=0; i<n_matrice; i++) {
00800         p_matrice_nouveau[i] = p_matrice[i] ; 
00801         }
00802         
00803         // The intermediate addresses are set to 0x0
00804         for (int i=n_matrice; i<index; i++) {
00805         p_matrice_nouveau[i] = 0x0 ; 
00806         }
00807         
00808         // The new address 
00809         p_matrice_nouveau[index] = &ti ; 
00810         
00811         // Update 
00812         if (n_matrice > 0) delete [] p_matrice ; 
00813         p_matrice = p_matrice_nouveau ; 
00814         n_matrice = n_matrice_nouveau ; 
00815         
00816     }
00817     else {
00818     
00819         if (p_matrice[index] != 0x0) {
00820         cout << "Param::add_matrice : the position " << index 
00821              << " is already occupied !" << endl ; 
00822         abort() ; 
00823         }
00824         else{
00825         p_matrice[index] = &ti ; 
00826         }
00827         
00828     }   
00829     
00830 }
00831 
00832 // Extraction 
00833 // ----------
00834             
00835 const Matrice& Param::get_matrice(int index) const {
00836 
00837     assert(index >= 0) ;
00838     assert(index < n_matrice) ; 
00839     
00840     return *(p_matrice[index]) ; 
00841 
00842 } 
00843             
00844 
00845             //------------------------------------//
00846             //      Modifiable Matrice storage    //
00847             //------------------------------------//
00848 
00849 // Total number of stored addresses
00850 // --------------------------------
00851 
00852 int Param::get_n_matrice_mod() const {
00853     return n_matrice_mod ; 
00854 }
00855 
00856 // Addition  
00857 // --------
00858             
00859 void Param::add_matrice_mod(Matrice& ti, int index){
00860     
00861     if (index >= n_matrice_mod) {    // p_matrice_mod must be rescaled
00862                 
00863         int n_matrice_nouveau = index + 1 ; 
00864         Matrice** p_matrice_nouveau = new Matrice*[n_matrice_nouveau] ; 
00865         
00866        
00867         // Copy of the previous addresses  
00868         for (int i=0; i<n_matrice_mod; i++) {
00869         p_matrice_nouveau[i] = p_matrice_mod[i] ; 
00870         }
00871         
00872         // The intermediate addresses are set to 0x0
00873         for (int i=n_matrice_mod; i<index; i++) {
00874         p_matrice_nouveau[i] = 0x0 ; 
00875         }
00876         
00877         // The new address 
00878         p_matrice_nouveau[index] = &ti ; 
00879         
00880         // Update 
00881         if (n_matrice_mod > 0) delete [] p_matrice_mod ; 
00882         p_matrice_mod = p_matrice_nouveau ; 
00883         n_matrice_mod = n_matrice_nouveau ; 
00884         
00885     }
00886     else {
00887     
00888         if (p_matrice_mod[index] != 0x0) {
00889         cout << "Param::add_matrice_mod : the position " << index 
00890              << " is already occupied !" << endl ; 
00891         abort() ; 
00892         }
00893         else{
00894         p_matrice_mod[index] = &ti ; 
00895         }
00896         
00897     }   
00898     
00899 }
00900 
00901 // Extraction 
00902 // ----------
00903             
00904 Matrice& Param::get_matrice_mod(int index) const {
00905 
00906     assert(index >= 0) ;
00907     assert(index < n_matrice_mod) ; 
00908     
00909     return *(p_matrice_mod[index]) ; 
00910 
00911 } 
00912 
00913             
00914             //------------------------------------//
00915             //      Cmp storage       //
00916             //------------------------------------//
00917 
00918 // Total number of stored addresses
00919 // --------------------------------
00920 
00921 int Param::get_n_cmp() const {
00922     return n_cmp ; 
00923 }
00924 
00925 // Addition  
00926 // --------
00927             
00928 void Param::add_cmp(const Cmp& ti, int index){
00929     
00930     if (index >= n_cmp) {    // p_cmp must be rescaled
00931                 
00932         int n_cmp_nouveau = index + 1 ; 
00933         const Cmp** p_cmp_nouveau = new const Cmp*[n_cmp_nouveau] ; 
00934         
00935        
00936         // Copy of the previous addresses  
00937         for (int i=0; i<n_cmp; i++) {
00938         p_cmp_nouveau[i] = p_cmp[i] ; 
00939         }
00940         
00941         // The intermediate addresses are set to 0x0
00942         for (int i=n_cmp; i<index; i++) {
00943         p_cmp_nouveau[i] = 0x0 ; 
00944         }
00945         
00946         // The new address 
00947         p_cmp_nouveau[index] = &ti ; 
00948         
00949         // Update 
00950         if (n_cmp > 0) delete [] p_cmp ; 
00951         p_cmp = p_cmp_nouveau ; 
00952         n_cmp = n_cmp_nouveau ; 
00953         
00954     }
00955     else {
00956     
00957         if (p_cmp[index] != 0x0) {
00958         cout << "Param::add_cmp : the position " << index 
00959              << " is already occupied !" << endl ; 
00960         abort() ; 
00961         }
00962         else{
00963         p_cmp[index] = &ti ; 
00964         }
00965         
00966     }   
00967     
00968 }
00969 
00970 // Extraction 
00971 // ----------
00972             
00973 const Cmp& Param::get_cmp(int index) const {
00974 
00975     assert(index >= 0) ;
00976     assert(index < n_cmp) ; 
00977     
00978     return *(p_cmp[index]) ; 
00979 
00980 } 
00981             
00982 
00983             //------------------------------------//
00984             //      Modifiable Cmp storage    //
00985             //------------------------------------//
00986 
00987 // Total number of stored addresses
00988 // --------------------------------
00989 
00990 int Param::get_n_cmp_mod() const {
00991     return n_cmp_mod ; 
00992 }
00993 
00994 // Addition  
00995 // --------
00996             
00997 void Param::add_cmp_mod(Cmp& ti, int index){
00998     
00999     if (index >= n_cmp_mod) {    // p_cmp_mod must be rescaled
01000                 
01001         int n_cmp_nouveau = index + 1 ; 
01002         Cmp** p_cmp_nouveau = new Cmp*[n_cmp_nouveau] ; 
01003         
01004        
01005         // Copy of the previous addresses  
01006         for (int i=0; i<n_cmp_mod; i++) {
01007         p_cmp_nouveau[i] = p_cmp_mod[i] ; 
01008         }
01009         
01010         // The intermediate addresses are set to 0x0
01011         for (int i=n_cmp_mod; i<index; i++) {
01012         p_cmp_nouveau[i] = 0x0 ; 
01013         }
01014         
01015         // The new address 
01016         p_cmp_nouveau[index] = &ti ; 
01017         
01018         // Update 
01019         if (n_cmp_mod > 0) delete [] p_cmp_mod ; 
01020         p_cmp_mod = p_cmp_nouveau ; 
01021         n_cmp_mod = n_cmp_nouveau ; 
01022         
01023     }
01024     else {
01025     
01026         if (p_cmp_mod[index] != 0x0) {
01027         cout << "Param::add_cmp_mod : the position " << index 
01028              << " is already occupied !" << endl ; 
01029         abort() ; 
01030         }
01031         else{
01032         p_cmp_mod[index] = &ti ; 
01033         }
01034         
01035     }   
01036     
01037 }
01038 
01039 // Extraction 
01040 // ----------
01041             
01042 Cmp& Param::get_cmp_mod(int index) const {
01043 
01044     assert(index >= 0) ;
01045     assert(index < n_cmp_mod) ; 
01046     
01047     return *(p_cmp_mod[index]) ; 
01048 
01049 } 
01050 
01051             
01052             //------------------------------------//
01053             //      Tenseur storage       //
01054             //------------------------------------//
01055 
01056 // Total number of stored addresses
01057 // --------------------------------
01058 
01059 int Param::get_n_tenseur() const {
01060     return n_tenseur ; 
01061 }
01062 
01063 // Addition  
01064 // --------
01065             
01066 void Param::add_tenseur(const Tenseur& ti, int index){
01067     
01068     if (index >= n_tenseur) {    // p_tenseur must be rescaled
01069                 
01070         int n_tenseur_nouveau = index + 1 ; 
01071         const Tenseur** p_tenseur_nouveau = new const Tenseur*[n_tenseur_nouveau] ; 
01072         
01073        
01074         // Copy of the previous addresses  
01075         for (int i=0; i<n_tenseur; i++) {
01076         p_tenseur_nouveau[i] = p_tenseur[i] ; 
01077         }
01078         
01079         // The intermediate addresses are set to 0x0
01080         for (int i=n_tenseur; i<index; i++) {
01081         p_tenseur_nouveau[i] = 0x0 ; 
01082         }
01083         
01084         // The new address 
01085         p_tenseur_nouveau[index] = &ti ; 
01086         
01087         // Update 
01088         if (n_tenseur > 0) delete [] p_tenseur ; 
01089         p_tenseur = p_tenseur_nouveau ; 
01090         n_tenseur = n_tenseur_nouveau ; 
01091         
01092     }
01093     else {
01094     
01095         if (p_tenseur[index] != 0x0) {
01096         cout << "Param::add_tenseur : the position " << index 
01097              << " is already occupied !" << endl ; 
01098         abort() ; 
01099         }
01100         else{
01101         p_tenseur[index] = &ti ; 
01102         }
01103         
01104     }   
01105     
01106 }
01107 
01108 // Extraction 
01109 // ----------
01110             
01111 const Tenseur& Param::get_tenseur(int index) const {
01112 
01113     assert(index >= 0) ;
01114     assert(index < n_tenseur) ; 
01115     
01116     return *(p_tenseur[index]) ; 
01117 
01118 } 
01119             
01120 
01121             //------------------------------------//
01122             //      Modifiable Tenseur storage    //
01123             //------------------------------------//
01124 
01125 // Total number of stored addresses
01126 // --------------------------------
01127 
01128 int Param::get_n_tenseur_mod() const {
01129     return n_tenseur_mod ; 
01130 }
01131 
01132 // Addition  
01133 // --------
01134             
01135 void Param::add_tenseur_mod(Tenseur& ti, int index){
01136     
01137     if (index >= n_tenseur_mod) {    // p_tenseur_mod must be rescaled
01138                 
01139         int n_tenseur_nouveau = index + 1 ; 
01140         Tenseur** p_tenseur_nouveau = new Tenseur*[n_tenseur_nouveau] ; 
01141         
01142        
01143         // Copy of the previous addresses  
01144         for (int i=0; i<n_tenseur_mod; i++) {
01145         p_tenseur_nouveau[i] = p_tenseur_mod[i] ; 
01146         }
01147         
01148         // The intermediate addresses are set to 0x0
01149         for (int i=n_tenseur_mod; i<index; i++) {
01150         p_tenseur_nouveau[i] = 0x0 ; 
01151         }
01152         
01153         // The new address 
01154         p_tenseur_nouveau[index] = &ti ; 
01155         
01156         // Update 
01157         if (n_tenseur_mod > 0) delete [] p_tenseur_mod ; 
01158         p_tenseur_mod = p_tenseur_nouveau ; 
01159         n_tenseur_mod = n_tenseur_nouveau ; 
01160         
01161     }
01162     else {
01163     
01164         if (p_tenseur_mod[index] != 0x0) {
01165         cout << "Param::add_tenseur_mod : the position " << index 
01166              << " is already occupied !" << endl ; 
01167         abort() ; 
01168         }
01169         else{
01170         p_tenseur_mod[index] = &ti ; 
01171         }
01172         
01173     }   
01174     
01175 }
01176 
01177 // Extraction 
01178 // ----------
01179             
01180 Tenseur& Param::get_tenseur_mod(int index) const {
01181 
01182     assert(index >= 0) ;
01183     assert(index < n_tenseur_mod) ; 
01184     
01185     return *(p_tenseur_mod[index]) ; 
01186 
01187 } 
01188 
01189              
01190             //------------------------------------//
01191             //      Map storage       //
01192             //------------------------------------//
01193 
01194 // Total number of stored addresses
01195 // --------------------------------
01196 
01197 int Param::get_n_map() const {
01198     return n_map ; 
01199 }
01200 
01201 // Addition  
01202 // --------
01203             
01204 void Param::add_map(const Map& mi, int index){
01205     
01206     if (index >= n_map) {    // p_map must be rescaled
01207                 
01208         int n_map_nouveau = index + 1 ; 
01209         const Map** p_map_nouveau = new const Map*[n_map_nouveau] ; 
01210         
01211        
01212         // Copy of the previous addresses  
01213         for (int i=0; i<n_map; i++) {
01214         p_map_nouveau[i] = p_map[i] ; 
01215         }
01216         
01217         // The intermediate addresses are set to 0x0
01218         for (int i=n_map; i<index; i++) {
01219         p_map_nouveau[i] = 0x0 ; 
01220         }
01221         
01222         // The new address 
01223         p_map_nouveau[index] = &mi ; 
01224         
01225         // Update 
01226         if (n_map > 0) delete [] p_map ; 
01227         p_map = p_map_nouveau ; 
01228         n_map = n_map_nouveau ; 
01229         
01230     }
01231     else {
01232     
01233         if (p_map[index] != 0x0) {
01234         cout << "Param::add_map : the position " << index 
01235              << " is already occupied !" << endl ; 
01236         abort() ; 
01237         }
01238         else{
01239         p_map[index] = &mi ; 
01240         }
01241         
01242     }   
01243     
01244 }
01245 
01246 // Extraction 
01247 // ----------
01248             
01249 const Map& Param::get_map(int index) const {
01250 
01251     assert(index >= 0) ;
01252     assert(index < n_map) ; 
01253     
01254     return *(p_map[index]) ; 
01255 
01256 } 
01257             
01258             //------------------------------------//
01259             //      Mtbl_cf storage       //
01260             //------------------------------------//
01261 
01262 // Total number of stored addresses
01263 // --------------------------------
01264 
01265 int Param::get_n_mtbl_cf() const {
01266     return n_mtbl_cf ; 
01267 }
01268 
01269 // Addition  
01270 // --------
01271             
01272 void Param::add_mtbl_cf(const Mtbl_cf& mi, int index){
01273     
01274     if (index >= n_mtbl_cf) {    // p_mtbl_cf must be rescaled
01275                 
01276         int n_mtbl_cf_nouveau = index + 1 ; 
01277         const Mtbl_cf** p_mtbl_cf_nouveau = 
01278                     new const Mtbl_cf*[n_mtbl_cf_nouveau] ; 
01279         
01280        
01281         // Copy of the previous addresses  
01282         for (int i=0; i<n_mtbl_cf; i++) {
01283         p_mtbl_cf_nouveau[i] = p_mtbl_cf[i] ; 
01284         }
01285         
01286         // The intermediate addresses are set to 0x0
01287         for (int i=n_mtbl_cf; i<index; i++) {
01288         p_mtbl_cf_nouveau[i] = 0x0 ; 
01289         }
01290         
01291         // The new address 
01292         p_mtbl_cf_nouveau[index] = &mi ; 
01293         
01294         // Update 
01295         if (n_mtbl_cf > 0) delete [] p_mtbl_cf ; 
01296         p_mtbl_cf = p_mtbl_cf_nouveau ; 
01297         n_mtbl_cf = n_mtbl_cf_nouveau ; 
01298         
01299     }
01300     else {
01301     
01302         if (p_mtbl_cf[index] != 0x0) {
01303         cout << "Param::add_mtbl_cf : the position " << index 
01304              << " is already occupied !" << endl ; 
01305         abort() ; 
01306         }
01307         else{
01308         p_mtbl_cf[index] = &mi ; 
01309         }
01310         
01311     }   
01312     
01313 }
01314 
01315 // Extraction 
01316 // ----------
01317             
01318 const Mtbl_cf& Param::get_mtbl_cf(int index) const {
01319 
01320     assert(index >= 0) ;
01321     assert(index < n_mtbl_cf) ; 
01322     
01323     return *(p_mtbl_cf[index]) ; 
01324 
01325 } 
01326             
01327             //------------------------------------//
01328             //      Scalar storage        //
01329             //------------------------------------//
01330 
01331 // Total number of stored addresses
01332 // --------------------------------
01333 
01334 int Param::get_n_scalar() const {
01335     return n_scalar ; 
01336 }
01337 
01338 // Addition  
01339 // --------
01340             
01341 void Param::add_scalar(const Scalar& ti, int index){
01342     
01343     if (index >= n_scalar) {    // p_scalar must be rescaled
01344                 
01345         int n_scalar_nouveau = index + 1 ; 
01346         const Scalar** p_scalar_nouveau = new const Scalar*[n_scalar_nouveau] ; 
01347         
01348        
01349         // Copy of the previous addresses  
01350         for (int i=0; i<n_scalar; i++) {
01351         p_scalar_nouveau[i] = p_scalar[i] ; 
01352         }
01353         
01354         // The intermediate addresses are set to 0x0
01355         for (int i=n_scalar; i<index; i++) {
01356         p_scalar_nouveau[i] = 0x0 ; 
01357         }
01358         
01359         // The new address 
01360         p_scalar_nouveau[index] = &ti ; 
01361         
01362         // Update 
01363         if (n_scalar > 0) delete [] p_scalar ; 
01364         p_scalar = p_scalar_nouveau ; 
01365         n_scalar = n_scalar_nouveau ; 
01366         
01367     }
01368     else {
01369     
01370         if (p_scalar[index] != 0x0) {
01371         cout << "Param::add_scalar : the position " << index 
01372              << " is already occupied !" << endl ; 
01373         abort() ; 
01374         }
01375         else{
01376         p_scalar[index] = &ti ; 
01377         }
01378         
01379     }   
01380     
01381 }
01382 
01383 // Extraction 
01384 // ----------
01385             
01386 const Scalar& Param::get_scalar(int index) const {
01387 
01388     assert(index >= 0) ;
01389     assert(index < n_scalar) ; 
01390     
01391     return *(p_scalar[index]) ; 
01392 
01393 } 
01394             
01395 
01396             //------------------------------------//
01397             //      Modifiable Scalar storage     //
01398             //------------------------------------//
01399 
01400 // Total number of stored addresses
01401 // --------------------------------
01402 
01403 int Param::get_n_scalar_mod() const {
01404     return n_scalar_mod ; 
01405 }
01406 
01407 // Addition  
01408 // --------
01409             
01410 void Param::add_scalar_mod(Scalar& ti, int index){
01411     
01412     if (index >= n_scalar_mod) {    // p_scalar_mod must be rescaled
01413                 
01414         int n_scalar_nouveau = index + 1 ; 
01415         Scalar** p_scalar_nouveau = new Scalar*[n_scalar_nouveau] ; 
01416         
01417        
01418         // Copy of the previous addresses  
01419         for (int i=0; i<n_scalar_mod; i++) {
01420         p_scalar_nouveau[i] = p_scalar_mod[i] ; 
01421         }
01422         
01423         // The intermediate addresses are set to 0x0
01424         for (int i=n_scalar_mod; i<index; i++) {
01425         p_scalar_nouveau[i] = 0x0 ; 
01426         }
01427         
01428         // The new address 
01429         p_scalar_nouveau[index] = &ti ; 
01430         
01431         // Update 
01432         if (n_scalar_mod > 0) delete [] p_scalar_mod ; 
01433         p_scalar_mod = p_scalar_nouveau ; 
01434         n_scalar_mod = n_scalar_nouveau ; 
01435         
01436     }
01437     else {
01438     
01439         if (p_scalar_mod[index] != 0x0) {
01440         cout << "Param::add_scalar_mod : the position " << index 
01441              << " is already occupied !" << endl ; 
01442         abort() ; 
01443         }
01444         else{
01445         p_scalar_mod[index] = &ti ; 
01446         }
01447         
01448     }   
01449     
01450 }
01451 
01452 // Extraction 
01453 // ----------
01454             
01455 Scalar& Param::get_scalar_mod(int index) const {
01456 
01457     assert(index >= 0) ;
01458     assert(index < n_scalar_mod) ; 
01459     
01460     return *(p_scalar_mod[index]) ; 
01461 
01462 } 
01463 
01464             
01465             //------------------------------------//
01466             //      Tensor storage        //
01467             //------------------------------------//
01468 
01469 // Total number of stored addresses
01470 // --------------------------------
01471 
01472 int Param::get_n_tensor() const {
01473     return n_tensor ; 
01474 }
01475 
01476 // Addition  
01477 // --------
01478             
01479 void Param::add_tensor(const Tensor& ti, int index){
01480     
01481     if (index >= n_tensor) {    // p_tensor must be rescaled
01482                 
01483         int n_tensor_nouveau = index + 1 ; 
01484         const Tensor** p_tensor_nouveau = new const Tensor*[n_tensor_nouveau] ; 
01485         
01486        
01487         // Copy of the previous addresses  
01488         for (int i=0; i<n_tensor; i++) {
01489         p_tensor_nouveau[i] = p_tensor[i] ; 
01490         }
01491         
01492         // The intermediate addresses are set to 0x0
01493         for (int i=n_tensor; i<index; i++) {
01494         p_tensor_nouveau[i] = 0x0 ; 
01495         }
01496         
01497         // The new address 
01498         p_tensor_nouveau[index] = &ti ; 
01499         
01500         // Update 
01501         if (n_tensor > 0) delete [] p_tensor ; 
01502         p_tensor = p_tensor_nouveau ; 
01503         n_tensor = n_tensor_nouveau ; 
01504         
01505     }
01506     else {
01507     
01508         if (p_tensor[index] != 0x0) {
01509         cout << "Param::add_tensor : the position " << index 
01510              << " is already occupied !" << endl ; 
01511         abort() ; 
01512         }
01513         else{
01514         p_tensor[index] = &ti ; 
01515         }
01516         
01517     }   
01518     
01519 }
01520 
01521 // Extraction 
01522 // ----------
01523             
01524 const Tensor& Param::get_tensor(int index) const {
01525 
01526     assert(index >= 0) ;
01527     assert(index < n_tensor) ; 
01528     
01529     return *(p_tensor[index]) ; 
01530 
01531 } 
01532             
01533 
01534             //------------------------------------//
01535             //      Modifiable Tensor storage     //
01536             //------------------------------------//
01537 
01538 // Total number of stored addresses
01539 // --------------------------------
01540 
01541 int Param::get_n_tensor_mod() const {
01542     return n_tensor_mod ; 
01543 }
01544 
01545 // Addition  
01546 // --------
01547             
01548 void Param::add_tensor_mod(Tensor& ti, int index){
01549     
01550     if (index >= n_tensor_mod) {    // p_tensor_mod must be rescaled
01551                 
01552         int n_tensor_nouveau = index + 1 ; 
01553         Tensor** p_tensor_nouveau = new Tensor*[n_tensor_nouveau] ; 
01554         
01555        
01556         // Copy of the previous addresses  
01557         for (int i=0; i<n_tensor_mod; i++) {
01558         p_tensor_nouveau[i] = p_tensor_mod[i] ; 
01559         }
01560         
01561         // The intermediate addresses are set to 0x0
01562         for (int i=n_tensor_mod; i<index; i++) {
01563         p_tensor_nouveau[i] = 0x0 ; 
01564         }
01565         
01566         // The new address 
01567         p_tensor_nouveau[index] = &ti ; 
01568         
01569         // Update 
01570         if (n_tensor_mod > 0) delete [] p_tensor_mod ; 
01571         p_tensor_mod = p_tensor_nouveau ; 
01572         n_tensor_mod = n_tensor_nouveau ; 
01573         
01574     }
01575     else {
01576     
01577         if (p_tensor_mod[index] != 0x0) {
01578         cout << "Param::add_tensor_mod : the position " << index 
01579              << " is already occupied !" << endl ; 
01580         abort() ; 
01581         }
01582         else{
01583         p_tensor_mod[index] = &ti ; 
01584         }
01585         
01586     }   
01587     
01588 }
01589 
01590 // Extraction 
01591 // ----------
01592             
01593 Tensor& Param::get_tensor_mod(int index) const {
01594 
01595     assert(index >= 0) ;
01596     assert(index < n_tensor_mod) ; 
01597     
01598     return *(p_tensor_mod[index]) ; 
01599 
01600 } 
01601 
01602 
01603             //------------------------------------//
01604             //      Etoile storage        //
01605             //------------------------------------//
01606 
01607 // Total number of stored addresses
01608 // --------------------------------
01609 
01610 int Param::get_n_etoile() const {
01611     return n_etoile ; 
01612 }
01613 
01614 // Addition  
01615 // --------
01616             
01617 void Param::add_etoile(const Etoile& eti, int index){
01618     
01619     if (index >= n_etoile) {    // p_etoile must be rescaled
01620                 
01621         int n_etoile_nouveau = index + 1 ; 
01622         const Etoile** p_etoile_nouveau = new const Etoile*[n_etoile_nouveau] ; 
01623         
01624        
01625         // Copy of the previous addresses  
01626         for (int i=0; i<n_etoile; i++) {
01627         p_etoile_nouveau[i] = p_etoile[i] ; 
01628         }
01629         
01630         // The intermediate addresses are set to 0x0
01631         for (int i=n_etoile; i<index; i++) {
01632         p_etoile_nouveau[i] = 0x0 ; 
01633         }
01634         
01635         // The new address 
01636         p_etoile_nouveau[index] = &eti ; 
01637         
01638         // Update 
01639         if (n_etoile > 0) delete [] p_etoile ; 
01640         p_etoile = p_etoile_nouveau ; 
01641         n_etoile = n_etoile_nouveau ; 
01642         
01643     }
01644     else {
01645     
01646         if (p_etoile[index] != 0x0) {
01647         cout << "Param::add_etoile : the position " << index 
01648              << " is already occupied !" << endl ; 
01649         abort() ; 
01650         }
01651         else{
01652         p_etoile[index] = &eti ; 
01653         }
01654         
01655     }   
01656     
01657 }
01658 
01659 // Extraction 
01660 // ----------
01661             
01662 const Etoile& Param::get_etoile(int index) const {
01663 
01664     assert(index >= 0) ;
01665     assert(index < n_etoile) ; 
01666     
01667     return *(p_etoile[index]) ; 
01668 }
01669             //------------------------------------//
01670             //      Star storage          //
01671             //------------------------------------//
01672 
01673 // Total number of stored addresses
01674 // --------------------------------
01675 
01676 int Param::get_n_star() const {
01677     return n_star ; 
01678 }
01679 
01680 // Addition  
01681 // --------
01682             
01683 void Param::add_star(const Star& eti, int index){
01684     
01685     if (index >= n_star) {    // p_star must be rescaled
01686                 
01687         int n_star_nouveau = index + 1 ; 
01688         const Star** p_star_nouveau = new const Star*[n_star_nouveau] ; 
01689         
01690        
01691         // Copy of the previous addresses  
01692         for (int i=0; i<n_star; i++) {
01693         p_star_nouveau[i] = p_star[i] ; 
01694         }
01695         
01696         // The intermediate addresses are set to 0x0
01697         for (int i=n_star; i<index; i++) {
01698         p_star_nouveau[i] = 0x0 ; 
01699         }
01700         
01701         // The new address 
01702         p_star_nouveau[index] = &eti ; 
01703         
01704         // Update 
01705         if (n_star > 0) delete [] p_star ; 
01706         p_star = p_star_nouveau ; 
01707         n_star = n_star_nouveau ; 
01708         
01709     }
01710     else {
01711     
01712         if (p_star[index] != 0x0) {
01713         cout << "Param::add_star : the position " << index 
01714              << " is already occupied !" << endl ; 
01715         abort() ; 
01716         }
01717         else{
01718         p_star[index] = &eti ; 
01719         }
01720         
01721     }   
01722     
01723 }
01724 
01725 // Extraction 
01726 // ----------
01727             
01728 const Star& Param::get_star(int index) const {
01729 
01730     assert(index >= 0) ;
01731     assert(index < n_star) ; 
01732     
01733     return *(p_star[index]) ; 
01734 
01735 
01736 }

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