TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Partitionneur_Tranche.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_Tranche_included
16#define Partitionneur_Tranche_included
17
18#include <Partitionneur_base.h>
19#include <TRUSTTabs_forward.h>
20#include <TRUST_Ref.h>
21
22#include <Domaine_forward.h>
23
24/*! @brief Domain partitioner that splits the domain into slabs parallel to the coordinate directions.
25 *
26 * See construire_partition
27 *
28 */
29template <typename _SIZE_>
31{
32 Declare_instanciable_with_param_32_64(Partitionneur_Tranche_32_64);
33
34protected:
35 void validate_params() const override;
36
37public:
38 using int_t = _SIZE_;
39 using ArrOfInt_t = ArrOfInt_T<_SIZE_>;
40 using IntVect_t = IntVect_T<_SIZE_>;
41 using IntTab_t = IntTab_T<_SIZE_>;
43
44 using BigIntVect_ = TRUSTVect<int, _SIZE_>; // always int as value type, will hold proc/partition number.
45
46 void associer_domaine(const Domaine_t& domaine) override;
47 void initialiser(const ArrOfInt& nb_tranches);
48 void construire_partition(BigIntVect_& elem_part, int& nb_parts_tot) const override;
49 static void chercher_direction_perio(const Domaine_t& domaine, ArrOfInt& directions_perio);
50
51private:
52 // Partitioner parameters
53 OBS_PTR(Domaine_t) ref_domaine_;
54
55 // For each space dimension (2 or 3), the number of slabs
56 // to create in that direction (>=1)
57 ArrOfInt nb_tranches_;
58};
59
60using Partitionneur_Tranche = Partitionneur_Tranche_32_64<int>;
61using Partitionneur_Tranche_64 = Partitionneur_Tranche_32_64<trustIdType>;
62
63#endif
class Domaine_32_64 A Domain is a mesh composed of a set of geometric elements of the same type.
Definition Domaine.h:62
Domain partitioner that splits the domain into slabs parallel to the coordinate directions.
void validate_params() const override
The syntax is { Tranches nx ny [ nz ] }.
static void chercher_direction_perio(const Domaine_t &domaine, ArrOfInt &directions_perio)
Fills the directions_perio array from the names of the periodic boundaries.
void associer_domaine(const Domaine_t &domaine) override
First initialization step of the partitioner: associates a domain.
Domaine_32_64< _SIZE_ > Domaine_t
void construire_partition(BigIntVect_ &elem_part, int &nb_parts_tot) const override
void initialiser(const ArrOfInt &nb_tranches)
Second initialization step: defines the number of slabs.
TRUSTVect< int, _SIZE_ > BigIntVect_
Base class for domain partitioners (for splitting a mesh before a parallel computation).