My Project
ParallelFileMerger.hpp
1 /*
2  Copyright 2016 Dr. Blatt - HPC-Simulation-Software & Services
3  Copyright 2016 STATOIL AS.
4 
5  This file is part of the Open Porous Media project (OPM).
6 
7  OPM is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  OPM is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with OPM. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef OPM_PARALLELFILEMERGER_HEADER_INCLUDED
22 #define OPM_PARALLELFILEMERGER_HEADER_INCLUDED
23 
24 #include <fstream>
25 #include <memory>
26 #include <regex>
27 #include <string>
28 
29 #include <opm/common/utility/FileSystem.hpp>
30 
31 
32 namespace Opm
33 {
34 namespace detail
35 {
36 
37 namespace fs = ::Opm::filesystem;
38 
46 {
47 public:
51  ParallelFileMerger(const fs::path& output_dir,
52  const std::string& deckname,
53  bool show_fallout = false);
54 
55  void operator()(const fs::path& file);
56 
57 private:
62  void appendFile(std::ofstream& of, const fs::path& file, const std::string& rank);
63 
65  std::regex debugFileRegex_;
67  std::regex logFileRegex_;
69  std::regex fileWarningRegex_;
71  std::unique_ptr<std::ofstream> debugStream_;
73  std::unique_ptr<std::ofstream> logStream_;
75  bool show_fallout_;
76 };
77 } // end namespace detail
78 } // end namespace Opm
79 #endif // end header guard
A functor that merges multiple files of a parallel run to one file.
Definition: ParallelFileMerger.hpp:46
ParallelFileMerger(const fs::path &output_dir, const std::string &deckname, bool show_fallout=false)
Constructor.
Definition: ParallelFileMerger.cpp:29
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:26