Microflow 3D  v1.0
ConsoleWriter.h
Go to the documentation of this file.
1 // ==============================================================================================
2 // Microflow 3D, http://www.microflow.pwr.edu.pl/
3 // Created by Roman Szafran on 25.03.19.
4 // Copyright (c) 2019 Wroclaw University of Science and Technology.
5 // Distributed under the Apache License, Version 2.0. You may obtain a copy of the License at
6 // http://www.apache.org/licenses/LICENSE-2.0 or see accompanying file license.txt.
7 // Redistributions of source code must retain the above copyright and license notice.
8 // ==============================================================================================
9 
10 #pragma once
11 
12 #include <cstring>
13 #include <iostream>
14 #include <memory>
15 #include <iomanip>
16 #include <chrono>
17 #include <cstdlib>
18 #include <cstdio>
19 
22 #include "MFDatabase/ConfigData.h"
25 
26 namespace MF {
27  namespace Solver_CPU {
28 
31  {
32  public:
33  ConsoleWriter() = default;
34  ~ConsoleWriter() = default;
35 
36  static double m_VSum, m_minMLUPS, m_maxMLUPS;
37  static unsigned int m_SimPreviousStep;
38  static unsigned int m_iter;
39  static std::chrono::time_point<std::chrono::high_resolution_clock> m_TimePreviousStep;
40 
41  static void ThreadsArrayInfo (const std::shared_ptr<MF::Database::ThreadArray>& ThreadArray_Ptr);
42 
43  static void ThreadsNodeInfo (const std::shared_ptr<MF::Database::ThreadArray>& ThreadArray_Ptr);
44 
45  static void ExtendedInfo(const std::shared_ptr<MF::Solver_CPU::ProgramParameters>& ProgramParameters_Ptr, const std::shared_ptr<MF::Solver_CPU::CaseParameters>& CaseParameters_Ptr,
46  const std::shared_ptr<MF::Database::ConfigData>& ConfigData_Ptr);
47 
48  static void PrintComputationParameters(const std::shared_ptr<MF::Solver_CPU::CaseParameters>& CaseParameters_Ptr);
49 
50  static void PrintGridStatistics(const std::shared_ptr<MF::Database::ThreadArray>& ThreadArray_Ptr);
51 
52  static void PrintCPUInfo(const int &CPU_ThreadsNr);
53 
54  static void PrintTimeStepStatistics(double& V_SimError, double& M_SimError, const unsigned int & SimStep, const std::shared_ptr<MF::Database::ThreadArray>& ThreadArray_Ptr,
55  const std::shared_ptr<MF::Solver_CPU::CaseParameters>& CaseParameters_Ptr);
56 
57  static void PrintComputationStatistics(std::chrono::time_point<std::chrono::high_resolution_clock> TimeStart,
58  std::chrono::time_point<std::chrono::high_resolution_clock> TimeStop,
59  unsigned int SimStep, const std::shared_ptr<MF::Database::ThreadArray>& ThreadArray_Ptr);
60 
61  static int parseFileLine(char* line);
62  static int getMemoryUsageValue();
63  };
64 
65  } /* namespace Solver_CPU */
66 } /* namespace MF */
67 
static unsigned int m_iter
Definition: ConsoleWriter.h:38
static void PrintTimeStepStatistics(double &V_SimError, double &M_SimError, const unsigned int &SimStep, const std::shared_ptr< MF::Database::ThreadArray > &ThreadArray_Ptr, const std::shared_ptr< MF::Solver_CPU::CaseParameters > &CaseParameters_Ptr)
Prints on console time step statistics.
static void PrintComputationStatistics(std::chrono::time_point< std::chrono::high_resolution_clock > TimeStart, std::chrono::time_point< std::chrono::high_resolution_clock > TimeStop, unsigned int SimStep, const std::shared_ptr< MF::Database::ThreadArray > &ThreadArray_Ptr)
Prints on console final computation statistics.
static void PrintCPUInfo(const int &CPU_ThreadsNr)
Prints on console CPU usage info.
static void ExtendedInfo(const std::shared_ptr< MF::Solver_CPU::ProgramParameters > &ProgramParameters_Ptr, const std::shared_ptr< MF::Solver_CPU::CaseParameters > &CaseParameters_Ptr, const std::shared_ptr< MF::Database::ConfigData > &ConfigData_Ptr)
Prints on console case and program parameters and also uid-threads defined in thread_params.cfg.
static unsigned int m_SimPreviousStep
Definition: ConsoleWriter.h:37
static void ThreadsArrayInfo(const std::shared_ptr< MF::Database::ThreadArray > &ThreadArray_Ptr)
Prints on console information about all MFThreads.
 The ConsoleWriter class collects functions that prints information on console.
Definition: ConsoleWriter.h:30
static std::chrono::time_point< std::chrono::high_resolution_clock > m_TimePreviousStep
Definition: ConsoleWriter.h:39
static void ThreadsNodeInfo(const std::shared_ptr< MF::Database::ThreadArray > &ThreadArray_Ptr)
Prints on console information about all Threads node.
static int parseFileLine(char *line)
static void PrintGridStatistics(const std::shared_ptr< MF::Database::ThreadArray > &ThreadArray_Ptr)
Prints on console basic grid statistics.
static void PrintComputationParameters(const std::shared_ptr< MF::Solver_CPU::CaseParameters > &CaseParameters_Ptr)
Prints on console basic solution parameters.