CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::DB::jsonPropertiesDatabase Class Reference

#include <jsonPropertiesDatabase.hh>

+ Inheritance diagram for CASM::DB::jsonPropertiesDatabase:

Detailed Description

An implementation of PropertiesDatabase for reading/writing JSON.

Definition at line 52 of file jsonPropertiesDatabase.hh.

Public Types

typedef MappedProperties value_type
 
typedef PropertiesDatabaseIterator iterator
 
typedef Index size_type
 
typedef Base::MostDerived MostDerived
 

Public Member Functions

 jsonPropertiesDatabase (const PrimClex &_primclex, std::string calc_type, fs::path location)
 
DatabaseBaseopen () override
 
void commit () override
 
void close () override
 
void from_json (jsonParser const &json)
 Clear all and read from JSON. More...
 
jsonParserto_json (jsonParser &json) const
 Export all to JSON. More...
 
iterator begin () const override
 Begin iterator. More...
 
iterator end () const override
 End iterator. More...
 
size_type size () const override
 
iterator find_via_to (std::string to_configname) const override
 Return iterator to MappedProperties that is the best mapping to specified config. More...
 
iterator find_via_origin (std::string origin) const override
 Return iterator to MappedProperties that is from the specified config. More...
 
std::set< std::string, Compareall_origins (std::string to_configname) const override
 Names of all configurations that relaxed 'origin'->'to'. More...
 
void set_score_method (std::string to_configname, const ScoreMappedProperties &score) override
 Change the score method for a single configuration. More...
 
bool empty () const
 
ScoreMappedProperties score_method (std::string to_configname) const
 Name of ScoreMappedProperties method. More...
 
double best_score (std::string to_configname) const
 Best score of configurations that relaxed 'origin'->'to'. More...
 
double score (std::string origin) const
 Score mapping 'origin'->'to'. More...
 
double score (const MappedProperties &value) const
 Score mapping 'from'->'to'. More...
 
std::pair< iterator, bool > insert (const MappedProperties &value)
 Insert data. More...
 
iterator erase (iterator pos)
 Erase data. More...
 
size_type erase_via_origin (std::string origin)
 Erase data. More...
 
const PrimClexprimclex () const
 
const Structureprim () const
 
double crystallography_tol () const
 

Protected Member Functions

MostDerivedderived ()
 
const MostDerivedderived () const
 

Private Member Functions

iterator _iterator (jsonPropertiesDatabaseIterator::base_iterator _it) const
 
std::pair< iterator, bool > _insert (const MappedProperties &value) override
 Private _insert MappedProperties, without modifying 'relaxed_from'. More...
 
iterator _erase (iterator pos) override
 Private _erase MappedProperties, without modifying 'relaxed_from'. More...
 
void _set_all_origins (std::string to_configname, const std::set< std::string, Compare > &_set) override
 Names of all configurations that relaxed 'from'->'to'. More...
 
std::set< std::string, Compare_make_set (std::string to_configname, const ScoreMappedProperties &score) const
 

Private Attributes

bool m_is_open
 
std::string m_calc_type
 
fs::path m_location
 
ScoreMappedProperties m_default_score
 
std::map< std::string, MappedPropertiesm_data
 
std::map< std::string, std::set< std::string, Compare > > m_origins
 
const PrimClexm_primclex
 

Member Typedef Documentation

◆ iterator

◆ MostDerived

typedef Base::MostDerived CASM::HasPrimClex< CRTPBase< DatabaseBase > >::MostDerived
inherited

Definition at line 16 of file HasPrimClex.hh.

◆ size_type

Definition at line 216 of file PropertiesDatabase.hh.

◆ value_type

Constructor & Destructor Documentation

◆ jsonPropertiesDatabase()

CASM::DB::jsonPropertiesDatabase::jsonPropertiesDatabase ( const PrimClex _primclex,
std::string  calc_type,
fs::path  location 
)

Constructor

Parameters
locationWhere the JSON is read from on "open", written to on "commit". Can be used all in memory with empty location.

Note: "_primclex" and "calc_type" are unused and will be removed in the future

Definition at line 12 of file jsonPropertiesDatabase.cc.

Member Function Documentation

◆ _erase()

jsonPropertiesDatabase::iterator CASM::DB::jsonPropertiesDatabase::_erase ( iterator  pos)
overrideprivatevirtual

Private _erase MappedProperties, without modifying 'relaxed_from'.

Private _erase MappedProperties, without modifying 'origins'.

