AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
GranularFieldPostProcessor.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# pragma once
18
19#include <agxModel/export.h>
20
21#include <agx/Frame.h>
24
25#include <agx/ref_ptr.h>
26
27namespace agxModel
28{
29 class GranularField;
30
31 typedef std::pair<agx::Physics::GranularBodyPtr, agx::Real> ParticleWeightPair;
33
35
43 {
44 public:
45
53
59
65
70 bool removeField(const agx::String& name);
71
76
81
86
91
96
103
108
113
118 void setPosition(const agx::Vec3& pos);
119
124 void setRotation(const agx::Quat & quat);
125
131
132 protected:
134
135 private:
136 agx::Physics::GranularBodySystemRef m_granularBodySystem;
137 agx::FrameRef m_frame;
138 agx::Vec3u m_voxelCount; // x is width, y is depth, z is height
139 agx::Vec3 m_halfExtents;
140 agx::Vec3 m_voxelSize;
141
143
144 public:
148
149 private:
150 /* Sorts the particles into voxels. The result is in the particleWeightPairVector. */
151 bool sortParticlesIntoVoxels();
152 agx::Vec3i getVoxelIndexFromPosition(const agx::Vec3& position) const;
153 agx::Vec3 getPositionRelativeFirstVoxel(const agx::Vec3& position) const;
154
155 agx::UInt getFlatIndex(const agx::Vec3i& index) const;
156
157 void addRequiredFields(const agx::Vector<agx::String>& fields);
158
159 };
160
161}
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXMODEL_EXPORT
Class for calculating different granular fields.
bool addField(agxModel::GranularField *gf)
Adds a new field.
void setRotation(const agx::Quat &quat)
Set rotation of the field volume in world coordinates.
agxModel::GranularField * getField(const agx::String &name)
Get a field added to the GranularFieldPostProcessor.
const agxModel::GranularFieldRefVector & getFields()
bool calculateFields()
Sorts particles into voxels and calculate the fields that are added to this class.
void setPosition(const agx::Vec3 &pos)
Set position of the field volume in world coordinates.
bool removeField(const agx::String &name)
Remove field with this name.
void createDebugVisualization(agxSDK::Simulation *simulation)
Set position of the field volume in world coordinates.
GranularFieldPostProcessor(agx::Physics::GranularBodySystem *gbs, const agx::Vec3u &voxelCount, const agx::Vec3 &halfExtents)
GranularFieldPostProcessor that computes voxel discretized granular fields for a given granular body ...
agx::Physics::GranularBodySystem * getGranularBodySystem()
Base class for a GranularField.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition Simulation.h:126
The object defining a frame of reference and providing transformations operations.
Definition agx/Frame.h:68
Base class providing referencing counted objects.
Definition Referenced.h:120
A class holding 3 dimensional vectors and providing basic arithmetic.
Templated vector class.
Definition agx/Vector.h:53
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition FlowUnit.h:37
agx::Vector< ParticleWeightPair > ParticleWeightPairVector
std::pair< agx::Physics::GranularBodyPtr, agx::Real > ParticleWeightPair
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42