Commit Graph

42 Commits

Author SHA1 Message Date
mattijs
8d37a8dd2c COMP: g++11: suppress optimisation. See #3024 2024-01-19 21:00:52 +01:00
Andrew Heather
f8e4715e53 COMP: Gcc 11+ potential fix - see #2434 2022-06-24 15:31:58 +02:00
Kutalmis Bercin
6a53794e0a STYLE: reorder global funcs and opers in Tensor types
- In the course of time, global funcs/opers of Tensor types expanded
    leaving funcs/opers unordered.

  - Therefore, by following the order designated in Matrix class, the order
    of global funcs and global opers are reordered:
    - oper+ oper- oper* oper/ inner-product double-inner-product outer-product
2020-02-18 12:21:01 +00:00
Kutalmis Bercin
66b02ca5ca ENH: improve funcs and opers in Tensor types
- ensures each Tensor-container operates for the following base types:
    - floatScalar
    - doubleScalar
    - complex

  - adds/improves test applications for each container and base type:
    - constructors
    - member functions
    - global functions
    - global operators

  - misc:
    - silently removes `invariantIII()` for `tensor2D` and `symmTensor2D`
      since the 3rd invariant does not exist for 2x2 matrices
    - fixes `invariantII()` algorithm for `tensor2D` and `symmTensor2D`
    - adds `Cmpt` multiplication to `Vector2D` and `Vector`
    - adds missing access funcs for symmetric containers
    - improves func/header documentations
