MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / rotationTensor

Function rotationTensor

src/OpenFOAM/primitives/transform/transform.H:46–77  ·  view source on GitHub ↗

- Rotational transformation tensor from vector n1 to n2

Source from the content-addressed store, hash-verified

44
45//- Rotational transformation tensor from vector n1 to n2
46inline tensor rotationTensor
47(
48 const vector& n1,
49 const vector& n2
50)
51{
52 const scalar s = n1 & n2;
53 const vector n3 = n1 ^ n2;
54 const scalar magSqrN3 = magSqr(n3);
55
56 // n1 and n2 define a plane n3
57 if (magSqrN3 > SMALL)
58 {
59 // Return rotational transformation tensor in the n3-plane
60 return
61 s*I
62 + (1 - s)*sqr(n3)/magSqrN3
63 + (n2*n1 - n1*n2);
64 }
65 // n1 and n2 are contradirectional
66 else if (s < 0)
67 {
68 // Return mirror transformation tensor
69 return I + 2*n1*n2;
70 }
71 // n1 and n2 are codirectional
72 else
73 {
74 // Return null transformation tensor
75 return I;
76 }
77}
78
79
80//- Rotational transformation tensor about the x-axis by omega radians

Callers 9

mainFunction · 0.85
mainFunction · 0.85
calcCurvatureFunction · 0.85
constantPropertiesMethod · 0.85
calcGeometryFunction · 0.85
calcTransformTensorsFunction · 0.85
restrainFunction · 0.85
restrainFunction · 0.85
restrainFunction · 0.85

Calls 2

magSqrFunction · 0.50
sqrFunction · 0.50

Tested by

no test coverage detected