VirtualFluids
0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
L2NormLogFileInformationBetweenKernels.cpp
Go to the documentation of this file.
1
//=======================================================================================
2
// ____ ____ __ ______ __________ __ __ __ __
3
// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4
// \ \ | | | | | |_) | | | | | | | / \ | |
5
// \ \ | | | | | _ / | | | | | | / /\ \ | |
6
// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7
// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8
// \ \ | | ________________________________________________________________
9
// \ \ | | | ______________________________________________________________|
10
// \ \| | | | __ __ __ __ ______ _______
11
// \ | | |_____ | | | | | | | | | _ \ / _____)
12
// \ | | _____| | | | | | | | | | | \ \ \_______
13
// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14
// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15
//
16
// This file is part of VirtualFluids. VirtualFluids is free software: you can
17
// redistribute it and/or modify it under the terms of the GNU General Public
18
// License as published by the Free Software Foundation, either version 3 of
19
// the License, or (at your option) any later version.
20
//
21
// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24
// for more details.
25
//
26
// SPDX-License-Identifier: GPL-3.0-or-later
27
// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28
//
32
//=======================================================================================
33
#include "
L2NormLogFileInformationBetweenKernels.h
"
34
35
#include "
Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernels.h
"
36
#include "
Tests/L2NormTestBetweenKernels/L2NormTestBetweenKernelsParameterStruct.h
"
37
38
#include <iomanip>
39
#include <sstream>
40
41
std::shared_ptr<L2NormBetweenKernelsInformation>
L2NormBetweenKernelsInformation::getNewInstance
(std::vector<std::shared_ptr<L2NormTestBetweenKernels> > tests, std::shared_ptr<L2NormTestBetweenKernelsParameterStruct>
testPara
, std::vector<std::string> dataToCalcTests)
42
{
43
return
std::shared_ptr<L2NormBetweenKernelsInformation>(
new
L2NormBetweenKernelsInformation
(tests,
testPara
, dataToCalcTests));
44
}
45
46
std::string
L2NormBetweenKernelsInformation::getOutput
()
47
{
48
std::ostringstream
headName
;
49
headName
<<
"L2Norm Test Between Kernels"
;
50
makeCenterHead
(
headName
.str());
51
52
oss
<<
"BasicKernel_L2Norm_BK="
<< basicKernel << std::endl;
53
oss
<<
"DataToCalculate_L2Norm_BK=\""
;
54
for
(
int
i
= 0;
i
< dataToCalc.size();
i
++)
55
oss
<< dataToCalc.at(
i
) <<
" "
;
56
deleteLastCharInOss();
57
oss
<<
"\""
<< std::endl;
58
oss
<<
"TimeSteps_L2Norm_BK=\""
;
59
for
(
int
i
= 0;
i
< timeSteps.size();
i
++)
60
oss
<< timeSteps.at(
i
) <<
" "
;
61
deleteLastCharInOss();
62
oss
<<
"\""
<< std::endl << std::endl;
63
oss
<<
"NormalizeWith_L2Norm_BK=\""
;
64
for
(
int
i
= 0;
i
< normalizeData.size();
i
++)
65
oss
<< normalizeData.at(
i
) <<
" "
;
66
deleteLastCharInOss();
67
oss
<<
"\""
<< std::endl << std::endl;
68
69
std::ostringstream
failMessage
;
70
failMessage
<<
"FailTests_L2Norm_BK=\""
;
71
for
(
int
i
= 0;
i
< tests.size();
i
++) {
72
if
(tests.at(
i
)->getTestStatus() ==
passed
|| tests.at(
i
)->getTestStatus() ==
failed
)
73
oss
<< tests.at(
i
)->getLogFileOutput();
74
if
(tests.at(
i
)->getTestStatus() ==
test_error
|| tests.at(
i
)->getTestStatus() ==
simulationCrashed
)
75
failMessage
<< tests.at(
i
)->getErrorLogFileOutput() <<
" "
;
76
}
77
std::string
fail
=
failMessage
.str();
78
if
(
fail
.back() ==
' '
)
79
fail
=
fail
.substr(0,
fail
.size() - 1);
80
failMessage
.str(std::string());
81
failMessage
<<
fail
<<
"\""
;
82
oss
<<
failMessage
.str() << std::endl << std::endl;
83
84
return
oss
.str();
85
}
86
87
L2NormBetweenKernelsInformation::L2NormBetweenKernelsInformation(std::vector<std::shared_ptr<L2NormTestBetweenKernels> > tests, std::shared_ptr<L2NormTestBetweenKernelsParameterStruct>
testPara
, std::vector<std::string> dataToCalcTests)
88
: tests(tests), dataToCalc(dataToCalcTests)
89
{
90
basicKernel =
testPara
->basicKernel;
91
timeSteps =
testPara
->timeSteps;
92
normalizeData =
testPara
->normalizeData;
93
}
94
95
void
L2NormBetweenKernelsInformation::deleteLastCharInOss()
96
{
97
std::string
myString
=
oss
.str().substr(0,
oss
.str().size() - 1);
98
oss
.str(
""
);
99
oss
.clear();
100
oss
<<
myString
;
101
}
102
L2NormLogFileInformationBetweenKernels.h
L2NormTestBetweenKernels.h
L2NormTestBetweenKernelsParameterStruct.h
L2NormBetweenKernelsInformation
Definition
L2NormLogFileInformationBetweenKernels.h:45
LogFileInformationImp::oss
std::ostringstream oss
Definition
LogFileInformationImp.h:49
L2NormBetweenKernelsInformation::getOutput
std::string getOutput()
Definition
L2NormLogFileInformationBetweenKernels.cpp:46
L2NormBetweenKernelsInformation::getNewInstance
static std::shared_ptr< L2NormBetweenKernelsInformation > getNewInstance(std::vector< std::shared_ptr< L2NormTestBetweenKernels > > tests, std::shared_ptr< L2NormTestBetweenKernelsParameterStruct > testPara, std::vector< std::string > dataToCalcTests)
Definition
L2NormLogFileInformationBetweenKernels.cpp:41
LogFileInformationImp::makeCenterHead
void makeCenterHead(std::string head)
Definition
LogFileInformationImp.cpp:42
test_error
@ test_error
Definition
TestStatus.h:36
simulationCrashed
@ simulationCrashed
Definition
TestStatus.h:36
failed
@ failed
Definition
TestStatus.h:36
passed
@ passed
Definition
TestStatus.h:36
SPtr
std::shared_ptr< T > SPtr
Definition
PointerDefinitions.h:39
tests
numerical-tests
gpu
NumericalTests
Tests
L2NormTestBetweenKernels
LogFileInformation
L2NormLogFileInformationBetweenKernels.cpp
Generated on Fri May 15 2026 00:03:21 for VirtualFluids by
1.9.8