TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Matrice_Base.cpp
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#include <Matrice_Base.h>
17#include <Matrice_Morse.h>
18#include <Matrice_Morse_Sym.h>
19#include <Matrix_tools.h>
20#include <Array_tools.h>
21
22Implemente_base(Matrice_Base,"Matrice_Base",Objet_U);
23
25printOn(Sortie& s ) const
26{
27 return s << que_suis_je() << finl;
28}
30readOn(Entree& s )
31{
32 return s ;
33}
34
35/*! @brief Fonction (hors classe) amie de la classe Matrice_Base.
36 *
37 * Operateur de multiplication: renvoie (A*vect)
38 * Appelle Matrice_base::multv(const DoubleVect&) sur A.
39 *
40 * @param (Matrice_Base& A) la matrice multiplicatrice
41 * @param (DoubleVect& vect) le vecteur a multiplier
42 * @return (DoubleVect) le vecteur resultat de l'operation
43 */
44DoubleVect operator * (const Matrice_Base& A, const DoubleVect& vect)
45{
46 DoubleVect r(A.nb_colonnes());
47 return A.multvect(vect, r);
48}
49
51{
52 Cerr << "Error in 'Matrice_Base::build_stencil( )"<<finl;
53 Cerr << " This method should be implemented in derived class." << finl;
54 Cerr << " Exiting..." << finl;
56}
57
59{
60 return stencil_.dimension( 0 );
61}
62
63void Matrice_Base::get_stencil( Stencil& stencil ) const
64{
65 Cerr << "Error in 'Matrice_Base::get_stencil( )':" << finl;
66 Cerr << " This method should be implemented in derived class." << finl;
67 Cerr << " Exiting..." << finl;
69}
70
71void Matrice_Base::get_symmetric_stencil( Stencil& stencil ) const
72{
73 Matrice_Morse tmp1;
75
76 Matrice_Morse_Sym tmp2( tmp1 );
77 tmp2.get_symmetric_stencil( stencil );
78}
79
81 StencilCoeffs& coefficients ) const
82{
83 Cerr << "Error in 'Matrice_Base::get_stencill_and_coefficients( )':" << finl;
84 Cerr << " This method should be implemented in derived class" << finl;
85 Cerr << " Exiting..." << finl;
87}
88
89void Matrice_Base::get_stencil_and_coeff_ptrs(Stencil& stencil, std::vector<const double *>& coeff_ptr) const
90{
91 Cerr << "Error in 'Matrice_Base::get_stencil_and_coeff_ptrs( )':" << finl;
92 Cerr << " This method should be implemented in derived class" << finl;
93 Cerr << " Exiting..." << finl;
95}
96
97
99 StencilCoeffs& coefficients ) const
100{
101 Matrice_Morse tmp1;
103
104 Matrice_Morse_Sym tmp2( tmp1 );
105 tmp2.get_symmetric_stencil_and_coefficients( stencil, coefficients );
106}
107
108void Matrice_Base::set_stencil( const Stencil& stencil )
109{
110 stencil_ = stencil ;
111 tableau_trier_retirer_doublons( stencil_ );
112 is_stencil_up_to_date_ = false ;
113}
114
119
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Classe Matrice_Base Classe de base de la hierarchie des matrices.
int get_stencil_size() const
void set_stencil(const Stencil &stencil)
virtual void get_symmetric_stencil(Stencil &stencil) const
virtual void get_stencil(Stencil &stencil) const
bool is_stencil_up_to_date_
virtual int nb_colonnes() const =0
Return local number of columns (=size on the current proc).
virtual DoubleVect & multvect(const DoubleVect &, DoubleVect &) const
Multiplication d'un vecteur par la matrice.
Stencil stencil_
virtual void get_symmetric_stencil_and_coefficients(Stencil &stencil, StencilCoeffs &coefficients) const
virtual void get_stencil_and_coeff_ptrs(Stencil &stencil, std::vector< const double * > &coeff_ptr) const
virtual void get_stencil_and_coefficients(Stencil &stencil, StencilCoeffs &coefficients) const
virtual void build_stencil()
bool is_stencil_up_to_date() const
Classe Matrice_Morse_Sym Represente une matrice M (creuse) symetrique stockee au format Morse.
void get_symmetric_stencil_and_coefficients(Stencil &stencil, StencilCoeffs &coefficients) const override
void get_symmetric_stencil(Stencil &stencil) const override
Classe Matrice_Morse Represente une matrice M (creuse), non necessairement carree.
static void convert_to_morse_matrix(const Matrice_Base &in, Matrice_Morse &out)
classe Objet_U Cette classe est la classe de base des Objets de TRUST
Definition Objet_U.h:73
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52