TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
MD_Vector_base.h
1/****************************************************************************
2* Copyright (c) 2025, 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 MD_Vector_base_included
17#define MD_Vector_base_included
18
19#include <TRUSTArray.h>
20#include <ArrOfBit.h>
21
24class MD_Vector;
25class MD_Vector_seq;
27class MD_Vector_std;
28
29/*! @brief Base class for distributed vectors parallel descriptors.
30 *
31 * See also the MD_Vector class (which is a kind of DERIV() of this class), and see derived classes
32 * MD_Vector_std, MD_Vector_composite and MD_Vector_seq.
33 */
34class MD_Vector_base : public Objet_U
35{
36 Declare_base(MD_Vector_base);
37
38public:
39
40 virtual int get_nb_items_reels() const { return nb_items_reels_; }
41 virtual int get_nb_items_tot() const { return nb_items_tot_; }
42 virtual trustIdType nb_items_seq_tot() const { return nb_items_seq_tot_; }
43 virtual int nb_items_seq_local() const { return nb_items_seq_local_; }
44
45 virtual const ArrOfInt& get_blocs_items_to_compute() const = 0;
46 virtual const ArrOfInt& get_items_to_compute() const = 0;
47 virtual const ArrOfInt& get_blocs_items_to_sum() const = 0;
48 virtual const ArrOfInt& get_items_to_sum() const = 0;
49
50 int get_sequential_items_flags(ArrOfBit& flags, int line_size=1) const;
51 int get_sequential_items_flags(ArrOfInt& flags, int line_size=1) const;
52
53 virtual bool validate(trustIdType sz_array, int line_size) const;
54
55 virtual void initialize_comm(const Echange_EV_Options& opt, Schema_Comm_Vecteurs&, DoubleVect&) const = 0;
56 virtual void prepare_send_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs&, DoubleVect&) const = 0;
57 virtual void process_recv_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs&, DoubleVect&) const = 0;
58
59 virtual void initialize_comm(const Echange_EV_Options& opt, Schema_Comm_Vecteurs&, FloatVect&) const = 0;
60 virtual void prepare_send_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs&, FloatVect&) const = 0;
61 virtual void process_recv_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs&, FloatVect&) const = 0;
62
63 virtual void initialize_comm(const Echange_EV_Options& opt, Schema_Comm_Vecteurs&, IntVect&) const = 0;
64 virtual void prepare_send_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs&, IntVect&) const = 0;
65 virtual void process_recv_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs&, IntVect&) const = 0;
66
67#if INT_is_64_ == 2
68 virtual void initialize_comm(const Echange_EV_Options& opt, Schema_Comm_Vecteurs&, TIDVect&) const = 0;
69 virtual void prepare_send_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs&, TIDVect&) const = 0;
70 virtual void process_recv_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs&, TIDVect&) const = 0;
71#endif
72
73 // Used in MD_Vector_tools:
74 virtual void fill_md_vect_renum(const IntVect& renum, MD_Vector& md_vect) const = 0;
75
76 // Tool method:
77 static void append_item_to_blocs(ArrOfInt& blocs, int item);
78
79 /*! Whether algorithms in TRUSTVect_tools should use the blocks stored in members MD_Vector_mono::blocs_items_to_*
80 */
81 virtual bool use_blocks() const = 0;
82
83protected:
84 // Actual implementation of the sequential flags retrieval - overriden in MD_Vector_seq:
85 virtual int get_seq_flags_impl(ArrOfBit& flags, int line_size) const;
86
87 // Tool methods:
88 static void append_blocs(ArrOfInt& dest, const ArrOfInt& src, int offset=0, int multiplier=1);
89 static void append_items(ArrOfInt& dest, const ArrOfInt& src, int offset=0, int multiplier=1);
90
91 // Nombre total d'items (reels+virtuels), utilise pour connaitre la taille des tableaux a creer
92 int nb_items_tot_ = -1;
93 // Nombre d'items "reels" (propriete dimension(0) du tableau ou size() pour le vecteur)
94 // En principe les items reels sont tous ceux appartenant aux elements reels, ils sont regroupes au
95 // debut du tableau aux indices 0 <= i < nb_items_reels_.
96 // Si ce nombre vaut -1, il n'y a pas de separation entre items reels et items virtuels
97 // (cas des tableaux P1Bulle multilocalisation pour lesquels les items reels et virtuels sont melanges)
99
100 // Nombre total (sur tous les procs) d'items sequentiels (c'est mp_sum(nb_items_seq_local_)) - cela peut depasser 32 bits.
101 trustIdType nb_items_seq_tot_ = -1;
102 // Nombre d'items sequentiels sur ce processeur (c'est le nombre d'items dans les blocs de blocs_items_to_sum_)
104
105private:
106 // This class may modify ref_count_:
107 friend class MD_Vector;
108
109};
110
111#endif
Base class for distributed vectors parallel descriptors.
virtual void process_recv_data(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &, DoubleVect &) const =0
virtual const ArrOfInt & get_blocs_items_to_sum() const =0
int get_sequential_items_flags(ArrOfBit &flags, int line_size=1) const
virtual const ArrOfInt & get_items_to_sum() const =0
friend class MD_Vector
static void append_blocs(ArrOfInt &dest, const ArrOfInt &src, int offset=0, int multiplier=1)
trustIdType nb_items_seq_tot_
virtual void initialize_comm(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &, IntVect &) const =0
virtual int get_seq_flags_impl(ArrOfBit &flags, int line_size) const
virtual void prepare_send_data(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &, DoubleVect &) const =0
virtual void prepare_send_data(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &, FloatVect &) const =0
virtual bool use_blocks() const =0
virtual int nb_items_seq_local() const
virtual void initialize_comm(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &, DoubleVect &) const =0
static void append_items(ArrOfInt &dest, const ArrOfInt &src, int offset=0, int multiplier=1)
virtual bool validate(trustIdType sz_array, int line_size) const
virtual void initialize_comm(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &, FloatVect &) const =0
virtual void prepare_send_data(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &, IntVect &) const =0
virtual int get_nb_items_tot() const
virtual void process_recv_data(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &, FloatVect &) const =0
virtual void process_recv_data(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &, IntVect &) const =0
virtual trustIdType nb_items_seq_tot() const
virtual int get_nb_items_reels() const
static void append_item_to_blocs(ArrOfInt &blocs, int item)
methode outil pour ajouter un item a un tableau du genre "blocs" contenant des series de blocs.
virtual void fill_md_vect_renum(const IntVect &renum, MD_Vector &md_vect) const =0
virtual const ArrOfInt & get_items_to_compute() const =0
virtual const ArrOfInt & get_blocs_items_to_compute() const =0
Metadata for a distributed composite vector.
Dummy parallel descriptor used for sequential computations.
C'est le plus simple des descripteurs, utilise pour les tableaux de valeurs aux sommets,...
: Cette classe est un OWN_PTR mais l'objet pointe est partage entre plusieurs
Definition MD_Vector.h:48
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
Definition Objet_U.cpp:55