PLaSK library
Loading...
Searching...
No Matches
plask::Solver Class Referenceabstract

Base class for all solvers. More...

#include <plask/solver.hpp>

Inheritance diagram for plask::Solver:
[legend]

Public Member Functions

bool initCalculation ()
 This should be called on beginning of each calculation method to ensure that solver will be initialized.
 
 Solver (const std::string &name="")
 Construct uninitialized solver.
 
virtual ~Solver ()
 Virtual destructor (for subclassing). Do nothing.
 
virtual void loadConfiguration (XMLReader &source, Manager &manager)
 Load configuration from given source.
 
void parseStandardConfiguration (XMLReader &source, Manager &manager, const std::string &expected_msg="solver configuration element")
 Load standard configuration (geometry, mesh) tags from source.
 
bool isInitialized ()
 Check if solver is already initialized.
 
void invalidate ()
 This method should be and is called if something important was changed: calculation space, mesh, etc.
 
virtual std::string getClassName () const =0
 Get name of solver.
 
std::string getId () const
 Get solver id.
 
std::string getName () const
 
virtual std::string getClassDescription () const
 Get a description of this solver.
 
template<typename ArgT = double, typename ValT = double>
DataLog< ArgT, ValTdataLog (const std::string &chart_name, const std::string &axis_arg_name, const std::string &axis_val_name)
 
template<typename ArgT = double, typename ValT = double>
DataLog< ArgT, ValTdataLog (const std::string &axis_arg_name, const std::string &axis_val_name)
 
template<typename ... Args>
void writelog (LogLevel level, std::string msg, Args &&... params) const
 Log a message for this solver.
 

Protected Member Functions

virtual void onInitialize ()
 Initialize the solver.
 
virtual void onInvalidate ()
 This method is called by invalidate() to reset stored values.
 

Protected Attributes

bool initialized
 true only if solver is initialized
 

Detailed Description

Base class for all solvers.

See also
Solvers

Definition at line 525 of file solver.hpp.

Constructor & Destructor Documentation

◆ Solver()

plask::Solver::Solver ( const std::string &  name = "")
inline

Construct uninitialized solver.

Parameters
nameId of the instance of this solver

Definition at line 563 of file solver.hpp.

◆ ~Solver()

virtual plask::Solver::~Solver ( )
inlinevirtual

Virtual destructor (for subclassing). Do nothing.

Definition at line 566 of file solver.hpp.

Member Function Documentation

◆ dataLog() [1/2]

template<typename ArgT = double, typename ValT = double>
DataLog< ArgT, ValT > plask::Solver::dataLog ( const std::string &  axis_arg_name,
const std::string &  axis_val_name 
)
inline

Definition at line 645 of file solver.hpp.

◆ dataLog() [2/2]

template<typename ArgT = double, typename ValT = double>
DataLog< ArgT, ValT > plask::Solver::dataLog ( const std::string &  chart_name,
const std::string &  axis_arg_name,
const std::string &  axis_val_name 
)
inline

Definition at line 639 of file solver.hpp.

◆ getClassDescription()

virtual std::string plask::Solver::getClassDescription ( ) const
inlinevirtual

Get a description of this solver.

Returns
description of this solver (empty string by default)

Reimplemented in plask::ccategory::your_solver::YourSolver, plask::optical::effective::EffectiveFrequencyCyl, and plask::optical::effective::EffectiveIndex2D.

Definition at line 636 of file solver.hpp.

◆ getClassName()

virtual std::string plask::Solver::getClassName ( ) const
pure virtual

Get name of solver.

Returns
name of this solver

