### get_x_start() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1region.html Getter for the region's start position. ```APIDOC ## get_x_start() ### Description Gets the region start position. ### Returns - **real** - The start position in x-direction. ``` -------------------------------- ### get_sources() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Gets all sources of this scenario. ```APIDOC ## get_sources() ### Description Gets all sources of this scenario. ### Method const std::vector >& mbsolve::scenario::get_sources() const ### Parameters None ### Returns - **const std::vector >&** - All sources of this scenario. ``` -------------------------------- ### get_records() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Gets all records of this scenario. ```APIDOC ## get_records() n ### Description Gets all records of this scenario. ### Method const std::vector >& mbsolve::scenario::get_records() const ### Parameters None ### Returns - **const std::vector >&** - All records of this scenario. ``` -------------------------------- ### qm_superop::get_num_levels() const Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1qm__superop.html Get the number of levels. ```APIDOC ## qm_superop::get_num_levels() const ### Description Get the number of levels. ### Parameters None. ### Return Value - **unsigned int** - The number of levels. ``` -------------------------------- ### const std::string& get_name() const Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1device.html Gets the device name. ```APIDOC ## const std::string& get_name() const ### Description Gets the device name. ### Returns The device name as a string reference. ``` -------------------------------- ### const std::set& get_used_materials() const Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1device.html Gets the IDs of used materials. ```APIDOC ## const std::set& get_used_materials() const ### Description Gets the IDs of used materials. ### Returns A set of material IDs. ``` -------------------------------- ### get_ic_density() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Gets initial conditions for density matrix. ```APIDOC ## get_ic_density() ### Description Gets initial conditions for density matrix. ### Method std::shared_ptr mbsolve::scenario::get_ic_density() const ### Parameters None ### Returns - **std::shared_ptr** - The initial conditions for density matrix. ``` -------------------------------- ### real get_length() const Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1device.html Gets the device length. ```APIDOC ## real get_length() const ### Description Gets the device length. ### Returns The device length as a real number. ``` -------------------------------- ### material::get_qm Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1material.html Gets a pointer to the quantum mechanical description. This is a const member function that returns a shared pointer to the qm_description object. ```APIDOC ## material::get_qm ### Description Gets a pointer to the quantum mechanical description. This is a const member function that returns a shared pointer to the qm_description object. ### Method Member Function ### Signature `std::shared_ptr mbsolve::material::get_qm() const` ### Returns - **std::shared_ptr** - Pointer to the quantum mechanical description. ### Example ```cpp // Get the quantum mechanical description auto qm = mat->get_qm(); ``` ``` -------------------------------- ### const std::vector>& get_regions() const Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1device.html Gets all regions of the device. ```APIDOC ## const std::vector>& get_regions() const ### Description Gets all regions of the device. ### Returns A vector of shared pointers to the regions. ``` -------------------------------- ### Example Class Hierarchy for Graph Generation Source: https://mriesch-tum.github.io/mbsolve/graph_legend.html A set of C++ class definitions used to demonstrate various inheritance and containment relationships in Doxygen graphs. ```cpp /*! Invisible class because of truncation */ class Invisible { }; /*! Truncated class, inheritance relation is hidden */ class Truncated : public Invisible { }; /* Class not documented with doxygen comments */ class Undocumented { }; /*! Class that is inherited using public inheritance */ class PublicBase : public Truncated { }; /*! A template class */ template class Templ { }; /*! Class that is inherited using protected inheritance */ class ProtectedBase { }; /*! Class that is inherited using private inheritance */ class PrivateBase { }; /*! Class that is used by the Inherited class */ class Used { }; /*! Super class that inherits a number of other classes */ class Inherited : public PublicBase, protected ProtectedBase, private PrivateBase, public Undocumented, public Templ { private: Used *m_usedClass; }; ``` -------------------------------- ### initialize(real x) Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1ic__density.html Pure virtual method that returns the initial density matrix for a given position x. This is the primary interface for subclasses to implement. ```APIDOC ## initialize(real x) ### Description Returns the initial density matrix for a given position x. This is a pure virtual method that must be implemented by derived classes. ### Method initialize ### Signature virtual const qm_operator& initialize(real x) = 0 ### Parameters - **x** (real) - Required - The position for which the initial density matrix is returned. ### Returns - **const qm_operator&** - The initial density matrix at position x. ### Implemented In - mbsolve::ic_density_const ``` -------------------------------- ### run() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1solver__cpu__fdtd__red.html Executes the solver. This method is virtual and implements the pure virtual method from mbsolve::solver. ```APIDOC ## run() ### Description Executes the solver. This method is virtual and implements the pure virtual method from mbsolve::solver. ### Signature cpp void run() const ### Parameters - None ### Returns - void ``` -------------------------------- ### get_type() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1record.html Gets type of the record. ```APIDOC ## mbsolve::record::get_type() ### Description Gets type of the record. ### Returns - **type** - Type of the record. ``` -------------------------------- ### get_name() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1record.html Gets name of the record. ```APIDOC ## mbsolve::record::get_name() ### Description Gets name of the record. ### Returns - **const std::string&** - Name of the record. ``` -------------------------------- ### qm_description constructor Source: https://mriesch-tum.github.io/mbsolve/qm__description_8hpp_source.html Constructs a quantum mechanical description with carrier density, Hamiltonian, dipole operator, and relaxation superoperator. ```APIDOC ## qm_description constructor ### Description Constructs a quantum mechanical description with carrier density, Hamiltonian, dipole operator, and relaxation superoperator. ### Method Constructor ### Signature `qm_description(real carrier_density, const qm_operator& hamiltonian, const qm_operator& dipole_operator, std::shared_ptr relaxation_superop)` ### Parameters - **carrier_density** (real) - Required - The density of charge carriers. - **hamiltonian** (const qm_operator&) - Required - The Hamiltonian operator. - **dipole_operator** (const qm_operator&) - Required - The dipole moment operator. - **relaxation_superop** (std::shared_ptr) - Required - The relaxation superoperator. ### Returns No return value (constructor). ``` -------------------------------- ### scenario::scenario (constructor 2) Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Constructs a scenario with a name, number of grid points, end time, and initial conditions for the density matrix. ```APIDOC ## scenario::scenario (constructor 2) ### Description Constructs a scenario with the given name, number of spatial grid points, simulation end time, and initial conditions for the density matrix. ### Signature mbsolve::scenario::scenario(const std::string & _name_, unsigned int _num_gridpoints_, real _endtime_, std::shared_ptr< ic_density > _density_init_) ### Parameters - **name** (const std::string &) - [in] - Name of the scenario. - **num_gridpoints** (unsigned int) - [in] - Number of spatial grid points. - **endtime** (real) - [in] - Simulation end time. - **density_init** (std::shared_ptr< ic_density >) - [in] - Initial conditions for density matrix. ``` -------------------------------- ### get_timestep_size() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Gets time step size. ```APIDOC ## get_timestep_size() n ### Description Gets time step size. ### Method real mbsolve::scenario::get_timestep_size() const ### Parameters None ### Returns - **real** - The time step size. ``` -------------------------------- ### scenario::scenario (constructor 1) Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Constructs a scenario with a name, number of grid points, end time, and an initial density matrix. ```APIDOC ## scenario::scenario (constructor 1) ### Description Constructs a scenario with the given name, number of spatial grid points, simulation end time, and initial density matrix. ### Signature mbsolve::scenario::scenario(const std::string & _name_, unsigned int _num_gridpoints_, real _endtime_, const qm_operator & _rho_init_) ### Parameters - **name** (const std::string &) - [in] - Name of the scenario. - **num_gridpoints** (unsigned int) - [in] - Number of spatial grid points. - **endtime** (real) - [in] - Simulation end time. - **rho_init** (const qm_operator &) - [in] - Initial density matrix. ``` -------------------------------- ### get_num_timesteps() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Gets number of time steps. ```APIDOC ## get_num_timesteps() n ### Description Gets number of time steps. ### Method unsigned int mbsolve::scenario::get_num_timesteps() const ### Parameters None ### Returns - **unsigned int** - The number of time steps. ``` -------------------------------- ### qm_desc_2lvl constructor Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1qm__desc__2lvl.html Constructs a two-level system description with the given carrier density, transition frequency, dipole moment, scattering rate, dephasing rate, and equilibrium inversion. ```APIDOC ## Constructor: qm_desc_2lvl ### Description Constructs a two-level system description with the Hamiltonian and the dipole moment operator. ### Signature qm_desc_2lvl(real carrier_density, real transition_freq, real dipole_moment, real scattering_rate, real dephasing_rate, real equilibrium_inversion = -1.0) ### Parameters - **carrier_density** (real) - Required - Density of particles in the system. - **transition_freq** (real) - Required - Transition frequency between upper and lower laser level. - **dipole_moment** (real) - Required - Dipole moment between upper and lower laser level. - **scattering_rate** (real) - Required - Describes the decay of the population inversion towards equilibrium_inversion. - **dephasing_rate** (real) - Required - Describes the decay of the coherence term. - **equilibrium_inversion** (real) - Optional - Equilibrium value of the population inversion. Default is -1.0 (all particles in lower energy level). ``` -------------------------------- ### get_gridpoint_size() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Gets grid point size. ```APIDOC ## get_gridpoint_size() ### Description Gets grid point size. ### Method real mbsolve::scenario::get_gridpoint_size() const ### Parameters None ### Returns - **real** - The grid point size. ``` -------------------------------- ### Initialize Solver Constants Source: https://mriesch-tum.github.io/mbsolve/algo__lindblad__cvr__rodr_8hpp_source.html Initializes the simulation constants (sim_constants) based on the quantum mechanical description, including Hamiltonian contributions, dissipation terms, and equilibrium vectors. ```cpp /* check whether number of levels matches solver */ if (qm->get_num_levels() != num_lvl) { throw std::invalid_argument( "Number of energy levels does not " "match selected solver!"); } /* create coherence vector representation */ cv_representation cvr(qm); /* polarization constant */ sc.M_CP = 0.5 * qm->get_carrier_density(); /* time step size */ sc.d_t = time_step; /* dissipation term in cvr */ real_matrix_t G = cvr.get_relaxation_superop(); /* time-independent Hamiltonian contribution in cvr */ real_matrix_t M_0 = cvr.get_hamiltonian(); /* time-independent part of the Lindblad equation rhs */ sc.M = M_0 + G; /* dipole moment Liouvillian in cvr form (matrix) + squared */ sc.U = -cvr.get_dipole_operator(); sc.U2 = sc.U * sc.U; sc.theta_1 = sqrt( pow(sc.U(0, 1), 2) + pow(sc.U(0, 2), 2) + pow(sc.U(1, 2), 2)); /* time-independent propagator, half step */ sc.A1 = (sc.M * time_step / 2).exp(); /* prepare time-dependent propagator */ fill_coefficients(sc); /* dipole moment operator in cvr form (vector) */ sc.v = cvr.get_dipole_operator_vec(); /* equilibrium terms */ sc.d_eq = cvr.get_equilibrium_vec(); real eps = std::numeric_limits::epsilon(); if (sc.d_eq.isZero(eps)) { sc.d_in = density::Zero(); } else { /* solve equation system M * d_in = d_eq */ sc.d_in = sc.M.fullPivLu().solve(sc.d_eq); real err = (sc.M * sc.d_in - sc.d_eq).norm() / sc.d_eq.norm(); if (err > 1e-3) { throw std::invalid_argument("Time-indepent matrix not " "invertible!"); } } ``` -------------------------------- ### get_endtime() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Gets the simulation end time. ```APIDOC ## get_endtime() ### Description Gets the simulation end time. ### Method real mbsolve::scenario::get_endtime() const ### Parameters None ### Returns - **real** - The simulation end time. ``` -------------------------------- ### set_ic_density(std::shared_ptr _density_init_) Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Sets initial conditions for density matrix. ```APIDOC ## set_ic_density(std::shared_ptr _density_init_) ### Description Sets initial conditions for density matrix. ### Method set_ic_density ### Parameters - **_density_init_** (std::shared_ptr) - Required - The initial density condition. ### Return Type void ``` -------------------------------- ### source::get_type Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1source.html Gets the type of the source. ```APIDOC ## source::get_type ### Description Gets the type of the source. ### Method `type get_type() const` ### Returns - **type** - The source type (hard_source or soft_source). ``` -------------------------------- ### device(const std::string &name) Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1device.html Constructs a device with the given name. ```APIDOC ## device(const std::string &name) ### Description Constructs a device with the given name. ### Parameters - **name** (const std::string&) - Required - Name of the device. ``` -------------------------------- ### source::get_position Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1source.html Gets the position of the source. ```APIDOC ## source::get_position ### Description Gets the position of the source. ### Method `real get_position() const` ### Returns - **real** - The position of the source in meters. ``` -------------------------------- ### result::get_rows Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1result.html Gets the number of rows. ```APIDOC ## result::get_rows ### Description Gets the number of rows. ### Signature unsigned int get_rows() const ### Returns - **unsigned int** - The number of rows. ``` -------------------------------- ### Handle Non-Quantum Initialization Source: https://mriesch-tum.github.io/mbsolve/algo__lindblad__cvr__rodr_8hpp_source.html Resets simulation constants to zero when no quantum mechanical description is provided. ```cpp } else { /* no quantum mechanical description */ sc.has_qm = false; sc.M_CP = 0.0; sc.d_t = 0.0; sc.M = real_matrix_t::Zero(); sc.U = real_matrix_t::Zero(); sc.U2 = real_matrix_t::Zero(); sc.theta_1 = 0.0; sc.A1 = real_matrix_t::Zero(); sc.v = density::Zero(); sc.d_eq = density::Zero(); sc.d_in = density::Zero(); /* TODO initialize properly?: real_matrix_t coeff_1[num_lvl/2]; real_matrix_t coeff_2[num_lvl/2]; real theta[num_lvl/2]; */ } ``` -------------------------------- ### qm_description::qm_description Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1qm__description.html Constructor for the qm_description class, initializing the quantum mechanical description of an active region. ```APIDOC ## Constructor: qm_description ### Description Constructs a quantum mechanical description of an active region with the given carrier density, Hamiltonian, dipole operator, and relaxation superoperator. ### Signature ```cpp qm_description(real carrier_density, const qm_operator &hamiltonian, const qm_operator &dipole_operator, std::shared_ptr relaxation_superop) ``` ### Parameters - **carrier_density** (real) - Required - Density of particles in the system. - **hamiltonian** (const qm_operator&) - Required - Hamiltonian operator. - **dipole_operator** (const qm_operator&) - Required - Dipole moment operator. - **relaxation_superop** (std::shared_ptr) - Required - Relaxation superoperator. ### Returns No return value. ``` -------------------------------- ### result::get_cols Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1result.html Gets the number of columns. ```APIDOC ## result::get_cols ### Description Gets the number of columns. ### Signature unsigned int get_cols() const ### Returns - **unsigned int** - The number of columns. ``` -------------------------------- ### scenario::scenario (constructor with qm_operator) Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Constructs a scenario object with a name, number of grid points, end time, and an initial density operator. ```APIDOC ## scenario::scenario (constructor with qm_operator) ### Description Constructs a scenario object with the given name, number of grid points, end time, and initial density operator. ### Signature scenario(const std::string &name, unsigned int num_gridpoints, real endtime, const qm_operator &rho_init) ### Parameters - **name** (const std::string&) - Required - The name of the scenario. - **num_gridpoints** (unsigned int) - Required - The number of grid points. - **endtime** (real) - Required - The end time of the simulation. - **rho_init** (const qm_operator&) - Required - The initial density operator. ``` -------------------------------- ### result::get_count Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1result.html Gets the count of the result. ```APIDOC ## result::get_count ### Description Gets the count of the result. ### Signature unsigned int get_count() const ### Returns - **unsigned int** - The count of the result. ``` -------------------------------- ### scenario::scenario (constructor with ic_density) Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Constructs a scenario object with a name, number of grid points, end time, and an initial density condition. ```APIDOC ## scenario::scenario (constructor with ic_density) ### Description Constructs a scenario object with the given name, number of grid points, end time, and initial density condition. ### Signature scenario(const std::string &name, unsigned int num_gridpoints, real endtime, std::shared_ptr density_init) ### Parameters - **name** (const std::string&) - Required - The name of the scenario. - **num_gridpoints** (unsigned int) - Required - The number of grid points. - **endtime** (real) - Required - The end time of the simulation. - **density_init** (std::shared_ptr) - Required - The initial density condition. ``` -------------------------------- ### result::get_name Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1result.html Gets the result name. ```APIDOC ## result::get_name ### Description Gets the result name. ### Signature std::string get_name() const ### Returns - **std::string** - The name of the result. ``` -------------------------------- ### get_row() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1record.html Gets row index (zero-based). ```APIDOC ## mbsolve::record::get_row() ### Description Gets row index (zero-based). ### Returns - **unsigned int** - Row index (zero-based). ``` -------------------------------- ### solver_cpu_fdtd_red constructor Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1solver__cpu__fdtd__red.html Constructs a solver_cpu_fdtd_red instance with a device and scenario. ```APIDOC ## solver_cpu_fdtd_red ### Description Constructs a solver_cpu_fdtd_red instance with the given device and scenario. ### Signature cpp solver_cpu_fdtd_red(std::shared_ptr dev, std::shared_ptr scen) ### Parameters - **dev** (std::shared_ptr) - Required - The device to be used by the solver. - **scen** (std::shared_ptr) - Required - The scenario to be solved. ### Returns - None (constructor) ``` -------------------------------- ### get_position() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1record.html Gets sampling position (in meter). ```APIDOC ## mbsolve::record::get_position() ### Description Gets sampling position (in meter). ### Returns - **real** - Sampling position in meter. ``` -------------------------------- ### get_interval() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1record.html Gets sampling interval (in seconds). ```APIDOC ## mbsolve::record::get_interval() ### Description Gets sampling interval (in seconds). ### Returns - **real** - Sampling interval in seconds. ``` -------------------------------- ### mbsolve::solver::get_device Source: https://mriesch-tum.github.io/mbsolve/solver_8hpp_source.html Returns the device to be simulated. This accessor provides a constant reference to the device. ```APIDOC ## get_device ### Description Returns the device to be simulated as a constant reference. ### Method const ### Signature `const device& get_device() const` ### Parameters None ### Returns - **const device&** - The device to be simulated. ### Example ```cpp const device& dev = solver->get_device(); ``` ``` -------------------------------- ### get_col() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1record.html Gets column index (zero-based). ```APIDOC ## mbsolve::record::get_col() ### Description Gets column index (zero-based). ### Returns - **unsigned int** - Column index (zero-based). ``` -------------------------------- ### qm_desc_2lvl constructor Source: https://mriesch-tum.github.io/mbsolve/qm__description_8hpp_source.html Constructs a two-level quantum description with specified parameters. ```APIDOC ## qm_desc_2lvl constructor ### Description Constructs a two-level quantum description with specified parameters. ### Method Constructor ### Signature `qm_desc_2lvl(real carrier_density, real transition_freq, real dipole_moment, real scattering_rate, real dephasing_rate, real equilibrium_inversion = -1.0)` ### Parameters - **carrier_density** (real) - Required - The density of charge carriers. - **transition_freq** (real) - Required - The transition frequency. - **dipole_moment** (real) - Required - The dipole moment. - **scattering_rate** (real) - Required - The scattering rate from upper laser level to lower laser level. - **dephasing_rate** (real) - Required - The dephasing rate. - **equilibrium_inversion** (real) - Optional - The equilibrium population inversion. Defaults to -1.0. ### Returns No return value (constructor). ``` -------------------------------- ### get_num_gridpoints() Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Gets number of spatial grid points. ```APIDOC ## get_num_gridpoints() ### Description Gets number of spatial grid points. ### Method unsigned int mbsolve::scenario::get_num_gridpoints() const ### Parameters None ### Returns - **unsigned int** - The number of spatial grid points. ``` -------------------------------- ### material::get_qm Source: https://mriesch-tum.github.io/mbsolve/material_8hpp_source.html Getter for the quantum mechanical description. ```APIDOC ## material::get_qm ### Description Returns the quantum mechanical description of the active material. ### Method Getter ### Signature `std::shared_ptr get_qm() const` ### Parameters None. ### Returns - **std::shared_ptr** - The quantum mechanical description. ``` -------------------------------- ### material::material Source: https://mriesch-tum.github.io/mbsolve/material_8hpp_source.html Constructor for the material class. ```APIDOC ## material::material ### Description Constructs a material object with the given identifier, quantum mechanical description, and electromagnetic properties. ### Method Constructor ### Signature `material(const std::string& id, std::shared_ptr qm = nullptr, real rel_permittivity = 1.0, real overlap_factor = 1.0, real losses = 0.0, real rel_permeability = 1.0)` ### Parameters - **id** (const std::string&) - Required - Material identifier. - **qm** (std::shared_ptr) - Optional - Quantum mechanical description of the active material. Defaults to nullptr. - **rel_permittivity** (real) - Optional - Relative permittivity. Defaults to 1.0. - **overlap_factor** (real) - Optional - Overlap factor. Defaults to 1.0. - **losses** (real) - Optional - Losses. Defaults to 0.0. - **rel_permeability** (real) - Optional - Relative permeability. Defaults to 1.0. ### Returns No return value (constructor). ``` -------------------------------- ### Include mbsolve library components in lib.hpp Source: https://mriesch-tum.github.io/mbsolve/lib_8hpp_source.html This header file includes all necessary sub-modules for the mbsolve library, protected by the MBSOLVE_LIB_H include guard. ```cpp /* * mbsolve: An open-source solver tool for the Maxwell-Bloch equations. * * Copyright (c) 2016, Computational Photonics Group, Technical University of * Munich. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MBSOLVE_LIB_H #define MBSOLVE_LIB_H #include #include #include #include #include #include #include #include #include #include #endif ``` -------------------------------- ### result::get_data_complex Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1result.html Gets the complex-valued result data. ```APIDOC ## result::get_data_complex ### Description Gets the complex-valued result data. ### Signature std::vector> get_data_complex() const ### Returns - **std::vector>** - The complex-valued result data. ``` -------------------------------- ### mbsolve::solver::run Source: https://mriesch-tum.github.io/mbsolve/solver_8hpp_source.html Runs the solver. This pure virtual method must be implemented by derived solver classes to perform the actual simulation. ```APIDOC ## run ### Description Runs the solver. This is a pure virtual method that must be implemented by derived classes to perform the simulation. ### Method virtual pure ### Signature `virtual void run() const = 0` ### Parameters None ### Returns void ### Example ```cpp solver->run(); ``` ``` -------------------------------- ### source::get_value Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1source.html Gets the source value at a given time. ```APIDOC ## source::get_value ### Description Gets the source value at a certain time value. ### Method `real get_value(real t, real current_value = 0.0) const` ### Parameters - **t** (real) - Required - Time value. - **current_value** (real) - Optional - Reserved for later use. Default is 0.0. ### Returns - **real** - The source value at the given time. ``` -------------------------------- ### scenario::get_ic_density Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Returns the initial density condition. ```APIDOC ## scenario::get_ic_density ### Description Returns the initial density condition. ### Signature std::shared_ptr get_ic_density() const ### Returns A shared pointer to the initial density condition. ``` -------------------------------- ### result::get_data_imag Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1result.html Gets the imaginary part of the result data. ```APIDOC ## result::get_data_imag ### Description Gets the imaginary part of the result data. ### Signature const std::vector& get_data_imag() const ### Returns - **const std::vector&** - Reference to the imaginary part of the result data. ``` -------------------------------- ### Aligned memory allocation for CPU solver (mb_aligned_alloc, mb_aligned_free) Source: https://mriesch-tum.github.io/mbsolve/common__cpu_8hpp_source.html Provides aligned memory allocation and deallocation functions for the CPU solver. It uses Intel's _mm_malloc/_mm_free when __INTEL_COMPILER is defined, _aligned_malloc/_aligned_free on Windows, and posix_memalign/free otherwise. The __mb_assume_aligned macro is defined accordingly to hint alignment to the compiler. ```cpp #ifdef __INTEL_COMPILER __mb_on_device inline void* mb_aligned_alloc(size_t size) { return _mm_malloc(size, ALIGN); } __mb_on_device inline void mb_aligned_free(void* ptr) { _mm_free(ptr); } #define __mb_assume_aligned(ptr) __assume_aligned((ptr), ALIGN) #else #ifdef _WIN32 inline void* mb_aligned_alloc(size_t size) { return _aligned_malloc(size, ALIGN); } inline void mb_aligned_free(void* ptr) { _aligned_free(ptr); } #define __mb_assume_aligned(ptr) #else inline void* mb_aligned_alloc(size_t size) { void* addr; int ret; ret = posix_memalign(&addr, ALIGN, size); if (ret != 0) { throw std::invalid_argument("posix_memalign failed."); } return addr; } inline void mb_aligned_free(void* ptr) { free(ptr); } #define __mb_assume_aligned(ptr) __builtin_assume_aligned(ptr, ALIGN) #endif #endif ``` -------------------------------- ### result::get_data_real Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1result.html Gets the real part of the result data. ```APIDOC ## result::get_data_real ### Description Gets the real part of the result data. ### Signature const std::vector& get_data_real() const ### Returns - **const std::vector&** - Reference to the real part of the result data. ``` -------------------------------- ### mbsolve::solver::create_instance Source: https://mriesch-tum.github.io/mbsolve/solver_8hpp_source.html Creates a solver instance by name. This static method looks up the registered bootstrap function for the given name and invokes it with the provided device and scenario. ```APIDOC ## create_instance ### Description Creates a solver instance of the solver registered under the given name. The method uses the registered bootstrap function to construct the solver. ### Method static ### Signature `static std::shared_ptr create_instance(const std::string& name, std::shared_ptr dev, std::shared_ptr scen)` ### Parameters - **name** (const std::string&) - Required - The name of the solver to create. - **dev** (std::shared_ptr) - Required - The device to be simulated. - **scen** (std::shared_ptr) - Required - The simulation scenario. ### Returns - **std::shared_ptr** - A shared pointer to the created solver instance. ### Example ```cpp auto solver = mbsolve::solver::create_instance("my_solver", dev, scen); ``` ``` -------------------------------- ### qm_operator::get_num_levels Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1qm__operator.html Gets the number of levels of the quantum operator. ```APIDOC ## Method ### Description Gets number of levels. ### Signature unsigned int get_num_levels() const ### Returns - **unsigned int** - The number of levels ``` -------------------------------- ### get_qm_constants method Source: https://mriesch-tum.github.io/mbsolve/algo__lindblad__cvr__rodr_8hpp_source.html Determines the simulation constants for the quantum mechanical description required for the generalized Rodrigues formula. ```cpp static sim_constants get_qm_constants( std::shared_ptr qm, real time_step) { sim_constants sc; if (qm) { /* quantum mechanical description present */ sc.has_qm = true; ``` -------------------------------- ### qm_operator::get_main_diagonal Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1qm__operator.html Gets the main diagonal entries of the quantum operator. ```APIDOC ## Method ### Description Gets main diagonal entries. ### Signature const std::vector& get_main_diagonal() const ### Returns - **const std::vector&** - The main diagonal entries ``` -------------------------------- ### real get_minimum_permittivity() const Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1device.html Gets the minimum relative permittivity value. ```APIDOC ## real get_minimum_permittivity() const ### Description Gets the minimum relative permittivity value. ### Returns The minimum relative permittivity as a real number. ``` -------------------------------- ### FDTD common header with simulation initialization and constants Source: https://mriesch-tum.github.io/mbsolve/common__fdtd_8hpp_source.html Header guard and includes for the FDTD common utilities. Defines the sim_source struct, the init_fdtd_simulation function, the sim_constants_fdtd struct, and the get_fdtd_constants function within the mbsolve namespace. ```cpp #ifndef MBSOLVE_COMMON_FDTD_H #define MBSOLVE_COMMON_FDTD_H #include #include #include #include #include namespace mbsolve { class sim_source { public: source::type type; unsigned int x_idx; unsigned int data_base_idx; }; static void init_fdtd_simulation( std::shared_ptr dev, std::shared_ptr scen, real courant = 1) { if (scen->get_num_gridpoints() > 0) { /* speed of light (use smallest value of relative permittivities) */ real velocity = 1.0 / sqrt(MU0 * EPS0 * dev->get_minimum_permittivity()); /* get number of grid points */ unsigned int n_x = scen->get_num_gridpoints(); /* grid point size */ real d_x = dev->get_length() / (n_x - 1); scen->set_gridpoint_size(d_x); /* time step size */ real d_t = courant * d_x / velocity; /* number of time steps */ unsigned int n_t = ceil(scen->get_endtime() / d_t) + 1; scen->set_num_timesteps(n_t); /* re-adjust time step size in order to fit number of time steps */ d_t = scen->get_endtime() / (n_t - 1); scen->set_timestep_size(d_t); } else { throw std::invalid_argument("Invalid scenario."); } } class sim_constants_fdtd { public: /* prefactor for current electric field in Ampere's law (update equation * for electric field). */ real fac_a; /* prefactor for the \partial_x H_y and \partial_t P_z (update equation * for electric field) */ real fac_b; /* prefactor for \partial_x E_z (update equation for magnetic field) */ real fac_c; /* overlap factor (applied as pre-factor to polarization, which is * determined by the density matrix) */ real gamma; }; static sim_constants_fdtd get_fdtd_constants( std::shared_ptr dev, std::shared_ptr scen, std::shared_ptr mat) { sim_constants_fdtd sc; /* convert loss term to conductivity */ real sigma = sqrt( EPS0 * mat->get_rel_permittivity() / (MU0 * mat->get_rel_permeability())) * mat->get_losses() * 2.0; real dt = scen->get_timestep_size(); real epsilon = EPS0 * mat->get_rel_permittivity(); real x = (sigma * dt) / (2.0 * epsilon); /* prefactor a */ sc.fac_a = (1.0 - x) / (1.0 + x); /* prefactor b */ sc.fac_b = dt / epsilon / (1.0 + x); /* prefactor c */ sc.fac_c = dt / (MU0 * mat->get_rel_permeability() * scen->get_gridpoint_size()); /* overlap factor */ sc.gamma = mat->get_overlap_factor(); return sc; } } #endif ``` -------------------------------- ### scenario::add_source Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Adds a source to the scenario. ```APIDOC ## scenario::add_source ### Description Adds a source to the scenario. ### Signature void add_source(std::shared_ptr src) ### Parameters - **src** (std::shared_ptr) - Required - The source to add. ``` -------------------------------- ### scenario::add_source Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Adds a source to the scenario. ```APIDOC ## scenario::add_source ### Description Adds a source to the scenario. ### Signature void mbsolve::scenario::add_source(std::shared_ptr< source > _src_) ### Parameters - **src** (std::shared_ptr< source >) - The source to add. ``` -------------------------------- ### result::get_data_imag_it Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1result.html Gets an iterator for the imaginary part of the result data at a specified row and column. ```APIDOC ## result::get_data_imag_it ### Description Gets an iterator for the imaginary part of the result data. ### Signature std::vector::iterator get_data_imag_it(unsigned int row, unsigned int col) ### Parameters - **row** (unsigned int) - Required - Row index. - **col** (unsigned int) - Required - Column index. ### Returns - **std::vector::iterator** - Iterator for the imaginary part of the result data. ``` -------------------------------- ### result::get_data_real_it Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1result.html Gets an iterator for the real part of the result data at a specified row and column. ```APIDOC ## result::get_data_real_it ### Description Gets an iterator for the real part of the result data. ### Signature std::vector::iterator get_data_real_it(unsigned int row, unsigned int col) ### Parameters - **row** (unsigned int) - Required - Row index. - **col** (unsigned int) - Required - Column index. ### Returns - **std::vector::iterator** - Iterator for the real part of the result data. ``` -------------------------------- ### source::source Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1source.html Constructs a source with the given name, position, type, amplitude, frequency, and optional phase. ```APIDOC ## source::source ### Description Constructs a source with the specified parameters. ### Constructor `source(const std::string &name, real position, type source_type, real ampl, real freq, real phase = 0)` ### Parameters - **name** (std::string) - Required - Name of the source. - **position** (real) - Required - Position of the source (in meters). - **source_type** (type) - Required - Source type (hard_source or soft_source). - **ampl** (real) - Required - Amplitude of the source. - **freq** (real) - Required - Frequency of the source. - **phase** (real) - Optional - Phase of the source. Default is 0. ``` -------------------------------- ### material::get_id Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1material.html Gets the material ID. This is a const member function that returns the identifier of the material. ```APIDOC ## material::get_id ### Description Gets the material ID. This is a const member function that returns the identifier of the material. ### Method Member Function ### Signature `const std::string& mbsolve::material::get_id() const` ### Returns - **const std::string&** - The material ID. ### Example ```cpp // Get the material ID std::string id = mat->get_id(); ``` ``` -------------------------------- ### record() [2/2] Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1record.html Constructor that constructs a record with explicit type, row, and column indices. ```APIDOC ## mbsolve::record::record [2/2] ### Description Constructs record with explicit type, row index, and column index. ### Parameters - **name** (const std::string&) - [in] - Name of the record. - **record_type** (type) - [in] - Type of the record, e.g., "density". - **row_idx** (unsigned int) - [in] - Only for density matrix entries. One-based. - **col_idx** (unsigned int) - [in] - Only for density matrix entries. One-based. - **interval** (real) - [in] - Sampling interval in seconds. If set to 0.0, the value at every time step is stored. - **position** (real) - [in] - Sampling position in meter. If set to -1.0, the complete grid is stored. ``` -------------------------------- ### scenario::set_ic_density Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1scenario.html Sets the initial density condition. ```APIDOC ## scenario::set_ic_density ### Description Sets the initial density condition. ### Signature void set_ic_density(std::shared_ptr density_init) ### Parameters - **density_init** (std::shared_ptr) - Required - The initial density condition to set. ``` -------------------------------- ### writer_hdf5_loader constructor Source: https://mriesch-tum.github.io/mbsolve/writer__hdf5_8hpp_source.html Constructs a writer_hdf5_loader object. This is the default constructor for the writer_hdf5_loader class. ```APIDOC ## writer_hdf5_loader::writer_hdf5_loader ### Description Constructs a writer_hdf5_loader object. This is the default constructor for the writer_hdf5_loader class. ### Method writer_hdf5_loader ### Signature writer_hdf5_loader() ### Parameters None ### Return Value None ``` -------------------------------- ### Utility Functions for Density and Population Source: https://mriesch-tum.github.io/mbsolve/algo__lindblad__cvr__rodr_8hpp_source.html Provides helper functions to calculate population inversion, specific populations, and convert operators to density matrices. ```cpp /* * Returns the population inversion (which is the difference * \f$ \rho_{22} - \rho_{11} \f$). */ static inline real calc_inversion(const density& d) { return d(num_lvl * (num_lvl - 1)); } /* * Returns the population specified by \param idx (zero-based). */ static inline real calc_population(const density& d, unsigned int idx) { return cv_representation::calc_population(d, idx); } /* * Converts the density matrix \param op into the coherence vector * representation. */ static inline density get_density(const qm_operator& op) { return cv_representation::coherence_vector(op); } /* * Returns a zero coherence vector (for initialization purposes only). */ static inline density get_density() { return density::Zero(); } ``` -------------------------------- ### qm_operator::get_off_diagonal Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1qm__operator.html Gets the off-diagonal entries (top half, column major ordering) of the quantum operator. ```APIDOC ## Method ### Description Gets off-diagonal entries (top half, column major ordering). ### Signature const std::vector>& get_off_diagonal() const ### Returns - **const std::vector>&** - The off-diagonal entries ``` -------------------------------- ### mbsolve::writer::create_instance Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1writer.html Static function that constructs a writer instance with a given name. ```APIDOC ## mbsolve::writer::create_instance ### Description Constructs a writer with a given name. ### Method create_instance ### Signature static std::shared_ptr create_instance(const std::string &name) ### Parameters - **name** (const std::string&) - Required - Name of the writer method. ### Returns std::shared_ptr - A shared pointer to the created writer instance. ``` -------------------------------- ### material::get_losses Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1material.html Gets the optical losses α. This is a const member function that returns the losses value. ```APIDOC ## material::get_losses ### Description Gets the optical losses α. This is a const member function that returns the losses value. ### Method Member Function ### Signature `real mbsolve::material::get_losses() const` ### Returns - **real** - The optical losses α. ### Example ```cpp // Get the losses real losses = mat->get_losses(); ``` ``` -------------------------------- ### material::get_rel_permittivity Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1material.html Gets the relative permittivity εr. This is a const member function that returns the relative permittivity value. ```APIDOC ## material::get_rel_permittivity ### Description Gets the relative permittivity εr. This is a const member function that returns the relative permittivity value. ### Method Member Function ### Signature `real mbsolve::material::get_rel_permittivity() const` ### Returns - **real** - The relative permittivity εr. ### Example ```cpp // Get the relative permittivity real eps_r = mat->get_rel_permittivity(); ``` ``` -------------------------------- ### material::get_rel_permeability Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1material.html Gets the relative permeability μr. This is a const member function that returns the relative permeability value. ```APIDOC ## material::get_rel_permeability ### Description Gets the relative permeability μr. This is a const member function that returns the relative permeability value. ### Method Member Function ### Signature `real mbsolve::material::get_rel_permeability() const` ### Returns - **real** - The relative permeability μr. ### Example ```cpp // Get the relative permeability real mu_r = mat->get_rel_permeability(); ``` ``` -------------------------------- ### record::record (constructor with name, interval, position) Source: https://mriesch-tum.github.io/mbsolve/record_8hpp_source.html Constructs a record object with a name, optional interval, and optional position. This constructor is used for recording data at a specific position or over an interval. ```APIDOC ## record::record (constructor) ### Description Constructs a record object with a name, optional interval, and optional position. This constructor is used for recording data at a specific position or over an interval. ### Method Constructor ### Signature `record(const std::string& name, real interval = 0.0, real position = -1.0)` ### Parameters - **name** (const std::string&) - Required - The name of the record. - **interval** (real) - Optional - The recording interval. Default is 0.0. - **position** (real) - Optional - The position for recording. Default is -1.0. ### Returns No return value (constructor). ``` -------------------------------- ### material::get_overlap_factor Source: https://mriesch-tum.github.io/mbsolve/classmbsolve_1_1material.html Gets the overlap factor Γ. This is a const member function that returns the overlap factor value. ```APIDOC ## material::get_overlap_factor ### Description Gets the overlap factor Γ. This is a const member function that returns the overlap factor value. ### Method Member Function ### Signature `real mbsolve::material::get_overlap_factor() const` ### Returns - **real** - The overlap factor Γ. ### Example ```cpp // Get the overlap factor real overlap = mat->get_overlap_factor(); ``` ```