multiMotion.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) 2011-2026 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 "multiMotion.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace solidBodyMotionFunctions
34 {
37  (
41  );
42 }
43 }
44 
45 
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 
49 (
50  const word& name,
51  const dictionary& SBMFCoeffs,
52  const Time& runTime
53 )
54 :
55  solidBodyMotionFunction(name, SBMFCoeffs, runTime)
56 {
57  read(SBMFCoeffs);
58 }
59 
60 
61 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
62 
64 {}
65 
66 
67 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
68 
71 {
72  scalar t = time_.value();
73 
74  septernion TR = SBMFs_[0].transformation();
75 
76  for (label i = 1; i < SBMFs_.size(); i++)
77  {
78  TR *= SBMFs_[i].transformation();
79  }
80 
81  DebugInFunction << "Time = " << t << " transformation: " << TR << endl;
82 
83  return TR;
84 }
85 
86 
88 (
89  const dictionary& SBMFCoeffs
90 )
91 {
93 
94  label i = 0;
95  SBMFs_.setSize(SBMFCoeffs_.size());
96 
97  forAllConstIter(IDLList<entry>, SBMFCoeffs_, iter)
98  {
99  if (iter().isDict())
100  {
101  SBMFs_.set
102  (
103  i,
105  (
106  SBMFCoeffs,
107  time_,
108  iter().keyword()
109  )
110  );
111 
112  Info<< "Constructed SBMF " << i << " : "
113  << iter().keyword() << " of type "
114  << SBMFs_[i].type() << endl;
115 
116  i++;
117  }
118  }
119  SBMFs_.setSize(i);
120 
121  return true;
122 }
123 
124 
125 // ************************************************************************* //
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:492
Macros for easy insertion into run-time selection tables.
Template class for intrusive linked lists.
Definition: ILList.H:67
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Septernion class used to perform translations and rotations in 3D space.
Definition: septernion.H:66
Base class for defining solid-body motions.
virtual bool read(const dictionary &dict)=0
Update properties from given dictionary.
static autoPtr< solidBodyMotionFunction > New(const dictionary &SBMFCoeffs, const Time &runTime, const word &name="solidBodyMotionFunction")
Select constructed from the SBMFCoeffs dictionary and Time.
Combination of SolidBodyMotionFvMesh 6DoF motion functions.
Definition: multiMotion.H:55
multiMotion(const word &name, const dictionary &SBMFCoeffs, const Time &runTime)
Construct from components.
Definition: multiMotion.C:49
virtual septernion transformation() const
Return the solid-body motion transformation septernion.
Definition: multiMotion.C:70
virtual bool read(const dictionary &SBMFCoeffs)
Update properties from given dictionary.
Definition: multiMotion.C:88
A class for handling words, derived from string.
Definition: word.H:63
#define DebugInFunction
Report an information message using Foam::Info.
addToRunTimeSelectionTable(solidBodyMotionFunction, multiValveEnginePistonMotion, dictionary)
defineTypeNameAndDebug(multiValveEnginePistonMotion, 0)
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
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
messageStream Info
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.