TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
MD_Vector.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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 <MD_Vector.h>
17#include <Memoire.h>
18
19//Implemente_base_sans_constructeur_ni_destructeur(MD_Vector_base,"MD_Vector_base",Objet_U);
20
21/*! @brief construction d'un objet MD_Vector par copie d'un objet existant.
22 *
23 * C'est la methode recommandee pour creer un objet MD_Vector (autrement que
24 * par copie d'un autre MD_Vector)
25 */
27{
28 int num_obj = src.duplique();
29 MD_Vector_base * p = dynamic_cast<MD_Vector_base *>(Memoire::Instance().objet_u_ptr(num_obj));
30 assert(p!= nullptr);
31 ptr_.reset(p);
32}
33
34/*! @brief renvoie 1 si les structures sont identiques, 0 sinon
35 *
36 */
37int MD_Vector::operator==(const MD_Vector& md) const
38{
39 // Pour l'instant, test tres restrictif: les deux structures sont
40 // identiques si et seulement si les pointeurs sont identiques,
41 // (autrement dit la deuxieme a ete creee par copie de la premiere)
42 // Si on veut debrancher le systeme de reference multiple et dupliquer
43 // les structures a la copie, il faut faire le test complet d'egalite
44 // sur toute la structure !
45 return ptr_ == md.ptr_;
46}
47
48/*! @brief reponse inverse de == ...
49 */
50int MD_Vector::operator!=(const MD_Vector& md) const
51{
52 return !operator==(md);
53}
Base class for distributed vectors parallel descriptors.
void copy(const MD_Vector_base &)
construction d'un objet MD_Vector par copie d'un objet existant.
Definition MD_Vector.cpp:26
int operator!=(const MD_Vector &) const
reponse inverse de == ...
Definition MD_Vector.cpp:50
int operator==(const MD_Vector &) const
renvoie 1 si les structures sont identiques, 0 sinon
Definition MD_Vector.cpp:37
Objet_U * objet_u_ptr(int)
Retoune un pointeur sur l'Objet_U de rang num dans la memoire.
Definition Memoire.cpp:258
static Memoire & Instance()
Retourne un pointeur sur l'instance de la memoire Cree un nouvel objet memoire si aucune instance n'a...
Definition Memoire.cpp:32
virtual int duplique() const =0