Skip to content
Snippets Groups Projects
  • Mark OLESEN's avatar
    97a42df7
    ENH: add VectorSpace trait tests and evaluations · 97a42df7
    Mark OLESEN authored
    - is_vectorspace :
      test existence and non-zero value of the Type 'rank' static variable
    
    - pTraits_rank :
      value of 'rank' static variable (if it exists), 0 otherwise
    
    - pTraits_nComponents :
      value of 'nComponents' static variable (if it exists), 1 otherwise
    
    - pTraits_has_zero :
      test for pTraits<T>::zero member, which probably means that it also
      has one, min, max members as well
    
    Note that these traits are usable with any classes. For example,
    
      - is_vectorspace<std::string>::value  ==> false
      - pTraits_nComponents<std::string>::value  ==> 1
      - pTraits<std::string>::nComponents  ==> fails to compile
    
      Thus also allows testing pTraits_rank<...>::value with items
      for which pTraits<...>::rank fails to compile.
    
      Eg, cyclicAMIPolyPatch::interpolate called by FaceCellWave with a
      wallPoint.
    
         pTraits<wallPoint>::rank ==> fails to compile
         is_vectorspace<wallPoint>::value ==> false
    
    GIT: relocate ListLoopM.H to src/OpenFOAM/fields/Fields (future isolation)
    97a42df7
    History
    ENH: add VectorSpace trait tests and evaluations
    Mark OLESEN authored
    - is_vectorspace :
      test existence and non-zero value of the Type 'rank' static variable
    
    - pTraits_rank :
      value of 'rank' static variable (if it exists), 0 otherwise
    
    - pTraits_nComponents :
      value of 'nComponents' static variable (if it exists), 1 otherwise
    
    - pTraits_has_zero :
      test for pTraits<T>::zero member, which probably means that it also
      has one, min, max members as well
    
    Note that these traits are usable with any classes. For example,
    
      - is_vectorspace<std::string>::value  ==> false
      - pTraits_nComponents<std::string>::value  ==> 1
      - pTraits<std::string>::nComponents  ==> fails to compile
    
      Thus also allows testing pTraits_rank<...>::value with items
      for which pTraits<...>::rank fails to compile.
    
      Eg, cyclicAMIPolyPatch::interpolate called by FaceCellWave with a
      wallPoint.
    
         pTraits<wallPoint>::rank ==> fails to compile
         is_vectorspace<wallPoint>::value ==> false
    
    GIT: relocate ListLoopM.H to src/OpenFOAM/fields/Fields (future isolation)
direction.H 2.49 KiB
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | www.openfoam.com
     \\/     M anipulation  |
-------------------------------------------------------------------------------
    Copyright (C) 2011-2016 OpenFOAM Foundation
    Copyright (C) 2020-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

Primitive
    direction

Description
    Direction is an 8-bit unsigned integer type used to represent
    Cartesian directions, components etc.

Note
    If a different typedef is used, "uint8.H" must be modified accordingly.

\*---------------------------------------------------------------------------*/

#ifndef Foam_primitives_direction_H
#define Foam_primitives_direction_H

#include <cstdint>
#include <iostream>

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

// Forward Declarations
class Istream;
class Ostream;

// Typedefs
typedef uint8_t direction;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

//- Read direction (uint8_t) from stream.
direction readDirection(Istream& is);

Istream& operator>>(Istream& is, direction& val);
Ostream& operator<<(Ostream& os, const direction val);

std::ostream& operator<<(std::ostream& os, const direction val);


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#include "pTraits.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //