pointMasses.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-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 Class
25  Foam::RBD::pointMasses
26 
27 Description
28  Specialisation of rigidBody to construct a pointMasses given the mass and
29  lengths of the sides.
30 
31 SourceFiles
32  pointMassesI.H
33  pointMasses.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef RBD_pointMasses_H
38 #define RBD_pointMasses_H
39 
40 #include "rigidBody.H"
41 #include "TableReader.H"
42 #include "pointField.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 namespace RBD
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class pointMasses Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class pointMasses
56 :
57  public rigidBody
58 {
59  // Private Data
60 
61  //- Table reader
63 
64  //- Points
65  pointField points_;
66 
67  //- Masses
68  scalarField masses_;
69 
70  //- Indices of the points when sorted in the three axes
71  mutable PtrList<labelList> sortedPointis_;
72 
73 
74  // Private Member Functions
75 
76  //- Return the n-th moments of the sections of the body between
77  // planes defined by distances along the given axis
78  template<class Type, class Op>
79  tmp<Field<Type>> sectionMuNs
80  (
81  const direction axis,
82  const scalarField& distances,
83  const Op& op
84  ) const;
85 
86 
87 public:
88 
89  //- Runtime type information
90  TypeName("pointMasses");
91 
92 
93  // Constructors
94 
95  //- Construct from dictionary
97  (
98  const word& name,
99  const dictionary& dict
100  );
101 
102  //- Copy construct
103  pointMasses(const pointMasses&);
104 
105  //- Return clone of this pointMasses
106  virtual autoPtr<rigidBody> clone() const;
107 
108 
109  //- Destructor
110  virtual ~pointMasses();
111 
112 
113  // Member Functions
114 
115  //- Return the zeroth moments of the sections of the body between
116  // planes defined by distances along the given axis
118  (
119  const direction axis,
120  const scalarField& distances
121  ) const;
122 
123  //- Return the first moments of the sections of the body between
124  // planes defined by distances along the given axis
126  (
127  const direction axis,
128  const scalarField& distances
129  ) const;
130 
131  //- Return the second moments of the sections of the body between
132  // planes defined by distances along the given axis
134  (
135  const direction axis,
136  const scalarField& distances
137  ) const;
138 
139  //- Write
140  virtual void write(Ostream&) const;
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace RBD
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #endif
152 
153 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
Specialisation of rigidBody to construct a pointMasses given the mass and lengths of the sides.
Definition: pointMasses.H:57
virtual tmp< vectorField > sectionMu1s(const direction axis, const scalarField &distances) const
Return the first moments of the sections of the body between.
Definition: pointMasses.C:218
virtual void write(Ostream &) const
Write.
Definition: pointMasses.C:249
virtual tmp< symmTensorField > sectionMu2s(const direction axis, const scalarField &distances) const
Return the second moments of the sections of the body between.
Definition: pointMasses.C:234
TypeName("pointMasses")
Runtime type information.
virtual autoPtr< rigidBody > clone() const
Return clone of this pointMasses.
Definition: pointMasses.C:187
pointMasses(const word &name, const dictionary &dict)
Construct from dictionary.
Definition: pointMasses.C:107
virtual tmp< scalarField > sectionMu0s(const direction axis, const scalarField &distances) const
Return the zeroth moments of the sections of the body between.
Definition: pointMasses.C:202
virtual ~pointMasses()
Destructor.
Definition: pointMasses.C:195
const word & name() const
Return name.
Definition: rigidBodyI.H:65
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
uint8_t direction
Definition: direction.H:45
#define Op(opName, op)
Definition: ops.H:100
dictionary dict