QMCPACK
ParseGridInput.hpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2023 QMCPACK developers.
6 //
7 // File developed by: Peter W. Doak, doakpw@ornl.gov, Oak Ridge National Lab
8 //
9 // File created by: Peter W. Doak, doakpw@ornl.gov, Oak Ridge National Lab
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 /** \file
13  * The AxisGrid data structure and the ParseGridInput factor parsing in a manner usable in acustom handler
14  * method of any InputSection subtype. Right now it is only required by
15  * SpaceGridInput::SpaceGridAxisInputSection::setFromStreamCustom.
16  * This takes the one dimensional grid input specified for EnergyDensityEstimator (described in the for
17  * the legacy energy density estimator). To the suprising complex input variables required by SpaceGrid.
18  * AxisGrid should be subjected to analysis at a later date for which of these data elements are actually
19  * required to successfully construct a NESpaceGrid instance.
20  */
21 
22 #ifndef QMCPLUSPLUS_PARSE_GRID_INPUT_HPP
23 #define QMCPLUSPLUS_PARSE_GRID_INPUT_HPP
24 #include <vector>
25 #include <string>
26 #include <sstream>
27 #include <iostream>
28 
29 namespace qmcplusplus
30 {
31 
32 template<typename REAL>
33 struct AxisGrid
34 {
35  AxisGrid() = default;
36 
37  /** "aggregate" style constructor
38  */
39  AxisGrid(std::vector<int>&& rhs_ndom_int,
40  std::vector<int>&& rhs_ndu_int,
41  std::vector<REAL>&& rhs_du_int,
42  REAL rhs_umin,
43  REAL rhs_umax,
44  REAL rhs_odu,
45  std::vector<int>&& rhs_gmap,
46  std::vector<int>&& rhs_ndu_per_interval,
47  int rhs_dimensions);
48 
49  AxisGrid(const AxisGrid& rhs);
50 
52 
53  /** equality operator, all values must be equal.
54  * In C++20 this will just be the defaulted operator==.
55  */
56  bool operator==(const AxisGrid& ag) const
57  {
58  return (ag.ndom_int == ndom_int && ag.ndu_int == ndu_int && ag.du_int == du_int && ag.umin == umin &&
59  ag.umax == umax && ag.odu == odu && ag.gmap == gmap && ag.ndu_per_interval == ndu_per_interval &&
60  ag.dimensions == dimensions);
61  }
62 
63  std::vector<int> ndom_int;
64  std::vector<int> ndu_int;
65  std::vector<REAL> du_int;
66  REAL umin;
67  REAL umax;
68  REAL odu;
69  std::vector<int> gmap;
70  std::vector<int> ndu_per_interval;
72 };
73 
74 /** Parses the one dimensional grid specification format originated for EnergyDensity
75  * This has be refactored from QMCHamiltonian/SpaceGrid.cpp.
76  * My evidence for correctness is that it can pass the unit test I wrote, there was no legacy test.
77  */
78 template<typename REAL>
79 AxisGrid<REAL> parseGridInput(std::istringstream& grid_input_stream);
80 
81 // explicit instantiation declaration.
82 extern template struct AxisGrid<float>;
83 extern template struct AxisGrid<double>;
84 extern template AxisGrid<double> parseGridInput<double>(std::istringstream& grid_input_stream);
85 extern template AxisGrid<float> parseGridInput<float>(std::istringstream& grid_input_stream);
86 
87 } // namespace qmcplusplus
88 
89 #endif
template AxisGrid< double > parseGridInput< double >(std::istringstream &grid_input_stream)
std::vector< int > gmap
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
AxisGrid< REAL > parseGridInput(std::istringstream &grid_input_stream)
Parses the one dimensional grid specification format originated for EnergyDensity This has be refacto...
std::vector< int > ndu_per_interval
template AxisGrid< float > parseGridInput< float >(std::istringstream &grid_input_stream)
std::vector< int > ndom_int
bool operator==(const AxisGrid &ag) const
equality operator, all values must be equal.
AxisGrid & operator=(AxisGrid rhs)
std::vector< int > ndu_int
std::vector< REAL > du_int