floatingJoint.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "floatingJoint.H"
27 #include "rigidBodyModel.H"
29 
30 #include "Rs.H"
31 #include "Rzyx.H"
32 #include "Pxyz.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 namespace RBD
39 {
40 namespace joints
41 {
42  defineTypeNameAndDebug(floating, 0);
43 
45  (
46  joint,
47  floating,
48  dictionary
49  );
50 }
51 }
52 }
53 
54 
55 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
56 
58 Foam::RBD::joints::floating::sixDoF(const rigidBodyModel& model)
59 {
60  PtrList<joint> cj(2);
61  cj.set(0, new joints::Pxyz(model));
62 
63  // The quaternion-based spherical joint could be used
64  // but then w must be set appropriately
65  // cj.set(1, new joints::Rs(model));
66 
67  // Alternatively the Euler-angle joint can be used
68  cj.set(1, new joints::Rzyx(model));
69 
70  return autoPtr<composite>(new composite(cj));
71 }
72 
73 
74 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
75 
77 :
78  composite(sixDoF(model))
79 {}
80 
81 
83 (
84  const rigidBodyModel& model,
85  const dictionary& dict
86 )
87 :
88  composite(sixDoF(model))
89 {}
90 
91 
93 {
94  return autoPtr<joint>(new floating(*this));
95 }
96 
97 
98 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
99 
101 {}
102 
103 
104 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
105 
107 {
108  joint::write(os);
109 }
110 
111 
112 // ************************************************************************* //
virtual autoPtr< joint > clone() const
Clone this joint.
Definition: floatingJoint.C:92
virtual ~floating()
Destructor.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
defineTypeNameAndDebug(composite, 0)
addToRunTimeSelectionTable(joint, composite, dictionary)
Macros for easy insertion into run-time selection tables.
Prismatic joint for translation along the specified arbitrary axis.
virtual void write(Ostream &) const
Write.
virtual void write(Ostream &) const
Write.
Definition: joint.C:82
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
floating(const rigidBodyModel &model)
Construct.
Definition: floatingJoint.C:76
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
composite(const PtrList< joint > &joints)
Construct for given PtrList<joint>
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints...
Namespace for OpenFOAM.