2020-02-18 12:21:01 +00: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
a400bfae21 ENH: add rows/cols setters to Tensor, Tensor2D
- also support transposed construction when given a set of vectors
2019-11-15 09:18:52 +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
b465592ee2 ENH: added access to get/set a Tensor diagonal 2019-10-10 10:44:29 +02:00
OpenFOAM bot
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
Mark Olesen
6697bb4735 ENH: improve, simplify, rationalize coordinate system handling (issue #863)
Previously the coordinate system functionality was split between
coordinateSystem and coordinateRotation. The coordinateRotation stored
the rotation tensor and handled all tensor transformations.

The functionality has now been revised and consolidated into the
coordinateSystem classes. The sole purpose of coordinateRotation
is now just to provide a selectable mechanism of how to define the
rotation tensor (eg, axis-angle, euler angles, local axes) for user
input, but after providing the appropriate rotation tensor it has
no further influence on the transformations.

--

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.

The new coordinateSystem and its derivates (cartesian, cylindrical,
indirect) now provide a uniform() method to define if the rotation
tensor is position dependent/independent.

The coordinateSystem transform and invTransform methods are now
available in two-parameter forms for obtaining position-dependent
rotation tensors. Eg,

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

In some cases it can be useful to use query uniform() to avoid
storage of redundant values.

      if (cs.uniform())
      {
          vector xx = cs.transform(someVector);
      }
      else
      {
          List<vector> xx = cs.transform(manyPoints, someVector);
      }

Support transform/invTransform for common data types:
   (scalar, vector, sphericalTensor, symmTensor, tensor).

====================
  Breaking Changes
====================

- These changes to coordinate systems and rotations may represent
  a breaking change for existing user coding.

- Relocating the rotation tensor into coordinateSystem itself means
  that the coordinate system 'R()' method now returns the rotation
  directly instead of the coordinateRotation. The method name 'R()'
  was chosen for consistency with other low-level entities (eg,
  quaternion).

  The following changes will be needed in coding:

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

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

  Accessing the runTime selectable coordinateRotation
  has moved to the rotation() method:

      Old:  Info<< "Rotation input: " << cs.R() << nl;
      New:  Info<< "Rotation input: " << cs.rotation() << nl;

- Naming consistency changes may also cause code to break.

      Old:  transformVector()
      New:  transformPrincipal()

  The old method name transformTensor() now simply becomes transform().

====================
  New methods
====================

For operations requiring caching of the coordinate rotations, the
'R()' method can be used with multiple input points:

       tensorField rots(cs.R(somePoints));

   and later

       Foam::transformList(rots, someVectors);

The rotation() method can also be used to change the rotation tensor
via a new coordinateRotation definition (issue #879).

The new methods transformPoint/invTransformPoint provide
transformations with an origin offset using Cartesian for both local
and global points. These can be used to determine the local position
based on the origin/rotation without interpreting it as a r-theta-z
value, for example.

================
  Input format
================

- Streamline dictionary input requirements

  * The default type is cartesian.
  * The default rotation type is the commonly used axes rotation
    specification (with e1/e2/3), which is assumed if the 'rotation'
    sub-dictionary does not exist.

    Example,

    Compact specification:

        coordinateSystem
        {
            origin  (0 0 0);
            e2      (0 1 0);
            e3      (0.5 0 0.866025);
        }

    Full specification (also accepts the longer 'coordinateRotation'
    sub-dictionary name):

        coordinateSystem
        {
            type    cartesian;
            origin  (0 0 0);

            rotation
            {
                type    axes;
                e2      (0 1 0);
                e3      (0.5 0 0.866025);
            }
        }

   This simplifies the input for many cases.

- Additional rotation specification 'none' (an identity rotation):

      coordinateSystem
      {
          origin  (0 0 0);
          rotation { type none; }
      }

- Additional rotation specification 'axisAngle', which is similar
  to the -rotate-angle option for transforming points (issue #660).
  For some cases this can be more intuitive.

  For example,

      rotation
      {
          type    axisAngle;
          axis    (0 1 0);
          angle   30;
      }
  vs.
      rotation
      {
          type    axes;
          e2      (0 1 0);
          e3      (0.5 0 0.866025);
      }

- shorter names (or older longer names) for the coordinate rotation
  specification.

     euler         EulerRotation
     starcd        STARCDRotation
     axes          axesRotation

================
  Coding Style
================
- use Foam::coordSystem namespace for categories of coordinate systems
  (cartesian, cylindrical, indirect). This reduces potential name
  clashes and makes a clearer declaration. Eg,

      coordSystem::cartesian csys_;

  The older names (eg, cartesianCS, etc) remain available via typedefs.

- added coordinateRotations namespace for better organization and
  reduce potential name clashes.
2018-10-01 13:54:10 +02:00
Mark Olesen
4a61042f3f ENH: add column access and other methods for Tensor
- Can now retrieve or set a column/row of a tensor.
  Either compile-time or run-time checks.

  Get
     t.col<1>();   t.col(1);
     t.row<1>();   t.row(1);

  Set
     t.col<1>(vec);   t.col(1,vec);
     t.row<1>(vec);   t.row(1,vec);

  The templated versions are compile-time checked

     t.col<3>();
     t.col<3>(vec);

  The parameter versions are run-time checked

     t.col(3);
     t.col(3,vec);

ENH: provide named access to tensor/tensor inner product as inner()
2018-09-28 11:20:31 +02:00
Andrew Heather
0f6f3e3c90 COMP: TensorI.H - provide default case to suppress compiler warning 2016-06-28 16:53:21 +01:00
Henry Weller
9d0f4997d3 Tensor, SymmTensor: Simplified invariantII
Now the calculation of the 2nd-invariant is more efficient and
accumulates less round-off error.
2016-04-21 21:07:39 +01:00
Henry Weller
e7ef7ed4e6 src/OpenFOAM/primitives: inherit operator=(const Foam::zero) from base class where appropriate 2016-04-17 21:02:57 +01:00
Henry Weller
e6e687b67d VectorSpaces and MatrixSpaces: Added construction from and assignment to zero 2016-03-22 08:25:50 +00:00
Henry Weller
c14ee0ade1 MatrixSpace: 2D (i-j) specialization of VectorSpace
Provides '(i, j)' element access and general forms of inner and outer
products, transpose etc. for square and rectangular VectorSpaces.

VectorSpaces default to be column-vectors as before whereas row-vectors
may be represented as 1xn MatrixSpaces.  In the future it may be
preferable to create a specializations of VectorSpace for column- and
maybe row-vectors but it would add complexity to MatrixSpace to handle
all the type combinations.

Tensor is now a 3x3 specialization of MatrixSpace.

Sub-block const and non-const access is provided via the
'.block<SubTensor, RowStart, ColStart>()' member functions.  Consistent
sub-block access is also provide for VectorSpace so that columns of
MatrixSpaces may be accessed and substituted.

These new classes will be used to create a more extensive set of
primitive vector and tensor types over the next few weeks.

Henry G. Weller
CFD Direct
2016-03-12 10:41:18 +00:00
Henry Weller
93285d5fe1 src/OpenFOAM/primitives: Moved the standard static data members for vector and tensor types into VectorSpace
This simplifies the code easing maintenance and the addition of other
VectorSpace types.
2016-03-08 10:57:41 +00:00
Henry Weller
d62351f53c Tensor: Added inv() member function 2016-03-07 15:25:27 +00:00
Henry Weller
e7bac07e14 Tensor: Added operator&= 2016-03-06 19:05:14 +00:00
Henry Weller
56fa7c0906 Update code to use the simpler C++11 template syntax removing spaces between closing ">"s 2016-01-10 22:41:16 +00:00
andy
27599ec536 ENH: Updated comment 2013-11-18 13:59:18 +00:00
mattijs
f35a8798d8 ENH: Tensor: access for vector component 2013-07-18 13:05:34 +01:00
Henry
74e16d7729 Reformat "template <..." to template<"
Add support for constructing VectorSpaces from forms with lower component type,
e.g. Vector<scalar> from Vector<label>
2013-02-21 15:07:50 +00:00
Henry
944b8d438b Reformat "template <..." to template<"
Add support for constructing VectorSpaces from forms with lower component type,
e.g. Vector<scalar> from Vector<label>
2013-02-21 15:07:09 +00:00
laurence
9989b015a6 COMP/ENH: Update assignments to constructors to compile with clang. Add tensor->triad conversion. 2012-12-24 15:36:50 +00:00
Henry
a78a46e7c2 symmTensor: Corrected symmTensor & symmTensor dot-product 2011-12-28 17:46:51 +00: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
ebb9a9e1ac ENH: tet decomposed particle tracking.
Squashed merge of particleInteractions up to
commit e7cb5bcf0315c359539ef1e715e1d51991343391
2010-09-17 16:59:17 +01:00
mattijs
69526c6c1c BUG: various reinterpret_cast to enable strict-aliasing 2010-08-19 15:44:17 +01: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
Henry Weller
3345fd8378 Removed support for cint. 2009-06-22 21:03:57 +01:00
Mark Olesen
48247a3d62 consistency update
- DynamicList gets append methods as per List
- misc cosmetic changes
2009-04-27 10:08:29 +02:00
Mark Olesen
28b200bcd9 update copyrights for 2009 2008-12-31 19:01:56 +01:00
henry
a622a9a0ec Changed the function name "cofactors" to "cof" and propagated the function
through the field algebra.
2008-11-14 16:02:47 +00:00
Mark Olesen
02cabc3cf2 updated Copyright (C) \d+-2008 OpenCFD Ltd. 2008-06-25 15:01:46 +02:00
henry
d2a0363d64 Bug-fix: http://openfoam.cfd-online.com/cgi-bin/forum/show.cgi?126/8030 2008-06-13 20:13:25 +01:00
OpenFOAM-admin
3170c7c0c9 Creation of OpenFOAM-dev repository 15/04/2008 2008-04-15 18:56:58 +01:00