AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
AddedMassDb.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_ADDEDMASSDB_H
18#define AGXMODEL_ADDEDMASSDB_H
19
20#include <agxModel/export.h>
21
22#include <agx/Vec6.h>
24
25#include <agxCollide/Mesh.h>
26
30
31namespace agxModel
32{
33 namespace dense
34 {
36 {
37 public:
39
40 public:
43
44 agx::UInt size() const;
45
46 void resize( agx::UInt size );
47
49 const DataType& getData() const;
50
51 agx::Real& operator()( const agx::UInt i );
52 const agx::Real& operator()( const agx::UInt i ) const;
53
54 private:
55 DataType m_data;
56 };
57
59 {
60 public:
62
67
68 agx::Real operator()( agx::UInt i, agx::UInt j ) const;
69 agx::Real& operator()( agx::UInt i, agx::UInt j );
70
71 private:
72 void solveL( Vector& x ) const;
73 void solveU( Vector& x ) const;
74
75 private:
76 agx::RealValarray m_data;
77 agx::UInt m_n;
78 agx::Bool m_factored;
79 };
80
82 {
83 return (agx::UInt)m_data.size();
84 }
85
87 {
88 return m_data[ i ];
89 }
90
92 {
93 return m_data[ i ];
94 }
95
97 {
98 agxAssert( !m_factored );
99 return m_data[ m_n * i + j ];
100 }
102 {
103 agxAssert( !m_factored );
104 return m_data[ m_n * i + j ];
105 }
106 }
107
109
114 {
115 public:
120
121 public:
127
132
133 public:
138 {
139 Report( agx::Bool validIn, agx::Real executionTimeIn ) : valid( validIn ), executionTime( executionTimeIn ) {}
142 };
143
144 public:
148 agxModel::AddedMassStorage::Report create( const agxCollide::Mesh* mesh, const agx::Vec3& localCenterOfMassPosition );
149
154
159
163 agx::Bool equals( const agxModel::AddedMassStorage* other, agx::Real threshold = agx::Real( 0 ) ) const;
164
169
174
179
180 protected:
181 friend class AddedMassDb;
186
191
195 void allocate( agx::UInt numElements );
196
197 private:
198 PhiContainer m_phi;
199 NormalTangentContainer m_normalsTangents;
200 Identifier m_id;
201 };
202
204
277
279
281}
282
283#endif // AGXMODEL_ADDEDMASSDB_H
#define AGXMODEL_EXPORT
Class for more intuitive access to the Mesh's mesh data.
Definition Mesh.h:79
Mesh is a common base class for triangle meshes, such as Mesh or HeightField.
Definition Mesh.h:70
Holder/manager of added mass storages.
agxModel::AddedMassStorage * getOrCreateStorage(const agx::String &filename, const agxModel::WindAndWaterParameters *parameters)
Returns already loaded storage or loads existing file.
virtual void store(agxStream::OutputArchive &out) const
Internal method.
AddedMassDb()
Default constructor.
const agxModel::AddedMassStorage * getStorage(agxModel::AddedMassStorage::Identifier id) const
virtual ~AddedMassDb()
Reference counted object, protected destructor.
agxModel::AddedMassStorage * load(const agx::String &filename)
Reloads a file and updates the storage identifier if it exist.
agx::HashVector< AddedMassStorage::Identifier, AddedMassStorageRef > AddedMassStorageContainer
virtual void restore(agxStream::InputArchive &in)
Internal method.
static agxModel::AddedMassStorageRef createStorage(const agxModel::WindAndWaterParameters *parameters, agxModel::AddedMassStorage::Identifier identifier)
Creates new storage given shape.
agx::Bool save(agxModel::AddedMassStorage *storage, const agx::String &filename)
Saves storage to file.
Storage that holds data needed for added mass calculations.
static agx::Bool isValid(agxModel::AddedMassStorage::Identifier id)
virtual ~AddedMassStorage()
Reference counted object, protected destructor.
agx::VectorPOD< agx::Vec6 > NormalTangentContainer
static agxModel::AddedMassStorage::Identifier createIdentifier(const agx::String &name)
Creates an identifier given name (normally path + filename) used to identify added mass storages.
AddedMassStorage(agxModel::AddedMassStorage::Identifier identifier)
Construct given identifier.
agx::Bool equals(const agxModel::AddedMassStorage *other, agx::Real threshold=agx::Real(0)) const
Mostly for debug purposes.
const agxModel::AddedMassStorage::NormalTangentContainer & getNormalTangentData() const
agxModel::AddedMassStorage::Identifier getIdentifier() const
agxModel::AddedMassStorage::Report restore(agxStream::StorageStream &str)
Restore data from stream.
agxModel::AddedMassStorage::Report create(const agxCollide::Mesh *mesh, const agx::Vec3 &localCenterOfMassPosition)
Create/calculate data given mesh and center of mass position given in mesh coordinate frame.
agxModel::dense::Vector Phi
agxModel::AddedMassStorage::Report store(agxStream::StorageStream &str) const
Store data to stream.
agx::Vector< Phi > PhiContainer
void allocate(agx::UInt numElements)
Allocate internal structure given the number of elements (triangles).
const agxModel::AddedMassStorage::PhiContainer & getFlowData() const
agx::Bool isFactored() const
agx::Real operator()(agx::UInt i, agx::UInt j) const
Definition AddedMassDb.h:96
agx::Bool solve(agxModel::dense::Vector &x)
agx::RealValarray DataType
Definition AddedMassDb.h:38
agx::Real & operator()(const agx::UInt i)
Definition AddedMassDb.h:86
void resize(agx::UInt size)
Vector(agx::UInt size)
const DataType & getData() const
agx::UInt size() const
Definition AddedMassDb.h:81
Class for reading a binary stream of serialized data.
Class for writing serialized data in binary format to a stream.
Abstract base class for storing/restoring a line/drums with version control.
Base class providing referencing counted objects.
Definition Referenced.h:120
Smart pointer for handling referenced counted objects.
Definition ref_ptr.h:30
#define agxAssert(expr)
Definition debug.h:143
#define AGX_FORCE_INLINE
Definition macros.h:58
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition FlowUnit.h:37
agx::ref_ptr< AddedMassDb > AddedMassDbRef
agx::ref_ptr< AddedMassStorage > AddedMassStorageRef
AGXMODEL_EXPORT agx::Vec3 getCenter(const agxCollide::Mesh::Triangle &triangle)
uint32_t UInt32
Definition Integer.h:32
bool Bool
Definition Integer.h:40
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42
std::valarray< agx::Real > RealValarray
For this module, vectors are defined using valarray.
Report from creation, store and restore.
Report(agx::Bool validIn, agx::Real executionTimeIn)