Itasca C++ Interface
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
jointmodel.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "jmodelbase.h"
4 #include <vector>
5 #include <iostream>
6 
15 namespace jmodels
17 {
18  struct State;
19 
21 
30  class JMODEL_EXPORT JointModel
31  {
32  public:
39  virtual String getName() const=0;
41  virtual String getPluginName() const { return getName(); }
48  virtual String getFullName() const=0; // Full name of model.
53  virtual UInt getMinorVersion() const; // Returns minor version of base implementation, override for actual model.
59  virtual String getProperties() const=0; // comma delimited
66  virtual String getStates() const=0; // comma delimited
72  virtual Variant getProperty(UInt index) const=0; // Return real/0.0 if property doesn't exist.
82  virtual void setProperty(UInt index,const Variant &p,UInt restoreVersion=0); // Calls setValid(0). Return true if error.
86  virtual void save(std::ostream &o) const;
88  virtual void restore(std::istream &i,UInt restoreVersion);
92  virtual JointModel *clone() const=0;
95  virtual Double getMaxNormalStiffness() const=0;
98  virtual Double getMaxShearStiffness() const=0;
104  virtual void copy(const JointModel *mod);
112  virtual void run(UByte dim,State *s);
124  virtual void initialize(UByte dim,State *s);
129  virtual Double getStressStrengthRatio(const State &) const { return(10.0); }
135  virtual void scaleProperties(const Double &,const std::vector<UInt> &) { std::logic_error("Does not support property scaling"); }
137  virtual bool supportsStressStrengthRatio() const { return(false); }
139  virtual bool supportsPropertyScaling() const { return(false); }
141  virtual void destroy() { delete this; }
143  virtual bool isSliding(const State &) { return false; }
145  virtual bool isBonded(const State &) { return true; }
146 
148  enum EnergyKeys { kwEStrainShear = 1, kwEStrainCompression, kwEStrainTension, kwESlip };
149  virtual String getEnergies() const { return L"energy-strain-shear,energy-strain-compression,energy-strain-tension,energy-slip"; }
150  virtual double getEnergy(UInt) const { return 0.0; } // Base 1
151  virtual bool getEnergyAccumulate(UInt) const { return false; } // Base 1
152  virtual void setEnergy(UInt, const double&) {} // Base 1
153  virtual void activateEnergy() {}
154  virtual bool getEnergyActivated() const { return false; } // Returns a boolean indicating if energies have been instanciated
155 
156 
158  JointModel();
160  virtual ~JointModel();
162  static UInt getMajorVersion();
166  static UInt getLibraryMinorVersion();
168  bool isValid(UByte dimVal) const { return(valid_==dimVal); }
170  void setValid(UByte dimVal) { valid_ = dimVal; }
173  bool canFail() const { return(can_fail_); }
175  void setIfCanFail(bool b) { can_fail_ = b; }
177  bool getPlugIn() const { return plugin_; }
178  void setPlugIn(bool b) { plugin_ = b; }
179 
180  private:
181  UByte valid_;
182  bool can_fail_;
183  bool plugin_;
184  };
185 } // namespace jmodels
186 
187 // EoF
The Joint Constitutive Model interface library.
Definition: jointmodel.cpp:5
A simpler (and slightly faster) version of a QVariant, added for interfaces that do not use Qt.
Definition: variant.h:28
virtual bool isBonded(const State &)
Return true if subcontact is bonced. Used in fragment calculations.
Definition: jointmodel.h:145
virtual void destroy()
There should be no reason for an implementation to change the default behavior of this function.
Definition: jointmodel.h:141
void setIfCanFail(bool b)
Specifies whether or not "failure" is being allowed for this instanced of the constitutive model.
Definition: jointmodel.h:175
virtual bool isSliding(const State &)
Return true if subcontact is sliding.
Definition: jointmodel.h:143
EXPORT_TAG unsigned getMajorVersion()
Definition: fishexample.cpp:56
unsigned int UInt
unsigned 32 bit
Definition: basedef.h:31
void setValid(UByte dimVal)
Sets the current valid state to dimension dim.
Definition: jointmodel.h:170
bool getPlugIn() const
Indicates whether the model was loaded as a plugin (defaults to false).
Definition: jointmodel.h:177
virtual String getPluginName() const
There should be no reason for an implementation to override the default behavior of this function.
Definition: jointmodel.h:41
virtual bool supportsPropertyScaling() const
Returns true if property scaling is supported for factor-of-safety calculations via scaleProperties()...
Definition: jointmodel.h:139
bool isValid(UByte dimVal) const
Indicates whether initializion is necessary - by dimension.
Definition: jointmodel.h:168
EXPORT_TAG const char * getName()
Definition: fishexample.cpp:43
double Double
64 bit floating point
Definition: basedef.h:40
unsigned char UByte
unsigned 8 bit
Definition: basedef.h:27
virtual bool supportsStressStrengthRatio() const
Returns true if strength-stress ratio calculations are supported via getStrengthStressRatio().
Definition: jointmodel.h:137
bool canFail() const
Definition: jointmodel.h:173
EnergyKeys
Default implementation 4 energies should be defined for each model (at least)
Definition: jointmodel.h:148
The structure used to pass information to the joint constitutive model.
Definition: state.h:24
The base class for joint constitutive model plug-ins.
Definition: jointmodel.h:30
virtual void scaleProperties(const Double &, const std::vector< UInt > &)
Scales failure property indices v by the factor f.
Definition: jointmodel.h:135
EXPORT_TAG unsigned getMinorVersion()
Definition: fishexample.cpp:62
virtual Double getStressStrengthRatio(const State &) const
Returns the ratio of the shear force to the current yield strength.
Definition: jointmodel.h:129