AGX Dynamics  2.35.0.1
RegularizationParameters.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGX_REGULARIZATION_PARAMETERS_H
18 #define AGX_REGULARIZATION_PARAMETERS_H
19 
20 #include <agx/agxPhysics_export.h>
21 #include <agx/agx.h>
22 #include <agxStream/Serializable.h>
23 
24 namespace agx
25 {
30  {
31  public:
33  {
36  DEFAULT = HOLONOMIC
37  };
38 
39  public:
44 
48  bool isHolonomic() const;
49 
54  void setType( VariableType type );
55 
63 
75  void setDamping( agx::Real d );
76 
80  agx::Real getCompliance() const;
81 
85  agx::Real getDamping() const;
86 
92  agx::Real getDiagonalPerturbation( agx::Real h ) const;
93 
102 
111  void setDampingHalfLife( agx::Real compliance, agx::Real h, agx::Real numSteps );
112 
114 
115 
119  void setIndexSetState( int8_t state );
120 
121 
125  int8_t getIndexSetState() const;
126 
127  private:
128  int m_type;
129  agx::Real m_compliance;
130  agx::Real m_damping;
131  };
132 
134  {
135  return (m_type & 0xff) == HOLONOMIC;
136  }
137 
139  {
140  return m_compliance;
141  }
142 
144  {
145  return m_damping;
146  }
147 
149  {
150  if ( isHolonomic() )
151  return Real(4.0 / ( h * h * ( 1.0 + 4.0 * m_damping / h ) ) * m_compliance);
152  else
153  return Real(1.0) / h * m_compliance;
154  }
155 
156 
158  {
159  return (int8_t) ((m_type >> 8) & 0xff );
160  }
161 } //namespace agx
162 
163 #endif
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXPHYSICS_EXPORT
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45
All ghost variables have compliance and damping attributes.
void setDampingHalfLife(agx::Real compliance, agx::Real h, agx::Real numSteps)
Utility method to set compliance and assign damping given time step used and the number of steps the ...
int8_t getIndexSetState() const
Used by the solver.
void setIndexSetState(int8_t state)
Used by the solver, should in general not be called by user code.
RegularizationParameters()
Default constructor.
void setDamping(agx::Real d)
Set the damping rate with suitable dimensionality given linear or angular variable.
agx::Real getDiagonalPerturbation(agx::Real h) const
Internal method used by solvers.
void setCompliance(agx::Real c)
Set the value of compliance which is an inverse spring constant with suitable dimensionality given li...
void setType(VariableType type)
Assign new type.
void setDampingHalfLife(agx::Real h, agx::Real numSteps)
Utility method to assign damping given time step used and the number of steps the solver gets to fulf...
#define AGX_FORCE_INLINE
Definition: macros.h:58
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
double Real
Definition: Real.h:42