TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Partitionneur_base.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#ifndef Partitionneur_base_included
16#define Partitionneur_base_included
17
18#include <TRUSTTabs_forward.h>
19#include <Noms.h>
20#include <Static_Int_Lists.h>
21
22#include <Objet_U_With_Params.h>
23class Param;
24#include <Domaine_forward.h>
25
26/*! @brief Base class for domain partitioners (for splitting a mesh before a parallel computation).
27 *
28 * This class describes the interface common to all partitioners.
29 * Example:
30 *
31 * // Create an instance of the class:
32 * Partitionneur_xxx part;
33 * // Associate the computational domain to be split
34 * part.associer_domaine(domaine);
35 * // Initialise the parameters specific to the derived class!
36 * fichier_data >> part; // Read parameters from the data file
37 * or
38 * part.initialiser(nb_parties); // Direct initialisation (depends on the class)
39 * // If needed:
40 * part.declarer_bords_periodiques(liste_noms_bords_perio);
41 * // Build the partition array:
42 * ArrOfInt elem_part;
43 * part.construire_partition(elem_part);
44 *
45 * WARNING: in principle, the implementation of construire_partition()
46 * must ensure that the partition is valid (applying corrections for periodic
47 * boundaries and others...)
48 *
49 */
50template <typename _SIZE_>
52{
53 Declare_base_with_param_32_64(Partitionneur_base_32_64);
54
55public:
56 using int_t = _SIZE_;
57 using ArrOfInt_t = ArrOfInt_T<_SIZE_>;
58 using IntVect_t = IntVect_T<_SIZE_>;
59 using IntTab_t = IntTab_T<_SIZE_>;
63
64 using BigArrOfInt_ = TRUSTArray<int, _SIZE_>; // always int as value type, will hold proc/partition number.
66
67 int lire_motcle_non_standard(const Motcle&, Entree&) override { return -1; }
68 virtual void associer_domaine(const Domaine_t& domaine) = 0;
69 virtual void construire_partition(BigIntVect_& elem_part, int& nb_parts_tot) const = 0;
70
71 static void corriger_elem0_sur_proc0(BigIntVect_& elem_part);
72
74 const Static_Int_Lists_t& som_elem, const int_t my_offset,
75 Static_Int_Lists_t& graph);
76
77 static int_t corriger_bords_avec_graphe(const Static_Int_Lists_t& graph_elements_perio, const Static_Int_Lists_t& som_elem,
78 const Domaine_t& domaine, BigIntVect_& elem_part);
79 static void corriger_bords_avec_liste(const Domaine_t& dom, const int_t my_offset, BigIntVect_& elem_part);
80 static int_t corriger_sommets_bord(const Domaine_t& domaine, const ArrOfInt_t& renum_som_perio,
81 const Static_Int_Lists_t& som_elem, BigIntVect_& elem_part);
82 static int_t corriger_multiperiodique(const Domaine_t& domaine, const ArrOfInt_t& renum_som_perio,
83 const Static_Int_Lists_t& som_elem, BigIntVect_& elem_part);
84
85};
86
87using Partitionneur_base = Partitionneur_base_32_64<int>;
88using Partitionneur_base_64 = Partitionneur_base_32_64<trustIdType>;
89
90#endif
Class Bord This class represents a boundary of a domain, it is a type of frontier.
Definition Bord.h:31
class Domaine_32_64 A Domain is a mesh composed of a set of geometric elements of the same type.
Definition Domaine.h:62
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
A character string (Nom) in uppercase.
Definition Motcle.h:26
Inherits from Objet_U, adds the very common method set_param for the Objet_U hierarchy.
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
Base class for domain partitioners (for splitting a mesh before a parallel computation).
TRUSTArray< int, _SIZE_ > BigArrOfInt_
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
static int_t corriger_bords_avec_graphe(const Static_Int_Lists_t &graph_elements_perio, const Static_Int_Lists_t &som_elem, const Domaine_t &domaine, BigIntVect_ &elem_part)
Corrects elem_part so that element i is on the same partition elem_part[i] as all elements connected ...
static void corriger_bords_avec_liste(const Domaine_t &dom, const int_t my_offset, BigIntVect_ &elem_part)
Computes the periodic element connectivity graphs and calls corriger_periodique_avec_graphe.
static void corriger_elem0_sur_proc0(BigIntVect_ &elem_part)
Corrects the partition so that element 0 of the initial domain is on the first sub-domain of the part...
ArrOfInt_T< _SIZE_ > ArrOfInt_t
static int_t corriger_sommets_bord(const Domaine_t &domaine, const ArrOfInt_t &renum_som_perio, const Static_Int_Lists_t &som_elem, BigIntVect_ &elem_part)
Modifies elem_part to ensure the following properties: 1) Elements that have a boundary vertex are as...
virtual void associer_domaine(const Domaine_t &domaine)=0
IntVect_T< _SIZE_ > IntVect_t
TRUSTVect< int, _SIZE_ > BigIntVect_
Domaine_32_64< _SIZE_ > Domaine_t
Bord_32_64< _SIZE_ > Bord_t
static int_t corriger_multiperiodique(const Domaine_t &domaine, const ArrOfInt_t &renum_som_perio, const Static_Int_Lists_t &som_elem, BigIntVect_ &elem_part)
Applies corrections to elem_part so that multi-periodicity is correct:
IntTab_T< _SIZE_ > IntTab_t
virtual void construire_partition(BigIntVect_ &elem_part, int &nb_parts_tot) const =0
Static_Int_Lists_32_64< _SIZE_ > Static_Int_Lists_t
static int_t calculer_graphe_connexions_periodiques(const Domaine_t &domaine, const Static_Int_Lists_t &som_elem, const int_t my_offset, Static_Int_Lists_t &graph)
Computes a connectivity graph between elements connected by periodic faces.
This class allows storing lists of integers accessible in constant time.
Represents a an array of int/int64/double/... values.
Definition TRUSTArray.h:81