CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::Calculable< _Base > Class Template Reference

#include <Calculable.hh>

+ Inheritance diagram for CASM::Calculable< _Base >:

Detailed Description

template<typename _Base>
class CASM::Calculable< _Base >

  • name and calculated properties should be invalidated whenever the ConfigType DoF are modified. Can do this by calling _modify_dof(). This means all DoF should be accessed via functions.
  • cache should only be used for DoF-dependent properties, not calctype-dependent properties

Definition at line 23 of file Calculable.hh.

Public Types

typedef DB::Indexed< _Base > Base
 
typedef Base::MostDerived MostDerived
 

Public Member Functions

MappedProperties const & calc_properties (std::string calctype="") const
 Return MappedProperties for requested calctype. More...
 
void set_calc_properties (const MappedProperties &_prop, std::string calctype="")
 
void refresh_calc_properties (std::string calctype="")
 grabs properties from the indicated calctype and adds info to calc_properties_map More...
 
const jsonParsersource () const
 
void set_source (const jsonParser &source)
 
void push_back_source (const jsonParser &source)
 
std::map< std::string, MappedPropertiescalc_properties_map () const
 
template<typename T >
void cache_insert (std::string name, const T &data) const
 
void set_initial_cache (jsonParser const &_cache)
 Set the configuration cache as read from the database. More...
 
void update_cache (jsonParser const &_cache)
 Upate the configuration cache. More...
 
const jsonParsercache () const
 Access the configuration cache, which will be saved in the database. More...
 
bool cache_updated () const
 Check if cache updated. More...
 
void cache_clear () const
 
std::string id () const
 
std::string name () const
 
std::string alias () const
 Return "alias" if object stored in database and alias exists, return empty string otherwise. More...
 

Protected Member Functions

void _modify_dof ()
 Call in MostDerived any time DoF may be modified. More...
 
void _refresh_calc_properties (std::string calctype="") const
 grabs properties from the indicated calctype and adds info to calc_properties_map More...
 
jsonParsercache ()
 
void clear_name () const
 Unset "id" and "name", if object is modified. More...
 
void set_id (Index _id) const
 Set id. More...
 
void set_id (std::string _id) const
 Set id. More...
 
void regenerate_name () const
 Regenerate "name". More...
 
void set_name (std::string _name) const
 Set "name", explicity. More...
 

Private Attributes

std::map< std::string, MappedPropertiesm_calc_properties_map
 
jsonParser m_source
 
jsonParser m_cache
 
bool m_cache_updated
 
friend ValDatabase< MostDerived >
 
std::string m_id
 
std::string m_name
 

Member Typedef Documentation

◆ Base

template<typename _Base >
typedef DB::Indexed<_Base> CASM::Calculable< _Base >::Base

Definition at line 25 of file Calculable.hh.

◆ MostDerived

template<typename _Base >
typedef Base::MostDerived CASM::Calculable< _Base >::MostDerived

Definition at line 26 of file Calculable.hh.

Member Function Documentation

◆ _modify_dof()

template<typename _Base >
void CASM::Calculable< _Base >::_modify_dof
protected

Call in MostDerived any time DoF may be modified.

Call in _Base any time DoF may be modified.

Definition at line 104 of file Calculable.cc.

◆ _refresh_calc_properties()

template<typename _Base >
void CASM::Calculable< _Base >::_refresh_calc_properties ( std::string  calctype = "") const
protected

grabs properties from the indicated calctype and adds info to calc_properties_map

Definition at line 116 of file Calculable.cc.

◆ alias()

std::string CASM::DB::Named< _Base >::alias
inherited

Return "alias" if object stored in database and alias exists, return empty string otherwise.

Definition at line 34 of file Named_impl.hh.

◆ cache() [1/2]

jsonParser& CASM::DB::Cache::cache ( )
inlineprotectedinherited

Access the configuration cache, which will be saved in the database

Definition at line 65 of file Cache.hh.

◆ cache() [2/2]

const jsonParser& CASM::DB::Cache::cache ( ) const
inlineinherited

Access the configuration cache, which will be saved in the database.

Definition at line 47 of file Cache.hh.

◆ cache_clear()

void CASM::DB::Cache::cache_clear ( ) const
inlineinherited

Clear the cache

  • Clearing cache is modeled as const, but a flag is set so the updated data can be obtained
  • Sets 'cache_updated()' to true

Definition at line 56 of file Cache.hh.

◆ cache_insert()

template<typename T >
void CASM::DB::Cache::cache_insert ( std::string  name,
const T &  data 
) const
inlineinherited

Insert data in the configuration cache, which will be saved in the database

  • For data that depends on DoF only, not calculated properties or composition axes
  • Adding to cache is modeled as const, but a flag is set so the updated data can be obtained
  • Data only written if 'name' does not already exist in cache
  • Sets 'cache_updated()' to true

