CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::Variable Class Reference

#include <Variable.hh>

+ Inheritance diagram for CASM::Variable:

Detailed Description

Definition at line 25 of file Variable.hh.

Public Member Functions

 Variable (const DoFSet &tvar, int var_ind)
 
 Variable (const DoFSet &tvar, const Eigen::VectorXd &init_coeffs)
 
std::string type_name () const override
 
Functioncopy () const override
 
bool is_zero () const override
 
void small_to_zero (double tol=TOL) override
 
Index num_terms () const override
 
double leading_coefficient () const override
 
double leading_coefficient (Index &index) const override
 
double get_coefficient (Index i) const override
 
const DoFSetdof_set () const
 
SymGroupRepID symrep_ID () const
 
const Eigen::VectorXd & coeffs () const
 
void make_formula () const override
 
std::set< Indexdof_IDs () const override
 
int register_remotes (const std::vector< DoF::RemoteHandle > &remote_handles) override
 
bool compare (const Variable *RHS) const
 
int class_ID () const override
 
double dot (Function const *RHS) const
 
void scale (double scale_factor) override
 
double remote_eval () const override
 
double remote_deval (const DoF::RemoteHandle &dvar) const override
 
double cache_eval () const override
 
double cache_deval (const DoF::RemoteHandle &dvar) const override
 
Functionminus_equals (const Variable *RHS)
 
Functionplus_equals (const Variable *RHS)
 
jsonParserto_json (jsonParser &json) const override
 
void from_json (const jsonParser &json)
 
void refresh_ID ()
 
Index ID () const
 
Index num_args () const
 
void set_identifier (char _key, std::string const &_value)
 
std::string identifier (char _key) const
 
std::string formula () const
 
std::string tex_formula () const
 
void print (std::ostream &stream) const
 
void print_tex (std::ostream &stream) const
 
void set_formula (const std::string &new_formula)
 
void set_tex_formula (const std::string &new_formula)
 
void clear_formula ()
 
virtual bool depends_on (const Function *test_func) const
 
bool accept (const FunctionVisitor &visitor, BasisSet const *home_basis_ptr=nullptr)
 
bool accept (const FunctionVisitor &visitor, BasisSet const *home_basis_ptr=nullptr) const
 
virtual SparseTensor< double > const * get_coeffs () const
 
virtual Eigen::VectorXd const * get_eigen_coeffs () const
 
bool update_dof_IDs (const std::vector< Index > &before_IDs, const std::vector< Index > &after_IDs)
 
virtual Functionapply_sym_coeffs (const SymOp &op, int dependency_layer=1)
 
Functionsym_copy_coeffs (const SymOp &op, int dependency_layer=1) const
 
void normalize ()
 
bool shallow_compare (Function const *RHS) const
 
bool compare (Function const *RHS) const
 
Functionminus (Function const *RHS) const
 
Functionplus (Function const *RHS) const
 
Functionmultiply (Function const *RHS) const
 
Functionpoly_quotient (Function const *RHS) const
 
Functionpoly_remainder (Function const *RHS) const
 
Functionminus_in_place (Function const *RHS)
 
Functionplus_in_place (Function const *RHS)
 
void set_arguments (const ArgumentContainer &new_arg)
 change arguments of this function More...
 
void set_arguments (const ArgumentContainer &new_arg, std::vector< Index > const &compatibility_map)
 change arguments, allowing for new_arg to be larger than current argument list [or permuted (not yet implemented)] More...
 
const ArgumentContainerargument_bases () const
 

Static Public Member Functions

static void fill_dispatch_table ()
 
static int sclass_ID ()
 

Protected Types

typedef std::vector< std::shared_ptr< BasisSet > > ArgumentContainer
 

Protected Member Functions

Function_apply_sym (const SymOp &op) override
 
bool _accept (const FunctionVisitor &visitor, BasisSet const *home_basis_ptr=NULL) override
 
bool _accept (const FunctionVisitor &visitor, BasisSet const *home_basis_ptr=NULL) const override
 
bool _update_dof_IDs (const std::vector< Index > &before_IDs, const std::vector< Index > &after_IDs) override
 
ReturnArray< SymGroupRepID_sub_sym_reps () const
 
virtual void _set_arguments (const ArgumentContainer &new_arg, std::vector< Index > const &compatibility_map)
 
Function const * _argument (Index i) const
 
double _arg_eval_cache (Index i) const
 
double _arg_deval_cache (Index i) const
 
