VirtualFluids
0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
L2NormLogFileInformation.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 "
L2NormLogFileInformation.h
"
34
35
#include "
Tests/L2NormTest/L2NormTest.h
"
36
#include "
Tests/L2NormTest/L2NormTestParameterStruct.h
"
37
38
#include <iomanip>
39
#include <sstream>
40
41
std::shared_ptr<L2NormInformation>
L2NormInformation::getNewInstance
(std::vector<std::shared_ptr<L2NormTest> > tests, std::shared_ptr<L2NormTestParameterStruct>
testParameter
, std::vector<std::string> dataToCalcTests)
42
{
43
return
std::shared_ptr<L2NormInformation>(
new
L2NormInformation
(tests,
testParameter
, dataToCalcTests));
44
}
45
46
std::string
L2NormInformation::getOutput
()
47
{
48
std::ostringstream
headName
;
49
headName
<<
" L2Norm Test"
;
50
makeCenterHead
(
headName
.str());
51
52
oss
<<
"BasicTimeStep_L2Norm="
<< basicTimeStep << std::endl;
53
oss
<<
"DivergentTimeStep_L2Norm="
<< divergentTimeStep << std::endl;
54
oss
<<
"DataToCalc_L2Norm=\""
;
55
for
(
int
i
= 0;
i
< dataToCalc.size();
i
++) {
56
oss
<< dataToCalc.at(
i
);
57
if
(
i
< dataToCalc.size() - 1)
58
oss
<<
" "
;
59
else
60
oss
<<
"\""
<< std::endl;
61
}
62
oss
<<
"NormalizeData_L2Norm=\""
;
63
for
(
int
i
= 0;
i
< normalizeData.size();
i
++) {
64
oss
<< normalizeData.at(
i
);
65
if
(
i
< normalizeData.size() - 1)
66
oss
<<
" "
;
67
else
68
oss
<<
"\""
<< std::endl;
69
}
70
oss
<< std::endl;
71
72
std::ostringstream
failMessage
;
73
failMessage
<<
"FailTests_L2Norm=\""
;
74
for
(
int
i
= 0;
i
< tests.size();
i
++) {
75
if
(tests.at(
i
)->getTestStatus() ==
passed
|| tests.at(
i
)->getTestStatus() ==
failed
)
76
oss
<< tests.at(
i
)->getLogFileOutput();
77
if
(tests.at(
i
)->getTestStatus() ==
test_error
|| tests.at(
i
)->getTestStatus() ==
simulationCrashed
)
78
failMessage
<< tests.at(
i
)->getErrorLogFileOutput() <<
" "
;
79
}
80
std::string
fail
=
failMessage
.str();
81
if
(
fail
.back() ==
' '
)
82
fail
=
fail
.substr(0,
fail
.size() - 1);
83
failMessage
.str(std::string());
84
failMessage
<<
fail
<<
"\""
;
85
oss
<<
failMessage
.str() << std::endl << std::endl;
86
87
return
oss
.str();
88
}
89
90
L2NormInformation::L2NormInformation(std::vector<std::shared_ptr<L2NormTest> > tests, std::shared_ptr<L2NormTestParameterStruct>
testParameter
, std::vector<std::string> dataToCalcTests) : tests(tests), dataToCalc(dataToCalcTests)
91
{
92
basicTimeStep =
testParameter
->basicTimeStep;
93
divergentTimeStep =
testParameter
->divergentTimeStep;
94
normalizeData =
testParameter
->normalizeData;
95
}
L2NormLogFileInformation.h
L2NormTest.h
L2NormTestParameterStruct.h
L2NormInformation
Definition
L2NormLogFileInformation.h:45
LogFileInformationImp::oss
std::ostringstream oss
Definition
LogFileInformationImp.h:49
L2NormInformation::getOutput
std::string getOutput()
Definition
L2NormLogFileInformation.cpp:46
L2NormInformation::getNewInstance
static std::shared_ptr< L2NormInformation > getNewInstance(std::vector< std::shared_ptr< L2NormTest > > tests, std::shared_ptr< L2NormTestParameterStruct > testParameter, std::vector< std::string > dataToCalcTests)
Definition
L2NormLogFileInformation.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
L2NormTest
LogFileInformation
L2NormLogFileInformation.cpp
Generated on Fri May 15 2026 00:03:21 for VirtualFluids by
1.9.8