TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
MD_Vector_tools.h
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#ifndef MD_Vector_tools_included
17#define MD_Vector_tools_included
18
19#include <TRUSTTabs_forward.h>
20#include <Array_base.h>
21#include <MD_Vector.h>
22#include <ArrOfBit.h>
23#include <Schema_Comm_Vecteurs.h>
24#include <array>
25#include <map>
26
27
29class Domaine_VF;
31
32//format de structure pour demander d'agrandir un MD_Vector : (proc, item sur le proc) -> item distant sur Process::me()
33typedef std::map<std::array<int, 2>, int> extra_item_t;
34
36{
37public:
38 // ECHANGE_EV: echange traditionnel
39 // EV_SOMME: items sequentiels = somme sur tous les procs qui partagent l'item
40 // EV_SOMME_ECHANGE: idem, suivi d'un ECHANGE_EV pour mettre a jour les items virtuels
41 // EV_MIN: items sequentiel = min sur tous les procs
42 // EV_MIN_COLONNE1: pour chaque ligne partagee du tableau, prend le processeur qui a la plus petite valeur
43 // dans la colonne1, envoie toute la ligne au processeur qui possede la ligne.
45
46 static void creer_tableau_distribue(const MD_Vector&, Array_base&, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT);
47
48 static void echange_espace_virtuel(IntVect&, Operations_echange opt=ECHANGE_EV, IsExchangeBlocking is_exchange_blocking = IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname");
49#if INT_is_64_ == 2
50 static void echange_espace_virtuel(TIDVect& v, Operations_echange opt=ECHANGE_EV, IsExchangeBlocking is_exchange_blocking = IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname");
51#endif
52 static void echange_espace_virtuel(DoubleVect&, Operations_echange opt=ECHANGE_EV, IsExchangeBlocking is_exchange_blocking = IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname");
53 static void echange_espace_virtuel(FloatVect&, Operations_echange opt=ECHANGE_EV, IsExchangeBlocking is_exchange_blocking = IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname");
54
55 // valeur de retour: nombre d'items sequentiels sur ce proc (nombre de flags a un dans le tableau)
56 static void compute_sequential_items_index(const MD_Vector&, MD_Vector_renumber&, int line_size = 1);
57 static void creer_md_vect_renum(const IntVect& renum, MD_Vector& md_vect);
58 static void creer_md_vect_renum_auto(IntVect& flags_renum, MD_Vector& md_vect);
59
60 static void dump_vector_with_md(const DoubleVect&, Sortie&);
61 static void restore_vector_with_md(DoubleVect&, Entree&);
62
63 static void CleanMyStatics() { last_md.detach(); }
64
65private:
66 template <typename _TYPE_>
67 static void perform_virtual_exchange(const MD_Vector& md, TRUSTVect<_TYPE_>& v, const Echange_EV_Options& opt, IsExchangeBlocking is_exchange_blocking= IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname");
68 template<typename _TYPE_>
69 static void select_virtual_exchange_operation(const MD_Vector& md, TRUSTVect<_TYPE_>& v, MD_Vector_tools::Operations_echange opt, IsExchangeBlocking is_exchange_blocking, const std::string kernel_name);
70 template<typename _TYPE_>
71 static void call_virtual_exchange(TRUSTVect<_TYPE_>& v, MD_Vector_tools::Operations_echange opt, IsExchangeBlocking is_exchange_blocking, const std::string kernel_name);
72
73 static Schema_Comm_Vecteurs comm;
74 static MD_Vector last_md;
75 static int last_isdouble;
76 static int last_linesize;
77 static Echange_EV_Options last_opt;
78};
79
80#endif /* MD_Vector_tools_included */
Empty class used as a base for all the arrays.
Definition Array_base.h:41
class Domaine_VF
Definition Domaine_VF.h:44
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
static void dump_vector_with_md(const DoubleVect &, Sortie &)
dumps vector v with its parallel descriptor to os.
static void CleanMyStatics()
static void creer_md_vect_renum_auto(IntVect &flags_renum, MD_Vector &md_vect)
Idem que creer_md_vect_renum() mais cree une numerotation par defaut.
static void creer_tableau_distribue(const MD_Vector &, Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
transforme v en un tableau parallele ayant la structure md.
static void restore_vector_with_md(DoubleVect &, Entree &)
restores a vector saved by dump_vector_with_md.
static void creer_md_vect_renum(const IntVect &renum, MD_Vector &md_vect)
cree un descripteur pour un sous-ensemble d'un vecteur.
static void compute_sequential_items_index(const MD_Vector &, MD_Vector_renumber &, int line_size=1)
static void echange_espace_virtuel(IntVect &, Operations_echange opt=ECHANGE_EV, IsExchangeBlocking is_exchange_blocking=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
: Cette classe est un OWN_PTR mais l'objet pointe est partage entre plusieurs
Definition MD_Vector.h:48
Classe de base des flux de sortie.
Definition Sortie.h:52