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//=======================================================================================
34
37
38#include <iomanip>
39#include <sstream>
40
41std::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
47{
48 std::ostringstream headName;
49 headName << " L2Norm Test";
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
90L2NormInformation::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}
static std::shared_ptr< L2NormInformation > getNewInstance(std::vector< std::shared_ptr< L2NormTest > > tests, std::shared_ptr< L2NormTestParameterStruct > testParameter, std::vector< std::string > dataToCalcTests)
void makeCenterHead(std::string head)
@ test_error
Definition TestStatus.h:36
@ simulationCrashed
Definition TestStatus.h:36
@ failed
Definition TestStatus.h:36
@ passed
Definition TestStatus.h:36
std::shared_ptr< T > SPtr