4 #ifndef CPPQEDCORE_STRUCTURE_STRUCTURE_H_INCLUDED
5 #define CPPQEDCORE_STRUCTURE_STRUCTURE_H_INCLUDED
7 #include "StructureFwd.h"
43 typedef blitz::TinyVector<bool,3> SystemCharacteristics;
46 using boost::dynamic_pointer_cast;
54 {
return dynamic_pointer_cast<
const Exact<RANK> >(quantumSystem);}
59 const typename Hamiltonian<RANK>::Ptr
66 const typename Liouvillean<RANK>::Ptr
73 const typename Averaged<RANK>::Ptr
75 {
return dynamic_pointer_cast<
const Averaged<RANK> >(quantumSystem);}
81 const typename Exact<RANK>::Ptr
82 qse(DynamicsBase::Ptr base)
83 {
return dynamic_pointer_cast<
const Exact<RANK> >(base);}
88 const typename Hamiltonian<RANK>::Ptr
89 qsh(DynamicsBase::Ptr base)
95 const typename Liouvillean<RANK>::Ptr
96 qsl(DynamicsBase::Ptr base)
102 const typename Averaged<RANK>::Ptr
103 qsa(DynamicsBase::Ptr base)
133 template<
int RANK,
bool IS_CONST>
137 static const int N_RANK=RANK;
150 typedef typename QS::Ptr QuantumSystemPtr;
151 typedef typename Ex::Ptr ExactPtr;
152 typedef typename Ha::Ptr HamiltonianPtr;
153 typedef typename Li::Ptr LiouvilleanPtr;
154 typedef typename Av::Ptr AveragedPtr;
159 typedef typename Ex::StateVectorLow StateVectorLow;
162 typedef typename Li::LazyDensityOperator LazyDensityOperator;
164 typedef typename Av::Averages Averages;
181 li_(isNoisy ? qsl<RANK>(qs) : LiouvilleanPtr()),
188 const QuantumSystemPtr getQS()
const {
return qs_;}
189 const ExactPtr getEx()
const {
return ex_;}
190 const HamiltonianPtr getHa()
const {
return ha_;}
191 const LiouvilleanPtr getLi()
const {
return li_;}
192 const AveragedPtr getAv()
const {
return av_;}
194 QuantumSystemPtr getQS() {
return qs_;}
195 ExactPtr getEx() {
return ex_;}
196 HamiltonianPtr getHa() {
return ha_;}
197 LiouvilleanPtr getLi() {
return li_;}
198 AveragedPtr getAv() {
return av_;}
210 const L_or_A_Ptr getLA(LA_Li_tagType)
const {
return li_;}
211 const L_or_A_Ptr getLA(LA_Av_tagType)
const {
return av_;}
215 std::ostream&
displayCharacteristics(std::ostream& os)
const {
return os<<
"# System characteristics: "<<(ex_ ?
"Interaction picture, " :
"")<<(ha_ ?
"Hamiltonian evolution, " :
"")<<(li_ ?
"Liouvillean evolution, " :
"")<<(av_ ?
"calculates Averages." :
"");}
220 bool applicableInMaster()
const {
return ex_ ? ex_->applicableInMaster() :
true;}
222 void actWithU(
double t, StateVectorLow& psi,
double t0)
const {
if (ex_) ex_->actWithU(t,psi,t0);}
228 void addContribution(
double t,
const StateVectorLow& psi, StateVectorLow& dpsidt,
double t0)
const {
if (ha_) ha_->addContribution(t,psi,dpsidt,t0);}
234 void actWithJ(
double t, StateVectorLow& psi,
size_t lindbladNo)
const {
if (li_) li_->actWithJ(t,psi,lindbladNo);}
240 void process(Averages& averages)
const {
if (av_) av_->process(averages);}
242 std::ostream& display(
double t,
const LazyDensityOperator& matrix, std::ostream& os,
int precision)
const {
return structure::display(av_,t,matrix,os,precision);}
248 template<LiouvilleanAveragedTag LA>
249 size_t nAvr()
const {
const auto ptr=getLA(LiouvilleanAveragedTag_<LA>());
return ptr ? ptr->nAvr() : 0;}
251 template<LiouvilleanAveragedTag LA>
252 std::ostream& displayKey(std::ostream& os,
size_t& i)
const {
if (
const auto ptr=getLA(LiouvilleanAveragedTag_<LA>())) ptr->displayKey(os,i);
return os;}
254 template<LiouvilleanAveragedTag LA>
255 const Averages average(
double t,
const LazyDensityOperator& matrix)
const {
return structure::average(getLA(LiouvilleanAveragedTag_<LA>()),t,matrix);}
280 typename Averaged<RANK>::Averages averages(av->average(t,matrix));
281 av->process(averages);
282 av->display(averages,os,precision);
299 #endif // CPPQEDCORE_STRUCTURE_STRUCTURE_H_INCLUDED
const Liouvillean< RANK >::Ptr qsl(boost::shared_ptr< const QuantumSystem< RANK > > quantumSystem)
Dynamic cast to a shared pointer to Liouvillean
std::ostream & displayCharacteristics(std::ostream &os) const
Displays the dynamical characteristics of the system.
The interface every system that needs transformation between two quantum mechanical pictures must pre...
Defines class of the same name.
const Exact< RANK >::Ptr qse(DynamicsBase::Ptr base)
Dynamic cast to a shared pointer to Exact
boost::shared_ptr< const Base > Ptr
Convenience typedef.
A wrapper for Exact, Hamiltonian, Liouvillean, and Averaged.
DArray< 1 > DArray1D
A 1D real array storing the quantum averages – even if they are complex, their real & imaginary part...
const Hamiltonian< RANK >::Ptr qsh(DynamicsBase::Ptr base)
Dynamic cast to a shared pointer to Hamiltonian
boost::shared_ptr< const QuantumSystem > Ptr
Many of the basic template classes in the framework act as template metafunctions returning a shared ...
Defines class of the same name.
Comprises modules for describing quantum systems.
The interface every system having (possibly non-Hermitian) Hamiltonian time-evolution must present to...
Defines class of the same name.
const Averaged< RANK >::Ptr qsa(boost::shared_ptr< const QuantumSystem< RANK > > quantumSystem)
Dynamic cast to a shared pointer to Averaged
Defines class of the same name.
The interface every system that calculates and displays quantum averages must present towards the tra...
const Hamiltonian< RANK >::Ptr qsh(boost::shared_ptr< const QuantumSystem< RANK > > quantumSystem)
Dynamic cast to a shared pointer to Hamiltonian
const Liouvillean< RANK >::Ptr qsl(DynamicsBase::Ptr base)
Dynamic cast to a shared pointer to Liouvillean
Defines class of the same name.
Common interface for calculating quantum averages.
const Averaged< RANK >::Ptr qsa(DynamicsBase::Ptr base)
Dynamic cast to a shared pointer to Averaged
The abstract interface every system has to present towards the quantum trajectory drivers quantumtraj...
Defines class of the same name.
const Exact< RANK >::Ptr qse(boost::shared_ptr< const QuantumSystem< RANK > > quantumSystem)
Dynamic cast to a shared pointer to Exact
QuantumSystemWrapper(QuantumSystemPtr qs, bool isNoisy)
Constructor from QuantumSystem.
The interface every system having Liouvillean time-evolution must present towards the trajectory driv...
QuantumSystemWrapper(DynamicsBase::Ptr qs)
Constructor from DynamicsBase.
const DArray1D average(double t, const LazyDensityOperator &matrix) const
Calculates quantum averages & checks post-conditions.
Base::DArray1D Rates
The 1D real array for storing the jump rates.