Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
98c75b87
Commit
98c75b87
authored
Sep 09, 2013
by
mattijs
Browse files
ENH: instant: quick time comparison
parent
3aacc8eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/Time/instant/instant.C
View file @
98c75b87
...
...
@@ -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_
);
}
...
...
src/OpenFOAM/db/Time/instant/instant.H
View file @
98c75b87
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment