TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
MD_Vector_composite.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_composite_included
17#define MD_Vector_composite_included
18
19#include <MD_Vector_std.h>
20#include <MD_Vector.h>
21#include <TRUSTTabs.h>
22#include <Noms.h>
23#include <memory>
24
25/*! @brief Metadata for a distributed composite vector.
26 *
27 * This class describes a vector that contains one or more sub-vectors (see P1bubble arrays),
28 * each sub-vector has the same shape as the base vector, plus one dimension if shapes_[i] > 0
29 * See also class DoubleTab_Parts and class ConstDoubleTab_Parts
30 *
31 * MD_Vector_composite can be nested (for example when using the U_P solver, where velocity and pressure are
32 * gathered in a single vector, and pressure itself has different support entities).
33 *
34 * The overall parallel information is aggregated in the member global_md_ which contains the overall equivalent
35 * of all the parts.
36 */
38{
39 Declare_instanciable(MD_Vector_composite);
40public:
41 void add_part(const MD_Vector& part, int shape = 0, Nom name = "");
42
43 void initialize_comm(const Echange_EV_Options& opt, Schema_Comm_Vecteurs& c, DoubleVect& v) const override { global_md_->initialize_comm(opt, c, v); }
44 void prepare_send_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs& c, DoubleVect& v) const override { global_md_->prepare_send_data(opt, c, v); }
45 void process_recv_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs& c, DoubleVect& v) const override { global_md_->process_recv_data(opt, c, v); }
46
47 void initialize_comm(const Echange_EV_Options& opt, Schema_Comm_Vecteurs& c, FloatVect& v) const override { global_md_->initialize_comm(opt, c, v); }
48 void prepare_send_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs& c, FloatVect& v) const override { global_md_->prepare_send_data(opt, c, v); }
49 void process_recv_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs& c, FloatVect& v) const override { global_md_->process_recv_data(opt, c, v); }
50
51 void initialize_comm(const Echange_EV_Options& opt, Schema_Comm_Vecteurs& c, IntVect& v) const override { global_md_->initialize_comm(opt, c, v); }
52 void prepare_send_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs& c, IntVect& v) const override { global_md_->prepare_send_data(opt, c, v); }
53 void process_recv_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs& c, IntVect& v) const override { global_md_->process_recv_data(opt, c, v); }
54
55#if INT_is_64_ == 2
56 void initialize_comm(const Echange_EV_Options& opt, Schema_Comm_Vecteurs& c, TIDVect& v) const override { global_md_->initialize_comm(opt, c, v); }
57 void prepare_send_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs& c, TIDVect& v) const override { global_md_->prepare_send_data(opt, c, v); }
58 void process_recv_data(const Echange_EV_Options& opt, Schema_Comm_Vecteurs& c, TIDVect& v) const override { global_md_->process_recv_data(opt, c, v); }
59#endif
60
61 const ArrOfInt& get_blocs_items_to_sum() const override { assert(global_md_ != nullptr); return global_md_->blocs_items_to_sum_; }
62 const ArrOfInt& get_items_to_sum() const override { assert(global_md_ != nullptr); return global_md_->get_items_to_sum(); }
63 const ArrOfInt& get_blocs_items_to_compute() const override { assert(global_md_ != nullptr); return global_md_->blocs_items_to_compute_; }
64 const ArrOfInt& get_items_to_compute() const override { assert(global_md_ != nullptr); return global_md_->get_items_to_compute(); }
65
66 const MD_Vector_mono& global_md() const { assert(global_md_ != nullptr); return *global_md_; }
67 inline int nb_parts() const { return data_.size(); }
68 inline int get_shape(int i) const { return shapes_[i]; }
69 inline const MD_Vector& get_desc_part(int i) const { return data_[i]; }
70 inline int get_part_offset(int i) const { return parts_offsets_[i]; }
71 inline Nom get_name(int i) const { return names_[i]; }
72
73 bool use_blocks() const override { assert(is_seq_ != -1); return is_seq_ == 0; }
74
75 int lire_motcle_non_standard(const Motcle& mot, Entree& is) override;
76
77protected:
78 void fill_md_vect_renum(const IntVect& renum, MD_Vector& md_vect) const override;
79 int get_seq_flags_impl(ArrOfBit& flags, int line_size) const override;
80
81 // Same as in MD_Vector_std - those members should be public, but a lot of tools/etc to fix ...:
83 // Descriptor for the entire vector - necessarily a non-composite MD_Vect:
84 std::shared_ptr<MD_Vector_mono> global_md_;
85 // Start index of the n-th part,
86 // parts_offsets_[j] = SUM(i=0..j-1) of ( data_[i].valeure().nb_items_tot() * shapes[i] )
88 // Shape of each part of the array (see class DoubleTab_Parts)
89 ArrOfInt shapes_;
90 // Name of each part
92
93private:
94 int is_seq_ = -1; ///< 1: global_md_ is a 'MD_Vector_seq', 0: global_md_ is 'MD_Vector_std', -1: not initialized.
95 void instanciate_std();
96 void instanciate_seq();
97
98};
99
100#endif /* MD_Vector_composite_included */
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Base class for distributed vectors parallel descriptors.
friend class MD_Vector
Metadata for a distributed composite vector.
Nom get_name(int i) const
void prepare_send_data(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &c, IntVect &v) const override
VECT(MD_Vector) data_
int get_part_offset(int i) const
int lire_motcle_non_standard(const Motcle &mot, Entree &is) override
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
void fill_md_vect_renum(const IntVect &renum, MD_Vector &md_vect) const override
int get_shape(int i) const
int get_seq_flags_impl(ArrOfBit &flags, int line_size) const override
void add_part(const MD_Vector &part, int shape=0, Nom name="")
Append the "part" descriptor to the composite vector.
void initialize_comm(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &c, FloatVect &v) const override
void prepare_send_data(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &c, FloatVect &v) const override
const MD_Vector & get_desc_part(int i) const
void process_recv_data(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &c, IntVect &v) const override
std::shared_ptr< MD_Vector_mono > global_md_
void process_recv_data(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &c, DoubleVect &v) const override
void initialize_comm(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &c, DoubleVect &v) const override
const ArrOfInt & get_blocs_items_to_sum() const override
const ArrOfInt & get_items_to_sum() const override
void process_recv_data(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &c, FloatVect &v) const override
const ArrOfInt & get_items_to_compute() const override
bool use_blocks() const override
const ArrOfInt & get_blocs_items_to_compute() const override
void prepare_send_data(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &c, DoubleVect &v) const override
void initialize_comm(const Echange_EV_Options &opt, Schema_Comm_Vecteurs &c, IntVect &v) const override
const MD_Vector_mono & global_md() const
Generic class for all mono-block MD_Vectors (i.e. non compoosite).
: Cette classe est un OWN_PTR mais l'objet pointe est partage entre plusieurs
Definition MD_Vector.h:48
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
Un tableau de chaine de caracteres (VECT(Nom)).
Definition Noms.h:26