AGXDynamics  2.35.0.2
AddedMassDb.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_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
WindAndWaterUtils.h
InputArchive.h
agxCollide::Mesh
Mesh is a common base class for triangle meshes, such as Mesh or HeightField.
Definition: Mesh.h:69
agxModel::AddedMassStorage::Phi
agxModel::dense::Vector Phi
Definition: AddedMassDb.h:41
agx::Real
double Real
Definition: Real.h:42
agxModel
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:36
agxModel::AddedMassStorage::Report::valid
agx::Bool valid
Definition: AddedMassDb.h:65
agx::Vector< Phi >
agxStream::out
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.
Definition: OutputArchive.h:412
export.h
agxModel::AddedMassStorage::Report
Report from creation, store and restore.
Definition: AddedMassDb.h:62
agxModel::AddedMassStorage::Report::executionTime
agx::Real executionTime
Definition: AddedMassDb.h:66
agxModel::AddedMassDb::AddedMassStorageContainer
agx::HashVector< AddedMassStorage::Identifier, AddedMassStorageRef > AddedMassStorageContainer
Definition: AddedMassDb.h:191
agxModel::AddedMassStorageRef
agx::ref_ptr< AddedMassStorage > AddedMassStorageRef
Definition: AddedMassDb.h:128
agxStream::StorageStream
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
agxModel::AddedMassStorage::NormalTangentContainer
agx::VectorPOD< agx::Vec6 > NormalTangentContainer
Definition: AddedMassDb.h:43
agxModel::dense::Vector
Definition: WindAndWaterUtils.h:111
agx::VectorPOD< agx::Vec6 >
agxModel::AddedMassDbRef
agx::ref_ptr< AddedMassDb > AddedMassDbRef
Definition: AddedMassDb.h:203
agxStream::in
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
agxModel::AddedMassStorage::Report::Report
Report(agx::Bool validIn, agx::Real executionTimeIn)
Definition: AddedMassDb.h:64
agxModel::AddedMassStorage
Storage that holds data needed for added mass calculations.
Definition: AddedMassDb.h:38
agxModel::WindAndWaterParameters
Definition: WindAndWaterParameters.h:28
agx::ref_ptr
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
agxTerrain::Profiler::getStorage
AGXTERRAIN_EXPORT TimingStorage & getStorage()
agxCollide::Mesh::Triangle
Class for more intuitive access to the Mesh's mesh data.
Definition: Mesh.h:78
Vec6.h
agxModel::getCenter
AGXMODEL_EXPORT agx::Vec3 getCenter(const agxCollide::Mesh::Triangle &triangle)
agxModel::AddedMassDb
Holder/manager of added mass storages.
Definition: AddedMassDb.h:133
agxModel::AddedMassStorage::PhiContainer
agx::Vector< Phi > PhiContainer
Definition: AddedMassDb.h:42
agxStream::OutputArchive
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
agxStream::InputArchive
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
agxModel::AddedMassStorage::Identifier
agx::UInt32 Identifier
Definition: AddedMassDb.h:44
Mesh.h
agx::Referenced
Base class providing referencing counted objects.
Definition: Referenced.h:113
agx::UInt
uint32_t UInt
Definition: Integer.h:34
agx::Bool
bool Bool
Definition: Integer.h:48
AGXMODEL_EXPORT
#define AGXMODEL_EXPORT
Definition: agxModel/export.h:42
agx::AgXString< std::string >
OutputArchive.h
agx::Vec3T< Real >
agx::UInt32
uint32_t UInt32
Definition: Integer.h:40
agx::HashVector< AddedMassStorage::Identifier, AddedMassStorageRef >
StorageStream.h