int _dependency_layer () const
 

Static Protected Member Functions

static void extend_hierarchy ()
 
static int new_class_ID ()
 
static int get_class_ID ()
 
static int new_class_ID ()
 

Protected Attributes

Index func_ID
 
ArgumentContainer m_argument
 
Array< Indexm_arg2sub
 
Array< Indexm_arg2fun
 
std::string m_formula
 
std::string m_tex_formula
 

Static Protected Attributes

static Array< Array< InnerProduct * > > inner_prod_table
 
static Array< Array< FunctionOperation * > > operation_table
 

Private Member Functions

 Variable (const Variable &old_var)=default
 

Private Attributes

DoFSet m_dof_set
 
Eigen::VectorXd m_coeffs
 
std::map< char, std::string > m_identifiers
 

Static Private Attributes

static Index ID_count
 

Member Typedef Documentation

◆ ArgumentContainer

typedef std::vector<std::shared_ptr<BasisSet> > CASM::Function::ArgumentContainer
protectedinherited

Definition at line 43 of file BasisFunction.hh.

Constructor & Destructor Documentation

◆ Variable() [1/3]

CASM::Variable::Variable ( const Variable old_var)
privatedefault

◆ Variable() [2/3]

CASM::Variable::Variable ( const DoFSet tvar,
int  var_ind 
)

Definition at line 25 of file Variable.cc.

◆ Variable() [3/3]

CASM::Variable::Variable ( const DoFSet tvar,
const Eigen::VectorXd &  init_coeffs 
)

Definition at line 33 of file Variable.cc.

Member Function Documentation

◆ _accept() [1/2]

bool CASM::Variable::_accept ( const FunctionVisitor visitor,
BasisSet const *  home_basis_ptr = NULL 
) const
overrideprotectedvirtual

Implements CASM::Function.

Definition at line 45 of file Variable.cc.

◆ _accept() [2/2]

bool CASM::Variable::_accept ( const FunctionVisitor visitor,
BasisSet const *  home_basis_ptr = NULL 
)
overrideprotectedvirtual

Implements CASM::Function.

Definition at line 38 of file Variable.cc.

◆ _apply_sym()

Function * CASM::Variable::_apply_sym ( const SymOp op)
overrideprotectedvirtual

Implements CASM::Function.

Definition at line 200 of file Variable.cc.

◆ _arg_deval_cache()

double CASM::Function::_arg_deval_cache ( Index  i) const
protectedinherited

Definition at line 150 of file BasisFunction.cc.

◆ _arg_eval_cache()

double CASM::Function::_arg_eval_cache ( Index  i) const
protectedinherited

Definition at line 144 of file BasisFunction.cc.

◆ _argument()

Function const * CASM::Function::_argument ( Index  i) const
protectedinherited

Definition at line 138 of file BasisFunction.cc.

◆ _dependency_layer()

int CASM::Function::_dependency_layer ( ) const
protectedinherited

Definition at line 156 of file BasisFunction.cc.

◆ _set_arguments()

virtual void CASM::Function::_set_arguments ( const ArgumentContainer new_arg,
std::vector< Index > const &  compatibility_map 
)
inlineprotectedvirtualinherited

Reimplemented in CASM::PolynomialFunction.

Definition at line 225 of file BasisFunction.hh.

◆ _sub_sym_reps()

ReturnArray< SymGroupRepID > CASM::Function::_sub_sym_reps ( ) const
protectedinherited

Definition at line 128 of file BasisFunction.cc.

◆ _update_dof_IDs()

bool CASM::Variable::_update_dof_IDs ( const std::vector< Index > &  before_IDs,
const std::vector< Index > &  after_IDs 
)
overrideprotectedvirtual

Reimplemented from CASM::Function.

Definition at line 246 of file Variable.cc.

◆ accept() [1/2]

bool CASM::Function::accept ( const FunctionVisitor visitor,
BasisSet const *  home_basis_ptr = nullptr 
)
inherited

Definition at line 171 of file BasisFunction.cc.

◆ accept() [2/2]

bool CASM::Function::accept ( const FunctionVisitor visitor,
BasisSet const *  home_basis_ptr = nullptr 
) const
inherited

Definition at line 189 of file BasisFunction.cc.

◆ apply_sym_coeffs()

virtual Function* CASM::Function::apply_sym_coeffs ( const SymOp op,
int  dependency_layer = 1 
)
inlinevirtualinherited

Reimplemented in CASM::PolynomialFunction.

