Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
OpenFOAM-plus
Commits
f71cec86
Commit
f71cec86
authored
Mar 14, 2018
by
Mark Olesen
Browse files
STYLE: derive always/never predicates from std types
- make constexpr noexcept
parent
f19b52db
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/primitives/predicates/predicates.H
View file @
f71cec86
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017
-2018
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -25,7 +25,7 @@ Namespace
Foam::predicates
Description
Various c
onstant predicate types.
C
onstant predicate types.
SourceFiles
predicates.H
...
...
@@ -36,6 +36,7 @@ SourceFiles
#define predicates_H
#include <string>
#include <type_traits>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -50,42 +51,29 @@ namespace predicates
\*---------------------------------------------------------------------------*/
//- Unary and binary predicates that always return true, useful for templating.
struct
always
struct
always
:
std
::
true_type
{
typedef
always
value_type
;
//- Null constructible
inline
always
()
{}
//- Evaluated as a bool
// \return true
inline
operator
bool
()
const
{
return
true
;
}
//- Unary predicate
// \return true
template
<
class
T
>
inline
bool
operator
()(
const
T
&
)
const
constexpr
bool
operator
()(
const
T
&
)
const
noexcept
{
return
tr
ue
;
return
val
ue
;
}
//- Binary predicate
// \return true
template
<
class
T1
,
class
T2
>
inline
bool
operator
()(
const
T1
&
,
const
T2
&
)
const
constexpr
bool
operator
()(
const
T1
&
,
const
T2
&
)
const
noexcept
{
return
tr
ue
;
return
val
ue
;
}
//- String match
// \return true
inline
bool
match
(
const
std
::
string
&
,
bool
literal
=
false
)
const
constexpr
bool
match
(
const
std
::
string
&
,
bool
literal
=
false
)
const
noexcept
{
return
tr
ue
;
return
val
ue
;
}
};
...
...
@@ -95,42 +83,29 @@ struct always
\*---------------------------------------------------------------------------*/
//- Unary and binary predicates that never return true, useful for templating.
struct
never
struct
never
:
std
::
false_type
{
typedef
never
value_type
;
//- Null constructible
inline
never
()
{}
//- Evaluated as a bool
// \return false
inline
operator
bool
()
const
{
return
false
;
}
//- Unary predicate
// \return false
template
<
class
T
>
inline
bool
operator
()(
const
T
&
)
const
constexpr
bool
operator
()(
const
T
&
)
const
noexcept
{
return
f
al
s
e
;
return
v
al
u
e
;
}
//- Binary predicate
// \return false
template
<
class
T1
,
class
T2
>
inline
bool
operator
()(
const
T1
&
,
const
T2
&
)
const
constexpr
bool
operator
()(
const
T1
&
,
const
T2
&
)
const
noexcept
{
return
f
al
s
e
;
return
v
al
u
e
;
}
//- String match
// \return false
inline
bool
match
(
const
std
::
string
&
,
bool
literal
=
false
)
const
constexpr
bool
match
(
const
std
::
string
&
,
bool
literal
=
false
)
const
noexcept
{
return
f
al
s
e
;
return
v
al
u
e
;
}
};
...
...
src/finiteVolume/volMesh/volMesh.H
View file @
f71cec86
...
...
@@ -27,12 +27,6 @@ Class
Description
Mesh data needed to do the Finite Volume discretisation.
Class
Foam::isVolMesh
Description
Supports static assertion that a template argument is of type volMesh.
\*---------------------------------------------------------------------------*/
#ifndef volMesh_H
...
...
@@ -56,7 +50,6 @@ class volMesh
:
public
GeoMesh
<
fvMesh
>
{
public:
// Constructors
...
...
@@ -71,15 +64,15 @@ public:
// Member Functions
//- Return size
label
size
(
)
const
static
label
size
(
const
Mesh
&
mesh
)
{
return
size
(
mesh_
);
return
mesh
.
nCells
(
);
}
//- Return size
static
label
size
(
const
Mesh
&
mesh
)
label
size
(
)
const
{
return
mesh
.
nCells
(
);
return
size
(
mesh_
);
}
//- Return cell centres
...
...
@@ -94,18 +87,10 @@ public:
Class isVolMesh Declaration
\*---------------------------------------------------------------------------*/
template
<
class
T
>
class
isVolMesh
:
public
std
::
false_type
{};
//- Template argument for type volMesh.
template
<
class
>
struct
isVolMesh
:
std
::
false_type
{};
template
<
>
class
isVolMesh
<
volMesh
>
:
public
std
::
true_type
{};
template
<
>
struct
isVolMesh
<
volMesh
>
:
std
::
true_type
{};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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