Definition at line 27 of file Cache.hh.

◆ cache_updated()

bool CASM::DB::Cache::cache_updated ( ) const
inlineinherited

Check if cache updated.

Definition at line 50 of file Cache.hh.

◆ calc_properties()

template<typename _Base >
MappedProperties const & CASM::Calculable< _Base >::calc_properties ( std::string  calctype = "") const

Return MappedProperties for requested calctype.

Definition at line 17 of file Calculable.cc.

◆ calc_properties_map()

template<typename _Base >
std::map<std::string, MappedProperties> CASM::Calculable< _Base >::calc_properties_map ( ) const
inline

Definition at line 45 of file Calculable.hh.

◆ clear_name()

template<typename _Base >
void CASM::DB::Indexed< _Base >::clear_name
protectedinherited

Unset "id" and "name", if object is modified.

Definition at line 65 of file Named_impl.hh.

◆ id()

template<typename _Base >
std::string CASM::DB::Indexed< _Base >::id
inherited

Definition at line 50 of file Named_impl.hh.

◆ name()

template<typename _Base >
std::string CASM::DB::Indexed< _Base >::name
inherited

Definition at line 56 of file Named_impl.hh.

◆ push_back_source()

template<typename _Base >
void CASM::Calculable< _Base >::push_back_source ( const jsonParser source)

Definition at line 68 of file Calculable.cc.

◆ refresh_calc_properties()

template<typename _Base >
void CASM::Calculable< _Base >::refresh_calc_properties ( std::string  calctype = "")

grabs properties from the indicated calctype and adds info to calc_properties_map

Definition at line 45 of file Calculable.cc.

◆ regenerate_name()

void CASM::DB::Named< _Base >::regenerate_name
protectedinherited

Regenerate "name".

Definition at line 41 of file Named_impl.hh.

◆ set_calc_properties()

template<typename _Base >
void CASM::Calculable< _Base >::set_calc_properties ( const MappedProperties _prop,
std::string  calctype = "" 
)

Definition at line 32 of file Calculable.cc.

◆ set_id() [1/2]

template<typename _Base >
void CASM::DB::Indexed< _Base >::set_id ( Index  _id) const
protectedinherited

Set id.

Setting id should be done through Database<Derived> implementations

  • protected, to allow reading Derived from database and setting id

Definition at line 76 of file Named_impl.hh.

◆ set_id() [2/2]

template<typename _Base >
void CASM::DB::Indexed< _Base >::set_id ( std::string  _id) const
protectedinherited

Set id.

Setting id should be done through Database<Derived> implementations

  • protected, to allow reading Derived from database and setting id

Definition at line 86 of file Named_impl.hh.

◆ set_initial_cache()

void CASM::DB::Cache::set_initial_cache ( jsonParser const &  _cache)
inlineinherited

Set the configuration cache as read from the database.

Definition at line 35 of file Cache.hh.

◆ set_name()

void CASM::DB::Named< _Base >::set_name ( std::string  _name) const
protectedinherited

Set "name", explicity.

Set "name", explicity modified.

Definition at line 44 of file Named_impl.hh.

◆ set_source()

template<typename _Base >
void CASM::Calculable< _Base >::set_source ( const jsonParser source)

Definition at line 56 of file Calculable.cc.

◆ source()

template<typename _Base >
const jsonParser & CASM::Calculable< _Base >::source

Definition at line 51 of file Calculable.cc.

◆ update_cache()

void CASM::DB::Cache::update_cache ( jsonParser const &  _cache)
inlineinherited

Upate the configuration cache.

Definition at line 41 of file Cache.hh.

Member Data Documentation

◆ m_cache

jsonParser CASM::DB::Cache::m_cache
mutableprivateinherited

Definition at line 68 of file Cache.hh.

◆ m_cache_updated

bool CASM::DB::Cache::m_cache_updated
mutableprivateinherited

Definition at line 69 of file Cache.hh.

◆ m_calc_properties_map

template<typename _Base >
std::map<std::string, MappedProperties> CASM::Calculable< _Base >::m_calc_properties_map
mutableprivate

Definition at line 58 of file Calculable.hh.

◆ m_id

template<typename _Base >
std::string CASM::DB::Indexed< _Base >::m_id
mutableprivateinherited

Definition at line 93 of file Named.hh.

◆ m_name

std::string CASM::DB::Named< _Base >::m_name
mutableprivateinherited

Definition at line 47 of file Named.hh.

◆ m_source

template<typename _Base >
jsonParser CASM::Calculable< _Base >::m_source
private

Definition at line 59 of file Calculable.hh.

◆ ValDatabase< MostDerived >

template<typename _Base >
friend CASM::DB::Indexed< _Base >::ValDatabase< MostDerived >
privateinherited

Definition at line 91 of file Named.hh.


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