12 std::vector<std::string> result;
13 if (_template.size()) result.push_back(std::string());
14 for (
Index i = 0; i < _template.size(); i++) {
15 if (_template[i] ==
'%') {
16 if (result.back().size()) result.push_back(std::string());
17 result.back() = _template.substr(i, 2);
18 if ((++i) + 1 < _template.size()) result.push_back(std::string());
20 result.back().push_back(_template[i]);
91 ss << host.
dof().
ID();
116 const std::string &_template)
117 : m_type_name(_type_name) {
126 std::stringstream tformula, ttex;
135 if (!var_ind.
size()) {
141 double var_scale(host.
coeffs()[var_ind[0]]);
146 var_scale, 10 * host.
coeffs().size() * host.
coeffs().size());
149 if (var_ind.
size() > 1) {
155 for (
Index i = 0; i < var_ind.
size(); i++) {
157 coeff = host.
coeffs()[var_ind[i]];
159 if (i > 0 && coeff > 0) {
170 if (i > 0 && coeff / var_scale > 0) {
176 if (!
almost_zero(std::abs(coeff / var_scale) - 1)) {
187 tformula << dof.
ID();
196 if (prefix.empty()) prefix =
"?";
200 std::string suffix = dof.
var_name();
201 if (suffix.empty()) suffix =
"?";
206 tformula << var_ind[i];
213 if (var_ind.
size() > 1) {
232 const std::string &_template)
233 : m_bset_name(_bset_name) {
250 std::stringstream ss;
254 if (bset_ptr->
dof_IDs().size() == 0) {
257 for (
Index i = 0; i < bset_ptr->
dof_IDs().size(); i++) {
258 ss << (bset_ptr->
dof_IDs())[i];
259 if (i + 1 < bset_ptr->
dof_IDs().size()) ss <<
'_';
269 for (
Index id : IDs) {
271 if (++i < IDs.size()) ss <<
'_';
276 if (f < bset_ptr->size())
Basic std::vector like container (deprecated)
const std::vector< Index > & dof_IDs() const
const std::string & name() const
Index ID() const
Const access of integer ID.
std::string var_name() const
Const access of variable name.
std::string type_name() const
Const access of DoF type name.
std::string const & type_name() const
std::string identifier(char _key) const
void set_tex_formula(const std::string &new_formula)
virtual std::set< Index > dof_IDs() const =0
void set_formula(const std::string &new_formula)
virtual bool visit(Variable const &host, BasisSet const *bset_ptr) const
virtual bool _generic_visit(Function &host, BasisSet const *bset_ptr) const
bool visit(OccupantFunction &host, BasisSet const *bset_ptr) const
bool visit(OccupantFunction &host, BasisSet const *bset_ptr) const
OccFuncLabeler(const std::string &_template)
std::vector< std::string > m_sub_strings
bool visit(OccupantFunction &host, BasisSet const *bset_ptr) const
const DiscreteDoF & dof() const
double discrete_eval(int state) const
Index occ_func_ind() const
void set_basis_ind(int new_ind)
SubExpressionLabeler(const std::string &_bset_name, const std::string &_template)
std::vector< std::string > m_sub_strings
bool _generic_visit(Function &host, BasisSet const *bset_ptr) const
const DoFSet & dof_set() const
const Eigen::VectorXd & coeffs() const
VariableLabeler(std::string const &m_type_name, std::string const &_template)
std::vector< std::string > m_sub_strings
bool visit(Variable &host, BasisSet const *bset_ptr) const
void push_back(const T &toPush)
Index find(const T &test_elem) const
bool almost_zero(const T &val, double tol=TOL)
If T is not integral, use std::abs(val) < tol;.
std::string irrational_to_tex_string(double val, int lim, int max_pow=2)
bool valid_index(Index i)
INDEX_TYPE Index
For long integer indexing:
std::vector< std::string > parse_label_template(std::string const &_template)