TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Matrice_Morse_Sym.h
1/****************************************************************************
2* Copyright (c) 2026, 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
16#ifndef Matrice_Morse_Sym_included
17#define Matrice_Morse_Sym_included
18
19#include <Matrice_Morse.h>
20#include <Matrice_Sym.h>
21#include <Matrice.h>
22
23
24/*! @brief Classe Matrice_Morse_Sym Represente une matrice M (creuse) symetrique stockee au format Morse
25 *
26 * Symetrique: on ne stocke que la partie triangulaire superieure de la
27 * matrice. Important: Tous les coefficients diagonaux doivent etre stockes
28 * meme s'ils sont nuls (hypothese TRUST pour plusieurs methodes dont multvect).
29 * Cette classe derive de Matrice_Morse et Matrice_Sym.
30 *
31 * @sa Matrice_Morse Matrice_Sym
32 */
34{
35
36 Declare_instanciable_sans_constructeur(Matrice_Morse_Sym);
37
38public :
39
40 // constructeurs :
41 Matrice_Morse_Sym(int n1=1,int n2=1) : Matrice_Morse(n1,n2)
42 {
44 }
45 Matrice_Morse_Sym(int ,int ,const IntLists& ,const DoubleLists& ,const DoubleVect& );
46 Matrice_Morse_Sym(const Matrice& ) ;
49
50 // operateurs :
55 friend Matrice_Morse_Sym operator *(const Matrice_Morse_Sym&, double );
56 friend Matrice_Morse_Sym operator *(double, const Matrice_Morse_Sym& );
58 void scale( const double x ) override;
59
60 void get_stencil(Stencil& stencil) const override;
61
62 void get_symmetric_stencil(Stencil& stencil) const override;
63
64 void get_stencil_and_coefficients(Stencil& stencil, StencilCoeffs& coefficients) const override;
65
66 void get_symmetric_stencil_and_coefficients(Stencil& stencil, StencilCoeffs& coefficients) const override;
67
69
70 DoubleTab& ajouter_multTab_(const DoubleTab&, DoubleTab& ) const override;
71 DoubleVect& ajouter_multvect_(const DoubleVect&, DoubleVect& ) const override;
72 DoubleVect& ajouter_multvectT_(const DoubleVect&, DoubleVect& ) const override;
73
74 virtual double multvect_et_prodscal(const DoubleVect&, DoubleVect& ) const ;
75 int inverse(const DoubleVect&, DoubleVect&, double ) const override;
76 int inverse(const DoubleVect&, DoubleVect&, double, int ) const override;
77
78 Sortie& imprimer_formatte(Sortie& s) const override;
79 void compacte(int elim_coeff_nul=0);
80 void renumerote() const; // Creation d'une matrice renumerotee pour reduire la largeur de bande
81 Matrice& matrice_renumerotee() { return matrice_renumerotee_; }// Renvoie la matrice renumerotee
82 Matrice& matrice_renumerotee() const { return matrice_renumerotee_; }// Renvoie la matrice renumerotee
83 inline ArrOfInt& permutation() { return permutation_; }
84 inline ArrOfInt& permutation_inverse() { return permutation_inverse_; }
85 inline ArrOfInt& permutation() const { return permutation_; }
86 inline ArrOfInt& permutation_inverse() const { return permutation_inverse_; }
87
92
93private :
94 int isLU() const { return 0; }
95 mutable ArrOfInt permutation_;
96 mutable ArrOfInt permutation_inverse_;
97 mutable Matrice matrice_renumerotee_;
98};
99
100int Matrice_Morse_Sym_test();
101
102Matrice_Morse operator +(const Matrice_Morse&, const Matrice_Morse& );
103Matrice_Morse operator *(double, const Matrice_Morse& );
104Matrice_Morse_Sym operator +(const Matrice_Morse_Sym&, const Matrice_Morse_Sym& );
105Matrice_Morse_Sym operator *(const Matrice_Morse_Sym&, double );
106Matrice_Morse_Sym operator *(double, const Matrice_Morse_Sym& );
107#endif
Classe Matrice_Morse_Sym Represente une matrice M (creuse) symetrique stockee au format Morse.
void assert_check_sorted_symmetric_morse_matrix_structure() const
void compacte(int elim_coeff_nul=0)
Suppression des doublons on ordonne tab2;.
DoubleVect & ajouter_multvectT_(const DoubleVect &, DoubleVect &) const override
Operation de multiplication-accumulation (saxpy) matrice vecteur, par la matrice transposee.
Matrice_Morse_Sym & operator*=(double)
NE FAIT RIEN : NON CODE.
bool check_symmetric_morse_matrix_structure() const
void get_symmetric_stencil_and_coefficients(Stencil &stencil, StencilCoeffs &coefficients) const override
void get_stencil(Stencil &stencil) const override
ArrOfInt & permutation()
Matrice & matrice_renumerotee()
Matrice_Morse_Sym(int n1=1, int n2=1)
void renumerote() const
Renumerotation d'une matrice afin de reduire la largeur de bande.
bool check_sorted_symmetric_morse_matrix_structure() const
DoubleVect & ajouter_multvect_(const DoubleVect &, DoubleVect &) const override
Operation de multiplication-accumulation (saxpy) matrice vecteur.
friend Matrice_Morse_Sym operator+(const Matrice_Morse_Sym &, const Matrice_Morse_Sym &)
Fonction (hors classe) amie de la classe Matrice_Morse_Sym NE FAIT RIEN : NON CODE.
int inverse(const DoubleVect &, DoubleVect &, double) const override
Calcule la solution du systeme lineaire: A * solution = secmem.
Matrice & matrice_renumerotee() const
void assert_check_symmetric_morse_matrix_structure() const
void get_stencil_and_coefficients(Stencil &stencil, StencilCoeffs &coefficients) const override
Matrice_Morse_Sym & operator=(const Matrice_Morse_Sym &)
Operateur d'affectatiob d'une Matrice_Morse_Sym dans une Matrice_Morse_Sym.
ArrOfInt & permutation() const
ArrOfInt & permutation_inverse()
Matrice_Morse_Sym operator-() const
Operateur de negation unaire, renvoie l'opposee de la matrice: - A.
Sortie & imprimer_formatte(Sortie &s) const override
ArrOfInt & permutation_inverse() const
DoubleTab & ajouter_multTab_(const DoubleTab &, DoubleTab &) const override
Operation de multiplication-accumulation (saxpy) matrice matrice (matrice represente par un tableau).
void scale(const double x) override
virtual double multvect_et_prodscal(const DoubleVect &, DoubleVect &) const
friend Matrice_Morse_Sym operator*(const Matrice_Morse_Sym &, double)
Fonction (hors classe) amie de la classe Matrice_Morse_Sym Simple appel a operator*(double,...
void get_symmetric_stencil(Stencil &stencil) const override
Classe Matrice_Morse Represente une matrice M (creuse), non necessairement carree.
Classe Matrice Classe generique de la hierarchie des matrices.
Definition Matrice.h:34
Classe de base des flux de sortie.
Definition Sortie.h:52