momentOfInertia.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::momentOfInertia
28 
29 Description
30  Calculates the inertia tensor and principal axes and moments of a
31  polyhedra/cells/triSurfaces. Inertia can either be of the solid body or
32  of a thin shell.
33 
34  References:
35  \verbatim
36  "Fast and Accurate Computation of Polyhedral Mass Properties",
37  Brian Mirtich,
38  Journal of Graphics Tools, Volume 1, Number 2, 1996.
39  \endverbatim
40 
41  https://people.eecs.berkeley.edu/~jfc/mirtich/massProps.html
42  https://people.eecs.berkeley.edu/~jfc/mirtich/papers/volInt.ps.gz
43  https://people.eecs.berkeley.edu/~jfc/mirtich/code/volumeIntegration.tar
44 
45 SourceFiles
46  momentOfInertia.H
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef momentOfInertia_H
51 #define momentOfInertia_H
52 
53 #include "triFaceList.H"
54 #include "triSurface.H"
55 #include "polyMesh.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 
62 /*---------------------------------------------------------------------------*\
63  Class momentOfInertia Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class momentOfInertia
67 {
68 
69 public:
70 
71  static void massPropertiesSolid
72  (
73  const pointField& pts,
74  const triFaceList& triFaces,
75  scalar density,
76  scalar& mass,
77  vector& cM,
78  tensor& J
79  );
80 
81  static void massPropertiesShell
82  (
83  const pointField& pts,
84  const triFaceList& triFaces,
85  scalar density,
86  scalar& mass,
87  vector& cM,
88  tensor& J,
89  bool doReduce = false
90  );
91 
92  static void massPropertiesSolid
93  (
94  const triSurface& surf,
95  scalar density,
96  scalar& mass,
97  vector& cM,
98  tensor& J
99  );
100 
101  static void massPropertiesShell
102  (
103  const triSurface& surf,
104  scalar density,
105  scalar& mass,
106  vector& cM,
107  tensor& J,
108  bool doReduce = false
109  );
110 
111  static void massPropertiesPatch
112  (
113  const polyPatch& pp,
114  scalar density,
115  scalar& mass,
116  vector& cM,
117  tensor& J,
118  bool doReduce = false
119  );
120 
122  (
123  scalar mass,
124  const vector& cM,
125  const tensor& J,
126  const vector& refPt
127  );
128 
129  // Calculate the inertia tensor for all cells in the mesh
131  (
132  const polyMesh& mesh
133  );
134 
135  // Calculate the inertia tensor the given cell
136  static tensor meshInertia
137  (
138  const polyMesh& mesh,
139  label celli
140  );
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #endif
151 
152 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::momentOfInertia::massPropertiesPatch
static void massPropertiesPatch(const polyPatch &pp, scalar density, scalar &mass, vector &cM, tensor &J, bool doReduce=false)
Definition: momentOfInertia.C:301
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::momentOfInertia::meshInertia
static tmp< tensorField > meshInertia(const polyMesh &mesh)
Definition: momentOfInertia.C:353
triSurface.H
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::momentOfInertia::massPropertiesSolid
static void massPropertiesSolid(const pointField &pts, const triFaceList &triFaces, scalar density, scalar &mass, vector &cM, tensor &J)
Definition: momentOfInertia.C:35
Foam::Field< vector >
Foam::triSurface
Triangulated surface description with patch information.
Definition: triSurface.H:76
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:67
Foam::momentOfInertia::applyParallelAxisTheorem
static tensor applyParallelAxisTheorem(scalar mass, const vector &cM, const tensor &J, const vector &refPt)
Definition: momentOfInertia.C:335
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::momentOfInertia
Calculates the inertia tensor and principal axes and moments of a polyhedra/cells/triSurfaces....
Definition: momentOfInertia.H:65
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:102
triFaceList.H
Foam::momentOfInertia::massPropertiesShell
static void massPropertiesShell(const pointField &pts, const triFaceList &triFaces, scalar density, scalar &mass, vector &cM, tensor &J, bool doReduce=false)
Definition: momentOfInertia.C:192