JDFTx  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EnergyComponents Class Reference

#include <EnergyComponents.h>

Inheritance diagram for EnergyComponents:

Public Member Functions

double & operator[] (const char *key)
 Access by C-style string (need this to prevent ambiguous overload)
 
double & operator[] (const string &key)
 Expose base-class function hidden by the C-style string version above.
 
double operator[] (const char *key) const
 Access by C-style string (need this to prevent ambiguous overload)
 
double operator[] (const string &key) const
 Expose base-class function hidden by the C-style string version above.
 
void operator= (const double &value)
 Set to a simple scalar.
 
void operator+= (const double &value)
 Accumulate a simple scalar.
 
 operator double () const
 Return sum of all components when cast to a simple number.
 
void print (FILE *fp, bool nonzeroOnly, const char *format="\t%s = %le\n") const
 

Additional Inherited Members

- Public Attributes inherited from std::map< K, T >
keys
 STL member.
 
elements
 STL member.
 

Detailed Description

Simply a map of named components with a few extra features! Proper use: E["name"] = value; or E["name"] += value Casting to a double returns the total. Assignment or increment by a scalar happens in a "default" component name

Member Function Documentation

void EnergyComponents::print ( FILE *  fp,
bool  nonzeroOnly,
const char *  format = "\t%s = %le\n" 
) const
inline

Print to a stream:

Parameters
fpOutput stream
nonzeroOnlyIf true, print only non-zero components
formatOutput format for each component - must have one string and one floating point conversion spec each

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