compositeJoint.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2016 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 "compositeJoint.H"
27 #include "rigidBodyModel.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace RBD
35 {
36 namespace joints
37 {
39 
41  (
42  joint,
43  composite,
45  );
46 }
47 }
48 }
49 
50 
51 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
52 
53 void Foam::RBD::joints::composite::setLastJoint()
54 {
55  last().joint::operator=(*this);
56 }
57 
58 
59 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
60 
62 :
63  PtrList<joint>(joints),
64  joint(last())
65 {}
66 
67 
69 :
70  PtrList<joint>(dict.lookup("joints")),
71  joint(last())
72 {}
73 
74 
76 {
77  return autoPtr<joint>(new composite(*this));
78 }
79 
80 
81 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
82 
84 {}
85 
86 
87 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
88 
90 (
91  joint::XSvc& J,
92  const scalarField& q,
93  const scalarField& qDot
94 ) const
95 {
96  last().jcalc(J, q, qDot);
97 }
98 
99 
101 {
102  joint::write(os);
103  os.writeKeyword("joints");
104  os << static_cast<const PtrList<joint>&>(*this);
105 }
106 
107 
108 // ************************************************************************* //
virtual void write(Ostream &) const
Write.
Abstract base-class for all rigid-body joints.
Definition: joint.H:79
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual ~composite()
Destructor.
defineTypeNameAndDebug(composite, 0)
addToRunTimeSelectionTable(joint, composite, dictionary)
T & last()
Return reference to the last element of the list.
Definition: UPtrListI.H:57
Macros for easy insertion into run-time selection tables.
Prismatic joint for translation along the specified arbitrary axis.
Joint state returned by jcalc.
Definition: joint.H:119
stressControl lookup("compactNormalStress") >> compactNormalStress
virtual void jcalc(joint::XSvc &J, const scalarField &q, const scalarField &qDot) const
Update the model state for this joint.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:54
virtual void write(Ostream &) const
Write.
Definition: joint.C:81
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
composite(const PtrList< joint > &joints)
Construct for given PtrList<joint>
Namespace for OpenFOAM.
virtual autoPtr< joint > clone() const
Clone this joint.