AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
WindAndWaterController.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#ifndef AGXMODEL_WINDANDWATERCONTROLLER_H
18#define AGXMODEL_WINDANDWATERCONTROLLER_H
19
20#include <agxModel/export.h>
24
25#include <agx/Vec6.h>
26
27#include <agxCollide/Geometry.h>
28
30
31#include <agxWire/Wire.h>
32
33#include <mutex>
34
35
36namespace agxModel {
37 class WaterWrapper;
41
46 {
47 public:
49
58
83
85
104
106
111 {
112 public:
118
123 virtual void prepare( const agxCollide::Geometry* geometry );
124
125#ifndef SWIG
127#endif
128 protected:
129 virtual ~WindGenerator();
130 };
131
132
137 {
138 public:
143
148
152 agx::Vec3 getVelocity( const agx::Vec3& worldPoint ) const;
153
158
159 protected:
163 };
164
169 {
170 public:
171
176 const agxModel::HydrodynamicsParameters* hydroParams );
177
181 const agxModel::AerodynamicsParameters* getAerodynamicsParameters() const;
182
186 const agxModel::HydrodynamicsParameters* getHydrodynamicsParameters() const;
187
188 protected:
190
193 };
194
199 {
200 public:
205 const agxModel::AerodynamicsParameters* aeroParams,
206 const agxModel::HydrodynamicsParameters* hydroParams,
207 const agxModel::WaterWrapper* water,
209 const agx::Vec3& gravity,
210 agxModel::PressureFieldRenderer* pressureFieldRenderer,
211 const agx::UInt numTriangles,
212 const agx::UInt startIndexT,
213 const agx::UInt startIndexV,
214 bool enableCenterOfBuoyancy);
215
220
225
229 agx::Real getDensity( agx::Bool belowSurface ) const;
230
235
240
245
250
254 const agx::Vec3& getGravity() const;
255
259 const agx::Vec3& getForce() const;
260
265
270
275
280
284 const agx::Vec3& getTorque() const;
285
290
295
300
305
310
315
320
325
330
335
340
345
349 const WaterWrapper* getWater() const;
350
355
361
366
371
376
381
386
391
395 void lock() const { m_mutex.lock(); };
396
400 void unLock() const { m_mutex.unlock(); };
401
402 protected:
403 virtual ~ObjectData();
404
405 private:
406 agx::Vec3 m_gravity;
407 agx::Real m_densityWater;
408 agx::Real m_densityAir;
409 mutable agx::Vec3 m_force;
410 agx::Vec3Vector m_forceComponents;
411 mutable agx::Vec3 m_torque;
412 agx::Vec3Vector m_torqueComponents;
413 agx::Matrix3x3 m_addedMass;
414 agx::Matrix3x3 m_addedInertia;
415 agx::Bool m_containsAddedMass;
416 const agxCollide::Shape* m_shape;
417 PressureFieldRenderer* m_pressureFieldRenderer;
418 WaterWrapperConstRef m_water;
419 const agx::UInt m_numTriangles;
420 const agx::UInt m_startIndexT;
421 mutable std::mutex m_mutex;
422 agx::Vec3 m_centerOfBuoyancy;
423 agx::Real m_volumeInWater;
424 bool m_enableCenterOfBuoyancy;
425 };
426
429
430 struct WirePair
431 {
433 : node1( nullptr ), node2( nullptr ), water( nullptr ), gravity( agx::Vec3() )
434 {
435 }
436 WirePair( agxWire::Node* node1, agxWire::Node* node2, const agxCollide::Geometry* water, agx::Vec3 gravity )
437 : node1( node1 ), node2( node2 ), water( water ), gravity( gravity )
438 {
439 }
444
445 private:
447 WirePair& operator=( const WirePair& )
448 {
449 return *this;
450 }
451 };
452
454
455 struct Segment
456 {
457 Segment( agx::RigidBody* rb, agx::Vec3 point1, agx::Vec3 point2, agx::Vec3 velocity, agx::Vec3 velocityOfFluid,
458 agx::Real fluidDensity, agx::Vec3 gravity, agx::Real volume )
459 : rb( rb ), point1( point1 ), point2( point2 ), velocity( velocity ), velocityOfFluid( velocityOfFluid ),
460 fluidDensity( fluidDensity ), gravity( gravity ), volume(volume)
461 {
462 }
471 };
472
474
479 {
480 public:
487 WireLinkedStructureData( agx::Real radius, const AerodynamicsParameters* aeroParams, const HydrodynamicsParameters* hydroParams );
488
493
497 void addWaterSegment( const Segment& segment );
498
502 void addAirSegment( const Segment& segment );
503
508
513
514 protected:
516
517
518 private:
519 SegmentContainer m_airSegments;
520 SegmentContainer m_waterSegments;
521 agx::Real m_radius;
522 };
523
526
527
533 {
534 DynamicsData() : worldForce(), worldTorque(), bodyFrameAddedMass( agx::Vec3() ), bodyFrameAddedInertia( agx::Vec3() ) {}
535
543 void getAddedMassAndInertiaDiagonalCoefficients( const agx::RigidBody* rb, agx::Vec3& addedMassDiagonalCoefficients, agx::Vec3& addedInertiaDiagonalCoefficients ) const;
544
549 };
550
555 {
558 size_t numWaterSegments{0};
559 size_t numAirSegments{0};
560 agx::Real lengthWater{0.0};
561 agx::Real lengthAir{0.0};
562 };
563
571
572 public:
577
584
592
598 virtual void setEnableAerodynamics( agx::Bool enable );
599
607
615
624
629 void setAirDensity( agx::Real airDensity );
630
636
642
648
654
663
672
677
683
688
698
704
711 agxModel::WaterWrapper* waterWrapper );
717
726
737 const agx::RigidBody* rb,
738 const agx::Vec3& gravity,
739 const agxCollide::Space* space = nullptr,
740 agx::Bool updateRenderers = false );
741
748 agxWire::Wire* wire );
749
756 agxSDK::LinkedStructure* linkedStructure,
757 const agxCollide::Space* space );
758
766
774
781
789
797
804
811
819
827
834
841
849 bool getCenterOfBuoyancy(agxCollide::Geometry* geometry, agx::Vec3& centerOfBuoyancy) const;
850
859 bool getCenterOfBuoyancy(agx::RigidBody* body, agx::Vec3& centerOfBuoyancy) const;
860
866
874
882
886 virtual void preCollide( const agx::TimeStamp& ) override;
887
891 virtual void pre( const agx::TimeStamp& ) override;
892
896 virtual void post( const agx::TimeStamp& ) override;
897
899
900 protected:
910
912 {
913 AerodynamicsData( const agxCollide::Geometry* geometryIn ) : geometry( geometryIn ) {}
915
916 protected:
917 virtual ~AerodynamicsData() {}
918 };
920
922 {
923 public:
926
929
930 static agx::Vec3 findScale( const agxCollide::Shape* shape );
931
933
934 private:
935 struct PrimitiveData : public agx::Referenced
936 {
937 PrimitiveData( const agxCollide::Shape* shapeIn, agxCollide::Mesh* meshIn )
938 : shape( shapeIn ), mesh( meshIn )
939 {
940 }
941
942 virtual void checkSize( agx::Real resolution ) = 0;
943
946
947 protected:
948 virtual ~PrimitiveData() {}
949 };
950
951 struct CapsuleData : PrimitiveData
952 {
953 CapsuleData( const agxCollide::Shape* shapeIn, agxCollide::Mesh* meshIn, agx::Real radiusIn, agx::Real heightIn )
954 : PrimitiveData( shapeIn, meshIn ), radius( radiusIn ), height( heightIn )
955 {
956 }
957
958 virtual void checkSize( agx::Real resolution ) override;
959
960 agx::Real radius;
961 agx::Real height;
962
963 protected:
964 virtual ~CapsuleData() {}
965 };
966
967 struct ConeData : PrimitiveData
968 {
969 ConeData( const agxCollide::Shape* shapeIn, agxCollide::Mesh* meshIn , agx::Real topRadiusIn, agx::Real bottomRadiusIn, agx::Real heightIn )
970 : PrimitiveData( shapeIn, meshIn ), topRadius( topRadiusIn ), bottomRadius( bottomRadiusIn ),
971 height( heightIn )
972 {
973 }
974
975 virtual void checkSize( agx::Real resolution ) override;
976
977 agx::Real topRadius;
978 agx::Real bottomRadius;
979 agx::Real height;
980
981 protected:
982 virtual ~ConeData() {}
983 };
984
985 struct HollowConeData : PrimitiveData
986 {
987 HollowConeData( const agxCollide::Shape* shapeIn, agxCollide::Mesh* meshIn, agx::Real topOuterRadiusIn,
988 agx::Real bottomInnerRadiusIn, agx::Real heightIn,
989 agx::Real thicknessIn )
990 : PrimitiveData( shapeIn, meshIn ), topOuterRadius( topOuterRadiusIn ),
991 bottomInnerRadius( bottomInnerRadiusIn ), height( heightIn ), thickness( thicknessIn )
992 {
993 }
994
995 virtual void checkSize( agx::Real resolution ) override;
996
997 agx::Real topOuterRadius;
998 agx::Real bottomInnerRadius;
999 agx::Real height;
1000 agx::Real thickness;
1001
1002 protected:
1003 virtual ~HollowConeData() {}
1004 };
1005
1006 struct HollowCylinderData : PrimitiveData
1007 {
1008 HollowCylinderData( const agxCollide::Shape* shapeIn, agxCollide::Mesh* meshIn, agx::Real innerRadiusIn, agx::Real heightIn, agx::Real thicknessIn )
1009 : PrimitiveData( shapeIn, meshIn ), innerRadius( innerRadiusIn ), height( heightIn ),
1010 thickness( thicknessIn )
1011 {
1012 }
1013
1014 virtual void checkSize( agx::Real resolution ) override;
1015
1016 agx::Real innerRadius;
1017 agx::Real height;
1018 agx::Real thickness;
1019
1020 protected:
1021 virtual ~HollowCylinderData() {}
1022 };
1023
1024 using PrimitiveDataRef = agx::ref_ptr< PrimitiveData >;
1025
1026 typedef agx::Vector< agxCollide::MeshRef > MeshContainer;
1028
1029 private:
1030 agxCollide::MeshRef createUnitShape( agxCollide::Shape::Type shapeType, agx::Real resolution = agx::Real( 1 ) ) const;
1031 const agxCollide::Mesh* getOrCreatePrimitive( const agxCollide::Shape* shape, agx::Real resolution = agx::Real( 1 ) ) const;
1032
1033 private:
1034 mutable MeshContainer m_cache;
1035 mutable PrimitiveContainer m_primitives;
1036
1037 mutable std::mutex meshCreationMutex;
1038 };
1039
1056
1057 protected:
1062
1066 virtual void updateAlgorithms( const ObjectDataContainer& data, bool updateRenderers );
1067
1068 protected:
1073
1078
1083
1088
1093 const agxCollide::Geometry* geometry,
1094 const agx::Vec3& gravity,
1095 agx::Bool aeroEnabled,
1096 agx::Bool hydroEnabled,
1097 agx::Bool updateRenderers,
1098 const agx::UIntVector startIndexT,
1099 const agx::UIntVector startIndexV,
1100 const agx::TimeStamp& t = 0 );
1101
1106 WirePairContainer wirePairs,
1108 agx::Bool aeroEnable,
1109 const agx::TimeStamp& t = 0 );
1110
1115 const agxCollide::Geometry* geometry,
1116 const agx::Vec3& gravity,
1117 const AerodynamicsParameters* aeroParams,
1118 const HydrodynamicsParameters* hydroParams,
1119 agx::Bool aeroEnabled,
1120 agx::Bool hydroEnabled,
1121 const agx::TimeStamp& t = 0 );
1122
1124 agx::UIntVector& numTriangles,
1125 agx::UIntVector& numVertices );
1126
1127 protected:
1153 };
1154
1161 {
1162 public:
1164
1165 public:
1169 virtual void preCollide( agxModel::WindAndWaterController* /*controller*/ ) {}
1170
1174 virtual void pre( agxModel::WindAndWaterController* /*controller*/ ) {}
1175
1179 virtual void post( agxModel::WindAndWaterController* /*controller*/ ) {}
1180
1185
1186 virtual WindAndWaterController::ForceType getForceType() const { return WindAndWaterController::ForceType::OTHER; }
1187 };
1188
1190
1195 {
1196 public:
1202
1207 void setVelocity( const agx::Vec3& velocity );
1208
1212 const agx::Vec3& getVelocity() const;
1213
1214 public:
1215 virtual agx::Vec3 getVelocity( const agx::Vec3& /*worldPosition*/ ) const override;
1216
1218
1219 protected:
1222
1223 private:
1224 agx::Vec3 m_velocity;
1225 };
1226
1227
1229
1234 {
1235 public:
1241
1246 void setVelocity( const agx::Vec3& velocity );
1247
1251 const agx::Vec3& getVelocity() const;
1252
1253 public:
1254 virtual agx::Vec3 getVelocity( const agx::Vec3& /*worldPosition*/ ) const override;
1255
1257
1258 protected:
1261
1262 private:
1263 agx::Vec3 m_velocity;
1264 };
1265
1271 {
1273
1274 public:
1279
1287 virtual agx::Real findHeightFromSurface( const agx::Vec3& worldPoint, const agx::Vec3& upVector, const agx::TimeStamp& t ) const;
1288
1292 virtual agx::Bool isValid() const;
1293
1297 virtual agx::Real getDensity() const;
1298
1302 virtual agx::Vec3 getVelocity( const agx::Vec3& worldPoint ) const;
1303
1308
1313
1314#ifndef SWIG
1316#endif
1317
1318 protected:
1319 virtual ~WaterWrapper() {}
1320
1326 agx::Vec3 project( const agx::Vec3& localPoint, const agx::Vec3& localUpVector ) const;
1327
1328 protected:
1333
1335 private:
1336 // Only used by WindAndWaterController
1337 WaterWrapper( const agxCollide::Geometry* geometry );
1338 void setFlowGenerator( WindAndWaterController::WaterFlowGenerator* flowGenerator );
1339 void setWaterGeometry( agxCollide::Geometry* waterGeometry );
1340 void update();
1342 };
1343
1345 {
1346 return m_aeroParams;
1347 }
1348
1349 AGX_FORCE_INLINE const HydrodynamicsParameters* WindAndWaterController::WindAndWaterData::getHydrodynamicsParameters() const
1350 {
1351 return m_hydroParams;
1352 }
1353
1354 AGX_FORCE_INLINE agx::Vec3 ConstantWaterFlowGenerator::getVelocity( const agx::Vec3& /*worldPosition*/ ) const
1355 {
1356 return m_velocity;
1357 }
1358
1359 AGX_FORCE_INLINE agx::Vec3 ConstantWindGenerator::getVelocity( const agx::Vec3& /*worldPosition*/ ) const
1360 {
1361 return m_velocity;
1362 }
1363}
1364
1365#endif // AGXMODEL_WINDANDWATERCONTROLLER_H
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(T)
Use this in a pure abstract Serializable class to add the required methods Important: Use full namesp...
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXMODEL_EXPORT
The geometry representation used by the collision detection engine.
Definition Geometry.h:92
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.
const agx::Vec3 & getVelocity() const
void setVelocity(const agx::Vec3 &velocity)
Assign new wind velocity.
ConstantWindGenerator(const agx::Vec3 &velocity)
Construct given wind velocity.
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::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
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.
const agxCollide::Geometry * getGeometry() const
const agxModel::WindAndWaterController::WaterFlowGenerator * getWaterFlowGenerator() const
agx::Real getDensity(agx::Bool belowSurface) const
const agx::Vec3 & getTorqueComponent(ForceType type) const
agx::Real getDensity(const agxModel::VertexData &vData) const
const agx::Matrix3x3 & getAddedInertia() const
agx::Vec3 & centerOfBuoyancy()
Access center of buoyancy vector (in world coordinate system).
const agxCollide::Geometry * getGeometry() const
void lock() const
Perform a mutex lock for this ObjectData.
const agx::Bool & containsAddedMass() const
agxModel::PressureFieldRenderer * getPressureFieldRenderer() const
const agx::Vec3Vector & getForceComponents() const
agx::Vec3 & forceComponent(ForceType type)
agx::Vec3 & torqueComponent(ForceType type)
const agx::RigidBody * getRigidBody() const
agx::Matrix3x3 & addedMass()
Access added mass matrix.
const agx::Vec3Vector & getTorqueComponents() const
const agx::Real & getVolumeInWater() const
agx::Vec3 & force()
Access force vector (in world coordinate system).
const agx::Vec3 & getCenterOfBuoyancy() const
const agxCollide::Shape * getShape() 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, bool enableCenterOfBuoyancy)
Construct given shape, parameters, wind and water definitions and gravity.
void unLock() const
Perform a mutex unlock for this ObjectData.
const WaterWrapper * getWater() const
agx::RigidBody * getRigidBodySerial()
This method is unsafe to use if this object is used during parallel execution.
agx::Matrix3x3 & addedInertia()
Access added inertia matrix.
const agx::Matrix3x3 & getAddedMass() const
agx::Real & volumeInWater()
Access the size of the volume in water of the geometry.
const agx::Vec3 & getForceComponent(ForceType type) const
agx::Bool & containsAddedMass()
Set to/is true if this data contains added mass and/or inertia.
agx::Vec3 & torque()
Access torque vector (in world coordinate system).
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.
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.
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...
virtual agxModel::HydrodynamicsParameters * getOrCreateHydrodynamicsParameters(const agxCollide::Shape *shape) const
Creates new or returns an already created parameter storage for a given shape.
agx::HashVector< const agxCollide::Shape *, AerodynamicsParametersRef > AerodynamicsParametersContainer
agxModel::WindAndWaterController::DynamicsWireData calculateWireDynamicsData(const agxCollide::Geometry *waterGeometry, agxWire::Wire *wire)
Calculates forces for hydro- and aerodynamics acting on a wire.
agxModel::AerodynamicsParameters * getOrCreateAerodynamicsParameters(const agxSDK::LinkedStructure *linkedStructure) const
Creates new or returns an already created parameter storage for a given linked structure.
agx::HashVector< const agxCollide::Shape *, HydrodynamicsParametersRef > HydrodynamicsParametersContainer
agx::Vector< WireLinkedStructureDataRef > WireLinkedStructureDataContainer
agx::Vector< ObjectDataRef > ObjectDataContainer
void setAirDensity(agx::Real airDensity)
Set the density of air.
agx::Vec3 getForceComponent(agxCollide::Geometry *geometry, WindAndWaterController::ForceType type) const
Get the given part of the hydrodynamic force for a geometry.
void setEnableCenterOfBuoyancy(agxCollide::Geometry *geometry, bool enable)
Enable or disable the center of buoyancy calculations for a geometry.
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.
GeometryConstObserverVector m_waterGeometries
virtual WindAndWaterController::ForceType getForceType() const
agx::HashVector< const agxCollide::Geometry *, std::pair< agx::Vec3, agx::Real > > CenterOfBuoyancyContainer
AerodynamicsDataContainer m_aeroGeometries
virtual agx::Bool setWaterFlowGenerator(const agxCollide::Geometry *waterGeometry, agxModel::WindAndWaterController::WaterFlowGenerator *flowGenerator)
Assign unique water flow generator to a water geometry.
virtual agxModel::AerodynamicsParameters * getOrCreateAerodynamicsParameters(const agxCollide::Shape *shape) const
Creates new or returns an already created parameter storage for a given shape.
agx::HashVector< const agxWire::Wire *, AerodynamicsParametersRef > AerodynamicsParametersWireContainer
agx::Vec3 getTorqueComponent(agxCollide::Geometry *geometry, WindAndWaterController::ForceType type) const
Get the given part of the hydrodynamic torque for a geometry.
agx::Vector< agxCollide::GeometryConstObserver > GeometryConstObserverVector
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.
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, const agx::UIntVector startIndexT, const agx::UIntVector startIndexV, const agx::TimeStamp &t=0)
Calculate object data (for each shape) in a geometry.
agx::Vec3 getForce(agx::RigidBody *body) const
Get the total hydrodynamic force on a geometry.
bool getCenterOfBuoyancy(agx::RigidBody *body, agx::Vec3 &centerOfBuoyancy) const
Get the weighted average center of buoyancy for all the geometries in a rigid body.
AerodynamicsParametersRef m_globalAerodynamicsParameters
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.
virtual agx::Bool addWater(agxCollide::Geometry *geometry)
Flag a geometry as water.
void configureDefaultAlgorithms()
Configure the default algorithms.
CenterOfBuoyancyContainer m_centerOfBuoyancy
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 ~WindAndWaterController()
Reference counted object, protected destructor.
bool getCenterOfBuoyancy(agxCollide::Geometry *geometry, agx::Vec3 &centerOfBuoyancy) const
Get the center of buoyancy based on the triangular mesh of the given geometry.
static agxModel::WindAndWaterControllerPtrVector findAll(const agxSDK::Simulation *simulation)
Finds all WindAndWaterControllers in the given simulation.
agx::HashVector< const agxSDK::LinkedStructure *, HydrodynamicsParametersRef > HydrodynamicsParametersLinkedStructureContainer
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.
void setEnableCenterOfBuoyancy(agx::RigidBody *body, bool enable)
Enable or disable the center of buoyancy calculations for all geometries in a rigid body.
agx::ref_ptr< WireLinkedStructureData > WireLinkedStructureDataRef
agx::Vec3 getForceComponent(agx::RigidBody *body, WindAndWaterController::ForceType type) const
Get the given part of the hydrodynamic force for a rigid body.
agx::ref_ptr< ObjectData > ObjectDataRef
GlobalTriangleData::Container m_trianglePool
void garbageCollect()
Collects garbage (e.g., due to deleted shapes).
agxModel::HydrodynamicsParameters * getOrCreateHydrodynamicsParameters(const agxSDK::LinkedStructure *linkedStructure) const
Creates new or returns an already created parameter storage for a given linked structure.
virtual void setEnableAerodynamics(agx::Bool enable)
Enable/disable aerodynamics for all objects in the simulation.
agx::Vec3 getForce(agxCollide::Geometry *geometry) const
Get the total hydrodynamic force on a geometry.
agxModel::AerodynamicsParameters * getOrCreateAerodynamicsParameters(const agxWire::Wire *wire) const
Creates new or returns an already created parameter storage for a given wire.
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::Vector< agxWire::WireObserver > WireObserverVector
GeometryForceTorqueContainer m_geomForcesAndTorques
agx::HashVector< const agxSDK::LinkedStructure *, AerodynamicsParametersRef > AerodynamicsParametersLinkedStructureContainer
agx::Vec3 getTorque(agx::RigidBody *body) const
Get the total hydrodynamic torque on a rigid body.
agx::ref_ptr< PressureFieldRendererData > PressureFieldRendererDataRef
virtual void pre(const agx::TimeStamp &) override
Internal method.
agxModel::WindAndWaterController::PressureFieldRendererData * getPressureFieldRenderData(const agxCollide::Shape *shape) const
agxModel::WindAndWaterController::WaterFlowGenerator * getWaterFlowGenerator(const agxCollide::Geometry *waterGeometry) const
static agxCollide::TrimeshRef createPrimitiveMesh(const agxCollide::Shape *shape, agxModel::WindAndWaterParameters::ShapeTessellation tessellation)
Create a mesh from a primitive shape given a tessellation level.
agx::ref_ptr< AerodynamicsData > AerodynamicsDataRef
agx::HashVector< const agxCollide::Geometry *, WaterFlowGeneratorRef > WaterFlowGeneratorContainer
agx::HashVector< const agxCollide::Geometry *, AerodynamicsDataRef > AerodynamicsDataContainer
agx::HashVector< const agxCollide::Geometry *, std::pair< bool, agxCollide::GeometryConstObserver > > EnableCbContainer
agxModel::HydrodynamicsParameters * getOrCreateHydrodynamicsParameters(const agxWire::Wire *wire) const
Creates new or returns an already created parameter storage for a given wire.
bool getEnableCenterOfBuoyancy(const agxCollide::Geometry *geometry) const
Get if the center of buoyancy calculations are enabled or not for the given geometry.
virtual void preCollide(const agx::TimeStamp &) override
Internal method.
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.
WindAndWaterController()
Construct wind and water controller.
agxModel::WaterWrapper * getWaterWrapper(const agxCollide::Geometry *waterGeometry)
agxModel::WindAndWaterController::ObjectData ObjectData
agx::HashVector< const agxCollide::Shape *, PressureFieldRendererDataRef > PressureFieldRendererDataContainer
static agxModel::WindAndWaterController * find(agxSDK::Simulation *simulation, const agx::Uuid &uuid)
Search the given simulation for a WindAndWaterController with the given Uuid.
agx::Bool setEnableAerodynamics(agxSDK::LinkedStructure *linkedStructure, agx::Bool enable)
Enable/disable a linked structure for aerodynamics calculations.
HydrodynamicsParametersLinkedStructureContainer m_hydrodynamicsParametersLinkedStructures
virtual void updateInteraction(agxModel::WindAndWaterController::ObjectData &, const GlobalTriangleData::Container &)
Called when it's time to update interaction.
agx::HashVector< const agxWire::Wire *, HydrodynamicsParametersRef > HydrodynamicsParametersWireContainer
AerodynamicsParametersLinkedStructureContainer m_aerodynamicsParametersLinkedStructures
virtual agxModel::WindAndWaterController::WindGenerator * getWindGenerator() const
PressureFieldRendererDataContainer m_pressureFieldRenderers
agx::HashVector< const agxCollide::Geometry *, WaterWrapperRef > WaterWrapperContainer
virtual void updateAlgorithms(const ObjectDataContainer &data, bool updateRenderers)
Updates algorithms given current triangle data.
HydrodynamicsParametersRef m_globalHydrodynamicsParameters
agx::Vec3 getTorqueComponent(agx::RigidBody *body, WindAndWaterController::ForceType type) const
Get the given part of the hydrodynamic torque for a geometry.
AerodynamicsParametersContainer m_aerodynamicsParameters
WaterFlowGeneratorContainer m_flowGenerators
AerodynamicsParametersWireContainer m_aerodynamicsParametersWires
agxModel::PressureFieldRenderer * getPressureFieldRender(const agxCollide::Shape *shape) const
virtual agx::Bool setEnableAerodynamics(agxCollide::Geometry *geometry, agx::Bool enable)
Enable/disable a geometry for aerodynamics calculations.
agx::Vector< agxModel::WindAndWaterController::AlgorithmRef > AlgorithmContainer
virtual void setWindGenerator(agxModel::WindAndWaterController::WindGenerator *windGenerator)
Assign unique wind generator.
agx::HashVector< const agxCollide::Geometry *, std::pair< agx::Vec3Vector, agx::Vec3Vector > > GeometryForceTorqueContainer
agx::Vec3 getTorque(agxCollide::Geometry *geometry) const
Get the total hydrodynamic torque on a geometry.
virtual void preCollide(agxModel::WindAndWaterController *)
Called during normal preCollide events.
HydrodynamicsParametersContainer m_hydrodynamicsParameters
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:126
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...
Class defining a node that is part of a wire.
Interface and placeholder of controllers/helpers for wires.
Definition Wire.h:62
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition HashVector.h:41
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:120
The rigid body class, combining a geometric model and a frame of reference.
Definition RigidBody.h:52
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
Definition Uuid.h:42
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.
bool Bool
Definition Integer.h:40
uint64_t UInt
Definition Integer.h:27
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)