TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Redistribute_Field.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 Redistribute_Field_included
17#define Redistribute_Field_included
18
19#include <IJK_Field.h>
20#include <IJK_Field_vector.h>
21#include <TRUSTTabs.h>
22#include <Schema_Comm_Vecteurs.h>
23
24// Classe outil permettant de redistribuer un champ d'un maillage ijk sur un maillage
25// distribue differemment (copie maille par maille sans interpolation)
27{
28public:
29 void initialize(const Domaine_IJK& input,
30 const Domaine_IJK& output,
32 void initialize(const Domaine_IJK& input,
33 const Domaine_IJK& output,
35 const VECT(IntTab) & redistribute_maps);
36 void redistribute(const IJK_Field_double& input_field,
37 IJK_Field_double& output_field)
38 {
39 redistribute_(input_field, output_field, false);
40 }
41 template<class T, int N>
42 void redistribute(const IJK_Field_vector<T, N>& input_field,
43 IJK_Field_vector<T, N>& output_field)
44 {
45 for (int i = 0; i < N; i++)
46 redistribute_(input_field[i], output_field[i], false);
47 }
48 void redistribute_add(const IJK_Field_double& input_field,
49 IJK_Field_double& output_field)
50 {
51 redistribute_(input_field, output_field, true);
52 }
53 template<class T, int N>
55 IJK_Field_vector<T, N>& output_field)
56 {
57 for (int i = 0; i < N; i++)
58 redistribute_(input_field[i], output_field[i], true);
59 }
60 void redistribute(const IJK_Field_float& input_field,
61 IJK_Field_float& output_field)
62 {
63 redistribute_(input_field, output_field, false);
64 }
65 void redistribute_add(const IJK_Field_float& input_field,
66 IJK_Field_float& output_field)
67 {
68 redistribute_(input_field, output_field, true);
69 }
70protected:
71 void redistribute_(const IJK_Field_double& input_field,
72 IJK_Field_double& output_field,
73 bool add);
74 void redistribute_(const IJK_Field_float& input_field,
75 IJK_Field_float& output_field,
76 bool add);
77 static void intersect(const int s1, const int n1, int& s2, int& n2, int& s3);
78 void compute_send_blocs(const Domaine_IJK& input,
79 const Domaine_IJK& output,
80 const Domaine_IJK::Localisation localisation,
81 const int dir,
82 const IntTab& global_index_mapping,
83 IntTab& send_blocs);
84
89};
90#endif
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
Definition Domaine_IJK.h:47
Localisation
Localisation sub class.
Definition Domaine_IJK.h:53
The class IJK_Field_vector is a fixed array of polymorphic IJK fields.
Schema_Comm_Vecteurs schema_comm_
static void intersect(const int s1, const int n1, int &s2, int &n2, int &s3)
void redistribute_(const IJK_Field_double &input_field, IJK_Field_double &output_field, bool add)
void compute_send_blocs(const Domaine_IJK &input, const Domaine_IJK &output, const Domaine_IJK::Localisation localisation, const int dir, const IntTab &global_index_mapping, IntTab &send_blocs)
FixedVector< IntTab, 3 > recv_blocs_
FixedVector< IntTab, 3 > send_blocs_
void redistribute(const IJK_Field_vector< T, N > &input_field, IJK_Field_vector< T, N > &output_field)
void redistribute(const IJK_Field_float &input_field, IJK_Field_float &output_field)
void redistribute(const IJK_Field_double &input_field, IJK_Field_double &output_field)
void redistribute_add(const IJK_Field_float &input_field, IJK_Field_float &output_field)
void redistribute_add(const IJK_Field_double &input_field, IJK_Field_double &output_field)
void redistribute_add(const IJK_Field_vector< T, N > &input_field, IJK_Field_vector< T, N > &output_field)
void initialize(const Domaine_IJK &input, const Domaine_IJK &output, const Domaine_IJK::Localisation loc)