subBody.H
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-2024 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 Class
25  Foam::RBD::subBody
26 
27 Description
28  This specialised rigidBody holds the original body after it has been merged
29  into a master.
30 
31 SourceFiles
32  subBodyI.H
33  subBody.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef RBD_subBody_H
38 #define RBD_subBody_H
39 
40 #include "rigidBody.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace RBD
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class subBody Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class subBody
54 {
55  // Private Data
56 
57  //- Original body from which this sub-body was constructed
58  autoPtr<rigidBody> body_;
59 
60  //- Master body name
61  word masterName_;
62 
63  //- Master body ID
64  label masterIndex_;
65 
66  //- Transform with respect to master body
67  spatialTransform masterXT_;
68 
69 
70 public:
71 
72  // Constructors
73 
74  //- Construct a merged version of the given rigidBody
75  // providing the ID of the master body to which this will be merged
76  // and the transform relative to the master
77  inline subBody
78  (
79  const autoPtr<rigidBody>& bodyPtr,
80  const word& masterName,
81  const label masterID,
83  );
84 
85  //- Return clone of this subBody
86  inline autoPtr<subBody> clone() const;
87 
88 
89  // Member Functions
90 
91  //- Return the original body from which this sub-body was constructed
92  inline const rigidBody& body() const;
93 
94  //- Return the body name
95  inline const word& name() const;
96 
97  //- Return the master body name
98  inline const word& masterName() const;
99 
100  //- Return the master body Id
101  inline label masterIndex() const;
102 
103  //- Return the transform with respect to the master body
104  inline const spatialTransform& masterXT() const;
105 
106  //- Write
107  void write(Ostream&) const;
108 };
109 
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 } // End namespace RBD
114 } // End namespace Foam
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 #include "subBodyI.H"
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 #endif
123 
124 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
This specialised rigidBody holds the original body after it has been merged into a master.
Definition: subBody.H:53
void write(Ostream &) const
Write.
Definition: subBody.C:30
autoPtr< subBody > clone() const
Return clone of this subBody.
Definition: subBodyI.H:43
subBody(const autoPtr< rigidBody > &bodyPtr, const word &masterName, const label masterID, const spatialTransform &masterXT)
Construct a merged version of the given rigidBody.
Definition: subBodyI.H:29
const spatialTransform & masterXT() const
Return the transform with respect to the master body.
Definition: subBodyI.H:75
const word & masterName() const
Return the master body name.
Definition: subBodyI.H:63
const rigidBody & body() const
Return the original body from which this sub-body was constructed.
Definition: subBodyI.H:51
const word & name() const
Return the body name.
Definition: subBodyI.H:57
label masterIndex() const
Return the master body Id.
Definition: subBodyI.H:69
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Compact representation of the Plücker spatial transformation tensor in terms of the rotation tensor E...
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59