rigidBodyDynamics/bodies/jointBody: Special body to support elements of composite joints
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
bodies0
|
||||
bodies
|
||||
{
|
||||
pendulum
|
||||
{
|
||||
@ -10,12 +10,12 @@ bodies0
|
||||
transform (1 0 0 0 1 0 0 0 1) (0 0 0);
|
||||
joint
|
||||
{
|
||||
type Rz;
|
||||
type floating;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bodies
|
||||
bodies0
|
||||
{
|
||||
hinge
|
||||
{
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
bodies/rigidBody/rigidBody.C
|
||||
bodies/masslessBody/masslessBody.C
|
||||
bodies/jointBody/jointBody.C
|
||||
bodies/compositeBody/compositeBody.C
|
||||
bodies/subBody/subBody.C
|
||||
bodies/sphere/sphere.C
|
||||
|
||||
61
src/rigidBodyDynamics/bodies/jointBody/jointBody.C
Normal file
61
src/rigidBodyDynamics/bodies/jointBody/jointBody.C
Normal file
@ -0,0 +1,61 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "jointBody.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RBD
|
||||
{
|
||||
defineTypeNameAndDebug(jointBody, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
rigidBody,
|
||||
jointBody,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::RBD::rigidBody> Foam::RBD::jointBody::clone() const
|
||||
{
|
||||
return autoPtr<rigidBody>(new jointBody(*this));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::RBD::jointBody::~jointBody()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
99
src/rigidBodyDynamics/bodies/jointBody/jointBody.H
Normal file
99
src/rigidBodyDynamics/bodies/jointBody/jointBody.H
Normal file
@ -0,0 +1,99 @@
|
||||
/*---------------------------------------------------------------------------*\3
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::jointBody
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
jointBodyI.H
|
||||
jointBody.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef RBD_jointBody_H
|
||||
#define RBD_jointBody_H
|
||||
|
||||
#include "masslessBody.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RBD
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class jointBody Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class jointBody
|
||||
:
|
||||
public masslessBody
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("jointBody");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct a joint body
|
||||
inline jointBody();
|
||||
|
||||
//- Construct a named joint body
|
||||
inline jointBody(const word& name);
|
||||
|
||||
//- Construct from dictionary
|
||||
inline jointBody
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Return clone of this jointBody
|
||||
virtual autoPtr<rigidBody> clone() const;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~jointBody();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RBD
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "jointBodyI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
49
src/rigidBodyDynamics/bodies/jointBody/jointBodyI.H
Normal file
49
src/rigidBodyDynamics/bodies/jointBody/jointBodyI.H
Normal file
@ -0,0 +1,49 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::RBD::jointBody::jointBody()
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::RBD::jointBody::jointBody(const word& name)
|
||||
:
|
||||
masslessBody(name)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::RBD::jointBody::jointBody
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
masslessBody(name, dict)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "rigidBodyModel.H"
|
||||
#include "masslessBody.H"
|
||||
#include "compositeBody.H"
|
||||
#include "jointBody.H"
|
||||
#include "nullJoint.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -215,7 +216,7 @@ Foam::label Foam::RBD::rigidBodyModel::join
|
||||
label parent = parentID;
|
||||
joints::composite& cJoint = cJointPtr();
|
||||
|
||||
// For all but the final joint in the set add a masslessBody with the
|
||||
// For all but the final joint in the set add a jointBody with the
|
||||
// joint and transform
|
||||
for (label j=0; j<cJoint.size()-1; j++)
|
||||
{
|
||||
@ -224,7 +225,7 @@ Foam::label Foam::RBD::rigidBodyModel::join
|
||||
parent,
|
||||
j == 0 ? XT : spatialTransform(),
|
||||
cJoint[j].clone(),
|
||||
autoPtr<rigidBody>(new masslessBody)
|
||||
autoPtr<rigidBody>(new jointBody)
|
||||
);
|
||||
}
|
||||
|
||||
@ -341,24 +342,26 @@ void Foam::RBD::rigidBodyModel::write(Ostream& os) const
|
||||
|
||||
for (label i=1; i<nBodies(); i++)
|
||||
{
|
||||
os << indent << bodies_[i].name() << nl
|
||||
<< indent << token::BEGIN_BLOCK << incrIndent << endl;
|
||||
if (!isType<jointBody>(bodies_[i]))
|
||||
{
|
||||
os << indent << bodies_[i].name() << nl
|
||||
<< indent << token::BEGIN_BLOCK << incrIndent << endl;
|
||||
|
||||
bodies_[i].write(os);
|
||||
bodies_[i].write(os);
|
||||
|
||||
os.writeKeyword("parent")
|
||||
<< bodies_[lambda_[i]].name() << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("parent")
|
||||
<< bodies_[lambda_[i]].name() << token::END_STATEMENT << nl;
|
||||
|
||||
os.writeKeyword("transform")
|
||||
<< XT_[i] << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("transform")
|
||||
<< XT_[i] << token::END_STATEMENT << nl;
|
||||
|
||||
os << indent << "joint" << nl << joints_[i] << endl;
|
||||
os << indent << "joint" << nl << joints_[i] << endl;
|
||||
|
||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
forAll (mergedBodies_, i)
|
||||
forAll(mergedBodies_, i)
|
||||
{
|
||||
os << indent << mergedBodies_[i].name() << nl
|
||||
<< indent << token::BEGIN_BLOCK << incrIndent << endl;
|
||||
|
||||
Reference in New Issue
Block a user