/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2026 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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 .
Namespace
Foam::cutPoly
Description
Functions and classes for extracting values from cut edges, faces and cells
SourceFiles
cutPolyValueI.H
cutPolyValueTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef cutPolyValue_H
#define cutPolyValue_H
#include "cutPoly.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace cutPoly
{
//- Get the local coordinate within an edge, given end point values and an
// iso-value
inline scalar edgeCutLambda
(
const edge& e,
const scalarField& pAlphas,
const scalar isoAlpha
);
//- Linearly interpolate a value from the end points to the cut point of an
// edge, given a local coordinate within the edge
template
Type edgeCutValue
(
const edge& e,
const scalar lambda,
const Field& pPsis
);
//- Linearly interpolate a value from the end points to the cut point of an
// edge, given end point values and an iso-value
template
Type edgeCutValue
(
const edge& e,
const scalarField& pAlphas,
const scalar isoAlpha,
const Field& pPsis
);
/*---------------------------------------------------------------------------*\
Class FaceValues Declaration
\*---------------------------------------------------------------------------*/
template
class FaceValues
{
// Private Data
//- The face
const face& f_;
//- The point values that we want to iterate over
const Field& pPsis_;
public:
// Public Typedefs
//- The value type
typedef Type value_type;
// Public Classes
//- Forward iterator
class const_iterator
{
// Private Data
//- Reference to the face-values
const FaceValues& fValues_;
//- Index of the face-point
label i_;
public:
// Constructors
//- Construct from components
const_iterator(const FaceValues& fValues, const label i);
// Member Functions
//- Get the next value around the sub-face
Type next() const;
// Member Operators
//- Equality comparison
bool operator==(const const_iterator& it) const;
//- Inequality comparison
bool operator!=(const const_iterator& it) const;
//- Dereference
Type operator*() const;
//- Increment
inline const_iterator& operator++();
//- Increment
inline const_iterator operator++(int);
};
// Constructors
//- Construct from components
FaceValues(const face& f, const Field& pPsis);
// Member Functions
//- Get the beginning of the iteration over the values
const_iterator begin() const;
//- Get the end of the iteration over the values
const_iterator end() const;
//- Get the beginning of the iteration over the values
const_iterator cbegin() const;
//- Get the end of the iteration over the values
const_iterator cend() const;
};
/*---------------------------------------------------------------------------*\
Class FaceCutValues Declaration
\*---------------------------------------------------------------------------*/
template
class FaceCutValues
{
// Private Data
//- The face
const face& f_;
//- The face's cuts
const List& fCuts_;
//- The point values that we want to iterate over
const Field& pPsis_;
//- The point values that define the iso-surface
const scalarField& pAlphas_;
//- The value that defines the iso-surface
const scalar isoAlpha_;
//- Do we want to iterate over the cut below or above the iso surface?
const bool below_;
public:
// Public Typedefs
//- The value type
typedef Type value_type;
// Public Classes
//- Forward iterator
class const_iterator
{
// Private Data
//- Reference to the face-values
const FaceCutValues& fValues_;
//- Index of the sub-face and sub-face-point
label i_, j_;
//- Cache of values on cut edges for this sub-face segment
mutable Tuple2