1 #ifndef DEF_COMMON_DISCSYST 2 #define DEF_COMMON_DISCSYST 17 template <
typename T_M,
typename T_Q>
21 std::vector<Syst<T_M,T_Q>> m_node;
24 __write2csv__ (
const std::string filename, std::ios_base::openmode mode,
const std::string sep)
27 file.open(filename,mode);
29 for (
int i=0; i<size(); i++) {
30 file << m_node[i].csvString(sep) << std::endl;
44 operator[] (
size_t index)
const 46 if (index<0 || index>=m_node.size()) {
47 throw std::out_of_range(
"Error : DiscSyst[] index out of range");
53 operator[] (
size_t index)
55 if (index<0 || index>=m_node.size()) {
56 throw std::out_of_range(
"Error : DiscSyst[] index out of range");
63 {
return m_node.size(); }
68 base (
const size_t& i)
const 69 {
return m_node[i].base(); }
72 pos (
const size_t& i)
const 73 {
return m_node[i].pos(); }
76 base (
const size_t& i,
const T_M& b)
77 { m_node[i].base(b); }
80 pos (
const size_t& i,
const T_Q& p)
83 static const unsigned int 93 baselinspace (
const T_M& inf_lim,
const T_M& sup_lim,
const size_t& n_steps)
96 throw std::domain_error(
"Error : DiscSyst.linspace size argument must be null or positive");
97 m_node = std::vector<Syst<T_M,T_Q>>();
99 float fn_steps = (float)n_steps;
100 for (
float i=0.0f; i<fn_steps; i+=1.0f) {
101 m_node.push_back(
Syst<T_M,T_Q>(inf_lim + (sup_lim-inf_lim)*i/(fn_steps-1.0f)));
115 throw std::domain_error(
"Error : DiscSyst.linstep size argument must be null or positive");
116 m_node = std::vector<Syst<T_M,T_Q>>();
118 for (
int i=0; i<n_steps; i++) {
125 operator<< (std::ostream& stream, const DiscSyst<T_M,T_Q>& ds)
127 for (
int i=0; i<ds.size(); i++) {
138 append2csv (
const std::string filename,
const std::string sep=
",")
139 {
return __write2csv__(filename,std::ios_base::app,sep); }
142 write2csv (
const std::string filename,
const std::string sep=
",")
143 {
return __write2csv__(filename,std::ios_base::trunc,sep); }
Definition: DiscSyst.hpp:18
void baselinspace(const T_M &inf_lim, const T_M &sup_lim, const size_t &n_steps)
Definition: DiscSyst.hpp:93
void baselinstep(T_M inf_lim, T_M step_size, size_t n_steps)
Definition: DiscSyst.hpp:112