TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Coarsen_Operator_Uniform.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 Coarsen_Operator_Uniform_included
17#define Coarsen_Operator_Uniform_included
18
19#include <Coarsen_Operator_base.h>
20
21// Refine all cells by factor 2 in K, JK or IJK directions
23{
24 Declare_instanciable(Coarsen_Operator_Uniform);
25public:
26 inline void initialize_grid_data(const Grid_Level_Data_double& fine, Grid_Level_Data_double& coarse, int additional_k_layers) override
27 {
28 initialize_grid_data_(fine, coarse, additional_k_layers);
29 }
30 inline void initialize_grid_data(const Grid_Level_Data_float& fine, Grid_Level_Data_float& coarse, int additional_k_layers) override
31 {
32 initialize_grid_data_(fine, coarse, additional_k_layers);
33 }
34 // Compute values on coarse mesh from values on fine mesh
35 inline void coarsen(const IJK_Field_double& fine, IJK_Field_double& coarse, int compute_weighted_average = 0) const override
36 {
37 coarsen_(fine, coarse, compute_weighted_average);
38 }
39 inline void coarsen(const IJK_Field_float& fine, IJK_Field_float& coarse, int compute_weighted_average = 0) const override
40 {
41 coarsen_(fine, coarse, compute_weighted_average);
42 }
43
44 // Interpolate values on coarse mesh to fine mesh and substract them from existing values
45 inline void interpolate_sub_shiftk(const IJK_Field_double& coarse, IJK_Field_double& fine, const int kshift) const override
46 {
47 interpolate_sub_shiftk_(coarse, fine, kshift);
48 }
49 inline void interpolate_sub_shiftk(const IJK_Field_float& coarse, IJK_Field_float& fine, const int kshift) const override
50 {
51 interpolate_sub_shiftk_(coarse, fine, kshift);
52 }
53
54protected:
55 void ajouter_param(Param& param) override;
56 // By how much shall we coarsen in each direction ?
58
59private:
60
61 //ToDo: temporary workaround as virtual templates are not possible...
62 // when suppressing mix precision multigrid, move the template on the class
63 template<typename _TYPE_>
64 void initialize_grid_data_(const Grid_Level_Data_template<_TYPE_>& fine, Grid_Level_Data_template<_TYPE_>& coarse,
65 int additional_k_layers);
66
67 template <typename _TYPE_, typename _TYPE_ARRAY_>
68 void coarsen_(const IJK_Field_template<_TYPE_,_TYPE_ARRAY_>& fine, IJK_Field_template<_TYPE_,_TYPE_ARRAY_>& coarse, int compute_weighted_average = 0) const;
69
70 template <typename _TYPE_, typename _TYPE_ARRAY_>
71 void interpolate_sub_shiftk_(const IJK_Field_template<_TYPE_,_TYPE_ARRAY_>& coarse, IJK_Field_template<_TYPE_,_TYPE_ARRAY_>& fine, const int kshift) const;
72
73};
74
75#include <Coarsen_Operator_Uniform.tpp>
76#endif
void initialize_grid_data(const Grid_Level_Data_float &fine, Grid_Level_Data_float &coarse, int additional_k_layers) override
void interpolate_sub_shiftk(const IJK_Field_float &coarse, IJK_Field_float &fine, const int kshift) const override
void ajouter_param(Param &param) override
void initialize_grid_data(const Grid_Level_Data_double &fine, Grid_Level_Data_double &coarse, int additional_k_layers) override
void interpolate_sub_shiftk(const IJK_Field_double &coarse, IJK_Field_double &fine, const int kshift) const override
void coarsen(const IJK_Field_float &fine, IJK_Field_float &coarse, int compute_weighted_average=0) const override
void coarsen(const IJK_Field_double &fine, IJK_Field_double &coarse, int compute_weighted_average=0) const override
: This class is an IJK_Field_local with parallel informations.
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112