Definition at line 129 of file BasisFunction.hh.

◆ argument_bases()

const ArgumentContainer& CASM::Function::argument_bases ( ) const
inlineinherited

Definition at line 170 of file BasisFunction.hh.

◆ cache_deval()

double CASM::Variable::cache_deval ( const DoF::RemoteHandle dvar) const
inlineoverridevirtual

Implements CASM::Function.

Definition at line 94 of file Variable.hh.

◆ cache_eval()

double CASM::Variable::cache_eval ( ) const
inlineoverridevirtual

Implements CASM::Function.

Definition at line 92 of file Variable.hh.

◆ class_ID()

int CASM::Variable::class_ID ( ) const
inlineoverridevirtual

Implements CASM::Function.

Definition at line 78 of file Variable.hh.

◆ clear_formula()

void CASM::Function::clear_formula ( )
inlineinherited

Definition at line 76 of file BasisFunction.hh.

◆ coeffs()

const Eigen::VectorXd& CASM::Variable::coeffs ( ) const
inline

Definition at line 67 of file Variable.hh.

◆ compare() [1/2]

bool CASM::Variable::compare ( const Variable RHS) const

Definition at line 262 of file Variable.cc.

◆ compare() [2/2]

bool CASM::Function::compare ( Function const *  RHS) const
inherited

Definition at line 52 of file BasisFunction.cc.

◆ copy()

Function* CASM::Variable::copy ( ) const
inlineoverridevirtual

Implements CASM::Function.

Definition at line 53 of file Variable.hh.

◆ depends_on()

virtual bool CASM::Function::depends_on ( const Function test_func) const
inlinevirtualinherited

Reimplemented in CASM::PolynomialFunction.

Definition at line 92 of file BasisFunction.hh.

◆ dof_IDs()

std::set< Index > CASM::Variable::dof_IDs ( ) const
overridevirtual

Implements CASM::Function.

Definition at line 215 of file Variable.cc.

◆ dof_set()

const DoFSet& CASM::Variable::dof_set ( ) const
inline

Definition at line 63 of file Variable.hh.

◆ dot()

double CASM::Variable::dot ( Function const *  RHS) const

◆ extend_hierarchy()

static void CASM::Function::extend_hierarchy ( )
inlinestaticprotectedinherited

Definition at line 182 of file BasisFunction.hh.

◆ fill_dispatch_table()

void CASM::Variable::fill_dispatch_table ( )
static

Definition at line 17 of file Variable.cc.

◆ formula()

std::string CASM::Function::formula ( ) const
inherited

Definition at line 281 of file BasisFunction.cc.

◆ from_json()

void CASM::Variable::from_json ( const jsonParser json)

◆ get_class_ID()

static int CASM::DerivedID< Variable , Function >::get_class_ID ( )
inlinestaticprotectedinherited

Definition at line 30 of file HierarchyID.hh.

◆ get_coefficient()

double CASM::Variable::get_coefficient ( Index  i) const
overridevirtual

Implements CASM::Function.

Definition at line 110 of file Variable.cc.

◆ get_coeffs()

virtual SparseTensor<double> const* CASM::Function::get_coeffs ( ) const
inlinevirtualinherited

Reimplemented in CASM::PolynomialFunction.

Definition at line 111 of file BasisFunction.hh.

◆ get_eigen_coeffs()

virtual Eigen::VectorXd const* CASM::Function::get_eigen_coeffs ( ) const
inlinevirtualinherited

Reimplemented in CASM::OccupantFunction.

Definition at line 113 of file BasisFunction.hh.

◆ ID()

Index CASM::Function::ID ( ) const
inlineinherited

Definition at line 55 of file BasisFunction.hh.

◆ identifier()

std::string CASM::Function::identifier ( char  _key) const
inherited

Definition at line 273 of file BasisFunction.cc.

◆ is_zero()

bool CASM::Variable::is_zero ( ) const
overridevirtual

Implements CASM::Function.

Definition at line 51 of file Variable.cc.

◆ leading_coefficient() [1/2]

double CASM::Variable::leading_coefficient ( ) const
overridevirtual

Implements CASM::Function.

Definition at line 88 of file Variable.cc.

◆ leading_coefficient() [2/2]

double CASM::Variable::leading_coefficient ( Index index) const
overridevirtual

Implements CASM::Function.

Definition at line 99 of file Variable.cc.

◆ make_formula()

void CASM::Variable::make_formula ( ) const
overridevirtual