Implements CASM::DB::PropertiesDatabase.

Definition at line 186 of file jsonPropertiesDatabase.cc.

◆ _insert()

std::pair< jsonPropertiesDatabase::iterator, bool > CASM::DB::jsonPropertiesDatabase::_insert ( const MappedProperties value)
overrideprivatevirtual

Private _insert MappedProperties, without modifying 'relaxed_from'.

Private _insert MappedProperties, without modifying 'origins'.

Implements CASM::DB::PropertiesDatabase.

Definition at line 180 of file jsonPropertiesDatabase.cc.

◆ _iterator()

jsonPropertiesDatabase::iterator CASM::DB::jsonPropertiesDatabase::_iterator ( jsonPropertiesDatabaseIterator::base_iterator  _it) const
private

Definition at line 173 of file jsonPropertiesDatabase.cc.

◆ _make_set()

std::set< std::string, PropertiesDatabase::Compare > CASM::DB::jsonPropertiesDatabase::_make_set ( std::string  to_configname,
const ScoreMappedProperties score 
) const
private

Definition at line 210 of file jsonPropertiesDatabase.cc.

◆ _set_all_origins()

void CASM::DB::jsonPropertiesDatabase::_set_all_origins ( std::string  to_configname,
const std::set< std::string, Compare > &  _set 
)
overrideprivatevirtual

Names of all configurations that relaxed 'from'->'to'.

Names of all configurations that relaxed 'origin'->'to'.

Implements CASM::DB::PropertiesDatabase.

Definition at line 193 of file jsonPropertiesDatabase.cc.

◆ all_origins()

std::set< std::string, PropertiesDatabase::Compare > CASM::DB::jsonPropertiesDatabase::all_origins ( std::string  to_configname) const
overridevirtual

Names of all configurations that relaxed 'origin'->'to'.

Implements CASM::DB::PropertiesDatabase.

Definition at line 137 of file jsonPropertiesDatabase.cc.

◆ begin()

jsonPropertiesDatabase::iterator CASM::DB::jsonPropertiesDatabase::begin ( ) const
overridevirtual

Begin iterator.

Implements CASM::DB::PropertiesDatabase.

Definition at line 101 of file jsonPropertiesDatabase.cc.

◆ best_score()

double CASM::DB::PropertiesDatabase::best_score ( std::string  to_configname) const
inlineinherited

Best score of configurations that relaxed 'origin'->'to'.

Definition at line 254 of file PropertiesDatabase.hh.

◆ close()

void CASM::DB::jsonPropertiesDatabase::close ( )
overridevirtual

Implements CASM::DB::DatabaseBase.

Definition at line 51 of file jsonPropertiesDatabase.cc.

◆ commit()

void CASM::DB::jsonPropertiesDatabase::commit ( )
overridevirtual

Implements CASM::DB::DatabaseBase.

Definition at line 32 of file jsonPropertiesDatabase.cc.

◆ crystallography_tol()

double CASM::HasPrimClex< CRTPBase< DatabaseBase > >::crystallography_tol
inherited

Definition at line 21 of file HasPrimClex_impl.hh.

◆ derived() [1/2]

template<typename _MostDerived >
MostDerived& notstd::CRTPBase< _MostDerived >::derived ( )
inlineprotectedinherited

Definition at line 13 of file CRTPBase.hh.

◆ derived() [2/2]

template<typename _MostDerived >
const MostDerived& notstd::CRTPBase< _MostDerived >::derived ( ) const
inlineprotectedinherited

Definition at line 15 of file CRTPBase.hh.

◆ empty()

bool CASM::DB::PropertiesDatabase::empty ( ) const
inlineinherited

Definition at line 227 of file PropertiesDatabase.hh.

◆ end()

jsonPropertiesDatabase::iterator CASM::DB::jsonPropertiesDatabase::end ( ) const
overridevirtual

End iterator.

Implements CASM::DB::PropertiesDatabase.

Definition at line 106 of file jsonPropertiesDatabase.cc.

◆ erase()

PropertiesDatabase::iterator CASM::DB::PropertiesDatabase::erase ( iterator  pos)
inherited

Erase data.

Erase the 'origin' data element at provided iterator.

Definition at line 35 of file PropertiesDatabase.cc.

◆ erase_via_origin()

size_type CASM::DB::PropertiesDatabase::erase_via_origin ( std::string  origin)
inlineinherited

Erase data.

Definition at line 275 of file PropertiesDatabase.hh.

◆ find_via_origin()

