00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef MECHSYS_LABTESTSIM_CTX_H
00023 #define MECHSYS_LABTESTSIM_CTX_H
00024
00025 #ifdef HAVE_CONFIG_H
00026 #include "config.h"
00027 #else
00028 #ifndef REAL
00029 #define REAL double
00030 #endif
00031 #endif
00032
00033 #include "tensors/functions.h"
00034 #include "util/string.h"
00035 #include "labtestsim/equipment.h"
00036
00037 namespace LabTestSim
00038 {
00039
00040 template<typename T_Model>
00041 class CTX : public Equipment<T_Model>
00042 {
00043 public:
00044 CTX (T_Model * pModel, String const & strEquipment, bool StopOnFailure, bool SaveIntStates, bool Silent=false)
00045 : Equipment<T_Model>(pModel, strEquipment, StopOnFailure, SaveIntStates, Silent)
00046 {}
00047
00048 private:
00049 int _exx_idx() const { return 0; }
00050 bool _do_update_one_increment(State const & DeltaState);
00051 };
00052
00053
00055
00056
00057 template<typename T_Model>
00058 inline bool CTX<T_Model>::_do_update_one_increment(State const & DeltaState)
00059 {
00060 Tensors::Tensor2 dSig; dSig = DeltaState.Sa, DeltaState.Sr, DeltaState.Sr, 0.0,0.0,0.0;
00061 REAL dPp; dPp = DeltaState.Pp;
00062 Tensors::Tensor2 dEps;
00063 try
00064 {
00065 #ifdef USE_COUPLEDMODEL
00066 REAL DnSr;
00067 Equipment<T_Model>::_model->Actualize(dSig, dPp, dEps, DnSr);
00068 #else
00069 Equipment<T_Model>::_model->Actualize(dSig, dEps);
00070 #endif
00071 return true;
00072 }
00073 catch (Exception * e)
00074 {
00075 if (e->IsFatal ()) throw;
00076 else if (e->IsWarning()) { if (!Equipment<T_Model>::_silent) e->Cout(); delete e; return false; }
00077 else { if (!Equipment<T_Model>::_silent) e->Cout(); delete e; return true; }
00078 }
00079 }
00080
00081 };
00082
00083 #endif // MECHSYS_LABTESTSIM_CTX_H