Go to the documentation of this file.
48 int main(
int argc,
char *argv[])
54 "cell to use for inertia calculation, defaults to 0"
68 pts[0] =
point(4.495, 3.717, -4.112);
69 pts[1] =
point(4.421, 3.932, -4.112);
70 pts[2] =
point(4.379, 4.053, -4.112);
71 pts[3] =
point(4.301, 4.026, -4.300);
72 pts[4] =
point(4.294, 4.024, -4.317);
73 pts[5] =
point(4.409, 3.687, -4.317);
81 J =
f.inertia(pts, Cf, density);
87 Info<<
nl <<
"Inertia tensor of test face " << J <<
nl
88 <<
"eigenValues (principal moments) " << eVal <<
nl
89 <<
"eigenVectors (principal axes) " << eVec
92 OFstream str(
"momentOfInertiaTestFace.obj");
94 Info<<
nl <<
"Writing test face and scaled principal axes to "
106 str <<
' ' << fI + 1;
118 for (
label i = nPts + 1; i < nPts + 4; i++)
120 str <<
"l " << nPts + 1 <<
' ' << i + 1 <<
endl;
129 pts[0] =
point(0, 0, 0);
130 pts[1] =
point(1, 0, 0);
131 pts[2] =
point(0.5, 1, 0);
132 pts[3] =
point(0.5, 0.5, 1);
138 tetFaces[0] =
triFace(0, 2, 1);
139 tetFaces[1] =
triFace(1, 2, 3);
140 tetFaces[2] =
triFace(0, 3, 2);
141 tetFaces[3] =
triFace(0, 1, 3);
154 <<
"Mass of tetrahedron " << m <<
nl
155 <<
"Centre of mass of tetrahedron " << cM <<
nl
156 <<
"Inertia tensor of tetrahedron " << J <<
nl
157 <<
"eigenValues (principal moments) " << eVal <<
nl
158 <<
"eigenVectors (principal axes) " << eVec
161 OFstream str(
"momentOfInertiaTestTet.obj");
163 Info<<
nl <<
"Writing test tetrahedron and scaled principal axes to "
179 str <<
' ' <<
f[fI] + 1;
182 str <<
' ' <<
f[0] + 1 <<
endl;
192 for (
label i = nPts + 1; i < nPts + 4; i++)
194 str <<
"l " << nPts + 1 <<
' ' << i + 1 <<
endl;
208 <<
"Inertia tensor of cell " << cellI <<
" " << J <<
nl
209 <<
"eigenValues (principal moments) " << eVal <<
endl;
215 Info<<
"eigenVectors (principal axes, from normalised inertia) " << eVec
220 Info<<
nl <<
"Writing scaled principal axes of cell " << cellI <<
" to "
236 for (
label i = 1; i < 4; i++)
238 str <<
"l " << 1 <<
' ' << i + 1 <<
endl;
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
#define forAll(list, i)
Loop across all elements in list.
dimensionedTensor eigenVectors(const dimensionedTensor &dt)
const cellList & cells() const
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Cmpt & component(const direction) const
static tmp< tensorField > meshInertia(const polyMesh &mesh)
dimensioned< scalar > mag(const dimensioned< Type > &)
static void massPropertiesSolid(const pointField &pts, const triFaceList &triFaces, scalar density, scalar &mass, vector &cM, tensor &J)
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
label findMin(const ListType &, const label start=0)
Find index of min element (and less than given element).
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
dimensionedVector eigenValues(const dimensionedTensor &dt)
T optionLookupOrDefault(const word &opt, const T &deflt) const
Read a value from the named option if present.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
const vectorField & cellCentres() const
A triangular face using a FixedList of labels corresponding to mesh vertices.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const vectorField & faceCentres() const
A face is a list of labels corresponding to mesh vertices.
int main(int argc, char *argv[])
Various functions to operate on Lists.
const fileName & name() const
Return the name of the stream.
vector point
Point is a vector.
Foam::argList args(argc, argv)
word name(const complex &)
Return a string representation of a complex.