TrioCFD 1.9.9_beta
TrioCFD documentation
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 Matrice_Morse_Sym class - Represents a sparse symmetric matrix M stored in Morse format.
25 *
26 * Symmetric: only the upper triangular part of the matrix is stored.
27 * Important: All diagonal coefficients must be stored even if they are zero
28 * (TRUST assumption for several methods including multvect).
29 * This class derives from Matrice_Morse and 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; // Create a renumbered matrix to reduce the bandwidth
81 Matrice& matrice_renumerotee() { return matrice_renumerotee_; }// Returns the renumbered matrix
82 Matrice& matrice_renumerotee() const { return matrice_renumerotee_; }// Returns the renumbered matrix
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
Matrice_Morse_Sym class - Represents a sparse symmetric matrix M stored in Morse format.
void assert_check_sorted_symmetric_morse_matrix_structure() const
void compacte(int elim_coeff_nul=0)
Remove duplicates by sorting tab2.
DoubleVect & ajouter_multvectT_(const DoubleVect &, DoubleVect &) const override
Transposed-matrix-vector multiply-accumulate operation (saxpy).
Matrice_Morse_Sym & operator*=(double)
DOES NOTHING: NOT IMPLEMENTED.
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
Renumbers a matrix to reduce its bandwidth.
bool check_sorted_symmetric_morse_matrix_structure() const
DoubleVect & ajouter_multvect_(const DoubleVect &, DoubleVect &) const override
Matrix-vector multiply-accumulate operation (saxpy).
friend Matrice_Morse_Sym operator+(const Matrice_Morse_Sym &, const Matrice_Morse_Sym &)
Friend function (non-member) of class Matrice_Morse_Sym. DOES NOTHING: NOT IMPLEMENTED.
int inverse(const DoubleVect &, DoubleVect &, double) const override
Computes the solution of the linear system: 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 &)
Assignment operator of a Matrice_Morse_Sym into a Matrice_Morse_Sym.
ArrOfInt & permutation() const
ArrOfInt & permutation_inverse()
Matrice_Morse_Sym operator-() const
Unary negation operator, returns the opposite of the matrix: -A.
Sortie & imprimer_formatte(Sortie &s) const override
ArrOfInt & permutation_inverse() const
DoubleTab & ajouter_multTab_(const DoubleTab &, DoubleTab &) const override
Matrix-matrix multiply-accumulate operation (saxpy) where the matrix is represented by an array.
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)
Friend function (non-member) of class Matrice_Morse_Sym. Simply calls operator*(double,...
void get_symmetric_stencil(Stencil &stencil) const override
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
Matrice class - Generic class in the matrix hierarchy.
Definition Matrice.h:34
Base class for output streams.
Definition Sortie.h:52