Implements CASM::Function.

Definition at line 117 of file Variable.cc.

◆ minus()

Function * CASM::Function::minus ( Function const *  RHS) const
inherited

Definition at line 72 of file BasisFunction.cc.

◆ minus_equals()

Function * CASM::Variable::minus_equals ( const Variable RHS)

Definition at line 306 of file Variable.cc.

◆ minus_in_place()

Function * CASM::Function::minus_in_place ( Function const *  RHS)
inherited

Definition at line 104 of file BasisFunction.cc.

◆ multiply()

Function * CASM::Function::multiply ( Function const *  RHS) const
inherited

Definition at line 90 of file BasisFunction.cc.

◆ new_class_ID() [1/2]

static int CASM::HierarchyID< Function >::new_class_ID ( )
inlinestaticprotectedinherited

Definition at line 16 of file HierarchyID.hh.

◆ new_class_ID() [2/2]

static int CASM::HierarchyID< Function >::new_class_ID ( )
inlinestaticprotectedinherited

Definition at line 16 of file HierarchyID.hh.

◆ normalize()

void CASM::Function::normalize ( )
inherited

Definition at line 33 of file BasisFunction.cc.

◆ num_args()

Index CASM::Function::num_args ( ) const
inlineinherited

Definition at line 57 of file BasisFunction.hh.

◆ num_terms()

Index CASM::Variable::num_terms ( ) const
overridevirtual

Implements CASM::Function.

Definition at line 74 of file Variable.cc.

◆ plus()

Function * CASM::Function::plus ( Function const *  RHS) const
inherited

Definition at line 67 of file BasisFunction.cc.

◆ plus_equals()

Function * CASM::Variable::plus_equals ( const Variable RHS)

Definition at line 313 of file Variable.cc.

◆ plus_in_place()

Function * CASM::Function::plus_in_place ( Function const *  RHS)
inherited

Definition at line 96 of file BasisFunction.cc.

◆ poly_quotient()

Function * CASM::Function::poly_quotient ( Function const *  RHS) const
inherited

Definition at line 78 of file BasisFunction.cc.

◆ poly_remainder()

Function * CASM::Function::poly_remainder ( Function const *  RHS) const
inherited

Definition at line 84 of file BasisFunction.cc.

◆ print()

void CASM::Function::print ( std::ostream &  stream) const
inherited

Definition at line 211 of file BasisFunction.cc.

◆ print_tex()

void CASM::Function::print_tex ( std::ostream &  stream) const
inherited

Definition at line 220 of file BasisFunction.cc.

◆ refresh_ID()

void CASM::Function::refresh_ID ( )
inherited

Definition at line 207 of file BasisFunction.cc.

◆ register_remotes()

int CASM::Variable::register_remotes ( const std::vector< DoF::RemoteHandle > &  remote_handles)
overridevirtual

Reimplemented from CASM::Function.

Definition at line 224 of file Variable.cc.

◆ remote_deval()

double CASM::Variable::remote_deval ( const DoF::RemoteHandle dvar) const
overridevirtual

Implements CASM::Function.

Definition at line 293 of file Variable.cc.

◆ remote_eval()

double CASM::Variable::remote_eval ( ) const
overridevirtual

Implements CASM::Function.

Definition at line 283 of file Variable.cc.

◆ scale()

void CASM::Variable::scale ( double  scale_factor)
overridevirtual

Implements CASM::Function.

Definition at line 274 of file Variable.cc.

◆ sclass_ID()

static int CASM::Variable::sclass_ID ( )
inlinestatic

Definition at line 81 of file Variable.hh.

◆ set_arguments() [1/2]

void CASM::Function::set_arguments ( const ArgumentContainer new_arg)
inlineinherited

change arguments of this function

Definition at line 161 of file BasisFunction.hh.

◆ set_arguments() [2/2]

void CASM::Function::set_arguments ( const ArgumentContainer new_arg,
std::vector< Index > const &  compatibility_map 
)
inherited

change arguments, allowing for new_arg to be larger than current argument list [or permuted (not yet implemented)]

Parameters
compatibility_mapspecifies which elements of
new_argare compatible with urrent argument list (e.g., [2, 3])

Definition at line 113 of file BasisFunction.cc.

◆ set_formula()

void CASM::Function::set_formula ( const std::string &  new_formula)
inlineinherited

Definition at line 69 of file BasisFunction.hh.

◆ set_identifier()

