1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// *****************************************************************************
/*!
  \file      src/Main/FileConvDriver.cpp
  \copyright 2012-2015 J. Bakosi,
             2016-2018 Los Alamos National Security, LLC.,
             2019-2021 Triad National Security, LLC.
             All rights reserved. See the LICENSE file for details.
  \brief     File converter driver
  \details   File converter driver.
*/
// *****************************************************************************

#include "Types.hpp"
#include "Tags.hpp"
#include "FileConvDriver.hpp"
#include "FileConvWriter.hpp"
#include "TaggedTupleDeepPrint.hpp"
#include "Writer.hpp"

#include "NoWarning/fileconv.decl.h"

using fileconv::FileConvDriver;

extern CProxy_Main mainProxy;

FileConvDriver::FileConvDriver( const ctr::CmdLine& cmdline, int )
  : m_input(), m_output()
// *****************************************************************************
//  Constructor
//! \param[in] cmdline Command line object storing data parsed from the command
//!   line arguments
// *****************************************************************************
{
  // Save input file name
  m_input = cmdline.get< tag::io, tag::input >();
  // Save output file name
  m_output = cmdline.get< tag::io, tag::output >();

  // Output command line object to file
  auto logfilename = tk::fileconv_executable() + "_input.log";
  tk::Writer log( logfilename );
  tk::print( log.stream(), "cmdline", cmdline );
}

void
FileConvDriver::execute() const
// *****************************************************************************
//  Execute: Convert the file layout
// *****************************************************************************
{

  std::vector< std::pair< std::string, tk::real > > times( 1 );

  std::unique_ptr< tk::FileConvWriter > fcw(new tk::FileConvWriter
					  ( m_input, m_output ) );
  fcw->convertFiles();

  mainProxy.timestamp( times );
  mainProxy.finalize();

}