jsonPropertiesDatabase::iterator CASM::DB::jsonPropertiesDatabase::find_via_origin ( std::string  origin) const
overridevirtual

Return iterator to MappedProperties that is from the specified config.

Implements CASM::DB::PropertiesDatabase.

Definition at line 129 of file jsonPropertiesDatabase.cc.

◆ find_via_to()

jsonPropertiesDatabase::iterator CASM::DB::jsonPropertiesDatabase::find_via_to ( std::string  to_configname) const
overridevirtual

Return iterator to MappedProperties that is the best mapping to specified config.

  • Prefers self-mapped, else best scoring

Implements CASM::DB::PropertiesDatabase.

Definition at line 118 of file jsonPropertiesDatabase.cc.

◆ from_json()

void CASM::DB::jsonPropertiesDatabase::from_json ( jsonParser const &  json)

Clear all and read from JSON.

Definition at line 57 of file jsonPropertiesDatabase.cc.

◆ insert()

std::pair< PropertiesDatabase::iterator, bool > CASM::DB::PropertiesDatabase::insert ( const MappedProperties value)
inherited

Insert data.

Definition at line 18 of file PropertiesDatabase.cc.

◆ open()

DatabaseBase & CASM::DB::jsonPropertiesDatabase::open ( )
overridevirtual

Implements CASM::DB::DatabaseBase.

Definition at line 20 of file jsonPropertiesDatabase.cc.

◆ prim()

const Structure & CASM::HasPrimClex< CRTPBase< DatabaseBase > >::prim
inherited

Definition at line 19 of file HasPrimClex_impl.hh.

◆ primclex()

const PrimClex& CASM::DB::DatabaseBase::primclex ( ) const
inlineinherited

Definition at line 35 of file Database.hh.

◆ score() [1/2]

double CASM::DB::PropertiesDatabase::score ( const MappedProperties value) const
inlineinherited

Score mapping 'from'->'to'.

Definition at line 264 of file PropertiesDatabase.hh.

◆ score() [2/2]

double CASM::DB::PropertiesDatabase::score ( std::string  origin) const
inlineinherited

Score mapping 'origin'->'to'.

Definition at line 259 of file PropertiesDatabase.hh.

◆ score_method()

ScoreMappedProperties CASM::DB::PropertiesDatabase::score_method ( std::string  to_configname) const
inlineinherited

Name of ScoreMappedProperties method.

Definition at line 249 of file PropertiesDatabase.hh.

◆ set_score_method()

void CASM::DB::jsonPropertiesDatabase::set_score_method ( std::string  to_configname,
const ScoreMappedProperties score 
)
overridevirtual

Change the score method for a single configuration.

Implements CASM::DB::PropertiesDatabase.

Definition at line 147 of file jsonPropertiesDatabase.cc.

◆ size()

jsonPropertiesDatabase::size_type CASM::DB::jsonPropertiesDatabase::size ( ) const
overridevirtual

Implements CASM::DB::PropertiesDatabase.

Definition at line 110 of file jsonPropertiesDatabase.cc.

◆ to_json()

jsonParser & CASM::DB::jsonPropertiesDatabase::to_json ( jsonParser json) const

Export all to JSON.

Definition at line 82 of file jsonPropertiesDatabase.cc.

Member Data Documentation

◆ m_calc_type

std::string CASM::DB::jsonPropertiesDatabase::m_calc_type
private

Definition at line 120 of file jsonPropertiesDatabase.hh.

◆ m_data

std::map<std::string, MappedProperties> CASM::DB::jsonPropertiesDatabase::m_data
private

Definition at line 129 of file jsonPropertiesDatabase.hh.

◆ m_default_score

ScoreMappedProperties CASM::DB::jsonPropertiesDatabase::m_default_score
private

Definition at line 123 of file jsonPropertiesDatabase.hh.

◆ m_is_open

bool CASM::DB::jsonPropertiesDatabase::m_is_open
private

Definition at line 118 of file jsonPropertiesDatabase.hh.

◆ m_location

fs::path CASM::DB::jsonPropertiesDatabase::m_location
private

Definition at line 121 of file jsonPropertiesDatabase.hh.

◆ m_origins

std::map<std::string, std::set<std::string, Compare> > CASM::DB::jsonPropertiesDatabase::m_origins
private

Definition at line 132 of file jsonPropertiesDatabase.hh.

◆ m_primclex

const PrimClex* CASM::DB::DatabaseBase::m_primclex
privateinherited

Definition at line 38 of file Database.hh.


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