1. 06 Feb, 2019 3 commits
  2. 23 Jan, 2019 1 commit
  3. 18 Jan, 2019 1 commit
  4. 09 Jan, 2019 1 commit
  5. 07 Jan, 2019 2 commits
  6. 03 Jan, 2019 1 commit
    • Mark Olesen's avatar
      ENH: additional read guards for dimensionedType. input consistency (#762, #1148) · 6a448016
      Mark Olesen authored
      - provide a lookupOrDefault constructor form, since this is a fairly
        commonly used requirement and simplifies the calling sequence.
      
        Before
      
            dimensionedScalar rhoMax
            (
                dimensionedScalar::lookupOrDefault
                (
                    "rhoMax",
                    pimple.dict(),
                    dimDensity,
                    GREAT
                )
           );
      
        After
      
            dimensionedScalar rhoMax("rhoMax", dimDensity, GREAT, pimple.dict());
      
      - read, readIfPresent methods with alternative lookup names.
      
      - Mark the Istream related constructors with compile-time deprecated
        warnings.
      
      BUG: read, readIfPresent methods not handling optional dimensions (#1148)
      6a448016
  7. 02 Jan, 2019 1 commit
  8. 11 Dec, 2018 1 commit
    • Mark Olesen's avatar
      ENH: use Zero when zero-initializing types · 1d85fecf
      Mark Olesen authored
      - makes the intent clearer and avoids the need for additional
        constructor casting. Eg,
      
            labelList(10, Zero)    vs.  labelList(10, 0)
            scalarField(10, Zero)  vs.  scalarField(10, scalar(0))
            vectorField(10, Zero)  vs.  vectorField(10, vector::zero)
      1d85fecf
  9. 21 Dec, 2018 1 commit
  10. 26 Nov, 2018 1 commit
  11. 14 Nov, 2018 1 commit
  12. 20 Nov, 2018 1 commit
    • Mark Olesen's avatar
      ENH: add read guard for dimensionedType constructors (#762) · dd87c983
      Mark Olesen authored
      - deprecate dimensionedType constructors using an Istream in favour of
        versions accepting a keyword and a dictionary.
      
        Dictionary entries are almost the exclusive means of read
        constructing a dimensionedType. By construct from the dictionary
        entry instead of doing a lookup() first, we can detect possible
        input errors such as too many tokens as a result of a input syntax
        error.
      
        Constructing a dimensionedType from a dictionary entry now has
        two forms.
      
        1.  dimensionedType(key, dims, dict);
      
            This is the constructor that will normally be used.
      
            It accepts entries with optional leading names and/or
            dimensions. If the entry contains dimensions, they are
            verified against the expected dimensions and an IOError is
            raised if they do not correspond. On conclusion, checks the
            token stream for any trailing rubbish.
      
        2.  dimensionedType(key, dict);
      
            This constructor is used less frequently.
      
            ...
      dd87c983
  13. 08 Oct, 2018 1 commit
  14. 06 Nov, 2018 1 commit
  15. 05 Nov, 2018 1 commit
    • Mark Olesen's avatar
      ENH: extend globalIndex toGlobal methods · f5baa9a5
      Mark Olesen authored
      - now applicable to labelLists.
      
      Note:
        in some situations it will be more efficient to use
        Foam::identity() directly. Eg,
      
           globalIndex globalCells(mesh.nCells());
           ...
           labelList cellIds
           (
               identity(globalCells.localSize(), globalCells.localStart())
           );
      f5baa9a5
  16. 03 Nov, 2018 1 commit
  17. 19 Oct, 2018 2 commits
  18. 18 Oct, 2018 2 commits
    • Mark Olesen's avatar
    • Mark Olesen's avatar
      ENH: cleanup of Enum class · 3b745122
      Mark Olesen authored
      - more dictionary-like methods, enforce keyType::LITERAL for all
        lookups to avoid any spurious keyword matching.
      
      - new readEntry, readIfPresent methods
      
      - The get() method replaces the now deprecate lookup() method.
      
      - Deprecate lookupOrFailsafe()
        Failsafe behaviour is now an optional parameter for lookupOrDefault,
        which makes it easier to tailor behaviour at runtime.
      
      - output of the names is now always flatted without line-breaks.
        Thus,
      
           os << flatOutput(someEnumNames.names()) << nl;
           os << someEnumNames << nl;
      
        both generate the same output.
      
      - Constructor now uses C-string (const char*) directly instead of
        Foam::word in its initializer_list.
      
      - Remove special enum + initializer_list constructor form since
        it can create unbounded lookup indices.
      
      - Removd old hasEnum, hasName forms that were provided during initial
        transition from NamedEnum.
      
      - Added static_assert on Enum contents to restrict to enum or
        integral values.  Should not likely be using this class to enumerate
        other things since it internally uses an 'int' for its values.
      
        Changed volumeType accordingly to enumerate on its type (enum),
        not the class itself.
      3b745122
  19. 17 Oct, 2018 1 commit
    • Mark Olesen's avatar
      ENH: simplify objectRegistry access names (issue #322) · 8fabc325
      Mark Olesen authored
        New name:  findObject(), cfindObject()
        Old name:  lookupObjectPtr()
      
            Return a const pointer or nullptr on failure.
      
        New name:  findObject()
        Old name:  --
      
            Return a non-const pointer or nullptr on failure.
      
        New name:  getObjectPtr()
        Old name:  lookupObjectRefPtr()
      
            Return a non-const pointer or nullptr on failure.
            Can be called on a const object and it will perform a
            const_cast.
      
      - use these updated names and functionality in more places
      
      NB: The older methods names are deprecated, but continue to be defined.
      8fabc325
  20. 12 Oct, 2018 1 commit
    • Mark Olesen's avatar
      ENH: avoid readScalar, readLabel etc from dictionary (#762, #1033) · 8eddcc07
      Mark Olesen authored
      - use the dictionary 'get' methods instead of readScalar for
        additional checking
      
           Unchecked:  readScalar(dict.lookup("key"));
           Checked:    dict.get<scalar>("key");
      
      - In templated classes that also inherit from a dictionary, an additional
        'template' keyword will be required. Eg,
      
           this->coeffsDict().template get<scalar>("key");
      
        For this common use case, the predefined getXXX shortcuts may be
        useful. Eg,
      
           this->coeffsDict().getScalar("key");
      8eddcc07
  21. 08 Oct, 2018 1 commit
  22. 01 Oct, 2018 1 commit
    • Mark Olesen's avatar
      ENH: improve, simplify, rationalize coordinate system handling (issue #863) · 6697bb47
      Mark Olesen authored
      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.
      6697bb47
  23. 27 Sep, 2018 1 commit
    • Mark Olesen's avatar
      STYLE: add nBoundaryFaces() method to primitiveMesh · 64c3e484
      Mark Olesen authored
      - nBoundaryFaces() is often used and is identical to
        (nFaces() - nInternalFaces()).
      
      - forward the mesh nInternalFaces() and nBoundaryFaces() to
        polyBoundaryMesh as nFaces() and start() respectively,
        for use when operating on a polyBoundaryMesh.
      
      STYLE:
      
      - use identity() function with starting offset when creating boundary maps.
      
           labelList map
           (
               identity(mesh.nBoundaryFaces(), mesh.nInternalFaces())
           );
      
        vs.
      
           labelList map(mesh.nBoundaryFaces());
           forAll(map, i)
           {
               map[i] = mesh.nInternalFaces() + i;
           }
      64c3e484
  24. 03 Aug, 2018 1 commit
    • Mark Olesen's avatar
      ENH: added ZoneMesh indices(), selection() with wordRes matcher · 84e2df49
      Mark Olesen authored
      - rationalized code dealing with extraction of name or indices from
        coordinateSystems, polyBoundaryMesh, faBoundaryMesh, fvBoundaryMesh,
        ZoneMesh to use internal implementations that allow direct
        searching/matching without building an intermediate list of names.
      
      - simpler and more efficient handling of patch group matching.
      84e2df49
  25. 27 Jul, 2018 1 commit
  26. 05 Oct, 2018 1 commit
    • Mark Olesen's avatar
      ENH: use dictionary::readEntry for detection of input errors (#762, #1033) · 13778f76
      Mark Olesen authored
      - instead of   dict.lookup(name) >> val;
        can use      dict.readEntry(name, val);
      
        for checking of input token sizes.
        This helps catch certain types of input errors:
      
        {
      
            key1 ;                // <- Missing value
            key2 1234             // <- Missing ';' terminator
            key3 val;
        }
      
      STYLE: readIfPresent() instead of 'if found ...' in a few more places.
      13778f76
  27. 26 Jun, 2018 1 commit
  28. 25 Jun, 2018 2 commits
  29. 10 Aug, 2018 1 commit
  30. 22 Jun, 2018 1 commit
  31. 20 Jun, 2018 1 commit
  32. 15 Jun, 2018 1 commit
  33. 04 Jun, 2018 1 commit
  34. 01 Jun, 2018 1 commit
    • Mark Olesen's avatar
      STYLE: reduced usage of Switch · 84b10921
      Mark Olesen authored
      - Since 'bool' and 'Switch' use the _identical_ input mechanism
        (ie, both accept true/false, on/off, yes/no, none, 1/0), the main
        reason to prefer one or the other is the output.
      
        The output for Switch is as text (eg, "true"), whereas for bool
        it is label (0 or 1). If the output is required for a dictionary,
        Switch may be appropriate. If the output is not required, or is only
        used for Pstream exchange, bool can be more appropriate.
      84b10921