momentOfInertia.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) 2011-2020 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::momentOfInertia
26 
27 Description
28  Calculates the inertia tensor and principal axes and moments of a
29  polyhedra/cells/triSurfaces. Inertia can either be of the solid body or
30  of a thin shell.
31 
32 SourceFiles
33  momentOfInertia.H
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef momentOfInertia_H
38 #define momentOfInertia_H
39 
40 #include "triFaceList.H"
41 #include "triSurface.H"
42 #include "polyMesh.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class momentOfInertia Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class momentOfInertia
54 {
55 
56 public:
57 
58  static void massPropertiesSolid
59  (
60  const pointField& pts,
61  const triFaceList& triFaces,
62  scalar density,
63  scalar& mass,
64  vector& cM,
65  tensor& J
66  );
67 
68  static void massPropertiesShell
69  (
70  const pointField& pts,
71  const triFaceList& triFaces,
72  scalar density,
73  scalar& mass,
74  vector& cM,
75  tensor& J
76  );
77 
78  static void massPropertiesSolid
79  (
80  const triSurface& surf,
81  scalar density,
82  scalar& mass,
83  vector& cM,
84  tensor& J
85  );
86 
87  static void massPropertiesShell
88  (
89  const triSurface& surf,
90  scalar density,
91  scalar& mass,
92  vector& cM,
93  tensor& J
94  );
95 
97  (
98  scalar mass,
99  const vector& cM,
100  const tensor& J,
101  const vector& refPt
102  );
103 
104  // Calculate the inertia tensor for all cells in the mesh
106  (
107  const polyMesh& mesh
108  );
109 
110  // Calculate the inertia tensor the given cell
111  static tensor meshInertia
112  (
113  const polyMesh& mesh,
114  label celli
115  );
116 };
117 
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 } // End namespace Foam
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 #endif
126 
127 // ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
Calculates the inertia tensor and principal axes and moments of a polyhedra/cells/triSurfaces....
static tensor applyParallelAxisTheorem(scalar mass, const vector &cM, const tensor &J, const vector &refPt)
static tmp< tensorField > meshInertia(const polyMesh &mesh)
static void massPropertiesShell(const pointField &pts, const triFaceList &triFaces, scalar density, scalar &mass, vector &cM, tensor &J)
static void massPropertiesSolid(const pointField &pts, const triFaceList &triFaces, scalar density, scalar &mass, vector &cM, tensor &J)
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A class for managing temporary objects.
Definition: tmp.H:55
Triangulated surface description with patch information.
Definition: triSurface.H:69
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