mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: instant: quick time comparison
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -54,15 +54,19 @@ Foam::instant::instant(const word& tname)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::instant::equal(const scalar b) const
|
||||
{
|
||||
return (value_ < b + SMALL && value_ > b - SMALL);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::operator==(const instant& a, const instant& b)
|
||||
{
|
||||
return
|
||||
(
|
||||
a.value_ < b.value_ + SMALL
|
||||
&& a.value_ > b.value_ - SMALL
|
||||
);
|
||||
return a.equal(b.value_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -99,10 +99,10 @@ public:
|
||||
instant(const scalar, const word&);
|
||||
|
||||
//- Construct from time value
|
||||
instant(const scalar);
|
||||
explicit instant(const scalar);
|
||||
|
||||
//- Construct from word
|
||||
instant(const word&);
|
||||
explicit instant(const word&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -133,6 +133,9 @@ public:
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Comparison used for instants to be equal
|
||||
bool equal(const scalar) const;
|
||||
|
||||
|
||||
// Friend Operators
|
||||
|
||||
|
||||
Reference in New Issue
Block a user