TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Filter_kernel.h
1/****************************************************************************
2* Copyright (c) 2015 - 2016, 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 Filter_kernel_included
16#define Filter_kernel_included
17#include <FixedVector.h>
18#include <IJK_Field.h>
19using std::min;
20
22{
23public:
25 bool normalisation)
26 : ghost_size_(ghost_size), n_mailles_(n_mailles),
27 ponderation_(ponderation), normalisation_(normalisation) {}
28 virtual ~Filter_kernel_base() {};
29
31 inhomogeneous(const bool elem, const int k, const int kg, const int nktot,
32 const double delta, const ArrOfDouble_with_ghost& delta_z) = 0;
33 virtual FixedVector<double, 21> uniform(double delta, double dz) = 0;
34 inline int ghost_size() { return ghost_size_; }
35 inline double n_mailles() { return n_mailles_; }
36 // inline int n_mailles() { return (int)n_mailles_; }
37 inline bool ponderation() { return ponderation_; }
38 inline bool normalisation() { return normalisation_; }
39
40 inline int size_uniform()
41 {
42 const int s = this->ghost_size();
43 return 2 * s + 1;
44 }
45 inline int size_k_elem(const int kg, const int nktot)
46 {
47 const int s = this->ghost_size();
48 return min(2 * s + 1, min(s + kg + 2, s + nktot - kg + 1));
49 }
50 inline int size_k_face(const int kg, const int nktot)
51 {
52 const int s = this->ghost_size();
53 return min(2 * s + 1, min(s + kg + 1, s + nktot - kg + 1));
54 }
55 inline int shift_uniform()
56 {
57 const int s = this->ghost_size();
58 return s;
59 }
60 inline int shift_k_elem(const int kg)
61 {
62 const int s = this->ghost_size();
63 return min(s, kg + 1);
64 }
65 inline int shift_k_face(const int kg)
66 {
67 const int s = this->ghost_size();
68 return min(s, kg);
69 }
70 inline bool is_at_wall_elem(const int kg, const int nktot)
71 {
72 return (kg == -1 || kg == nktot);
73 }
74 inline bool is_at_wall_face(const int kg, const int nktot)
75 {
76 return (kg == 0 || kg == nktot);
77 }
78
79private:
80 int ghost_size_;
81 double n_mailles_;
82 bool ponderation_;
83 bool normalisation_;
84};
85
87{
88public:
89 Filter_kernel_box(int ghost_size) : Filter_kernel_base(1, 3., true, true) {}
91 inhomogeneous(const bool elem, const int k, const int kg, const int nktot,
92 const double delta,
93 const ArrOfDouble_with_ghost& delta_z) override;
94 FixedVector<double, 21> uniform(double delta, double dz) override;
95};
96
98{
99public:
104 inhomogeneous(const bool elem, const int k, const int kg, const int nktot,
105 const double delta,
106 const ArrOfDouble_with_ghost& delta_z) override;
107 FixedVector<double, 21> uniform(double delta, double dz) override;
108};
109
117
125
133
135{
136public:
141 inhomogeneous(const bool elem, const int k, const int kg, const int nktot,
142 const double delta,
143 const ArrOfDouble_with_ghost& delta_z) override;
144 FixedVector<double, 21> uniform(double delta, double dz) override;
145};
146
154
162
170
172{
173public:
178 inhomogeneous(const bool elem, const int k, const int kg, const int nktot,
179 const double delta,
180 const ArrOfDouble_with_ghost& delta_z) override;
181 FixedVector<double, 21> uniform(double delta, double dz) override;
182};
183
191
199
207
209{
210public:
215 inhomogeneous(const bool elem, const int k, const int kg, const int nktot,
216 const double delta,
217 const ArrOfDouble_with_ghost& delta_z) override;
218 FixedVector<double, 21> uniform(double delta, double dz) override;
219};
220
228
236
244
246{
247public:
252 inhomogeneous(const bool elem, const int k, const int kg, const int nktot,
253 const double delta,
254 const ArrOfDouble_with_ghost& delta_z) override;
255 FixedVector<double, 21> uniform(double delta, double dz) override;
256};
257
265
273
281
283{
284public:
289 inhomogeneous(const bool elem, const int k, const int kg, const int nktot,
290 const double delta,
291 const ArrOfDouble_with_ghost& delta_z) override;
292 FixedVector<double, 21> uniform(double delta, double dz) override;
293};
294
302
310
318
320{
321public:
326 inhomogeneous(const bool elem, const int k, const int kg, const int nktot,
327 const double delta,
328 const ArrOfDouble_with_ghost& delta_z) override;
329 FixedVector<double, 21> uniform(double delta, double dz) override;
330};
331
339
347
355
357{
358public:
360 : Filter_kernel_base(1, -9999., false, false) {}
362 inhomogeneous(const bool elem, const int k, const int kg, const int nktot,
363 const double delta,
364 const ArrOfDouble_with_ghost& delta_z) override;
365 FixedVector<double, 21> uniform(double delta, double dz) override;
366};
367
368#endif
virtual FixedVector< double, 21 > uniform(double delta, double dz)=0
bool is_at_wall_elem(const int kg, const int nktot)
virtual FixedVector< double, 21 > inhomogeneous(const bool elem, const int k, const int kg, const int nktot, const double delta, const ArrOfDouble_with_ghost &delta_z)=0
int shift_k_face(const int kg)
int size_k_elem(const int kg, const int nktot)
bool is_at_wall_face(const int kg, const int nktot)
virtual ~Filter_kernel_base()
Filter_kernel_base(int ghost_size, double n_mailles, bool ponderation, bool normalisation)
int size_k_face(const int kg, const int nktot)
int shift_k_elem(const int kg)
FixedVector< double, 21 > uniform(double delta, double dz) override
FixedVector< double, 21 > inhomogeneous(const bool elem, const int k, const int kg, const int nktot, const double delta, const ArrOfDouble_with_ghost &delta_z) override
Filter_kernel_box(int ghost_size)
Filter_kernel_laplacian(int ghost_size)
FixedVector< double, 21 > inhomogeneous(const bool elem, const int k, const int kg, const int nktot, const double delta, const ArrOfDouble_with_ghost &delta_z) override
FixedVector< double, 21 > uniform(double delta, double dz) override
Filter_kernel_weight_12_14_base(int ghost_size, double n_mailles, bool ponderation, bool normalisation)
FixedVector< double, 21 > uniform(double delta, double dz) override
FixedVector< double, 21 > inhomogeneous(const bool elem, const int k, const int kg, const int nktot, const double delta, const ArrOfDouble_with_ghost &delta_z) override
Filter_kernel_weight_12_14_conservatif(int ghost_size)
Filter_kernel_weight_12_14_pondere(int ghost_size)
FixedVector< double, 21 > uniform(double delta, double dz) override
Filter_kernel_weight_13_13_base(int ghost_size, double n_mailles, bool ponderation, bool normalisation)
FixedVector< double, 21 > inhomogeneous(const bool elem, const int k, const int kg, const int nktot, const double delta, const ArrOfDouble_with_ghost &delta_z) override
Filter_kernel_weight_13_13_conservatif(int ghost_size)
Filter_kernel_weight_13_13_pondere(int ghost_size)
Filter_kernel_weight_14_14_18_base(int ghost_size, double n_mailles, bool ponderation, bool normalisation)
FixedVector< double, 21 > inhomogeneous(const bool elem, const int k, const int kg, const int nktot, const double delta, const ArrOfDouble_with_ghost &delta_z) override
FixedVector< double, 21 > uniform(double delta, double dz) override
Filter_kernel_weight_14_14_18_pondere(int ghost_size)
FixedVector< double, 21 > inhomogeneous(const bool elem, const int k, const int kg, const int nktot, const double delta, const ArrOfDouble_with_ghost &delta_z) override
FixedVector< double, 21 > uniform(double delta, double dz) override
Filter_kernel_weight_14_38_base(int ghost_size, double n_mailles, bool ponderation, bool normalisation)
Filter_kernel_weight_14_38_conservatif(int ghost_size)
Filter_kernel_weight_14_38_pondere(int ghost_size)
FixedVector< double, 21 > inhomogeneous(const bool elem, const int k, const int kg, const int nktot, const double delta, const ArrOfDouble_with_ghost &delta_z) override
FixedVector< double, 21 > uniform(double delta, double dz) override
Filter_kernel_weight_15_15_15_base(int ghost_size, double n_mailles, bool ponderation, bool normalisation)
Filter_kernel_weight_15_15_15_pondere(int ghost_size)
FixedVector< double, 21 > inhomogeneous(const bool elem, const int k, const int kg, const int nktot, const double delta, const ArrOfDouble_with_ghost &delta_z) override
FixedVector< double, 21 > uniform(double delta, double dz) override
Filter_kernel_weight_16_16_16_112_base(int ghost_size, double n_mailles, bool ponderation, bool normalisation)
Filter_kernel_weight_23_16_base(int ghost_size, double n_mailles, bool ponderation, bool normalisation)
FixedVector< double, 21 > inhomogeneous(const bool elem, const int k, const int kg, const int nktot, const double delta, const ArrOfDouble_with_ghost &delta_z) override
FixedVector< double, 21 > uniform(double delta, double dz) override
Filter_kernel_weight_23_16_conservatif(int ghost_size)
Filter_kernel_weight_23_16_pondere(int ghost_size)