Skip to content
Snippets Groups Projects
Commit 065a2089 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

ENH: consolidation of coordinate systems and coordinate rotations (issue #863)

The sole purpose of the coordinateRotation class is now simply to
specify a rotation tensor in a consistent and convenient form (eg, two
axes, axis-angle, Euler angles etc) with in a runTime-selectable
mechanism. All transformations methods have been removed from
coordinateRotation entirely.

The coordinateSystem class now contains an origin and a base rotation
tensor directly and various transformation methods.

  - The origin represents the "shift" for a local coordinate system.

  - The base rotation tensor represents the "tilt" or orientation
    of the local coordinate system in general (eg, for mapping
    positions), but may require position-dependent tensors when
    transforming vectors and tensors.

For some coordinate systems (currently the cylindrical coordinate system),
the rotation tensor required for rotating a vector or tensor is
position-dependent. This additional layer of complexity was previously
hidden in the cylindrical rotation, but was too inflexible and fragile.

The new coordinateSystem and its derivates (cartesian, cylindrical,
indirect) now provide a uniform() method to define if the rotation
tensor position independent or not.
Additional position-dependent transform methods are now supported with
the positions either being given as an additional parameter.

STYLE: provide a dedicated Foam::coordSystem namespace for categories
of coordinate systems (cartesian, cylindrical, indirect)

GENERAL NOTE:
- These changes to coordinate systems and rotations may represent
  a breaking change for existing user coding.
  The coordinate system 'R()' method now returns the rotation directly
  instead of the coordinateRotation.

      Old:  tensor rot = cs.R().R();
      New:  tensor rot = cs.R();

      Old:  cs.R().transform(...);
      New:  cs.transform(...);

  In some cases when cylindrical coordinates are permissible,
  position-dependent transformations may be required. Eg,

      ... = cs.transform(globalPt, someVector);

  Or even

      if (cs.uniform())
      {
          ... = cs.transform(someVector);
      }
      else
      {
          ... = cs.transform(globalPt, someVector);
      }

For operations requiring caching of the coordinate rotations:

   tensorField rots(cs.R(somePoints));

   and later

   Foam::transformList(rots, someVectors);

- harmonized naming of transformations.

     renamed  transformTensor -> transform
     renamed  transformVector -> transformPrincipal

- transformPoint and invTransformPoint provide transformations with an
  origin offset using Cartesian for both local and global points.

- support transform/invTransform for common data types
  (scalar, vector, sphericalTensor, symmTensor, tensor).
parent 38fe1991
No related merge requests found
Showing
with 136 additions and 187 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment