22 template<
typename REAL>
25 using namespace modernstrutil;
26 const REAL utol = 1
e-5;
28 std::string grid_line;
29 std::getline(grid_input_stream, grid_line);
31 std::vector<std::string_view> tokens =
split(grid_line,
" ");
35 for (
int i = 0; i < tokens.size(); i++)
36 if (tokens[i][0] !=
'(')
42 agr.
du_int.resize(nintervals);
45 REAL u1 = string2Real<REAL>(tokens[0]);
50 std::ostringstream msg;
51 msg <<
" interval endparticles cannot be greater than " << 1 <<
'\n' <<
" endpoint provided: " << u1;
55 bool has_paren_val =
false;
59 for (
int i = 1; i < tokens.size(); i++)
61 if (tokens[i][0] !=
'(')
63 REAL u2 = string2Real<REAL>(tokens[i]);
67 has_paren_val =
false;
71 std::ostringstream msg;
73 msg <<
" interval (" << u1 <<
"," << u2 <<
") is negative" << std::endl;
78 std::ostringstream msg;
80 msg <<
" interval endparticles cannot be greater than " << 1 << std::endl;
81 msg <<
" endpoint provided: " << u2 << std::endl;
86 agr.
du_int[interval] = (u2 - u1) / ndom_i;
91 agr.
du_int[interval] = du_i;
95 std::ostringstream msg;
97 msg <<
" interval (" << u1 <<
"," << u2 <<
") not divisible by du=" << du_i << std::endl;
105 has_paren_val =
true;
106 std::string paren_val{tokens[i].substr(1, tokens[i].length() - 2)};
107 is_int = tokens[i].find(
".") == std::string::npos;
110 ndom_i = string2Int<int>(paren_val);
116 du_i = string2Real<REAL>(paren_val);
122 for (
int i = 0; i < agr.
du_int.size(); i++)
124 agr.
odu = 1.0 / du_min;
126 for (
int i = 0; i < agr.
du_int.size(); i++)
131 std::ostringstream msg;
132 msg <<
"interval " << i + 1 <<
" of axis is not divisible by smallest subinterval " << du_min;
140 for (
int i = 0; i < agr.
ndom_int.size(); i++)
141 for (
int j = 0; j < agr.
ndom_int[i]; j++)
144 for (
int k = 0; k < agr.
ndu_int[i]; k++)
155 for (
int i = 0; i < agr.
ndom_int.size(); i++)
159 for (
int i = 0; i < agr.
ndom_int.size(); i++)
160 for (
int ii = 0; ii < agr.
ndom_int[i]; ii++)
168 template<
typename REAL>
170 std::vector<int>&& rhs_ndu_int,
171 std::vector<REAL>&& rhs_du_int,
175 std::vector<int>&& rhs_gmap,
176 std::vector<int>&& rhs_ndu_per_interval,
179 ndom_int = rhs_ndom_int;
180 ndu_int = rhs_ndu_int;
186 ndu_per_interval = rhs_ndu_per_interval;
187 dimensions = rhs_dimensions;
190 template<
typename REAL>
204 template<
typename REAL>
208 std::swap(ndu_int, rhs.
ndu_int);
209 std::swap(du_int, rhs.
du_int);
210 std::swap(umin, rhs.
umin);
211 std::swap(umax, rhs.
umax);
212 std::swap(odu, rhs.
odu);
213 std::swap(gmap, rhs.
gmap);
template AxisGrid< double > parseGridInput< double >(std::istringstream &grid_input_stream)
helper functions for EinsplineSetBuilder
AxisGrid< REAL > parseGridInput(std::istringstream &grid_input_stream)
Parses the one dimensional grid specification format originated for EnergyDensity This has be refacto...
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
std::vector< int > ndu_per_interval
template AxisGrid< float > parseGridInput< float >(std::istringstream &grid_input_stream)
This a subclass for runtime errors that will occur on all ranks.
std::vector< int > ndom_int
AxisGrid & operator=(AxisGrid rhs)
std::vector< int > ndu_int
The AxisGrid data structure and the ParseGridInput factor parsing in a manner usable in acustom handl...
std::vector< std::string_view > split(const string_view s, const string_view delimiters)
std::vector< REAL > du_int
MakeReturn< UnaryNode< FnFloor, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t floor(const Vector< T1, C1 > &l)