Implemented in plask::electrical::drift_diffusion::DriftDiffusionModel2DSolver< Geometry2DType >, plask::electrical::drift_diffusion::DriftDiffusionModel2DSolver< Geometry2DType >, plask::electrical::diffusion::Diffusion2DSolver< Geometry2DType >, plask::electrical::diffusion::Diffusion2DSolver< Geometry2DType >, plask::electrical::diffusion1d::DiffusionFem2DSolver< Geometry2DType >, plask::electrical::diffusion1d::DiffusionFem2DSolver< Geometry2DType >, plask::gain::freecarrier::FreeCarrierGainSolver2D< GeometryT >, plask::gain::freecarrier::FreeCarrierGainSolver2D< GeometryT >, plask::solvers::FermiNew::FermiNewGainSolver< GeometryType >, plask::solvers::FermiNew::FermiNewGainSolver< GeometryT >, plask::solvers::FermiNew::FermiNewGainSolver< GeometryType >, plask::solvers::FermiNew::FermiNewGainSolver< GeometryT >, plask::solvers::FermiNew::FermiNewGainSolver< GeometryType >, plask::solvers::FermiNew::FermiNewGainSolver< GeometryT >, plask::ccategory::your_solver::YourSolver, plask::thermal::dynamic::DynamicThermalFem2DSolver< Geometry2DType >, plask::thermal::dynamic::DynamicThermalFem2DSolver< Geometry2DType >, plask::thermal::tstatic::ThermalFem2DSolver< Geometry2DType >, plask::thermal::tstatic::ThermalFem2DSolver< Geometry2DType >, plask::FilterBaseImpl< PropertyT, FIELD_PROPERTY, OutputSpaceType, VariadicTemplateTypesHolder< ExtraArgs... > >, plask::FilterBaseImpl< PropertyT, MULTI_FIELD_PROPERTY, OutputSpaceType, VariadicTemplateTypesHolder< ExtraArgs... > >, plask::electrical::drift_diffusion::DriftDiffusionModel2DSolver< Geometry2DType >, plask::electrical::diffusion::Diffusion2DSolver< Geometry2DType >, plask::electrical::diffusion::Diffusion3DSolver, plask::electrical::diffusion1d::DiffusionFem2DSolver< Geometry2DType >, plask::gain::freecarrier::FreeCarrierGainSolver2D< GeometryT >, plask::gain::freecarrier::FreeCarrierGainSolver3D, plask::optical::effective::EffectiveFrequencyCyl, plask::optical::effective::EffectiveIndex2D, plask::optical::modal::BesselSolverCyl, plask::optical::modal::FourierSolver2D, plask::optical::modal::FourierSolver3D, plask::thermal::dynamic::DynamicThermalFem2DSolver< Geometry2DType >, plask::thermal::dynamic::DynamicThermalFem3DSolver, plask::thermal::tstatic::ThermalFem2DSolver< Geometry2DType >, and plask::thermal::tstatic::ThermalFem3DSolver.

◆ getId()

std::string plask::Solver::getId ( ) const
inline

Get solver id.

Returns
id of this solver

Definition at line 621 of file solver.hpp.

◆ getName()

std::string plask::Solver::getName ( ) const
inline
Returns
solver name

Definition at line 630 of file solver.hpp.

◆ initCalculation()

bool plask::Solver::initCalculation ( )

This should be called on beginning of each calculation method to ensure that solver will be initialized.

It's does nothing if solver is already initialized and calls onInitialize() if it's not.

Returns
true only if solver is newly initialized (it was previously uninitialized) and onInitialize has just been called.

Definition at line 27 of file solver.cpp.

◆ invalidate()

void plask::Solver::invalidate ( )
inline

This method should be and is called if something important was changed: calculation space, mesh, etc.

Default implementation set initialization flag to false and can call onInvalidate() if initialization flag was true.

See also
onInitialize()

Definition at line 603 of file solver.hpp.

◆ isInitialized()

bool plask::Solver::isInitialized ( )
inline

Check if solver is already initialized.

Returns
true only if solver is already initialized

Definition at line 595 of file solver.hpp.

◆ loadConfiguration()

void plask::Solver::loadConfiguration ( XMLReader source,
Manager manager 
)
virtual

Load configuration from given source.

XML reader (source) point to opening of this solver tag and after return from this method should point to this solver closing tag.

Parameters
sourcesource of configuration
managermanager from which information about geometry, meshes, materials, and so on can be get if needed

Reimplemented in plask::solvers::FermiNew::FermiNewGainSolver< GeometryType >, plask::solvers::FermiNew::FermiNewGainSolver< GeometryT >, plask::ccategory::your_solver::YourSolver, plask::gain::freecarrier::FreeCarrierGainSolver< SolverOver< Geometry3D > >, plask::gain::freecarrier::FreeCarrierGainSolver< SolverWithMesh< GeometryT, MeshAxis > >, plask::optical::effective::EffectiveFrequencyCyl, plask::optical::effective::EffectiveIndex2D, plask::electrical::diffusion1d::DiffusionFem2DSolver< Geometry2DType >, plask::optical::modal::BesselSolverCyl, plask::optical::modal::FourierSolver2D, plask::optical::modal::FourierSolver3D, plask::SolverOver< SpaceT >, plask::SolverOver< ForExample_Geometry2DCartesian >, plask::SolverOver< Geometry2DCartesian >, plask::SolverOver< Geometry2DCylindrical >, plask::SolverOver< Geometry2DType >, plask::SolverOver< Geometry3D >, plask::SolverOver< GeometryT >, plask::SolverOver< GeometryType >, plask::SolverWithMesh< SpaceT, MeshT >, plask::SolverWithMesh< ForExample_Geometry2DCartesian, ForExample_RectilinearMesh2D >, plask::SolverWithMesh< Geometry2DCartesian, MeshAxis >, plask::SolverWithMesh< Geometry2DCartesian, RectangularMesh< 2 > >, plask::SolverWithMesh< Geometry2DCylindrical, MeshAxis >, plask::SolverWithMesh< Geometry2DCylindrical, RectangularMesh< 2 > >, plask::SolverWithMesh< Geometry2DType, RectangularMesh< 2 > >, plask::SolverWithMesh< Geometry2DType, RegularMesh1D >, plask::SolverWithMesh< Geometry3D, RectangularMesh< 3 > >, plask::SolverWithMesh< GeometryT, MeshAxis >, plask::SolverWithMesh< GeometryType, MeshAxis >, plask::electrical::drift_diffusion::DriftDiffusionModel2DSolver< Geometry2DType >, plask::electrical::diffusion::Diffusion2DSolver< Geometry2DType >, plask::electrical::diffusion::Diffusion3DSolver, plask::electrical::shockley::ElectricalFem2DSolver< Geometry2DType >, plask::electrical::shockley::ElectricalFem3DSolver, plask::thermal::dynamic::DynamicThermalFem2DSolver< Geometry2DType >, plask::thermal::dynamic::DynamicThermalFem3DSolver, plask::thermal::tstatic::ThermalFem2DSolver< Geometry2DType >, and plask::thermal::tstatic::ThermalFem3DSolver.

