TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Matrice_Nulle.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_Nulle.h>
17#include <TRUSTTab.h>
18#include <TRUSTArray.h>
19
20Implemente_instanciable_sans_constructeur( Matrice_Nulle, "Matrice_Nulle", Matrice_Base ) ;
21
23{
24 os << nb_lines_ << finl;
25 os << nb_columns_ << finl;
26 return os;
27}
28
30{
31 is >> nb_lines_;
32 is >> nb_columns_;
33 return is;
34}
35
37{
38 assert( nb_lines_ > 0 );
39 assert( nb_columns_ > 0 );
40
41 if ( nb_lines_ == nb_columns_ )
42 {
43 return nb_lines_;
44 }
45 return -1;
46}
47
49{
50 assert( nb_lines_ > 0 );
51 assert( nb_columns_ > 0 );
52 return nb_lines_;
53}
54
56{
57 assert( nb_lines_ > 0 );
58 assert( nb_columns_ > 0 );
59 return nb_columns_;
60}
61
62DoubleVect& Matrice_Nulle::ajouter_multvect_(const DoubleVect& x,
63 DoubleVect& r) const
64{
65 assert( nb_lines_ > 0 );
66 assert( nb_columns_ > 0 );
67 return r;
68}
69
70DoubleVect& Matrice_Nulle::ajouter_multvectT_(const DoubleVect& x,
71 DoubleVect& r) const
72{
73 assert( nb_lines_ > 0 );
74 assert( nb_columns_ > 0 );
75 return r;
76}
77
78DoubleTab& Matrice_Nulle::ajouter_multTab_(const DoubleTab& x,
79 DoubleTab& r) const
80{
81 assert( nb_lines_ > 0 );
82 assert( nb_columns_ > 0 );
83 return r;
84}
85
86void Matrice_Nulle::scale( const double x )
87{
88 // nothing to do
89}
90
92{
93 // nothing to do
94}
95
96void Matrice_Nulle::get_stencil( Stencil& stencil ) const
97{
98 stencil.resize( 0, 2 );
99}
100
101void Matrice_Nulle::get_symmetric_stencil( Stencil& stencil ) const
102{
103 if ( nb_lines_ != nb_columns_ )
104 {
105 Cerr << "Error in 'Matrice_Nulle::get_symmetric_stencil( )':" << finl;
106 Cerr << " Matrix is not square." << finl;
107 Cerr << " nb_lines = " << nb_lines_ << finl;
108 Cerr << " nb_columns = " << nb_columns_ << finl;
109 Cerr << " Exiting..." << finl;
110 Process::exit( );
111 }
112 get_stencil( stencil );
113}
114
116 StencilCoeffs& coefficients ) const
117{
118 stencil.resize( 0, 2 );
119 coefficients.resize( 0 );
120}
121
123 StencilCoeffs& coefficients ) const
124{
125 if ( nb_lines_ != nb_columns_ )
126 {
127 Cerr << "Error in 'Matrice_Nulle::get_symmetric_stencil_and_coefficients( )':" << finl;
128 Cerr << " Matrix is not square." << finl;
129 Cerr << " nb_lines = " << nb_lines_ << finl;
130 Cerr << " nb_columns = " << nb_columns_ << finl;
131 Cerr << " Exiting..." << finl;
132 Process::exit( );
133 }
135 coefficients );
136}
137
143
145{
146 assert( order > 0 );
147 nb_lines_ = order;
148 nb_columns_ = order;
149}
150
151Matrice_Nulle::Matrice_Nulle( int nb_lines, int nb_columns ) : Matrice_Base( )
152{
153 assert( nb_lines > 0 );
154 assert( nb_columns > 0 );
155 nb_lines_ = nb_lines;
156 nb_columns_ = nb_columns;
157}
158
160{
161 assert( order > 0 );
162 nb_lines_ = order;
163 nb_columns_ = order;
164}
165
166void Matrice_Nulle::dimensionner( int nb_lines, int nb_columns )
167{
168 assert( nb_lines > 0 );
169 assert( nb_columns > 0 );
170 nb_lines_ = nb_lines;
171 nb_columns_ = nb_columns;
172}
173
174double Matrice_Nulle::coeff( int i, int j ) const
175{
176 assert( nb_lines_ > 0 );
177 assert( nb_columns_ > 0 );
178 return 0.0;
179}
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.
DoubleVect & ajouter_multvect_(const DoubleVect &x, DoubleVect &r) const override
void get_stencil(Stencil &stencil) const override
DoubleVect & ajouter_multvectT_(const DoubleVect &x, DoubleVect &r) const override
void scale(const double x) override
void get_symmetric_stencil(Stencil &stencil) const override
void clean() override
int nb_lignes() const override
Return local number of lines (=size on the current proc).
int nb_colonnes() const override
Return local number of columns (=size on the current proc).
int ordre() const override
If square matrix, returns number of lines, otherwise 0.
void get_stencil_and_coefficients(Stencil &stencil, StencilCoeffs &coefficients) const override
double coeff(int i, int j) const
DoubleTab & ajouter_multTab_(const DoubleTab &x, DoubleTab &r) const override
void get_symmetric_stencil_and_coefficients(Stencil &stencil, StencilCoeffs &coefficients) const override
void dimensionner(int order)
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
void resize(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTArray.h:156
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469