OpenLB 1.7
Loading...
Searching...
No Matches
superErrorNorm3D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2018 Adrian Kummerlaender
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
24#ifndef ERROR_NORM_3D_HH
25#define ERROR_NORM_3D_HH
26
27#include "superErrorNorm3D.h"
29
30namespace olb {
31
32
33template <typename T, typename W, int P>
34template <typename DESCRIPTOR>
39 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF)
40 : SuperIdentity3D<T,W>([&]()
41{
42 using namespace functor_dsl;
43
44 auto wantedLatticeF = restrictF(wantedF.toShared(), sLattice);
45
46 return norm<P>(wantedLatticeF - f.toShared(), indicatorF.toShared())
47 / norm<P>(wantedLatticeF, indicatorF.toShared());
48}())
49{
50 this->getName() = "relErrorNormL" + std::to_string(P);
51}
52
53template <typename T, typename W, int P>
54template <typename DESCRIPTOR>
58 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF)
59 : SuperRelativeErrorLpNorm3D(f.getSuperLattice(),
60 f,
61 std::forward<decltype(wantedF)>(wantedF),
62 std::forward<decltype(indicatorF)>(indicatorF))
63{ }
64
65
66template <typename T, typename W, int P>
67template <typename DESCRIPTOR>
72 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF)
73 : SuperIdentity3D<T,W>([&]()
74{
75 using namespace functor_dsl;
76
77 return norm<P>(restrictF(wantedF.toShared(), sLattice) - f.toShared(),
78 indicatorF.toShared());
79}())
80{
81 this->getName() = "absErrorNormL" + std::to_string(P);
82}
83
84template <typename T, typename W, int P>
85template <typename DESCRIPTOR>
89 FunctorPtr<SuperIndicatorF3D<T>>&& indicatorF)
90 : SuperAbsoluteErrorLpNorm3D(f.getSuperLattice(),
91 f,
92 std::forward<decltype(wantedF)>(wantedF),
93 std::forward<decltype(indicatorF)>(indicatorF))
94{ }
95
96
97}
98
99#endif
AnalyticalF are applications from DD to XD, where X is set by the constructor.
Smart pointer for managing the various ways of passing functors around.
Definition functorPtr.h:60
Absolute error norm functor.
SuperAbsoluteErrorLpNorm3D(SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperF3D< T, W > > &&f, FunctorPtr< AnalyticalF3D< T, W > > &&wantedF, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
represents all functors that operate on a SuperStructure<T,3> in general
identity functor for memory management
Base indicator functor (discrete)
represents all functors that operate on a SuperLattice in general, e.g. getVelocity(),...
Super class maintaining block lattices for a cuboid decomposition.
Relative error norm functor.
SuperRelativeErrorLpNorm3D(SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperF3D< T, W > > &&f, FunctorPtr< AnalyticalF3D< T, W > > &&wantedF, FunctorPtr< SuperIndicatorF3D< T > > &&indicatorF)
Top level namespace for all of OpenLB.