Phoebe developer's documentation  1.0
Phonon and Electron Boltzmann Equations
App Class Reference

Base class for launching apps. More...

#include <app.h>

Inheritance diagram for App:

Public Member Functions

virtual void run (Context &context)
 Launches the subprogram. More...
 
virtual void checkRequirements (Context &context)
 Checks that the user wrote a complete input file. More...
 

Static Public Member Functions

static std::unique_ptr< ApploadApp (const std::string &choice)
 Factory method, used to load the desired subclass. More...
 

Static Protected Member Functions

static void throwErrorIfUnset (const std::string &x, const std::string &name)
 
static void throwErrorIfUnset (const std::vector< std::string > &x, const std::string &name)
 
static void throwErrorIfUnset (const double &x, const std::string &name)
 
static void throwErrorIfUnset (const Eigen::VectorXi &x, const std::string &name)
 
static void throwErrorIfUnset (const Eigen::Vector3i &x, const std::string &name)
 
static void throwErrorIfUnset (const Eigen::VectorXd &x, const std::string &name)
 
static void throwErrorIfUnset (const Eigen::MatrixXd &x, const std::string &name)
 
static void throwErrorIfUnset (const Eigen::Tensor< double, 3 > &x, const std::string &name)
 
static void throwWarningIfUnset (const std::string &x, const std::string &name)
 

Detailed Description

An app is a subprogram, used e.g. to compute phonon transport, or a DoS. The base class is almost just an interface, with the implementation given in the derived classes.

To create a new app, 1) create a new subclass of App. 2) implement the run() method, with the main body of the subprogram. 3) Implement checkRequirements(), which checks that the user input has loaded the necessary input flags. 4) Update the base class App header, adding a new app name to choices. 5) Update the base class loadApp method in the app.cpp file, adding the possibility of loading the new application.

Member Function Documentation

◆ checkRequirements()

void App::checkRequirements ( Context context)
virtual

Calls an error if the requirements are not satisfied. To be used before a call to run(). The list of requirements is specified by each App subclass.

Parameters
contextobject Context with the user input.

Reimplemented in TransportEpaApp, PhononTransportApp, PhElLifetimesApp, PhononLifetimesApp, ElectronLifetimesApp, ElPhQeToPhoebeApp, ElPhCouplingPlotApp, ElectronWannierTransportApp, ElectronFourierDosApp, ElectronWannierDosApp, PhononDosApp, ElectronFourierBandsApp, ElectronWannierBandsApp, and PhononBandsApp.

◆ loadApp()

std::unique_ptr< App > App::loadApp ( const std::string &  choice)
static

Note: auto_ptr transfers the ownership to the returned pointer itself the returned app pointer is then destructed at the end of main().

Parameters
choicea string with the app name.
Returns
app: a unique_pointer to the subclass app instance.

◆ run()