TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
MD_Vector_mono.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_mono_included
17#define MD_Vector_mono_included
18
19#include <MD_Vector_base.h>
20
21/*! @brief Generic class for all mono-block MD_Vectors (i.e. non compoosite)
22 *
23 * The two main members of this class are blocs_items_to_sum_ and blocs_items_to_compute_.
24 * Note that those two members are hence **not** present in a MD_Vector_composite. For this case
25 * the redirection is made to the inner MD_Vector_mono member which aggregates the information.
26 *
27 * See also class MD_Vector_composite
28 */
30{
31
32 Declare_base(MD_Vector_mono);
33
34public:
35 const ArrOfInt& get_blocs_items_to_sum() const override { return blocs_items_to_sum_; }
36 const ArrOfInt& get_items_to_sum() const override;
37 const ArrOfInt& get_blocs_items_to_compute() const override { return blocs_items_to_compute_; }
38 const ArrOfInt& get_items_to_compute() const override;
39
40protected:
41 // MD_Vector_composite needs to see inside MD_Vector_mono because of its global_md_ member:
42 friend class MD_Vector_composite;
43
44 // Methods to extend/complete a MD_Vector_mono with another MD_Vector_mono - not all combinations are possible.
45 // See derived classes MD_Vector_seq and MD_Vector_std.
46 // For example extending a MD_Vector_std with a MD_Vector_seq is not possible.
47 virtual void append_from_other_std(const MD_Vector_std& src, int offset, int multiplier) { throw; }
48 virtual void append_from_other_seq(const MD_Vector_seq& src, int offset, int multiplier) { throw; }
49
50 // ***** Les membres suivants sont utilises pour calculer des sommes, produits scalaires, normes ******
51 // Indices de tous les items dont je suis proprietaire (ce sont les "items sequentiels", definis comme
52 // etant tous ceux dont la valeur n'est pas recue d'un autre processeur lors d'un echange_espace_virtuel).
53 // Pour faire une somme sur tous les items, il faut sommer les valeurs de tous les items
54 // de ces blocs. Le tableau contient debut_bloc1, fin_bloc1, debut_bloc2, fin_bloc2, etc...
55 // (fin_bloc est l'indice du dernier element + 1)
56 // (structure utilisee pour les sauvegardes sequentielles (xyz ou debog), les calculs de normes de vecteurs, etc)
58 mutable ArrOfInt items_to_sum_; // All items (more suitable for TRUSTVect_tools kernels on GPU)
59 // Indices de tous les items pour lesquels il faut calculer une valeur
60 // (utilise par DoubleTab::operator+=(const DoubleTab &) par exemple)
61 // En theorie, il suffirait de prendre blocs_items_to_sum_, mais ce dernier est
62 // plein de trous et peut etre inefficace. En pratique, on calcule toutes les valeurs
63 // reeles.
65 mutable ArrOfInt items_to_compute_; // All items (more suitable for TRUSTVect_tools kernels on GPU)
66};
67#endif
Base class for distributed vectors parallel descriptors.
Generic class for all mono-block MD_Vectors (i.e. non compoosite).
friend class MD_Vector_composite
ArrOfInt items_to_sum_
const ArrOfInt & get_items_to_compute() const override
ArrOfInt items_to_compute_
ArrOfInt blocs_items_to_sum_
virtual void append_from_other_std(const MD_Vector_std &src, int offset, int multiplier)
const ArrOfInt & get_items_to_sum() const override
virtual void append_from_other_seq(const MD_Vector_seq &src, int offset, int multiplier)
const ArrOfInt & get_blocs_items_to_sum() const override
const ArrOfInt & get_blocs_items_to_compute() const override
ArrOfInt blocs_items_to_compute_
Dummy parallel descriptor used for sequential computations.
C'est le plus simple des descripteurs, utilise pour les tableaux de valeurs aux sommets,...