Itasca C++ Interface
Loading...
Searching...
No Matches
jointmodel.h
Go to the documentation of this file.
1#pragma once
2
3#include "jmodelbase.h"
4#include "base/src/property.h"
5
6#include <vector>
7#include <iostream>
8
18namespace jmodels {
19 struct State;
20
22
31 class JMODEL_EXPORT JointModel {
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 uint32 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 base::Property getProperty(uint32 index) const = 0; // Return real/0.0 if property doesn't exist.
82 virtual void setProperty(uint32 index, const base::Property& p, uint32 restoreVersion = 0); // Calls setValid(0). Return true if error.
86 virtual void save(std::ostream& o) const;
88 virtual void restore(std::istream& i, uint32 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(uint32 dim, State* s);
124 virtual void initialize(uint32 dim, State* s);
129 virtual double getStrengthStressRatio(const State&) const { return(10.0); }
135 virtual void scaleProperties(const double&, const std::vector<uint32>&) { std::logic_error("Does not support property scaling"); }
137 virtual bool supportsStrengthStressRatio() 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 "energy-strain-shear,energy-strain-compression,energy-strain-tension,energy-slip"; }
150 virtual double getEnergy(uint32) const { return 0.0; } // Base 1
151 virtual bool getEnergyAccumulate(uint32) const { return false; } // Base 1
152 virtual void setEnergy(uint32, 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 uint32 getMajorVersion();
166 static uint32 getLibraryMinorVersion();
168 bool isValid(uint32 dimVal) const { return(valid_ == dimVal); }
170 void setValid(uint32 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 uint32 valid_;
182 bool can_fail_;
183 bool plugin_;
184 };
185} // namespace jmodels
186
187// EoF
Definition property.h:25
The base class for joint constitutive model plug-ins.
Definition jointmodel.h:31
EXPORT_TAG unsigned getMinorVersion()
Definition fishexample.cpp:62
EXPORT_TAG unsigned getMajorVersion()
Definition fishexample.cpp:56
EXPORT_TAG const char * getName()
Definition fishexample.cpp:43
bool isValid(uint32 dimVal) const
Indicates whether initializion is necessary - by dimension.
Definition jointmodel.h:168
bool getPlugIn() const
Indicates whether the model was loaded as a plugin (defaults to false).
Definition jointmodel.h:177
virtual void scaleProperties(const double &, const std::vector< uint32 > &)
Scales failure property indices v by the factor f.
Definition jointmodel.h:135
void setValid(uint32 dimVal)
Sets the current valid state to dimension dim.
Definition jointmodel.h:170
virtual bool isSliding(const State &)
Return true if subcontact is sliding.
Definition jointmodel.h:143
virtual bool supportsPropertyScaling() const
Returns true if property scaling is supported for factor-of-safety calculations via scaleProperties()...
Definition jointmodel.h:139
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 string getStates() const =0
Returns a string containing state names.
virtual bool isBonded(const State &)
Return true if subcontact is bonced. Used in fragment calculations.
Definition jointmodel.h:145
virtual double getMaxNormalStiffness() const =0
This is used by the code to compute the stable timestep or adjust inertial mass. .
EnergyKeys
Default implementation 4 energies should be defined for each model (at least)
Definition jointmodel.h:148
void setIfCanFail(bool b)
Specifies whether or not "failure" is being allowed for this instanced of the constitutive model.
Definition jointmodel.h:175
virtual base::Property getProperty(uint32 index) const =0
Return the value of the property of that index (base 1).
virtual string getProperties() const =0
Returns a string containing the names of model properties.
bool canFail() const
Definition jointmodel.h:173
virtual string getFullName() const =0
The full name of the model.
virtual string getName() const =0
Must be unique, used to identify model in save/restore, on command line, filename.
virtual JointModel * clone() const =0
Returns an instance this class.
virtual void destroy()
There should be no reason for an implementation to change the default behavior of this function.
Definition jointmodel.h:141
virtual bool supportsStrengthStressRatio() const
Returns true if strength-stress ratio calculations are supported via getStrengthStressRatio().
Definition jointmodel.h:137
virtual double getMaxShearStiffness() const =0
This is used by the code to compute the stable timestep or adjust inertial mass. .
virtual double getStrengthStressRatio(const State &) const
Returns the ratio of the shear force to the current yield strength.
Definition jointmodel.h:129
The Joint Constitutive Model interface library.
Definition jointmodel.cpp:6
The structure used to pass information to the joint constitutive model.
Definition state.h:25