AGX Dynamics  2.37.2.0
RegularizationParameters.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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 
62  void setCompliance( agx::Real c );
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 
101  void setDampingHalfLife( agx::Real h, agx::Real numSteps );
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
AGXFMI_EXPORT InputVariable_Real * setCompliance(agx::Constraint *constraint)
agx::Real getDiagonalPerturbation(agx::Real h) const
Internal method used by solvers.
#define AGXPHYSICS_EXPORT
#define AGX_FORCE_INLINE
Definition: Object.h:59
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
int8_t getIndexSetState() const
Used by the solver.
All ghost variables have compliance and damping attributes.
AGXFMI_EXPORT InputVariable_Real * setDamping(agx::Constraint *constraint)
#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
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
double Real
Definition: Real.h:42