AGX Dynamics  2.35.0.1
GranularFields.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 # pragma once
18 
19 #include <agxModel/export.h>
20 
21 #include <agx/Frame.h>
23 
24 #include <agx/ref_ptr.h>
25 
26 namespace agxModel
27 {
28  class GranularFieldPostProcessor;
29 
30  typedef std::pair<agx::Physics::GranularBodyPtr, agx::Real> ParticleWeightPair;
32 
38 
39 
45  {
46  public:
52  GranularField(agx::UInt dimensions, agx::String name);
53 
61  virtual bool addToField(agx::UInt index, ParticleWeightPair* pair);
62 
69  virtual bool calculateFieldElement(agx::UInt /* index */);
70 
74  virtual ~GranularField();
75 
81 
85  void clearField();
86 
91  bool allocateField();
92 
98 
104 
110 
116 
122 
128 
129 
130  protected:
135 
136  private:
137  agxModel::GranularFieldPostProcessor* m_granularFieldPostProcessor;
138  };
139 
141  {
142  public:
144 
145  virtual bool addToField(agx::UInt index, ParticleWeightPair* pair);
146  virtual bool calculateFieldElement(agx::UInt index);
147 
148  protected:
150 
151  private:
152 
153  };
154 
156  {
157  public:
159 
160  virtual bool addToField(agx::UInt index, ParticleWeightPair* pair);
161  virtual bool calculateFieldElement(agx::UInt index);
162 
163  // Used for debugging mass conservation
165  protected:
167 
168  private:
169 
170  };
171 
173  {
174  public:
176 
177  virtual bool addToField(agx::UInt index, ParticleWeightPair* pair);
178  virtual bool calculateFieldElement(agx::UInt index);
179 
180  protected:
182 
183  private:
184  };
185 
187  {
188  public:
194 
195  virtual bool addToField(agx::UInt index, ParticleWeightPair* pair);
196  virtual bool calculateFieldElement(agx::UInt index);
197 
198  protected:
200  };
201 }
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXMODEL_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
GranularCustomBufferField(agx::String bufferName)
Custom buffer field.
virtual bool addToField(agx::UInt index, ParticleWeightPair *pair)
Implement this method in derived classes to define how the particle weight pair should be added to th...
virtual bool calculateFieldElement(agx::UInt index)
Implement this method in derived class to do a final computation on the field when all the particles ...
Class for calculating different granular fields.
Base class for a GranularField.
agx::Vector< agx::Real > m_field
agx::Vector< agx::String > m_requiredFields
virtual ~GranularField()
Virtual destructor.
agx::Real * getFieldData()
Get ptr to field data.
const agx::Vector< agx::String > & getRequiredFields()
Get the names of the fields that this field depends on.
agx::Vec4u getFieldShape()
Get the shape of the field.
GranularField(agx::UInt dimensions, agx::String name)
GranularField base class.
void setGranularFieldPostProcesser(agxModel::GranularFieldPostProcessor *pp)
Set GranularFieldPostProcessor.
void clearField()
Clear the field.
bool allocateField()
Allocate memory for the field.
agxModel::GranularFieldPostProcessor * getGranularFieldPostProcessor()
Get the granular field post processor.
virtual bool calculateFieldElement(agx::UInt)
Implement this method in derived class to do a final computation on the field when all the particles ...
virtual bool addToField(agx::UInt index, ParticleWeightPair *pair)
Implement this method in derived classes to define how the particle weight pair should be added to th...
agx::String getName()
Get field name.
agx::UInt getFieldSize()
Get the field size.
virtual bool calculateFieldElement(agx::UInt index)
Implement this method in derived class to do a final computation on the field when all the particles ...
virtual bool addToField(agx::UInt index, ParticleWeightPair *pair)
Implement this method in derived classes to define how the particle weight pair should be added to th...
agx::Real calculateTotalMassInField()
virtual bool calculateFieldElement(agx::UInt index)
Implement this method in derived class to do a final computation on the field when all the particles ...
virtual bool addToField(agx::UInt index, ParticleWeightPair *pair)
Implement this method in derived classes to define how the particle weight pair should be added to th...
virtual bool addToField(agx::UInt index, ParticleWeightPair *pair)
Implement this method in derived classes to define how the particle weight pair should be added to th...
virtual bool calculateFieldElement(agx::UInt index)
Implement this method in derived class to do a final computation on the field when all the particles ...
Base class providing referencing counted objects.
Definition: Referenced.h:114
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:35
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
uint32_t UInt
Definition: Integer.h:34
double Real
Definition: Real.h:42