AGX Dynamics  2.37.2.0
AddedMassDb.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 AGXMODEL_ADDEDMASSDB_H
18 #define AGXMODEL_ADDEDMASSDB_H
19 
20 #include <agxModel/export.h>
22 
23 #include <agx/Vec6.h>
24 
25 #include <agxCollide/Mesh.h>
26 
29 #include <agxStream/InputArchive.h>
30 
31 namespace agxModel
32 {
33  class WindAndWaterParameters;
34 
39  {
40  public:
45 
46  public:
51  static agxModel::AddedMassStorage::Identifier createIdentifier( const agx::String& name );
52 
57 
58  public:
63  {
64  Report( agx::Bool validIn, agx::Real executionTimeIn ) : valid( validIn ), executionTime( executionTimeIn ) {}
67  };
68 
69  public:
73  agxModel::AddedMassStorage::Report create( const agxCollide::Mesh* mesh, const agx::Vec3& localCenterOfMassPosition );
74 
79 
84 
88  agx::Bool equals( const agxModel::AddedMassStorage* other, agx::Real threshold = agx::Real( 0 ) ) const;
89 
93  const agxModel::AddedMassStorage::PhiContainer& getFlowData() const;
94 
98  const agxModel::AddedMassStorage::NormalTangentContainer& getNormalTangentData() const;
99 
103  agxModel::AddedMassStorage::Identifier getIdentifier() const;
104 
105  protected:
106  friend class AddedMassDb;
111 
115  virtual ~AddedMassStorage();
116 
120  void allocate( agx::UInt numElements );
121 
122  private:
123  PhiContainer m_phi;
124  NormalTangentContainer m_normalsTangents;
125  Identifier m_id;
126  };
127 
129 
134  {
135  public:
144  static agxModel::AddedMassStorageRef createStorage( const agxModel::WindAndWaterParameters* parameters,
146 
147  public:
151  AddedMassDb();
152 
158 
166  agxModel::AddedMassStorage* getOrCreateStorage( const agx::String& filename, const agxModel::WindAndWaterParameters* parameters );
167 
172  agxModel::AddedMassStorage* load( const agx::String& filename );
173 
178  agx::Bool save( agxModel::AddedMassStorage* storage, const agx::String& filename );
179 
183  virtual void store( agxStream::OutputArchive& out ) const;
184 
188  virtual void restore( agxStream::InputArchive& in );
189 
190  protected:
192 
193  protected:
197  virtual ~AddedMassDb();
198 
199  private:
200  AddedMassStorageContainer m_storage;
201  };
202 
204 
206 }
207 
208 #endif // AGXMODEL_ADDEDMASSDB_H
agx::ref_ptr< AddedMassStorage > AddedMassStorageRef
Definition: AddedMassDb.h:128
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
Definition: InputArchive.h:400
Report from creation, store and restore.
Definition: AddedMassDb.h:62
Mesh is a common base class for triangle meshes, such as Mesh or HeightField.
Definition: Mesh.h:69
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive...
bool Bool
Definition: Integer.h:48
agx::HashVector< AddedMassStorage::Identifier, AddedMassStorageRef > AddedMassStorageContainer
Definition: AddedMassDb.h:191
agx::Vector< Phi > PhiContainer
Definition: AddedMassDb.h:42
agx::ref_ptr< AddedMassDb > AddedMassDbRef
Definition: AddedMassDb.h:203
agxModel::dense::Vector Phi
Definition: AddedMassDb.h:41
Storage that holds data needed for added mass calculations.
Definition: AddedMassDb.h:38
Base class providing referencing counted objects.
Definition: Referenced.h:119
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:36
AGXMODEL_EXPORT agx::Vec3 getCenter(const agxCollide::Mesh::Triangle &triangle)
uint32_t UInt
Definition: Integer.h:34
Class for more intuitive access to the Mesh&#39;s mesh data.
Definition: Mesh.h:78
Report(agx::Bool validIn, agx::Real executionTimeIn)
Definition: AddedMassDb.h:64
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
agx::VectorPOD< agx::Vec6 > NormalTangentContainer
Definition: AddedMassDb.h:43
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
AGXTERRAIN_EXPORT TimingStorage & getStorage()
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
#define AGXMODEL_EXPORT
double Real
Definition: Real.h:42
Holder/manager of added mass storages.
Definition: AddedMassDb.h:133
uint32_t UInt32
Definition: Integer.h:40