TrioCFD 1.9.9_beta
TrioCFD documentation
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// Structure format to request enlarging a MD_Vector: (proc, item on proc) -> distant item on Process::me()
33typedef std::map<std::array<int, 2>, int> extra_item_t;
34
36{
37public:
38 // ECHANGE_EV: traditional exchange
39 // EV_SOMME: sequential items = sum over all procs sharing the item
40 // EV_SOMME_ECHANGE: same, followed by an ECHANGE_EV to update the virtual items
41 // EV_MIN: sequential items = min over all procs
42 // EV_MIN_COLONNE1: for each shared row of the array, takes the processor with the smallest value
43 // in column 1, sends the entire row to the processor that owns the row.
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 // return value: number of sequential items on this proc (number of flags equal to one in the array)
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)
Same as creer_md_vect_renum() but creates a default numbering.
static void creer_tableau_distribue(const MD_Vector &, Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Transforms v into a parallel array having the 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)
Creates a descriptor for a subset of a vector.
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")
: This class is an OWN_PTR but the pointed object is shared among multiple
Definition MD_Vector.h:48
Base class for output streams.
Definition Sortie.h:52