CASM  1.1.0
A Clusters Approach to Statistical Mechanics
ConfigDatabaseTools_impl.hh
Go to the documentation of this file.
1 #ifndef CASM_ConfigDatabaseTools_impl
2 #define CASM_ConfigDatabaseTools_impl
3 
5 
6 namespace CASM {
7 
8 namespace DB {
9 
10 // Note: Supercell is being transitioned to no longer have a `PrimClex const *`.
11 // While this is occuring there are overloads of these functions with and
12 // without a `PrimClex const *`. Currently, the `PrimClex const *` is required
13 // for Configuration calculated properties, but not for enumeration without
14 // calculated properties.
15 
17 template <typename EnumeratorType>
19  EnumeratorType const &enumerator, Configuration const &configuration,
20  Database<Supercell> &supercell_db,
21  Database<Configuration> &configuration_db, bool primitive_only) {
22  if (is_guaranteed_for_database_insert(enumerator)) {
24  std::tie(res.primitive_it, res.insert_primitive) =
25  configuration_db.insert(configuration);
27  res.canonical_it = res.primitive_it;
28  return res;
29  } else {
30  return make_canonical_and_insert(configuration, supercell_db,
31  configuration_db, primitive_only);
32  }
33 }
34 } // namespace DB
35 } // namespace CASM
36 
37 #endif
virtual std::pair< iterator, bool > insert(const ValueType &obj)=0
bool is_guaranteed_for_database_insert(ConfigEnumAllOccupations const &enumerator)
ConfigInsertResult make_canonical_and_insert(Configuration const &configuration, Database< Supercell > &supercell_db, Database< Configuration > &configuration_db, bool primitive_only)
Insert this configuration (in primitive & canonical form) in the database.
Main CASM namespace.
Definition: APICommand.hh:8
Holds results of Configuration::insert.
bool insert_canonical
True if canonical configuration did not exist before insertion.
iterator primitive_it
Iterator pointing at primitive.
bool insert_primitive
True if primitive did not exist before insertion.
iterator canonical_it
Iterator pointing at canonical, if existing.