00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef MECHSYS_EQUILIBMODEL_H
00023 #define MECHSYS_EQUILIBMODEL_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 <map>
00034 #include <string>
00035
00036 #include "tensors/tensors.h"
00037 #include "util/string.h"
00038 #include "util/array.h"
00039 #include "numerical/integschemesctes.h"
00040
00041 using Tensors::Tensor2;
00042 using Tensors::Tensor4;
00043
00044 class EquilibModel
00045 {
00046 public:
00047
00048 EquilibModel() : _sig(0.0), _eps(0.0) {}
00049
00050
00051 virtual ~EquilibModel() {}
00052
00053
00054 virtual String Name () const =0;
00055 virtual void TgStiffness (Tensors::Tensor4 & D) const =0;
00056 virtual void Actualize (Tensor2 const & DSig, Tensor2 & DEps) =0;
00057 virtual void StressUpdate (Tensor2 const & DEps, Tensor2 & DSig) =0;
00058 virtual void BackupState () =0;
00059 virtual void RestoreState () =0;
00060
00061
00062 Tensor2 const & Sig() const { return _sig; }
00063 Tensor2 const & Eps() const { return _eps; }
00064 virtual int nInternalStateValues() const =0;
00065 virtual void InternalStateValues (Array<REAL> & IntStateVals ) const =0;
00066 virtual void InternalStateNames (Array<String> & IntStateNames) const =0;
00067
00068
00069 static void SetIntegSchemesCtes(IntegSchemesCtes const & ISC) { _isc=ISC; }
00070
00071 protected:
00072
00073 Tensor2 _sig;
00074 Tensor2 _eps;
00075 Tensor2 _sig_bkp;
00076 Tensor2 _eps_bkp;
00077
00078
00079 static IntegSchemesCtes _isc;
00080
00081 };
00082
00083
00085
00086
00087 IntegSchemesCtes EquilibModel::_isc;
00088
00089
00091
00092
00093
00094 typedef EquilibModel * (*EquilibModelMakerPtr)(Array<REAL> const & Prms, Array<REAL> const & IniData);
00095
00096
00097 typedef std::map<String, EquilibModelMakerPtr, std::less<String> > EquilibModelFactory_t;
00098
00099
00100 EquilibModelFactory_t EquilibModelFactory;
00101
00102
00103 EquilibModel * AllocEquilibModel(String const & Name, Array<REAL> const & Prms, Array<REAL> const & IniData)
00104 {
00105 EquilibModelMakerPtr ptr=NULL;
00106 ptr = EquilibModelFactory[Name];
00107 if (ptr==NULL)
00108 throw new Fatal(_("FEM::AllocEquilibModel: There is no < %s > implemented in this library"), Name.c_str());
00109 return (*ptr)(Prms, IniData);
00110 }
00111
00112 #endif // MECHSYS_EQUILIBMODEL_H
00113
00114