TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Matrice33.h
1/****************************************************************************
2 * Copyright (c) 2022, CEA
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9 *
10 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13 *
14 *****************************************************************************/
15#ifndef Matrice33_included
16#define Matrice33_included
17
18#include <TRUSTTabs_forward.h>
19#include <assert.h>
20
21/*! @brief une matrice 3x3.
22 *
23 * Convention pour m(i,j): i est l'indice de ligne, j l'indice de colonne entre 0 et 2 inclus.
24 * Attention: le constructeur par defaut n'initialise pas la matrice !
25 *
26 */
28{
29public:
31 {
32 }
33 ;
34 Matrice33(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
35 {
36 m[0][0] = m00;
37 m[0][1] = m01;
38 m[0][2] = m02;
39 m[1][0] = m10;
40 m[1][1] = m11;
41 m[1][2] = m12;
42 m[2][0] = m20;
43 m[2][1] = m21;
44 m[2][2] = m22;
45 }
46 Matrice33(const DoubleTab& tab)
47 {
48 assert(tab.nb_dim() == 2 && tab.dimension(0) == 3 && tab.dimension(1) == 3);
49 for (int i = 0; i < 3; i++)
50 for (int j = 0; j < 3; j++)
51 m[i][j] = tab(i, j);
52 }
53 double operator()(int i, int j) const
54 {
55 assert(i >= 0 && i < 3 && j >= 0 && j < 3);
56 return m[i][j];
57 }
58 double& operator()(int i, int j)
59 {
60 assert(i >= 0 && i < 3 && j >= 0 && j < 3);
61 return m[i][j];
62 }
63 inline double norme_Linfini();
64 static inline void produit(const Matrice33& m, const Vecteur3& x, Vecteur3& y);
65 static inline void produit_matriciel(const Matrice33& m1, const Matrice33& m2, Matrice33& res);
66 static inline void transpose(const Matrice33& matrice, Matrice33& matrice_transpose);
67 static inline double inverse(const Matrice33& m, Matrice33& resu, int exit_on_error = 1);
68
69protected:
70 double m[3][3];
71 void init()
72 {
73 for (int i = 0; i < 3; i++)
74 for (int j = 0; j < 3; j++)
75 m[i][j] = 0.;
76 }
77};
78
79#endif
une matrice 3x3.
Definition Matrice33.h:28
Matrice33(const DoubleTab &tab)
Definition Matrice33.h:46
double norme_Linfini()
calcul de la norme Linfini de la matrice Propriete: on note |x| la norme Linfini de x (vecteur ou mat...
double & operator()(int i, int j)
Definition Matrice33.h:58
static void produit_matriciel(const Matrice33 &m1, const Matrice33 &m2, Matrice33 &res)
static void produit(const Matrice33 &m, const Vecteur3 &x, Vecteur3 &y)
produit avec de la matrice avec le vecteur x.
double operator()(int i, int j) const
Definition Matrice33.h:53
void init()
Definition Matrice33.h:71
static void transpose(const Matrice33 &matrice, Matrice33 &matrice_transpose)
double m[3][3]
Definition Matrice33.h:70
static double inverse(const Matrice33 &m, Matrice33 &resu, int exit_on_error=1)
calcul de l'inverse.
Matrice33(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
Definition Matrice33.h:34
int nb_dim() const
Definition TRUSTTab.h:199
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133