MolSSI Integral Reference Project
All Classes Namespaces Files Functions Variables Typedefs Macros Pages
testfile_io.hpp
Go to the documentation of this file.
1 /*! \file
2  *
3  * \brief Helper functions for reading/writing test files
4  */
5 
6 #pragma once
7 
9 
10 namespace mirp {
11 
12 // forward declarations
13 struct integral_single_data;
14 struct integral_data;
15 
16 /*! \brief Read generic single integral test data from a file
17  *
18  * If \p is_input is set to true, then the returned data
19  * does not have the integral_single_data_entry::integral member
20  * populated.
21  *
22  * \throw std::runtime_error if there is a problem opening or
23  * writing to the file
24  *
25  * \param [in] filepath Path to the file to read from
26  * \param [in] n Number of centers in the integral (2 center, 4 center, etc)
27  * \param [in] is_input True if the file is a test input file, false if it is a data file
28  * \return Data read from the file
29  */
30 integral_single_data testfile_read_integral_single(const std::string & filepath,
31  int n,
32  bool is_input);
33 
34 
35 /*! \brief Write generic single integral test data to a file
36  *
37  * Any existing file at \p filepath will be overwritten
38  *
39  * \throw std::runtime_error if there is a problem opening or
40  * writing to the file
41  *
42  * \param [in] filepath Path to the file to read from
43  * \param [in] data The data to write to the file
44  */
45 void testfile_write_integral_single(const std::string & filepath,
46  const integral_single_data & data);
47 
48 
49 
50 /*! \brief Read generic contracted integral test data from a file
51  *
52  * If \p is_input is set to true, then the returned data
53  * does not have the integral_data_entry::integral member
54  * populated.
55  *
56  * \throw std::runtime_error if there is a problem opening or
57  * writing to the file
58  *
59  * \param [in] filepath Path to the file to read from
60  * \param [in] n Number of centers in the integral (2 center, 4 center, etc)
61  * \param [in] is_input True if the file is a test input file, false if it is a data file
62  * \return Data read from the file
63  */
64 integral_data testfile_read_integral(const std::string & filepath,
65  int n,
66  bool is_input);
67 
68 
69 /*! \brief Write generic contracted integral test data to a file
70  *
71  * Any existing file at \p filepath will be overwritten
72  *
73  * \throw std::runtime_error if there is a problem opening or
74  * writing to the file
75  *
76  * \param [in] filepath Path to the file to read from
77  * \param [in] data The data to write to the file
78  */
79 void testfile_write_integral(const std::string & filepath,
80  const integral_data & data);
81 
82 
83 } // closing namespace mirp
84 
integral_single_data testfile_read_integral_single(const std::string &filepath, int n, bool is_input)
Read generic single integral test data from a file.
Definition: testfile_io.cpp:17
integral_data testfile_read_integral(const std::string &filepath, int n, bool is_input)
Read generic contracted integral test data from a file.
Definition: testfile_io.cpp:172
void testfile_write_integral(const std::string &filepath, const integral_data &data)
Write generic contracted integral test data to a file.
Definition: testfile_io.cpp:334
Common data structures (shells, entries, etc)
void testfile_write_integral_single(const std::string &filepath, const integral_single_data &data)
Write generic single integral test data to a file.
Definition: testfile_io.cpp:140