Definition at line 19 of file solver.cpp.

◆ onInitialize()

virtual void plask::Solver::onInitialize ( )
inlineprotectedvirtual

Initialize the solver.

Default implementation just does nothing, however it is a good idea to overwrite it in subclasses and put initialization code in it.

Reimplemented in plask::FemSolverWithMaskedMesh< SpaceT, MeshT >, plask::FemSolverWithMaskedMesh< Geometry2DType, RectangularMesh< 2 > >, plask::FemSolverWithMaskedMesh< Geometry3D, RectangularMesh< 3 > >, plask::solvers::FermiNew::FermiNewGainSolver< GeometryType >, plask::solvers::FermiNew::FermiNewGainSolver< GeometryT >, plask::ccategory::your_solver::YourSolver, plask::electrical::drift_diffusion::DriftDiffusionModel2DSolver< Geometry2DType >, plask::electrical::diffusion::Diffusion2DSolver< Geometry2DType >, plask::electrical::diffusion::Diffusion3DSolver, plask::electrical::diffusion1d::DiffusionFem2DSolver< Geometry2DType >, plask::electrical::shockley::ElectricalFem2DSolver< Geometry2DType >, plask::electrical::shockley::ElectricalFem3DSolver, plask::gain::freecarrier::FreeCarrierGainSolver< SolverOver< Geometry3D > >, plask::gain::freecarrier::FreeCarrierGainSolver< SolverWithMesh< GeometryT, MeshAxis > >, plask::optical::effective::EffectiveFrequencyCyl, plask::optical::effective::EffectiveIndex2D, plask::optical::modal::BesselSolverCyl, plask::optical::modal::FourierSolver2D, plask::optical::modal::FourierSolver3D, plask::optical::modal::ModalSolver< SolverOver< Geometry3D > >, plask::optical::modal::ModalSolver< SolverWithMesh< Geometry2DCartesian, MeshAxis > >, plask::optical::modal::ModalSolver< SolverWithMesh< Geometry2DCylindrical, MeshAxis > >, plask::thermal::dynamic::DynamicThermalFem2DSolver< Geometry2DType >, plask::thermal::dynamic::DynamicThermalFem3DSolver, plask::thermal::tstatic::ThermalFem2DSolver< Geometry2DType >, and plask::thermal::tstatic::ThermalFem3DSolver.

Definition at line 540 of file solver.hpp.

◆ onInvalidate()

◆ parseStandardConfiguration()

void plask::Solver::parseStandardConfiguration ( XMLReader source,
Manager manager,
const std::string &  expected_msg = "solver configuration element" 
)

Load standard configuration (geometry, mesh) tags from source.

Throws an exception if the current tag is not a standard tag (so parse your own solver configuration first).

Parameters
[in,out]sourcesource of configuration which point to opening of parameter tag
[in,out]managermanager from which information about geometry, meshes, materials, and so on can be get if needed
[in]expected_msgoptional message stating what was expected
Exceptions
XMLUnexpectedElementExceptionif the current tag is not recognized

Definition at line 23 of file solver.cpp.

◆ writelog()

template<typename ... Args>
void plask::Solver::writelog ( LogLevel  level,
std::string  msg,
Args &&...  params 
) const
inline

Log a message for this solver.

Parameters
levellog level to log
msglog message
paramsparameters passed to format

Definition at line 656 of file solver.hpp.

Member Data Documentation

◆ initialized

bool plask::Solver::initialized
protected

true only if solver is initialized

Definition at line 533 of file solver.hpp.


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