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
Commits
b1996f34
Commit
b1996f34
authored
Jul 24, 2018
by
Mark Olesen
Browse files
COMP: avoid compiler warnings about phasePairKey friend functions
- improve alignment of various phasePairKey implementations
parent
d25dd342
Changes
6
Hide whitespace changes
Inline
Side-by-side
applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phasePair/phasePairKey/phasePairKey.C
View file @
b1996f34
...
...
@@ -27,14 +27,6 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
phasePairKey
::
hash
::
hash
()
{}
Foam
::
phasePairKey
::
phasePairKey
()
{}
Foam
::
phasePairKey
::
phasePairKey
(
const
word
&
name1
,
...
...
@@ -71,12 +63,8 @@ Foam::label Foam::phasePairKey::hash::operator()
word
::
hash
()(
key
.
second
())
);
}
else
{
return
word
::
hash
()(
key
.
first
())
+
word
::
hash
()(
key
.
second
());
}
return
word
::
hash
()(
key
.
first
())
+
word
::
hash
()(
key
.
second
());
}
...
...
@@ -88,14 +76,13 @@ bool Foam::operator==
const
phasePairKey
&
b
)
{
const
label
c
=
Pair
<
word
>::
compare
(
a
,
b
);
const
auto
cmp
=
Pair
<
word
>::
compare
(
a
,
b
);
return
(
(
a
.
ordered_
==
b
.
ordered_
)
&&
(
(
a
.
ordered_
&&
(
c
==
1
))
||
(
!
a
.
ordered_
&&
(
c
!=
0
))
);
&&
(
a
.
ordered_
?
(
cmp
==
1
)
:
cmp
)
);
}
...
...
@@ -121,7 +108,7 @@ Foam::Istream& Foam::operator>>(Istream& is, phasePairKey& key)
{
key
.
ordered_
=
false
;
}
else
if
(
temp
[
1
]
==
"to"
)
else
if
(
temp
[
1
]
==
"to"
)
{
key
.
ordered_
=
true
;
}
...
...
@@ -130,8 +117,8 @@ Foam::Istream& Foam::operator>>(Istream& is, phasePairKey& key)
FatalErrorInFunction
<<
"Phase pair type is not recognised. "
<<
temp
<<
"Use (phaseDispersed to phaseContinuous) for an ordered"
<<
"
pair,
or (phase1 and pase2) for an unordered pair."
<<
"Use (phaseDispersed to phaseContinuous) for an ordered
pair,
"
<<
"or (phase1 and p
h
ase2) for an unordered pair."
<<
exit
(
FatalError
);
}
...
...
applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phasePair/phasePairKey/phasePairKey.H
View file @
b1996f34
...
...
@@ -40,6 +40,15 @@ SourceFiles
namespace
Foam
{
// Forward declarations
class
phasePairKey
;
bool
operator
==
(
const
phasePairKey
&
a
,
const
phasePairKey
&
b
);
bool
operator
!=
(
const
phasePairKey
&
a
,
const
phasePairKey
&
b
);
Istream
&
operator
>>
(
Istream
&
is
,
phasePairKey
&
key
);
Ostream
&
operator
<<
(
Ostream
&
os
,
const
phasePairKey
&
key
);
/*---------------------------------------------------------------------------*\
Class phasePairKey Declaration
\*---------------------------------------------------------------------------*/
...
...
@@ -48,29 +57,6 @@ class phasePairKey
:
public
Pair
<
word
>
{
public:
class
hash
:
public
Hash
<
phasePairKey
>
{
public:
// Constructors
//- Construct null
hash
();
// Member operators
//- Generate a hash from a phase pair key
label
operator
()(
const
phasePairKey
&
key
)
const
;
};
private:
// Private data
//- Flag to indicate whether ordering is important
...
...
@@ -79,12 +65,20 @@ private:
public:
//- Ordered or unordered hashing of word pair
struct
hash
{
//- Generate a hash from a phase pair key
label
operator
()(
const
phasePairKey
&
key
)
const
;
};
// Constructors
//- Construct null
phasePairKey
()
;
phasePairKey
()
{}
// = default
//- Construct from names and
the
ordering flag
//- Construct from names and
optional
ordering flag
phasePairKey
(
const
word
&
name1
,
...
...
@@ -93,7 +87,7 @@ public:
);
// Destructor
//
-
Destructor
virtual
~
phasePairKey
()
=
default
;
...
...
@@ -105,16 +99,16 @@ public:
// Friend Operators
//- Test
if keys are
equal
//- Test
for
equal
ity
friend
bool
operator
==
(
const
phasePairKey
&
a
,
const
phasePairKey
&
b
);
//- Test
if keys are u
nequal
//- Test
for i
nequal
ity
friend
bool
operator
!=
(
const
phasePairKey
&
a
,
const
phasePairKey
&
b
);
//- Read from st
din
//- Read from
I
st
ream
friend
Istream
&
operator
>>
(
Istream
&
is
,
phasePairKey
&
key
);
//- Write to st
dout
//- Write to
O
st
ream
friend
Ostream
&
operator
<<
(
Ostream
&
os
,
const
phasePairKey
&
key
);
};
...
...
applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phasePair/phasePairKey/phasePairKey.C
View file @
b1996f34
...
...
@@ -63,12 +63,8 @@ Foam::label Foam::phasePairKey::hash::operator()
word
::
hash
()(
key
.
second
())
);
}
else
{
return
word
::
hash
()(
key
.
first
())
+
word
::
hash
()(
key
.
second
());
}
return
word
::
hash
()(
key
.
first
())
+
word
::
hash
()(
key
.
second
());
}
...
...
@@ -80,14 +76,13 @@ bool Foam::operator==
const
phasePairKey
&
b
)
{
const
label
cmp
=
Pair
<
word
>::
compare
(
a
,
b
);
const
auto
cmp
=
Pair
<
word
>::
compare
(
a
,
b
);
return
(
(
a
.
ordered_
==
b
.
ordered_
)
&&
(
(
a
.
ordered_
&&
(
cmp
==
1
))
||
(
!
a
.
ordered_
&&
(
cmp
!=
0
))
);
&&
(
a
.
ordered_
?
(
cmp
==
1
)
:
cmp
)
);
}
...
...
applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phasePair/phasePairKey/phasePairKey.H
View file @
b1996f34
...
...
@@ -41,14 +41,13 @@ namespace Foam
{
// Forward declarations
class
phasePairKey
;
bool
operator
==
(
const
phasePairKey
&
,
const
phasePairKey
&
);
bool
operator
!=
(
const
phasePairKey
&
,
const
phasePairKey
&
);
bool
operator
==
(
const
phasePairKey
&
a
,
const
phasePairKey
&
b
);
bool
operator
!=
(
const
phasePairKey
&
a
,
const
phasePairKey
&
b
);
Istream
&
operator
>>
(
Istream
&
,
phasePairKey
&
);
Ostream
&
operator
<<
(
Ostream
&
,
const
phasePairKey
&
);
Istream
&
operator
>>
(
Istream
&
is
,
phasePairKey
&
key
);
Ostream
&
operator
<<
(
Ostream
&
os
,
const
phasePairKey
&
key
);
/*---------------------------------------------------------------------------*\
...
...
@@ -64,11 +63,13 @@ class phasePairKey
//- Flag to indicate whether ordering is important
bool
ordered_
;
public:
//- Ordered or unordered hashing of word pair
struct
hash
{
// Generate a hash from a phase pair key
//
-
Generate a hash from a phase pair key
label
operator
()(
const
phasePairKey
&
key
)
const
;
};
...
...
@@ -78,7 +79,7 @@ public:
//- Construct null
phasePairKey
()
{}
// = default
//- Construct from names and
the
ordering flag
//- Construct from names and
optional
ordering flag
phasePairKey
(
const
word
&
name1
,
...
...
@@ -87,7 +88,7 @@ public:
);
// Destructor
//
-
Destructor
virtual
~
phasePairKey
()
=
default
;
...
...
@@ -99,16 +100,16 @@ public:
// Friend Operators
//- Test
if keys are
equal
//- Test
for
equal
ity
friend
bool
operator
==
(
const
phasePairKey
&
a
,
const
phasePairKey
&
b
);
//- Test
if keys are u
nequal
//- Test
for i
nequal
ity
friend
bool
operator
!=
(
const
phasePairKey
&
a
,
const
phasePairKey
&
b
);
//- Read from st
din
//- Read from
I
st
ream
friend
Istream
&
operator
>>
(
Istream
&
is
,
phasePairKey
&
key
);
//- Write to st
dout
//- Write to
O
st
ream
friend
Ostream
&
operator
<<
(
Ostream
&
os
,
const
phasePairKey
&
key
);
};
...
...
applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phasePair/phasePairKey/phasePairKey.C
View file @
b1996f34
...
...
@@ -39,6 +39,14 @@ Foam::phasePairKey::phasePairKey
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool
Foam
::
phasePairKey
::
ordered
()
const
{
return
ordered_
;
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
Foam
::
label
Foam
::
phasePairKey
::
hash
::
operator
()
...
...
@@ -55,12 +63,8 @@ Foam::label Foam::phasePairKey::hash::operator()
word
::
hash
()(
key
.
second
())
);
}
else
{
return
word
::
hash
()(
key
.
first
())
+
word
::
hash
()(
key
.
second
());
}
return
word
::
hash
()(
key
.
first
())
+
word
::
hash
()(
key
.
second
());
}
...
...
@@ -72,14 +76,13 @@ bool Foam::operator==
const
phasePairKey
&
b
)
{
const
label
cmp
=
Pair
<
word
>::
compare
(
a
,
b
);
const
auto
cmp
=
Pair
<
word
>::
compare
(
a
,
b
);
return
(
(
a
.
ordered_
==
b
.
ordered_
)
&&
(
(
a
.
ordered_
&&
(
cmp
==
1
))
||
(
!
a
.
ordered_
&&
(
cmp
!=
0
))
);
&&
(
a
.
ordered_
?
(
cmp
==
1
)
:
cmp
)
);
}
...
...
@@ -114,8 +117,8 @@ Foam::Istream& Foam::operator>>(Istream& is, phasePairKey& key)
FatalErrorInFunction
<<
"Phase pair type is not recognised. "
<<
temp
<<
"Use (phaseDispersed in phaseContinuous) for an ordered"
<<
"
pair,
or (phase1 and pase2) for an unordered pair."
<<
"Use (phaseDispersed in phaseContinuous) for an ordered
pair,
"
<<
"or (phase1 and p
h
ase2) for an unordered pair."
<<
exit
(
FatalError
);
}
...
...
applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phasePair/phasePairKey/phasePairKey.H
View file @
b1996f34
...
...
@@ -41,15 +41,13 @@ namespace Foam
{
// Forward declarations
class
phasePairKey
;
bool
operator
==
(
const
phasePairKey
&
,
const
phasePairKey
&
);
bool
operator
!=
(
const
phasePairKey
&
,
const
phasePairKey
&
);
Istream
&
operator
>>
(
Istream
&
,
phasePairKey
&
);
Ostream
&
operator
<<
(
Ostream
&
,
const
phasePairKey
&
);
bool
operator
==
(
const
phasePairKey
&
a
,
const
phasePairKey
&
b
);
bool
operator
!=
(
const
phasePairKey
&
a
,
const
phasePairKey
&
b
);
Istream
&
operator
>>
(
Istream
&
is
,
phasePairKey
&
key
);
Ostream
&
operator
<<
(
Ostream
&
os
,
const
phasePairKey
&
key
);
/*---------------------------------------------------------------------------*\
Class phasePairKey Declaration
...
...
@@ -66,9 +64,10 @@ class phasePairKey
public:
//- Ordered or unordered hashing of word pair
struct
hash
{
// Generate a hash from a phase pair key
//
-
Generate a hash from a phase pair key
label
operator
()(
const
phasePairKey
&
key
)
const
;
};
...
...
@@ -78,31 +77,37 @@ public:
//- Construct null
phasePairKey
()
{}
// = default
//- Construct from names and
the
ordering flag
//- Construct from names and
optional
ordering flag
phasePairKey
(
const
word
&
name1
,
const
word
&
name2
,
const
bool
ordered
const
bool
ordered
=
false
);
// Destructor
//
-
Destructor
virtual
~
phasePairKey
()
=
default
;
// Access
//- Return the ordered flag
bool
ordered
()
const
;
// Friend Operators
//- Test
if keys are
equal
//- Test
for
equal
ity
friend
bool
operator
==
(
const
phasePairKey
&
a
,
const
phasePairKey
&
b
);
//- Test
if keys are u
nequal
//- Test
for i
nequal
ity
friend
bool
operator
!=
(
const
phasePairKey
&
a
,
const
phasePairKey
&
b
);
//- Read from st
din
//- Read from
I
st
ream
friend
Istream
&
operator
>>
(
Istream
&
is
,
phasePairKey
&
key
);
//- Write to st
dout
//- Write to
O
st
ream
friend
Ostream
&
operator
<<
(
Ostream
&
os
,
const
phasePairKey
&
key
);
};
...
...
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