AGX Dynamics  2.35.0.1
WindAndWaterController.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 AGXMODEL_WINDANDWATERCONTROLLER_H
18 #define AGXMODEL_WINDANDWATERCONTROLLER_H
19 
20 #include <agxModel/export.h>
21 #include <agxModel/AddedMassDb.h>
24 
25 #include <agx/Vec6.h>
26 
27 #include <agxCollide/Geometry.h>
28 
29 #include <agxSDK/LinkedStructure.h>
30 
31 #include <agxWire/Wire.h>
32 
33 #include <mutex>
34 
35 
36 namespace agxModel {
37  class WaterWrapper;
41 
46  {
47  public:
49 
54  {
55  public:
61 
67  virtual agx::Vec3 getVelocity( const agx::Vec3& worldPoint ) const;
68 
70 
71  protected:
73  };
74 
76 
81  {
82  public:
88 
89 #ifndef SWIG
91 #endif
92  protected:
94  };
95 
97 
102  {
103  public:
109 
114  virtual void prepare( const agxCollide::Geometry* geometry );
115 
116 #ifndef SWIG
118 #endif
119  protected:
120  virtual ~WindGenerator();
121  };
122 
123 
128  {
129  public:
134 
139 
143  agx::Vec3 getVelocity( const agx::Vec3& worldPoint ) const;
144 
149 
150  protected:
154  };
155 
160  {
161  public:
162 
167  const agxModel::HydrodynamicsParameters* hydroParams );
168 
172  const agxModel::AerodynamicsParameters* getAerodynamicsParameters() const;
173 
177  const agxModel::HydrodynamicsParameters* getHydrodynamicsParameters() const;
178 
179  protected:
180  virtual ~WindAndWaterData();
181 
184  };
185 
190  {
191  public:
196  const agxModel::AerodynamicsParameters* aeroParams,
197  const agxModel::HydrodynamicsParameters* hydroParams,
198  const agxModel::WaterWrapper* water,
200  const agx::Vec3& gravity,
201  agxModel::PressureFieldRenderer* pressureFieldRenderer,
202  const agx::UInt numTriangles,
203  const agx::UInt startIndexT,
204  const agx::UInt startIndexV );
205 
210 
215 
219  agx::Real getDensity( agx::Bool belowSurface ) const;
220 
225 
230 
235 
240 
244  const agx::Vec3& getGravity() const;
245 
249  const agx::Vec3& getForce() const;
250 
255 
259  const agx::Vec3& getTorque() const;
260 
265 
269  const agx::Matrix3x3& getAddedMass() const;
270 
275 
280 
285 
290 
294  const agx::Bool& containsAddedMass() const;
295 
299  const agxCollide::Shape* getShape() const;
300 
305 
309  const WaterWrapper* getWater() const;
310 
314  const agx::RigidBody* getRigidBody() const;
315 
321 
326 
330  void lock() const { m_mutex.lock(); };
331 
335  void unLock() const { m_mutex.unlock(); };
336 
337  protected:
338  virtual ~ObjectData();
339 
340  private:
341  agx::Vec3 m_gravity;
342  agx::Real m_densityWater;
343  agx::Real m_densityAir;
344  mutable agx::Vec3 m_force;
345  mutable agx::Vec3 m_torque;
346  agx::Matrix3x3 m_addedMass;
347  agx::Matrix3x3 m_addedInertia;
348  agx::Bool m_containsAddedMass;
349  const agxCollide::Shape* m_shape;
350  PressureFieldRenderer* m_pressureFieldRenderer;
351  WaterWrapperConstRef m_water;
352  const agx::UInt m_numTriangles;
353  const agx::UInt m_startIndexT;
354  mutable std::mutex m_mutex;
355  };
356 
359 
360  struct WirePair
361  {
363  : node1( nullptr ), node2( nullptr ), water( nullptr ), gravity( agx::Vec3() )
364  {
365  }
366  WirePair( agxWire::Node* node1, agxWire::Node* node2, const agxCollide::Geometry* water, agx::Vec3 gravity )
367  : node1( node1 ), node2( node2 ), water( water ), gravity( gravity )
368  {
369  }
374 
375  private:
377  WirePair& operator=( const WirePair& )
378  {
379  return *this;
380  }
381  };
382 
384 
385  struct Segment
386  {
387  Segment( agx::RigidBody* rb, agx::Vec3 point1, agx::Vec3 point2, agx::Vec3 velocity, agx::Vec3 velocityOfFluid,
388  agx::Real fluidDensity, agx::Vec3 gravity, agx::Real volume )
389  : rb( rb ), point1( point1 ), point2( point2 ), velocity( velocity ), velocityOfFluid( velocityOfFluid ),
390  fluidDensity( fluidDensity ), gravity( gravity ), volume(volume)
391  {
392  }
401  };
402 
404 
409  {
410  public:
417  WireLinkedStructureData( agx::Real radius, const AerodynamicsParameters* aeroParams, const HydrodynamicsParameters* hydroParams );
418 
423 
427  void addWaterSegment( const Segment& segment );
428 
432  void addAirSegment( const Segment& segment );
433 
438 
443 
444  protected:
446 
447 
448  private:
449  SegmentContainer m_airSegments;
450  SegmentContainer m_waterSegments;
451  agx::Real m_radius;
452  };
453 
456 
457 
463  {
464  DynamicsData() : worldForce(), worldTorque(), bodyFrameAddedMass( agx::Vec3() ), bodyFrameAddedInertia( agx::Vec3() ) {}
465 
473  void getAddedMassAndInertiaDiagonalCoefficients( const agx::RigidBody* rb, agx::Vec3& addedMassDiagonalCoefficients, agx::Vec3& addedInertiaDiagonalCoefficients ) const;
474 
479  };
480 
485  {
488  size_t numWaterSegments{0};
489  size_t numAirSegments{0};
490  agx::Real lengthWater{0.0};
491  agx::Real lengthAir{0.0};
492  };
493 
498  {
500  };
501 
502  public:
507 
514 
522 
528  virtual void setEnableAerodynamics( agx::Bool enable );
529 
537 
545 
554 
559  void setAirDensity( agx::Real airDensity );
560 
566 
572 
578 
584 
593 
602 
607 
613 
618 
626  virtual agx::Bool setWaterFlowGenerator( const agxCollide::Geometry* waterGeometry,
628 
634 
641  agxModel::WaterWrapper* waterWrapper );
647 
656 
667  const agxCollide::Geometry* waterGeometry, const agx::RigidBody* rb, const agx::Vec3& gravity,
668  const agxCollide::Space* space = nullptr, agx::Bool updateRenderers = false );
669 
676  const agxCollide::Geometry* waterGeometry, agxWire::Wire* wire );
677 
684  const agxCollide::Geometry* waterGeometry, agxSDK::LinkedStructure* linkedStructure,
685  const agxCollide::Space* space );
686 
694 
702 
709 
713  virtual void preCollide( const agx::TimeStamp& ) override;
714 
718  virtual void pre( const agx::TimeStamp& ) override;
719 
723  virtual void post( const agx::TimeStamp& ) override;
724 
726 
727  protected:
729  {
732 
733  protected:
735  };
737 
739  {
740  AerodynamicsData( const agxCollide::Geometry* geometryIn ) : geometry( geometryIn ) {}
742 
743  protected:
744  virtual ~AerodynamicsData() {}
745  };
747 
749  {
750  public:
753 
755  agxModel::WindAndWaterParameters::ShapeTessellation tessellationLevel ) const;
756 
757  static agx::Vec3 findScale( const agxCollide::Shape* shape );
758 
760 
761  private:
762  struct PrimitiveData : public agx::Referenced
763  {
764  PrimitiveData( const agxCollide::Shape* shapeIn, agxCollide::Mesh* meshIn )
765  : shape( shapeIn ), mesh( meshIn )
766  {
767  }
768 
769  virtual void checkSize( agx::Real resolution ) = 0;
770 
772  agxCollide::MeshRef mesh;
773 
774  protected:
775  virtual ~PrimitiveData() {}
776  };
777 
778  struct CapsuleData : PrimitiveData
779  {
780  CapsuleData( const agxCollide::Shape* shapeIn, agxCollide::Mesh* meshIn, agx::Real radiusIn, agx::Real heightIn )
781  : PrimitiveData( shapeIn, meshIn ), radius( radiusIn ), height( heightIn )
782  {
783  }
784 
785  virtual void checkSize( agx::Real resolution ) override;
786 
787  agx::Real radius;
788  agx::Real height;
789 
790  protected:
791  virtual ~CapsuleData() {}
792  };
793 
794  struct ConeData : PrimitiveData
795  {
796  ConeData( const agxCollide::Shape* shapeIn, agxCollide::Mesh* meshIn , agx::Real topRadiusIn, agx::Real bottomRadiusIn, agx::Real heightIn )
797  : PrimitiveData( shapeIn, meshIn ), topRadius( topRadiusIn ), bottomRadius( bottomRadiusIn ),
798  height( heightIn )
799  {
800  }
801 
802  virtual void checkSize( agx::Real resolution ) override;
803 
804  agx::Real topRadius;
805  agx::Real bottomRadius;
806  agx::Real height;
807 
808  protected:
809  virtual ~ConeData() {}
810  };
811 
812  struct HollowConeData : PrimitiveData
813  {
814  HollowConeData( const agxCollide::Shape* shapeIn, agxCollide::Mesh* meshIn, agx::Real topOuterRadiusIn,
815  agx::Real bottomInnerRadiusIn, agx::Real heightIn,
816  agx::Real thicknessIn )
817  : PrimitiveData( shapeIn, meshIn ), topOuterRadius( topOuterRadiusIn ),
818  bottomInnerRadius( bottomInnerRadiusIn ), height( heightIn ), thickness( thicknessIn )
819  {
820  }
821 
822  virtual void checkSize( agx::Real resolution ) override;
823 
824  agx::Real topOuterRadius;
825  agx::Real bottomInnerRadius;
826  agx::Real height;
827  agx::Real thickness;
828 
829  protected:
830  virtual ~HollowConeData() {}
831  };
832 
833  struct HollowCylinderData : PrimitiveData
834  {
835  HollowCylinderData( const agxCollide::Shape* shapeIn, agxCollide::Mesh* meshIn, agx::Real innerRadiusIn, agx::Real heightIn, agx::Real thicknessIn )
836  : PrimitiveData( shapeIn, meshIn ), innerRadius( innerRadiusIn ), height( heightIn ),
837  thickness( thicknessIn )
838  {
839  }
840 
841  virtual void checkSize( agx::Real resolution ) override;
842 
843  agx::Real innerRadius;
844  agx::Real height;
845  agx::Real thickness;
846 
847  protected:
848  virtual ~HollowCylinderData() {}
849  };
850 
851  using PrimitiveDataRef = agx::ref_ptr< PrimitiveData >;
852 
853  typedef agx::Vector< agxCollide::MeshRef > MeshContainer;
855 
856  private:
857  agxCollide::MeshRef createUnitShape( agxCollide::Shape::Type shapeType, agx::Real resolution = agx::Real( 1 ) ) const;
858  const agxCollide::Mesh* getOrCreatePrimitive( const agxCollide::Shape* shape, agx::Real resolution = agx::Real( 1 ) ) const;
859 
860  private:
861  mutable MeshContainer m_cache;
862  mutable PrimitiveContainer m_primitives;
863 
864  mutable std::mutex meshCreationMutex;
865  };
866 
880 
881 
882  protected:
887 
888  protected:
893 
898 
903 
908 
913  const agxCollide::Geometry* waterGeometry,
914  const agxCollide::Geometry* geometry,
915  const agx::Vec3& gravity,
916  agx::Bool aeroEnabled,
917  agx::Bool hydroEnabled,
918  agx::Bool updateRenderers,
919  agx::UInt& numProcessedTriangles,
920  const agx::UIntVector startIndexT,
921  const agx::UIntVector startIndexV,
922  const agx::TimeStamp& t = 0 );
923 
929  const agx::TimeStamp& t = 0 );
930 
935  const agxCollide::Geometry* waterGeometry, const agxCollide::Geometry* geometry, const agx::Vec3& gravity,
936  const AerodynamicsParameters* aeroParams, const HydrodynamicsParameters* hydroParams, agx::Bool aeroEnabled,
937  agx::Bool hydroEnabled, const agx::TimeStamp& t = 0 );
938 
940  agx::UIntVector& numTriangles,
941  agx::UIntVector& numVertices );
942 
943  protected:
966  };
967 
973  class AGXMODEL_EXPORT WindAndWaterController::Algorithm : public agx::Referenced
974  {
975  public:
977 
978  public:
982  virtual void preCollide( agxModel::WindAndWaterController* /*controller*/ ) {}
983 
987  virtual void pre( agxModel::WindAndWaterController* /*controller*/ ) {}
988 
992  virtual void post( agxModel::WindAndWaterController* /*controller*/ ) {}
993 
998  };
999 
1001 
1006  {
1007  public:
1013 
1018  void setVelocity( const agx::Vec3& velocity );
1019 
1023  const agx::Vec3& getVelocity() const;
1024 
1025  public:
1026  virtual agx::Vec3 getVelocity( const agx::Vec3& /*worldPosition*/ ) const override;
1027 
1029 
1030  protected:
1033 
1034  private:
1035  agx::Vec3 m_velocity;
1036  };
1037 
1038 
1040 
1045  {
1046  public:
1051  ConstantWindGenerator( const agx::Vec3& velocity );
1052 
1057  void setVelocity( const agx::Vec3& velocity );
1058 
1062  const agx::Vec3& getVelocity() const;
1063 
1064  public:
1065  virtual agx::Vec3 getVelocity( const agx::Vec3& /*worldPosition*/ ) const override;
1066 
1068 
1069  protected:
1072 
1073  private:
1074  agx::Vec3 m_velocity;
1075  };
1076 
1082  {
1084 
1085  public:
1090 
1098  virtual agx::Real findHeightFromSurface( const agx::Vec3& worldPoint, const agx::Vec3& upVector, const agx::TimeStamp& t ) const;
1099 
1103  virtual agx::Bool isValid() const;
1104 
1108  virtual agx::Real getDensity() const;
1109 
1113  virtual agx::Vec3 getVelocity( const agx::Vec3& worldPoint ) const;
1114 
1119 
1124 
1125 #ifndef SWIG
1127 #endif
1128 
1129  protected:
1130  virtual ~WaterWrapper() {}
1131 
1137  agx::Vec3 project( const agx::Vec3& localPoint, const agx::Vec3& localUpVector ) const;
1138 
1139  protected:
1144 
1146  private:
1147  // Only used by WindAndWaterController
1148  WaterWrapper( const agxCollide::Geometry* geometry );
1149  void setFlowGenerator( WindAndWaterController::WaterFlowGenerator* flowGenerator );
1150  void setWaterGeometry( agxCollide::Geometry* waterGeometry );
1151  void update();
1153  };
1154 
1156  {
1157  return m_aeroParams;
1158  }
1159 
1161  {
1162  return m_hydroParams;
1163  }
1164 
1166  {
1167  return m_velocity;
1168  }
1169 
1171  {
1172  return m_velocity;
1173  }
1174 }
1175 
1176 #endif // AGXMODEL_WINDANDWATERCONTROLLER_H
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(T)
Use this in a pure abstract Serializable class to add the required methods Important: Use full namesp...
Definition: Serializable.h:221
#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 AGXMODEL_EXPORT
The geometry representation used by the collision detection engine.
Definition: Geometry.h:93
Mesh is a common base class for triangle meshes, such as Mesh or HeightField.
Definition: Mesh.h:70
Base class for a shape.
Definition: Shape.h:54
Type
Define the type of a Shape.
Definition: Shape.h:58
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
Definition: Space.h:82
Class to generate constant water flow in a scene.
void setVelocity(const agx::Vec3 &velocity)
Assign new water flow velocity.
ConstantWaterFlowGenerator(const agx::Vec3 &velocity)
Construct given flow velocity.
const agx::Vec3 & getVelocity() const
Class to generate constant wind in a scene.
void setVelocity(const agx::Vec3 &velocity)
Assign new wind velocity.
ConstantWindGenerator(const agx::Vec3 &velocity)
Construct given wind velocity.
const agx::Vec3 & getVelocity() const
Water wrapper that can be inherited to create custom made wrappers.
agx::Vec3 project(const agx::Vec3 &localPoint, const agx::Vec3 &localUpVector) const
Projects a point in local coordinate system onto the surface in local up direction.
const agxCollide::Geometry * getGeometry() const
const agxCollide::Shape * m_shape
virtual agx::Real findHeightFromSurface(const agx::Vec3 &worldPoint, const agx::Vec3 &upVector, const agx::TimeStamp &t) const
Finds height from surface given point in world.
const WindAndWaterController::WaterFlowGenerator * m_flowGenerator
const agxModel::WindAndWaterController::WaterFlowGenerator * getWaterFlowGenerator() const
agxCollide::GeometryConstObserver m_geometry
virtual agx::Bool isValid() const
agx::AffineMatrix4x4 m_worldToShape
virtual agx::Vec3 getVelocity(const agx::Vec3 &worldPoint) const
virtual agx::Real getDensity() const
WaterWrapper()
Default constructor.
agx::Real getDensity(agx::Bool belowSurface) const
agx::Real getDensity(const agxModel::VertexData &vData) const
agx::Bool & containsAddedMass()
Set to/is true if this data contains added mass and/or inertia.
agx::Vec3 & force()
Access force vector (in world coordinate system).
agx::Vec3 & torque()
Access torque vector (in world coordinate system).
void lock() const
Perform a mutex lock for this ObjectData.
const agx::RigidBody * getRigidBody() const
const agxCollide::Shape * getShape() const
const agx::Matrix3x3 & getAddedMass() const
agxModel::PressureFieldRenderer * getPressureFieldRenderer() const
agx::Matrix3x3 & addedMass()
Access added mass matrix.
agx::Matrix3x3 & addedInertia()
Access added inertia matrix.
const WaterWrapper * getWater() const
const agx::Bool & containsAddedMass() const
ObjectData(const agxCollide::Shape *shape, const agxModel::AerodynamicsParameters *aeroParams, const agxModel::HydrodynamicsParameters *hydroParams, const agxModel::WaterWrapper *water, const agxModel::WindAndWaterController::WindWrapper *wind, const agx::Vec3 &gravity, agxModel::PressureFieldRenderer *pressureFieldRenderer, const agx::UInt numTriangles, const agx::UInt startIndexT, const agx::UInt startIndexV)
Construct given shape, parameters, wind and water definitions and gravity.
const agxCollide::Geometry * getGeometry() const
const agx::Matrix3x3 & getAddedInertia() const
void unLock() const
Perform a mutex unlock for this ObjectData.
agx::RigidBody * getRigidBodySerial()
This method is unsafe to use if this object is used during parallel execution.
agx::Real getDensity(const agxModel::TriangleData &tData) const
const agxCollide::Mesh * getOrCreateMesh(const agxCollide::Shape *shape, agx::Vec3 &scale, agxModel::WindAndWaterParameters::ShapeTessellation tessellationLevel) const
static agx::Vec3 findScale(const agxCollide::Shape *shape)
WaterFlowGenerator()
Default constructor disables serialization.
const agxModel::HydrodynamicsParameters * getHydrodynamicsParameters() const
WindAndWaterData(const agxModel::AerodynamicsParameters *aeroParams, const agxModel::HydrodynamicsParameters *hydroParams)
Constructor.
virtual agx::Vec3 getVelocity(const agx::Vec3 &worldPoint) const
Calculate and return wind at a given position in world.
WindAndWaterFlowGenerator()
Default constructor disables serialization.
Interface for generating wind effects.
virtual void prepare(const agxCollide::Geometry *geometry)
Called before update of geometry.
WindGenerator()
Default constructor disables serialization.
agx::Vec3 getVelocity(const agx::Vec3 &worldPoint) const
WindWrapper(agx::Bool enable, const agxModel::WindAndWaterController::WindGenerator *windGenerator, agx::Real airDensity)
Default constructor.
WireLinkedStructureData(agx::Real radius, const AerodynamicsParameters *aeroParams, const HydrodynamicsParameters *hydroParams)
Constructor.
void addAirSegment(const Segment &segment)
Adds a segment of the wire that is affected by aerodynamics.
void addWaterSegment(const Segment &segment)
Adds a segment of the wire that is affected by hydrodynamics.
Controller that collects relevant data and executes algorithms (probably mostly aero- and hydrodynami...
agx::HashVector< const agxWire::Wire *, HydrodynamicsParametersRef > HydrodynamicsParametersWireContainer
agxModel::WindAndWaterController::DynamicsWireData calculateWireDynamicsData(const agxCollide::Geometry *waterGeometry, agxWire::Wire *wire)
Calculates forces for hydro- and aerodynamics acting on a wire.
agx::HashVector< const agxCollide::Geometry *, AerodynamicsDataRef > AerodynamicsDataContainer
agx::HashVector< const agxCollide::Shape *, PressureFieldRendererDataRef > PressureFieldRendererDataContainer
agx::Vector< WireLinkedStructureDataRef > WireLinkedStructureDataContainer
void setAirDensity(agx::Real airDensity)
Set the density of air.
virtual agxModel::WindAndWaterController::ObjectDataContainer calculateObjectData(const agxCollide::Geometry *waterGeometry, const agxCollide::Geometry *geometry, const agx::Vec3 &gravity, agx::Bool aeroEnabled, agx::Bool hydroEnabled, agx::Bool updateRenderers, agx::UInt &numProcessedTriangles, const agx::UIntVector startIndexT, const agx::UIntVector startIndexV, const agx::TimeStamp &t=0)
Calculate object data (for each shape) in a geometry.
agx::HashVector< const agxSDK::LinkedStructure *, HydrodynamicsParametersRef > HydrodynamicsParametersLinkedStructureContainer
agx::HashVector< const agxCollide::Geometry *, WaterFlowGeneratorRef > WaterFlowGeneratorContainer
agx::Vector< agxWire::WireObserver > WireObserverVector
agxModel::HydrodynamicsParameters * getOrCreateHydrodynamicsParameters(const agxWire::Wire *wire) const
Creates new or returns an already created parameter storage for a given wire.
virtual agx::Bool setEnableAerodynamics(agxWire::Wire *wire, agx::Bool enable)
Enable/disable a wire for aerodynamics calculations.
virtual void post(agxModel::WindAndWaterController *)
Called during normal post.
agxModel::AerodynamicsParameters * getOrCreateAerodynamicsParameters(const agxWire::Wire *wire) const
Creates new or returns an already created parameter storage for a given wire.
GeometryConstObserverVector m_waterGeometries
AerodynamicsDataContainer m_aeroGeometries
virtual agx::Bool setWaterFlowGenerator(const agxCollide::Geometry *waterGeometry, agxModel::WindAndWaterController::WaterFlowGenerator *flowGenerator)
Assign unique water flow generator to a water geometry.
static agxModel::WindAndWaterControllerPtrVector findAll(const agxSDK::Simulation *simulation, const agx::Name &name)
Find all WindAndWaterControllers with given name.
virtual agx::Bool setEnableAerodynamics(agx::RigidBody *rb, agx::Bool enable)
Enable/disable all geometries in rb for aerodynamics calculations.
agxModel::HydrodynamicsParameters * getOrCreateHydrodynamicsParameters(const agxSDK::LinkedStructure *linkedStructure) const
Creates new or returns an already created parameter storage for a given linked structure.
AerodynamicsParametersRef m_globalAerodynamicsParameters
agx::Vector< ObjectDataRef > ObjectDataContainer
virtual agx::Bool addWater(agxCollide::Geometry *geometry)
Flag a geometry as water.
void configureDefaultAlgorithms()
Configure the default algorithms.
void getSizeOfGeometry(const agxCollide::Geometry *geometry, agx::UIntVector &numTriangles, agx::UIntVector &numVertices)
HydrodynamicsParametersWireContainer m_hydrodynamicsParametersWires
virtual void post(const agx::TimeStamp &) override
Internal method.
virtual agxModel::HydrodynamicsParameters * getOrCreateHydrodynamicsParameters(const agxCollide::Shape *shape) const
Creates new or returns an already created parameter storage for a given shape.
virtual ~WindAndWaterController()
Reference counted object, protected destructor.
static agxModel::WindAndWaterControllerPtrVector findAll(const agxSDK::Simulation *simulation)
Finds all WindAndWaterControllers in the given simulation.
agx::Vector< agxCollide::GeometryConstObserver > GeometryConstObserverVector
virtual agxModel::WindAndWaterController::DynamicsData calculateDynamicsData(const agxCollide::Geometry *waterGeometry, const agx::RigidBody *rb, const agx::Vec3 &gravity, const agxCollide::Space *space=nullptr, agx::Bool updateRenderers=false)
Calculates forces given water geometry (may be null) acting on a rigid body.
virtual void pre(agxModel::WindAndWaterController *)
Called before all data is collected and before updateInteraction is called.
agx::ref_ptr< WireLinkedStructureData > WireLinkedStructureDataRef
GlobalTriangleData::Container m_trianglePool
void garbageCollect()
Collects garbage (e.g., due to deleted shapes).
agxModel::WindAndWaterController::WireLinkedStructureData * calculateWireData(agxWire::Wire *wire, WirePairContainer wirePairs, WindAndWaterController::WindWrapper wind, agx::Bool aeroEnable, const agx::TimeStamp &t=0)
Calculate wire data for all segments.
agx::HashVector< const agxSDK::LinkedStructure *, AerodynamicsParametersRef > AerodynamicsParametersLinkedStructureContainer
virtual void setEnableAerodynamics(agx::Bool enable)
Enable/disable aerodynamics for all objects in the simulation.
virtual agx::Bool registerPressureFieldRenderer(agxModel::PressureFieldRenderer *pressureFieldRenderer, const agxCollide::Shape *shape)
Pressure field renderer for a given shape.
virtual agx::Bool setWaterWrapper(agxCollide::Geometry *geometry, agxModel::WaterWrapper *waterWrapper)
Assign a water wrapper to a water geometry;.
agxModel::WindAndWaterController::DynamicsLinkedStructureData calculateLinkedStructureDynamicsData(const agxCollide::Geometry *waterGeometry, agxSDK::LinkedStructure *linkedStructure, const agxCollide::Space *space)
Calculates forces for hydro- and aerodynamics acting on a linked structure.
agx::ref_ptr< PressureFieldRendererData > PressureFieldRendererDataRef
virtual void pre(const agx::TimeStamp &) override
Internal method.
static agxCollide::TrimeshRef createPrimitiveMesh(const agxCollide::Shape *shape, agxModel::WindAndWaterParameters::ShapeTessellation tessellation)
Create a mesh from a primitive shape given a tessellation level.
agxModel::WindAndWaterController::WaterFlowGenerator * getWaterFlowGenerator(const agxCollide::Geometry *waterGeometry) const
agx::HashVector< const agxCollide::Geometry *, WaterWrapperRef > WaterWrapperContainer
agx::ref_ptr< AerodynamicsData > AerodynamicsDataRef
agx::HashVector< const agxCollide::Shape *, HydrodynamicsParametersRef > HydrodynamicsParametersContainer
agx::HashVector< const agxWire::Wire *, AerodynamicsParametersRef > AerodynamicsParametersWireContainer
virtual void preCollide(const agx::TimeStamp &) override
Internal method.
WindAndWaterController()
Construct wind and water controller.
agxModel::WindAndWaterController::ObjectData ObjectData
static agxModel::WindAndWaterController * find(agxSDK::Simulation *simulation, const agx::Uuid &uuid)
Search the given simulation for a WindAndWaterController with the given Uuid.
virtual agxModel::AerodynamicsParameters * getOrCreateAerodynamicsParameters(const agxCollide::Shape *shape) const
Creates new or returns an already created parameter storage for a given shape.
agx::Bool setEnableAerodynamics(agxSDK::LinkedStructure *linkedStructure, agx::Bool enable)
Enable/disable a linked structure for aerodynamics calculations.
agx::Vector< WirePair > WirePairContainer
HydrodynamicsParametersLinkedStructureContainer m_hydrodynamicsParametersLinkedStructures
virtual void updateInteraction(agxModel::WindAndWaterController::ObjectData &, const GlobalTriangleData::Container &)
Called when it's time to update interaction.
AerodynamicsParametersLinkedStructureContainer m_aerodynamicsParametersLinkedStructures
agx::ref_ptr< ObjectData > ObjectDataRef
PressureFieldRendererDataContainer m_pressureFieldRenderers
agx::HashVector< const agxCollide::Shape *, AerodynamicsParametersRef > AerodynamicsParametersContainer
agxModel::WindAndWaterController::PressureFieldRendererData * getPressureFieldRenderData(const agxCollide::Shape *shape) const
agxModel::WaterWrapper * getWaterWrapper(const agxCollide::Geometry *waterGeometry)
virtual agxModel::WindAndWaterController::WindGenerator * getWindGenerator() const
HydrodynamicsParametersRef m_globalHydrodynamicsParameters
agx::Vector< agxModel::WindAndWaterController::AlgorithmRef > AlgorithmContainer
AerodynamicsParametersContainer m_aerodynamicsParameters
agxModel::AerodynamicsParameters * getOrCreateAerodynamicsParameters(const agxSDK::LinkedStructure *linkedStructure) const
Creates new or returns an already created parameter storage for a given linked structure.
agxModel::WindAndWaterController::WireLinkedStructureData * calculateLinkedStructureData(const agxCollide::Geometry *waterGeometry, const agxCollide::Geometry *geometry, const agx::Vec3 &gravity, const AerodynamicsParameters *aeroParams, const HydrodynamicsParameters *hydroParams, agx::Bool aeroEnabled, agx::Bool hydroEnabled, const agx::TimeStamp &t=0)
Calculate linked structure data for all segments.
WaterFlowGeneratorContainer m_flowGenerators
AerodynamicsParametersWireContainer m_aerodynamicsParametersWires
virtual agx::Bool setEnableAerodynamics(agxCollide::Geometry *geometry, agx::Bool enable)
Enable/disable a geometry for aerodynamics calculations.
virtual void setWindGenerator(agxModel::WindAndWaterController::WindGenerator *windGenerator)
Assign unique wind generator.
virtual void preCollide(agxModel::WindAndWaterController *)
Called during normal preCollide events.
HydrodynamicsParametersContainer m_hydrodynamicsParameters
agxModel::PressureFieldRenderer * getPressureFieldRender(const agxCollide::Shape *shape) const
ShapeTessellation
Tessellation levels of native, non-mesh shapes, e.g, sphere, capsule and cylinder.
Basic implementation of any structure where bodies are linked/constrained together in a well defined ...
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
Derive from this class to implement a listener for simulation step events.
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45
Class defining a node that is part of a wire.
Definition: agxWire/Node.h:512
Interface and placeholder of controllers/helpers for wires.
Definition: Wire.h:62
Inheritance with partial specialization due to bug with ref_ptr containers.
Representation of a name string.
Definition: Name.h:33
Base class providing referencing counted objects.
Definition: Referenced.h:114
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
Definition: Uuid.h:42
Vector containing 'raw' data.
Definition: agx/Vector.h:246
Templated vector class.
Definition: agx/Vector.h:53
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
#define AGX_FORCE_INLINE
Definition: macros.h:58
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:37
agx::Vector< WindAndWaterController * > WindAndWaterControllerPtrVector
agx::ref_ptr< WindAndWaterController > WindAndWaterControllerRef
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
Definition: agx/Vec3.h:36
bool Bool
Definition: Integer.h:48
uint32_t UInt
Definition: Integer.h:34
double Real
Definition: Real.h:42
agx::Real TimeStamp
Definition: TimeStamp.h:26
Triangle data for a normal or a clipped triangle.
Vertex data for all global vertices in a mesh.
AerodynamicsData(const agxCollide::Geometry *geometryIn)
Data for rigid body with aero/hydro static/dynamic forces and added mass and inertia matrices.
void getAddedMassAndInertiaDiagonalCoefficients(const agx::RigidBody *rb, agx::Vec3 &addedMassDiagonalCoefficients, agx::Vec3 &addedInertiaDiagonalCoefficients) const
Calculate the diagonal coefficients given the added mass/inertia matrices have been calculated given ...
Hydro- and aerodynamic results for a linked structure.
Hydro- and aerodynamic results for a wire.
Segment(agx::RigidBody *rb, agx::Vec3 point1, agx::Vec3 point2, agx::Vec3 velocity, agx::Vec3 velocityOfFluid, agx::Real fluidDensity, agx::Vec3 gravity, agx::Real volume)
WirePair(agxWire::Node *node1, agxWire::Node *node2, const agxCollide::Geometry *water, agx::Vec3 gravity)