2021-09-28 17:59:27 +02:00
|
|
|
// FICHIER : Tableau_4D.h
|
|
|
|
// CLASSE : Tableau_4D
|
|
|
|
|
|
|
|
// This file is part of the Herezh++ application.
|
|
|
|
//
|
|
|
|
// The finite element software Herezh++ is dedicated to the field
|
|
|
|
// of mechanics for large transformations of solid structures.
|
|
|
|
// It is developed by Gérard Rio (APP: IDDN.FR.010.0106078.000.R.P.2006.035.20600)
|
|
|
|
// INSTITUT DE RECHERCHE DUPUY DE LÔME (IRDL) <https://www.irdl.fr/>.
|
|
|
|
//
|
|
|
|
// Herezh++ is distributed under GPL 3 license ou ultérieure.
|
|
|
|
//
|
2023-05-03 17:23:49 +02:00
|
|
|
// Copyright (C) 1997-2022 Université Bretagne Sud (France)
|
2021-09-28 17:59:27 +02:00
|
|
|
// AUTHOR : Gérard Rio
|
|
|
|
// E-MAIL : gerardrio56@free.fr
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License,
|
|
|
|
// or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
|
|
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
//
|
|
|
|
// For more information, please consult: <https://herezh.irdl.fr/>.
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* DATE: 23/01/97 *
|
|
|
|
* $ *
|
|
|
|
* AUTEUR: G RIO (mailto:gerardrio56@free.fr) *
|
|
|
|
* $ *
|
|
|
|
* PROJET: Herezh++ *
|
|
|
|
* $ *
|
|
|
|
************************************************************************
|
|
|
|
* La classe Tableau_4D permet de declarer des tableaux a quatre dimensions dont
|
|
|
|
* les composantes sont de type double.
|
|
|
|
* Les composantes d'une instance de cette classe sont stockees en ligne et la memoire
|
|
|
|
* est allouee dynamiquement.
|
|
|
|
* $ *
|
|
|
|
* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' *
|
|
|
|
* *
|
|
|
|
* VERIFICATION: *
|
|
|
|
* *
|
|
|
|
* ! date ! auteur ! but ! *
|
|
|
|
* ------------------------------------------------------------ *
|
|
|
|
* ! ! ! ! *
|
|
|
|
* $ *
|
|
|
|
* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' *
|
|
|
|
* MODIFICATIONS: *
|
|
|
|
* ! date ! auteur ! but ! *
|
|
|
|
* ------------------------------------------------------------ *
|
|
|
|
* $ *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
// La classe Tableau_4D permet de declarer des tableaux a quatre dimensions dont
|
|
|
|
// les composantes sont de type double.
|
|
|
|
// Les composantes d'une instance de cette classe sont stockees en ligne et la memoire
|
|
|
|
// est allouee dynamiquement.
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef TABLEAU_4D_H
|
|
|
|
#define TABLEAU_4D_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "Sortie.h"
|
|
|
|
|
|
|
|
|
|
|
|
/// @addtogroup Les_Tableaux_generiques
|
|
|
|
/// @{
|
|
|
|
///
|
|
|
|
|
|
|
|
|
|
|
|
class Tableau_4D
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
public :
|
|
|
|
|
|
|
|
|
|
|
|
// CONSTRUCTEURS :
|
|
|
|
|
|
|
|
// Constructeur par defaut
|
|
|
|
Tableau_4D ();
|
|
|
|
|
|
|
|
// Constructeur utile quand les quatre dimensions ainsi qu'une
|
|
|
|
// eventuelle valeur d'initialisation sont connues
|
|
|
|
Tableau_4D (int d1,int d2,int d3,int d4,double val=0.0);
|
|
|
|
|
|
|
|
// Constructeur de copie
|
|
|
|
Tableau_4D (const Tableau_4D& tab);
|
|
|
|
|
|
|
|
|
|
|
|
// DESTRUCTEUR :
|
|
|
|
|
|
|
|
~Tableau_4D ();
|
|
|
|
|
|
|
|
|
|
|
|
// METHODES :
|
|
|
|
|
|
|
|
inline void Affiche ()
|
|
|
|
// Affiche les donnees du tableau a trois dimensions
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Tableau 4D\n";
|
|
|
|
cout << "Dimension 1 : " << Taille1() << " .\n";
|
|
|
|
cout << "Dimension 2 : " << Taille2() << " .\n";
|
|
|
|
cout << "Dimension 3 : " << Taille3() << " .\n";
|
|
|
|
cout << "Dimension 4 : " << Taille4() << " .\n";
|
|
|
|
cout << "Composante(s) :\n{\n";
|
|
|
|
for (int i=0;i<dim1;i++)
|
|
|
|
{
|
|
|
|
cout << "( ";
|
|
|
|
for (int j=0;j<dim2;j++)
|
|
|
|
{
|
|
|
|
cout << "\t[ ";
|
|
|
|
for (int k=0;k<dim3;k++)
|
|
|
|
{
|
|
|
|
cout << "[ ";
|
|
|
|
for (int l=0;l<dim4;l++)
|
|
|
|
{
|
|
|
|
cout << *(t+dim4*dim3*dim2*i+dim4*dim3*j+dim4*k+l) << " ";
|
|
|
|
};
|
|
|
|
cout << " ]";
|
|
|
|
};
|
|
|
|
cout << "] \n";
|
|
|
|
};
|
|
|
|
cout << ") \n";
|
|
|
|
};
|
|
|
|
cout << "}\n\n";
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
inline int Taille1 ()
|
|
|
|
// Retourne la taille de la premiere dimension
|
|
|
|
{
|
|
|
|
|
|
|
|
return dim1;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
inline int Taille2 ()
|
|
|
|
// Retourne la taille de la deuxieme dimension
|
|
|
|
{
|
|
|
|
|
|
|
|
return dim2;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
inline int Taille3 ()
|
|
|
|
// Retourne la taille de la troisieme dimension
|
|
|
|
{
|
|
|
|
|
|
|
|
return dim3;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
inline int Taille4 ()
|
|
|
|
// Retourne la taille de la quatrieme dimension
|
|
|
|
{
|
|
|
|
|
|
|
|
return dim4;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
inline double& operator() (int i,int j,int k,int l)
|
|
|
|
// Retourne la ieme jieme kieme lieme composante
|
|
|
|
{
|
|
|
|
|
|
|
|
if ( (i<1) || (i>dim1) || (j<1) || (j>dim2)
|
|
|
|
|| (k<1) || (k>dim3) || (l<1) || (l>dim4) )
|
|
|
|
{
|
|
|
|
cout << "\nErreur : composante inexistante !\n";
|
|
|
|
cout << "TABLEAU_4D::OPERATOR[](int ,int ,int ,int ) \n";
|
|
|
|
Sortie(1);
|
|
|
|
};
|
|
|
|
return *(t+dim4*dim3*dim2*(i-1)+dim4*dim3*(j-1)+dim4*(k-1)+(l-1));
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// Initialisation des composantes du tableau
|
|
|
|
void Initialise (double val=0.0);
|
|
|
|
|
|
|
|
// Desallocation des composantes du tableau
|
|
|
|
void Libere ();
|
|
|
|
|
|
|
|
// Surcharge de l'operateur = : egalite entre deux tableaux a quatre dimensions
|
|
|
|
Tableau_4D& operator= (const Tableau_4D& tab);
|
|
|
|
|
|
|
|
|
|
|
|
protected :
|
|
|
|
|
|
|
|
|
|
|
|
int dim1; // dimension dans la premiere direction
|
|
|
|
int dim2; // dimension dans la seconde direction
|
|
|
|
int dim3; // dimension dans la troisieme direction
|
|
|
|
int dim4; // dimension dans la quatrieme direction
|
|
|
|
double* t; // tableau des composantes
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
/// @} // end of group
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|