Commit 9cf085a6 authored by Mark OLESEN's avatar Mark OLESEN Committed by Andrew Heather
Browse files

ENH: add min/max method to PDRblock::location (#1216)

- grid(i,j,k) method for returning the grid point at an i-j-k location
parent 5ab10212
......@@ -110,6 +110,12 @@ public:
//- True if the location is within the range
inline bool contains(const scalar p) const;
//- The first() value is considered the min value.
inline const scalar& min() const;
//- The last() value is considered the max value.
inline const scalar& max() const;
//- Mid-point location, zero for an empty list.
inline scalar centre() const;
......@@ -305,6 +311,12 @@ public:
//- Cell dimensions at i,j,k position.
inline vector span(const labelVector& ijk) const;
//- Grid point at i,j,k position.
inline point grid(const label i, const label j, const label k) const;
//- Grid point at i,j,k position.
inline point grid(const labelVector& ijk) const;
//- Cell centre at i,j,k position.
inline point C(const label i, const label j, const label k) const;
......
......@@ -62,6 +62,18 @@ inline bool Foam::PDRblock::location::contains(const scalar p) const
}
inline const Foam::scalar& Foam::PDRblock::location::min() const
{
return scalarList::empty() ? pTraits<scalar>::rootMax : first();
}
inline const Foam::scalar& Foam::PDRblock::location::max() const
{
return scalarList::empty() ? pTraits<scalar>::rootMin : last();
}
inline Foam::scalar Foam::PDRblock::location::centre() const
{
return scalarList::empty() ? 0 : (0.5*first() + 0.5*last());
......@@ -206,6 +218,29 @@ inline Foam::vector Foam::PDRblock::span(const labelVector& ijk) const
}
inline Foam::point Foam::PDRblock::grid
(
const label i,
const label j,
const label k
) const
{
return point(grid_.x()[i], grid_.y()[j], grid_.z()[k]);
}
inline Foam::point Foam::PDRblock::grid(const labelVector& ijk) const
{
return
point
(
grid_.x()[ijk.x()],
grid_.y()[ijk.y()],
grid_.z()[ijk.z()]
);
}
inline Foam::point Foam::PDRblock::C
(
const label i,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment