Commit Graph

46 Commits

Author SHA1 Message Date
Mark Olesen
eba7a485ba ENH: quaternion ROLL_PITCH_YAW and YAW_PITCH_ROLL aliases/lookups
COMP: define labelSphericalTensor::I

- remove spurious 'labelI' global constant (labelSphericalTensor::I)

STYLE: replace use of deprecated Tensor vectorComponent

STYLE: avoid bit-wise assignment of bool (VectorSpace compare ops)
2022-06-02 11:14:10 +02:00
Mark Olesen
8e6f2ca5de ENH: additional Field normalise method (#2444)
- for most field types this is a no-op, but for a field of floatVector
  or doubleVector (eg, vector and solveVector) it will normalise each
  element with divide-by-zero protection.

  More reliable and efficient than dividing a field by the mag of itself
  (even with VSMALL protection).
  Applied to FieldField and GeometricField as well.

  Eg,
      fld.normalise();
  vs.
      fld /= mag(fld) + VSMALL;

ENH: support optional tolerance for vector::normalise

- for cases where tolerances larger than ROOTVSMALL are preferable.
  Not currently available for the field method (a templating question).

ENH: vector::removeCollinear method

- when working with geometries it is frequently necessary to have a
  normal vector without any collinear components. The removeCollinear
  method provides for clearer, compacter code.

  Eg,
      vector edgeNorm = ...;

      const vector edgeDirn = e.unitVec(points());

      edgeNorm.removeCollinear(edgeDirn);
      edgeNorm.normalise();

  vs.
      vector edgeNorm = ...;

      const vector edgeDirn = e.unitVec(points());

      edgeNorm -= edgeDirn*(edgeDirn & edgeNorm);
      edgeNorm /= mag(edgeNorm);
2022-04-28 15:31:44 +02:00
Mark Olesen
9c85d40cc6 Merge remote-tracking branch 'origin/master' into develop 2020-01-31 16:53:36 +01:00
Mark Olesen
4ecc6ccfca ENH: declare generated methods for vector-space, primitives
- make read construct from Istream explicit

BUG: sph(const SymmTensor2D<Cmpt>&)

- had incorrect constant, but the 2D routines still need more attention
 (#1575)
2020-01-30 12:38:28 +00:00
Mark Olesen
e252ec46dc COMP: backport of updates for gcc-92 compilation 2020-01-28 16:09:18 +01:00
Andrew Heather
fdf8d10ab4 Merge commit 'e9219558d7' into develop-v1906 2019-12-05 11:47:19 +00:00
OpenFOAM bot
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
Mark Olesen
1d79c0452c ENH: additional contiguous traits (#1378)
- change contiguous from a series of global functions to separate
  templated traits classes:

    - is_contiguous
    - is_contiguous_label
    - is_contiguous_scalar

  The static constexpr 'value' and a constexpr conversion operator
  allow use in template expressions.  The change also makes it much
  easier to define general traits and to inherit from them.

  The is_contiguous_label and is_contiguous_scalar are special traits
  for handling data of homogeneous components of the respective types.
2019-07-29 11:36:30 +02:00
Andrew Heather
b0a1a3fd0b BUG: quaternion - corrected construction from rotation tensor. Fixes #1348 2019-07-24 09:37:38 +01:00
Mark Olesen
f7f08fce4b ENH: alternative Euler rotation orders for lumpedPointState (#1341) 2019-06-14 10:36:38 +02:00
Mark Olesen
dc32b20a5c ENH: add magType to pTraits and arithmetic primitives 2019-06-04 19:30:35 +02:00
Mark Olesen
6c8f6a2f50 ENH: support all 12 Euler rotation orders (#1292)
- adjust naming of quaternion 'rotationSequence' to be 'eulerOrder'
  to reflect its purpose.

- provide rotation matrices directly for these rotation orders in
  coordinateRotations::euler for case in which the rotation tensor
  is required but not a quaternion.
2019-05-10 11:20:21 +02:00
Mark Olesen
5f40a738d3 STYLE: adjust comments in quaternion
- make I/O operators global (non-member)
2019-04-26 10:27:53 +02:00
Mark Olesen
fe71bbd013 STYLE: use constexpr for pTraits rank 2019-04-04 17:40:06 +02:00
OpenFOAM bot
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
Mark Olesen
86ef9e86dc ENH: make treatment of stream allocators more uniform (issue #532)
- use allocator class to wrap the stream pointers instead of passing
  them into ISstream, OSstream and using a dynamic cast to delete
  then. This is especially important if we will have a bidirectional
  stream (can't delete twice!).

STYLE:

- file stream constructors with std::string (C++11)

- for rewind, explicit about in|out direction. This is not currently
  important, but avoids surprises with any future bidirectional access.

- combined string streams in StringStream.H header.
  Similar to <sstream> include that has both input and output string
  streams.
2017-07-17 15:14:38 +02:00
Mark Olesen
2af602c2f4 STYLE: for Istream/Ostream check() use FUNCTION_NAME in messages 2017-05-26 10:59:16 +02:00
Henry Weller
75c7b7b239 quaternion/septernion: Added multi- quaternion/septernion averaging
Using method based on
http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20070017872.pdf
but simplified for the case where the quaternions are similar.
2016-04-16 15:59:05 +01:00
Henry Weller
683cfb9d97 vector::zero -> Zero 2016-04-15 11:32:42 +01:00
Henry Weller
2d2ecf91dc quaternion: Added static member function to return a unit quaternion constructed from a vector
//- Return the unit quaternion (versor) from the given vector
    //  (w = sqrt(1 - |sqr(v)|))
    static inline quaternion unit(const vector& v);
2016-04-12 21:43:03 +01:00
Henry Weller
b4ebcd770f quaternion: Added generalized construction from and conversion to Euler-angles
The particular rotation sequence is specified via the enumeration:

    //- Euler-angle rotation sequence
    enum rotationSequence
    {
        ZYX, ZYZ, ZXY, ZXZ, YXZ, YXY, YZX, YZY, XYZ, XYX, XZY, XZX
    };

and provided as an argument to the constructor from Euler-angles

    //- Construct a quaternion given the three Euler angles:
    inline quaternion
    (
        const rotationSequence rs,
        const vector& angles
    );

and conversion to Euler-angles:

    //- Return a vector of euler angles corresponding to the
    //  specified rotation sequence
    inline vector eulerAngles(const rotationSequence rs) const;
2016-03-14 08:07:42 +00:00
Henry Weller
2027059b63 src/OpenFOAM: changed template rank type from int to Foam::direction
Foam::direction is an unsigned type which makes it easier for the
compiler to pickup and report errors in the instantiation of
VectorSpaces and associated types.
2016-03-09 10:10:28 +00:00
laurence
07cb342aeb Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev into feature/cvMesh
Conflicts:
	src/OpenFOAM/primitives/triad/triad.C
2013-01-28 15:17:48 +00:00
laurence
0686c5c9b9 BUG: static variable initialisation cannot depend on other static variables 2013-01-28 14:58:25 +00:00
laurence
78073fc13e ENH: quaternion slerp: Check for sign of dot product 2013-01-28 14:48:14 +00:00
laurence
986efe0a0a ENH: Add euler angle output to quaternion 2013-01-11 09:25:43 +00:00
laurence
e44ee6a4b0 ENH: quaternion: Add power and exp functions 2013-01-10 14:36:01 +00:00
Henry
ceae57bf01 Updated header 2012-07-19 17:55:52 +01:00
Henry
261ff062ae quaternion: added constructor from angle cosine and slerp 2012-07-19 17:55:43 +01:00
Henry
13f46fd889 quaternion: Added new "normalized" function which returns the normalized form of the argument 2012-07-13 10:24:47 +01:00
Henry
91ff5bcb92 Updated header 2012-07-12 13:57:43 +01:00
Henry
87e8e18cb6 quaternion: Correct constructor from angle and axis 2012-07-12 13:57:27 +01:00
Henry
3637370fab Merge branch 'master' of ssh://dm/home/dm4/OpenFOAM/OpenFOAM-dev 2012-07-09 12:35:38 +01:00
Henry
495f5eee74 Updated header 2012-07-09 12:34:37 +01:00
Henry
70f4d345ca quaternion: Adding members required by GeometricField 2012-07-09 12:34:03 +01:00
laurence
c030c5e40a ENH: Add rotation tensor constructor to quaternion class 2012-07-09 12:31:30 +01:00
Henry
c2dd153a14 Copyright transfered to the OpenFOAM Foundation 2011-08-14 12:17:30 +01:00
andy
eaef8d482b STYLE: Updated 1991 start copyright year to 2004 2011-01-14 16:08:00 +00:00
andy
099cc39e2e Revert "STYLE: 2011 copyright date."
This reverts commit b18f6cc1ce.
2011-01-05 18:24:29 +00:00
graham
b18f6cc1ce STYLE: 2011 copyright date. 2011-01-05 11:14:26 +00:00
graham
d79237597e STYLE: Fixing code style requirements for all src. 2010-07-28 13:31:46 +01:00
Mark Olesen
d29c438657 STYLE: use url for FSF license instead of postal address, switch to GPL v3 2010-03-29 14:07:56 +02:00
Mark Olesen
d5cbc3bf08 cosmetic cleanups
- grammar in comments, namespace qualifiers, etc.
2009-01-16 19:07:14 +01:00
Mark Olesen
28b200bcd9 update copyrights for 2009 2008-12-31 19:01:56 +01:00
Mark Olesen
02cabc3cf2 updated Copyright (C) \d+-2008 OpenCFD Ltd. 2008-06-25 15:01:46 +02:00
OpenFOAM-admin
3170c7c0c9 Creation of OpenFOAM-dev repository 15/04/2008 2008-04-15 18:56:58 +01:00