TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
IJK_Field_template.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 IJK_Field_template_included
17#define IJK_Field_template_included
18
19#include <IJK_Shear_Periodic_helpler.h>
20#include <communications.h>
21#include <Domaine_IJK.h>
22#include <TRUST_Ref.h>
23#include <TRUSTVect.h>
24
25// pour IJK_Lata_writer.cpp. TODO : FIXME : to do enum class !!!!!
26#define DIRECTION_I 0
27#define DIRECTION_J 1
28#define DIRECTION_K 2
29
30/*! @brief : This class is an IJK_Field_local with parallel informations.
31 *
32 * Each processor has a sub_box of the global box, and echange_espace_virtuel(n) exchanges n layers of ghost cells,
33 * echange_espace_virtuel handles periodicity by copying the first layer into the ghost layer on the opposite side.
34 *
35 */
36template<typename _TYPE_, typename _TYPE_ARRAY_>
37class IJK_Field_template : public IJK_Field_local_template<_TYPE_,_TYPE_ARRAY_>
38{
39protected:
40 unsigned taille_memoire() const override { throw; }
41
42 int duplique() const override
43 {
44 IJK_Field_template *xxx = new IJK_Field_template(*this);
45 if (!xxx) Process::exit("Not enough memory !");
46 return xxx->numero();
47 }
48
49 Sortie& printOn(Sortie& os) const override { return os; }
50
51 Entree& readOn(Entree& is) override { return is; }
52
53public:
55 IJK_Field_local_template<_TYPE_,_TYPE_ARRAY_>(),
56 localisation_(Domaine_IJK::Localisation::ELEM)
57 { }
58 void allocate(const Domaine_IJK& d, Domaine_IJK::Localisation l, int ghost_size, int additional_k_layers=0, int nb_compo=1, const Nom& name=Nom(), bool external_storage = false, int monofluide=0, double rov=0., double rol=0., int use_inv_rho_in_pressure_solver=0);
59 void allocate(const Domaine_IJK& d, Domaine_IJK::Localisation l, int ghost_size, const Nom& name)
60 {
61 allocate(d,l,ghost_size,0,1,name);
62 }
63
64 virtual void dumplata_scalar(const char *filename, int step) const;
65
66 const Domaine_IJK& get_domaine() const { return domaine_ref_.valeur(); }
69 //_TYPE_ interpolation_for_shear_periodicity(const int phase, const int send_j, const int send_k);
70 _TYPE_ interpolation_for_shear_periodicity_IJK_Field(const int send_j, const int send_k);
71 void interpolation_for_shear_periodicity_I_sig_kappa(const int send_j, const int send_k_zmin, const int send_k_zmax, _TYPE_& Isigkappazmin, _TYPE_& Isigkappazmax);
72 void redistribute_with_shear_domain_ft(const IJK_Field_double& input, double DU_perio, const int ft_extension);
73 void ajouter_second_membre_shear_perio(IJK_Field_double& resu);
74
77
78 // TODO : we should overload '=' operator and copy ctor to increase counter in those cases too...
79 static inline void increase_alloc_counter(int i=1) { alloc_counter_ += i; }
80 static inline int alloc_counter() { return alloc_counter_; }
81
82protected:
83 OBS_PTR(Domaine_IJK) domaine_ref_;
86
87 static int alloc_counter_; ///< To monitor how many field allocations we perform.
88
89 void exchange_data(int pe_imin_, /* processor to send to */
90 int is, int js, int ks, /* ijk coordinates of first data to send */
91 int pe_imax_, /* processor to recv from */
92 int ir, int jr, int kr, /* ijk coordinates of first data to recv */
93 int isz, int jsz, int ksz, /* size of block data to send/recv */
94 double offset_i = 0., double jump_i=0., int nb_ghost=0);
95};
96
97#include <IJK_Field_template.tpp>
98
99#endif /* IJK_Field_template_included */
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
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
IJK_Shear_Periodic_helpler shear_BC_helpler_
void ajouter_second_membre_shear_perio(IJK_Field_double &resu)
void allocate(const Domaine_IJK &d, Domaine_IJK::Localisation l, int ghost_size, int additional_k_layers=0, int nb_compo=1, const Nom &name=Nom(), bool external_storage=false, int monofluide=0, double rov=0., double rol=0., int use_inv_rho_in_pressure_solver=0)
void echange_espace_virtuel(int ghost)
Exchange data over "ghost" number of cells.
Domaine_IJK::Localisation get_localisation() const
Entree & readOn(Entree &is) override
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
void allocate(const Domaine_IJK &d, Domaine_IJK::Localisation l, int ghost_size, const Nom &name)
IJK_Shear_Periodic_helpler & get_shear_BC_helpler()
unsigned taille_memoire() const override
static void increase_alloc_counter(int i=1)
OBS_PTR(Domaine_IJK) domaine_ref_
void interpolation_for_shear_periodicity_I_sig_kappa(const int send_j, const int send_k_zmin, const int send_k_zmax, _TYPE_ &Isigkappazmin, _TYPE_ &Isigkappazmax)
void redistribute_with_shear_domain_ft(const IJK_Field_double &input, double DU_perio, const int ft_extension)
void exchange_data(int pe_imin_, int is, int js, int ks, int pe_imax_, int ir, int jr, int kr, int isz, int jsz, int ksz, double offset_i=0., double jump_i=0., int nb_ghost=0)
_TYPE_ interpolation_for_shear_periodicity_IJK_Field(const int send_j, const int send_k)
virtual void dumplata_scalar(const char *filename, int step) const
const Domaine_IJK & get_domaine() const
int duplique() const override
const IJK_Shear_Periodic_helpler & get_shear_BC_helpler() const
Sortie & printOn(Sortie &os) const override
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
int numero() const
Renvoie l'indice de l'objet dans Memoire::data.
Definition Objet_U.cpp:268
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52