void CASM::Function::set_identifier ( char  _key,
std::string const &  _value 
)
inherited

Definition at line 268 of file BasisFunction.cc.

◆ set_tex_formula()

void CASM::Function::set_tex_formula ( const std::string &  new_formula)
inlineinherited

Definition at line 73 of file BasisFunction.hh.

◆ shallow_compare()

bool CASM::Function::shallow_compare ( Function const *  RHS) const
inherited

Definition at line 45 of file BasisFunction.cc.

◆ small_to_zero()

void CASM::Variable::small_to_zero ( double  tol = TOL)
overridevirtual

Implements CASM::Function.

Definition at line 64 of file Variable.cc.

◆ sym_copy_coeffs()

Function * CASM::Function::sym_copy_coeffs ( const SymOp op,
int  dependency_layer = 1 
) const
inherited

Definition at line 230 of file BasisFunction.cc.

◆ symrep_ID()

SymGroupRepID CASM::Variable::symrep_ID ( ) const
inline

Definition at line 65 of file Variable.hh.

◆ tex_formula()

std::string CASM::Function::tex_formula ( ) const
inherited

Definition at line 291 of file BasisFunction.cc.

◆ to_json()

jsonParser & CASM::Variable::to_json ( jsonParser json) const
overridevirtual

Reimplemented from CASM::Function.

Definition at line 428 of file Variable.cc.

◆ type_name()

std::string CASM::Variable::type_name ( ) const
inlineoverridevirtual

Implements CASM::Function.

Definition at line 51 of file Variable.hh.

◆ update_dof_IDs()

bool CASM::Function::update_dof_IDs ( const std::vector< Index > &  before_IDs,
const std::vector< Index > &  after_IDs 
)
inherited

Definition at line 250 of file BasisFunction.cc.

Member Data Documentation

◆ func_ID

Index CASM::Function::func_ID
protectedinherited

Definition at line 194 of file BasisFunction.hh.

◆ ID_count

Index CASM::Function::ID_count
staticprivateinherited

Definition at line 266 of file BasisFunction.hh.

◆ inner_prod_table

Array< Array< InnerProduct * > > CASM::Function::inner_prod_table
staticprotectedinherited
Initial value:
=
Array<Array<InnerProduct *> >()

Definition at line 177 of file BasisFunction.hh.

◆ m_arg2fun

Array<Index> CASM::Function::m_arg2fun
protectedinherited

Definition at line 219 of file BasisFunction.hh.

◆ m_arg2sub

Array<Index> CASM::Function::m_arg2sub
protectedinherited

m_label_format sets the label format used to generate a label string for a Function object. It is specified as a string of the form (substr1 + "%a" + substr2 + "%b" + substr3 + ... ), where "%a" and "%b" are flags that specify object-specific values. The following flags are allowed:

  • f : function index (only available for some derived types)
  • b : basis index (only available for OccupantFunction and Variable)
  • n : neighbor list index – the DoF ID if dof.is_locked()==false
  • g : global DoF index – the DoF ID if dof.is_locked()==true For objects where the flag does not uniquely specify a single value, it evaluates to a substring that concatenates multiple values in ascending order. Example: For a polynomial function that combines DoFs from the sites {8, 2, 4} of the neighborlist, n will evaluate to the substring expression "2_4_8"

Definition at line 218 of file BasisFunction.hh.

◆ m_argument

ArgumentContainer CASM::Function::m_argument
protectedinherited

Definition at line 196 of file BasisFunction.hh.

◆ m_coeffs

Eigen::VectorXd CASM::Variable::m_coeffs
private

Definition at line 36 of file Variable.hh.

◆ m_dof_set

DoFSet CASM::Variable::m_dof_set
private

Definition at line 33 of file Variable.hh.

◆ m_formula

std::string CASM::Function::m_formula
mutableprotectedinherited

Definition at line 221 of file BasisFunction.hh.

◆ m_identifiers

std::map<char, std::string> CASM::Function::m_identifiers
privateinherited

Definition at line 268 of file BasisFunction.hh.

◆ m_tex_formula

std::string CASM::Function::m_tex_formula
protectedinherited

Definition at line 221 of file BasisFunction.hh.

◆ operation_table

Array< Array< FunctionOperation * > > CASM::Function::operation_table
staticprotectedinherited
Initial value:
=
Array<Array<FunctionOperation *> >()

Definition at line 178 of file BasisFunction.hh.


The documentation for this class was generated from the following files: