80 const scalar r6 = 1.0/6.0;
81 const scalar r24 = 1.0/24.0;
82 const scalar r60 = 1.0/60.0;
83 const scalar r120 = 1.0/120.0;
90 const triFace& tri(triFaces[i]);
103 scalar tmp0, tmp1, tmp2;
105 scalar f1x, f2x, f3x, g0x, g1x, g2x;
107 tmp0 = v0.
x() + v1.
x();
109 tmp1 = v0.
x()*v0.
x();
110 tmp2 = tmp1 + v1.
x()*tmp0;
111 f2x = tmp2 + v2.
x()*f1x;
112 f3x = v0.
x()*tmp1 + v1.
x()*tmp2 + v2.
x()*f2x;
113 g0x = f2x + v0.
x()*(f1x + v0.
x());
114 g1x = f2x + v1.
x()*(f1x + v1.
x());
115 g2x = f2x + v2.
x()*(f1x + v2.
x());
117 scalar f1y, f2y, f3y, g0y, g1y, g2y;
119 tmp0 = v0.
y() + v1.
y();
121 tmp1 = v0.
y()*v0.
y();
122 tmp2 = tmp1 + v1.
y()*tmp0;
123 f2y = tmp2 + v2.
y()*f1y;
124 f3y = v0.
y()*tmp1 + v1.
y()*tmp2 + v2.
y()*f2y;
125 g0y = f2y + v0.
y()*(f1y + v0.
y());
126 g1y = f2y + v1.
y()*(f1y + v1.
y());
127 g2y = f2y + v2.
y()*(f1y + v2.
y());
129 scalar f1z, f2z, f3z, g0z, g1z, g2z;
131 tmp0 = v0.
z() + v1.
z();
133 tmp1 = v0.
z()*v0.
z();
134 tmp2 = tmp1 + v1.
z()*tmp0;
135 f2z = tmp2 + v2.
z()*f1z;
136 f3z = v0.
z()*tmp1 + v1.
z()*tmp2 + v2.
z()*f2z;
137 g0z = f2z + v0.
z()*(f1z + v0.
z());
138 g1z = f2z + v1.
z()*(f1z + v1.
z());
139 g2z = f2z + v2.
z()*(f1z + v2.
z());
142 integrals[0] +=
n.x()*f1x;
143 integrals[1] +=
n.x()*f2x;
144 integrals[2] +=
n.y()*f2y;
145 integrals[3] +=
n.z()*f2z;
146 integrals[4] +=
n.x()*f3x;
147 integrals[5] +=
n.y()*f3y;
148 integrals[6] +=
n.z()*f3z;
149 integrals[7] +=
n.x()*(v0.
y()*g0x + v1.
y()*g1x + v2.
y()*g2x);
150 integrals[8] +=
n.y()*(v0.
z()*g0y + v1.
z()*g1y + v2.
z()*g2y);
151 integrals[9] +=
n.z()*(v0.
x()*g0z + v1.
x()*g1z + v2.
x()*g2z);
161 integrals[7] *= r120;
162 integrals[8] *= r120;
163 integrals[9] *= r120;
169 cM =
vector(integrals[1], integrals[2], integrals[3])/mass;
172 J.
xx() = integrals[5] + integrals[6];
173 J.
xy() = -integrals[7];
174 J.
xz() = -integrals[9];
176 J.
yy() = integrals[4] + integrals[6];
177 J.
yz() = -integrals[8];
180 J.
zz() = integrals[4] + integrals[5];
183 J -= mass*((cM & cM)*
I - cM*cM);
212 const triFace& tri(triFaces[i]);
221 scalar triMag = t.
mag();
242 const triFace& tri(triFaces[i]);
249 ).inertia(cM, density);
275 massPropertiesSolid(surf.
points(), faces, density, mass, cM, J);
296 massPropertiesShell(surf.
points(), faces, density, mass, cM, J, doReduce);
315 const face&
f = pp[faceI];
321 for (label i = 1; i <
f.
size() - 1; i++)
330 massPropertiesShell(pp.
points(), triFaces, density, mass, cM, J, doReduce);
348 return J + mass*((d & d)*
I - d*d);
363 tf[cI] = meshInertia(
mesh, cI);
386 faces[cTI] = cellTets[cTI].faceTriIs(
mesh);
393 massPropertiesSolid(
mesh.
points(), faces, 1.0, m, cM, J);
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &list)
const Field< point_type > & points() const noexcept
Return reference to global points.
void size(const label n)
Older name for setAddressableSize.
const Cmpt & z() const
Access to the vector z component.
const Cmpt & y() const
Access to the vector y component.
const Cmpt & x() const
Access to the vector x component.
A face is a list of labels corresponding to mesh vertices.
static void massPropertiesShell(const pointField &pts, const triFaceList &triFaces, scalar density, scalar &mass, vector &cM, tensor &J, bool doReduce=false)
static tensor applyParallelAxisTheorem(scalar mass, const vector &cM, const tensor &J, const vector &refPt)
static tmp< tensorField > meshInertia(const polyMesh &mesh)
static void massPropertiesPatch(const polyPatch &pp, scalar density, scalar &mass, vector &cM, tensor &J, bool doReduce=false)
static void massPropertiesSolid(const pointField &pts, const triFaceList &triFaces, scalar density, scalar &mass, vector &cM, tensor &J)
static List< tetIndices > cellTetIndices(const polyMesh &mesh, label cI)
Return the tet decomposition of the given cell, see.
Mesh consisting of general polyhedral cells.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
label nCells() const noexcept
Number of mesh cells.
A class for managing temporary objects.
A triangular face using a FixedList of labels corresponding to mesh vertices.
Triangulated surface description with patch information.
A triangle primitive used to calculate face normals and swept volumes.
Point centre() const
Return centre (centroid)
scalar mag() const
Return scalar magnitude.
static const Identity< scalar > I
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
triangle< point, const point & > triPointRef
A triangle using referred points.
static constexpr const zero Zero
Global zero (0)
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
#define forAll(list, i)
Loop across all elements in list.