rigidBodyModel: Added movingBodyNames() member function
which returns the list of names of the moving bodies in the model.
This commit is contained in:
@ -384,6 +384,25 @@ Foam::spatialTransform Foam::RBD::rigidBodyModel::X0
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::RBD::rigidBodyModel::movingBodyNames() const
|
||||
{
|
||||
wordList names(nBodies());
|
||||
|
||||
label j = 0;
|
||||
for (label i=1; i<nBodies(); i++)
|
||||
{
|
||||
if (!isType<jointBody>(bodies_[i]))
|
||||
{
|
||||
names[j++] = bodies_[i].name();
|
||||
}
|
||||
}
|
||||
|
||||
names.setSize(j);
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
void Foam::RBD::rigidBodyModel::write(Ostream& os) const
|
||||
{
|
||||
os << indent << "bodies" << nl
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -252,6 +252,9 @@ public:
|
||||
//- Return the name of body with the given ID
|
||||
inline const word& name(const label bodyID) const;
|
||||
|
||||
//- Return the names of the moving bodies
|
||||
wordList movingBodyNames() const;
|
||||
|
||||
//- Return the inertia of body i
|
||||
inline const rigidBodyInertia& I(const label i) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user