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
240e304b
Commit
240e304b
authored
Feb 21, 2018
by
sergio
Browse files
Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
parents
543ac077
32a854d2
Changes
109
Hide whitespace changes
Inline
Side-by-side
applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.H
View file @
240e304b
...
...
@@ -62,15 +62,8 @@ public:
{
public:
class
hash
:
public
Hash
<
interfacePair
>
struct
hash
{
public:
hash
()
{}
label
operator
()(
const
interfacePair
&
key
)
const
{
return
word
::
hash
()(
key
.
first
())
+
word
::
hash
()(
key
.
second
());
...
...
@@ -80,8 +73,7 @@ public:
// Constructors
interfacePair
()
{}
interfacePair
()
{}
// = default
interfacePair
(
const
word
&
alpha1Name
,
const
word
&
alpha2Name
)
:
...
...
applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.H
View file @
240e304b
...
...
@@ -74,30 +74,16 @@ public:
{
public:
class
symmHash
:
public
Hash
<
interfacePair
>
struct
symmHash
{
public:
symmHash
()
{}
label
operator
()(
const
interfacePair
&
key
)
const
{
return
word
::
hash
()(
key
.
first
())
+
word
::
hash
()(
key
.
second
());
}
};
class
hash
:
public
Hash
<
interfacePair
>
struct
hash
{
public:
hash
()
{}
label
operator
()(
const
interfacePair
&
key
)
const
{
return
word
::
hash
()(
key
.
first
(),
word
::
hash
()(
key
.
second
()));
...
...
@@ -107,8 +93,7 @@ public:
// Constructors
interfacePair
()
{}
interfacePair
()
{}
// = default
interfacePair
(
const
word
&
alpha1Name
,
const
word
&
alpha2Name
)
:
...
...
@@ -233,8 +218,7 @@ public:
//- Destructor
virtual
~
multiphaseSystem
()
{}
virtual
~
multiphaseSystem
()
=
default
;
// Member Functions
...
...
applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.H
View file @
240e304b
...
...
@@ -71,15 +71,8 @@ public:
{
public:
class
hash
:
public
Hash
<
interfacePair
>
struct
hash
{
public:
hash
()
{}
label
operator
()(
const
interfacePair
&
key
)
const
{
return
word
::
hash
()(
key
.
first
())
+
word
::
hash
()(
key
.
second
());
...
...
@@ -89,8 +82,7 @@ public:
// Constructors
interfacePair
()
{}
interfacePair
()
{}
// = default
interfacePair
(
const
word
&
alpha1Name
,
const
word
&
alpha2Name
)
:
...
...
@@ -196,8 +188,7 @@ public:
//- Destructor
virtual
~
multiphaseMixture
()
{}
virtual
~
multiphaseMixture
()
=
default
;
// Member Functions
...
...
applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phasePair/phasePairKey/phasePairKey.C
View file @
240e304b
...
...
@@ -27,14 +27,6 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
phasePairKey
::
hash
::
hash
()
{}
Foam
::
phasePairKey
::
phasePairKey
()
{}
Foam
::
phasePairKey
::
phasePairKey
(
const
word
&
name1
,
...
...
@@ -47,12 +39,6 @@ Foam::phasePairKey::phasePairKey
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
phasePairKey
::~
phasePairKey
()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool
Foam
::
phasePairKey
::
ordered
()
const
...
...
@@ -94,13 +80,13 @@ bool Foam::operator==
const
phasePairKey
&
b
)
{
const
label
c
=
Pair
<
word
>::
compare
(
a
,
b
);
const
label
c
mp
=
Pair
<
word
>::
compare
(
a
,
b
);
return
(
a
.
ordered_
==
b
.
ordered_
)
&&
(
(
a
.
ordered_
&&
(
c
==
1
))
||
(
!
a
.
ordered_
&&
(
c
!=
0
))
(
a
.
ordered_
&&
(
c
mp
==
1
))
||
(
!
a
.
ordered_
&&
(
c
mp
!=
0
))
);
}
...
...
@@ -127,7 +113,7 @@ Foam::Istream& Foam::operator>>(Istream& is, phasePairKey& key)
{
key
.
ordered_
=
false
;
}
else
if
(
temp
[
1
]
==
"in"
)
else
if
(
temp
[
1
]
==
"in"
)
{
key
.
ordered_
=
true
;
}
...
...
applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phasePair/phasePairKey/phasePairKey.H
View file @
240e304b
...
...
@@ -40,7 +40,7 @@ SourceFiles
namespace
Foam
{
// Forward declaration
of friend functions and operator
s
// Forward declarations
class
phasePairKey
;
...
...
@@ -59,41 +59,24 @@ 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
bool
ordered_
;
public:
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
phasePairKey
...
...
@@ -105,7 +88,7 @@ public:
// Destructor
virtual
~
phasePairKey
();
virtual
~
phasePairKey
()
=
default
;
// Access
...
...
applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phasePair/phasePairKey/phasePairKey.C
View file @
240e304b
...
...
@@ -27,14 +27,6 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
phasePairKey
::
hash
::
hash
()
{}
Foam
::
phasePairKey
::
phasePairKey
()
{}
Foam
::
phasePairKey
::
phasePairKey
(
const
word
&
name1
,
...
...
@@ -47,12 +39,6 @@ Foam::phasePairKey::phasePairKey
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
phasePairKey
::~
phasePairKey
()
{}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
Foam
::
label
Foam
::
phasePairKey
::
hash
::
operator
()
...
...
@@ -86,13 +72,13 @@ bool Foam::operator==
const
phasePairKey
&
b
)
{
const
label
c
=
Pair
<
word
>::
compare
(
a
,
b
);
const
label
c
mp
=
Pair
<
word
>::
compare
(
a
,
b
);
return
(
a
.
ordered_
==
b
.
ordered_
)
&&
(
(
a
.
ordered_
&&
(
c
==
1
))
||
(
!
a
.
ordered_
&&
(
c
!=
0
))
(
a
.
ordered_
&&
(
c
mp
==
1
))
||
(
!
a
.
ordered_
&&
(
c
mp
!=
0
))
);
}
...
...
@@ -119,7 +105,7 @@ Foam::Istream& Foam::operator>>(Istream& is, phasePairKey& key)
{
key
.
ordered_
=
false
;
}
else
if
(
temp
[
1
]
==
"in"
)
else
if
(
temp
[
1
]
==
"in"
)
{
key
.
ordered_
=
true
;
}
...
...
applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phasePair/phasePairKey/phasePairKey.H
View file @
240e304b
...
...
@@ -40,7 +40,7 @@ SourceFiles
namespace
Foam
{
// Forward declaration
of friend functions and operator
s
// Forward declarations
class
phasePairKey
;
...
...
@@ -59,48 +59,36 @@ 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
bool
ordered_
;
public:
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
phasePairKey
(
const
word
&
name1
,
const
word
&
name2
,
const
bool
ordered
);
phasePairKey
(
const
word
&
name1
,
const
word
&
name2
,
const
bool
ordered
);
// Destructor
virtual
~
phasePairKey
();
virtual
~
phasePairKey
()
=
default
;
// Friend Operators
...
...
applications/test/HashSet/Test-hashSet.C
View file @
240e304b
...
...
@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
setA
=
{
"kjhk"
,
"kjhk2"
,
"abced"
};
HashTable
<
label
,
word
>
tableA
HashTable
<
label
>
tableA
{
{
"value1"
,
1
},
{
"value2"
,
2
},
...
...
applications/test/List/Test-List.C
View file @
240e304b
...
...
@@ -48,6 +48,23 @@ See also
#include
<list>
#include
<numeric>
#include
<functional>
namespace
Foam
{
// Verify inheritance
class
MyStrings
:
public
List
<
string
>
{
public:
using
List
<
string
>::
List
;
};
}
// end namespace Foam
using
namespace
Foam
;
...
...
@@ -66,6 +83,14 @@ void testFind(const T& val, const ListType& lst)
}
void
printMyString
(
const
UList
<
string
>&
lst
)
{
MyStrings
slist2
(
lst
);
Info
<<
slist2
<<
nl
;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
...
...
@@ -76,6 +101,7 @@ int main(int argc, char *argv[])
argList
::
addOption
(
"wordList"
,
"wordList"
);
argList
::
addOption
(
"stringList"
,
"stringList"
);
argList
::
addOption
(
"float"
,
"xx"
);
argList
::
addBoolOption
(
"transform"
,
"Test List::createList functionality"
);
argList
::
addBoolOption
(
"flag"
);
#include
"setRootCase.H"
...
...
@@ -336,6 +362,85 @@ int main(int argc, char *argv[])
Info
<<
"-flag:"
<<
args
[
"flag"
]
<<
endl
;
}
if
(
args
.
found
(
"transform"
))
{
Info
<<
nl
<<
"Test List::createList functionality"
<<
nl
;
const
auto
labels
=
identity
(
15
);
Info
<<
"labels: "
<<
flatOutput
(
labels
)
<<
endl
;
{
auto
scalars
=
List
<
scalar
>::
createList
(
labels
,
[](
const
label
&
val
){
return
scalar
(
1
.
5
*
val
);
}
);
Info
<<
"scalars: "
<<
flatOutput
(
scalars
)
<<
endl
;
}
{
auto
vectors
=
List
<
vector
>::
createList
(
labels
,
[](
const
label
&
val
){
return
vector
(
1
.
2
*
val
,
-
1
.
2
*
val
,
0
);
}
);
Info
<<
"vectors: "
<<
flatOutput
(
vectors
)
<<
endl
;
}
{
auto
longs
=
List
<
long
>::
createList
(
labels
,
[](
const
label
&
val
){
return
val
;
}
);
Info
<<
"longs: "
<<
flatOutput
(
longs
)
<<
endl
;
}
{
auto
negs
=
List
<
label
>::
createList
(
labels
,
std
::
negate
<
label
>
()
);
Info
<<
"negs: "
<<
flatOutput
(
negs
)
<<
endl
;
}
{
auto
scalars
=
List
<
scalar
>::
createList
(
labelRange
::
null
.
cbegin
(),
labelRange
::
identity
(
15
).
cend
(),
[](
const
label
&
val
){
return
scalar
(
-
1
.
125
*
val
);
}
);
Info
<<
"scalars: "
<<
flatOutput
(
scalars
)
<<
endl
;
}
#if WM_LABEL_SIZE == 32
{
List
<
int64_t
>
input
(
10
);
std
::
iota
(
input
.
begin
(),
input
.
end
(),
0
);
auto
output
=
List
<
label
>::
createList
(
input
,
toLabel
<
int64_t
>
()
);
Info
<<
"label (from int64): "
<<
flatOutput
(
output
)
<<
endl
;
}
#elif WM_LABEL_SIZE == 64
{
List
<
int32_t
>
input
(
10
);
std
::
iota
(
input
.
begin
(),
input
.
end
(),
0
);
auto
output
=
List
<
label
>::
createList
(
input
,
toLabel
<
int32_t
>
()
);
Info
<<
"label (from int32): "
<<
flatOutput
(
output
)
<<
endl
;
}
#endif
}
if
(
args
.
readIfPresent
<
scalar
>
(
"float"
,
xxx
))
{
Info
<<
"read float "
<<
xxx
<<
endl
;
...
...
@@ -354,6 +459,8 @@ int main(int argc, char *argv[])
if
(
args
.
found
(
"stringList"
))
{
sLst
=
args
.
readList
<
string
>
(
"stringList"
);
printMyString
(
sLst
);
}
Info
<<
nl
...
...
applications/test/dictionary2/Test-dictionary2.C
View file @
240e304b
...
...
@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
{
entry
*
e
=
dict1
.
add
(
Foam
::
name
(
"entry%d"
,
i
),
word
::
printf
(
"entry%d"
,
i
),
string
(
"entry"
+
Foam
::
name
(
i
))
);
entryInfo
(
e
);
...
...
@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
{
entry
*
e
=
tmpdict
.
add
(
Foam
::
name
(
"subentry%d"
,
i
),
word
::
printf
(
"subentry%d"
,
i
),
string
(
"subentry"
+
Foam
::
name
(
i
))
);
entryInfo
(
e
);
...
...
@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
{
entry
*
e
=
dict1
.
add
(
Foam
::
name
(
"dict%d"
,
i
),
word
::
printf
(
"dict%d"
,
i
),
tmpdict
);
entryInfo
(
e
);
...
...
applications/test/string/Test-string.C
View file @
240e304b
...
...
@@ -64,14 +64,14 @@ int main(int argc, char *argv[])
// Test Foam::name with formatting string
{
word
formatted
=
Foam
::
name
(
"formatted=<%X>"
,
0xdeadbeef
);
word
formatted
=
word
::
printf
(
"formatted=<%X>"
,
0xdeadbeef
);
Info
<<
"formatted: "
<<
formatted
<<
nl
;
}
Info
<<
"formatted: "
<<
Foam
::
name
(
"formatted not checked for validity=<%X>"
,
0xdeadbeef
)
<<
word
::
printf
(
"formatted not checked for validity=<%X>"
,
0xdeadbeef
)
<<
nl
<<
endl
<<
endl
;
Info
<<
"string:"
<<
test
<<
nl
<<
"hash:"
...
...
@@ -227,7 +227,7 @@ int main(int argc, char *argv[])
cout
<<
"
\n
test Foam::name()
\n
"
;
Info
<<
"hash: = "
<<
Foam
::
name
(
"0x%012X"
,
string
::
hash
()(
s2
))
<<
endl
;
Info
<<
"hash: = "
<<
word
::
printf
(
"0x%012X"
,
string
::
hash
()(
s2
))
<<
endl
;
// test formatting on int
{
...
...
@@ -236,7 +236,7 @@ int main(int argc, char *argv[])
Info
<<
"int "
<<
val
<<
" as word >"
<<
Foam
::
name
(
val
)
<<
"< or "
<<
Foam
::
name
(
"formatted >%08d<"
,
val
)
<<
"
\n
"
;
<<
word
::
printf
(
"formatted >%08d<"
,
val
)
<<
"
\n
"
;
}
// test formatting on scalar
...
...
@@ -244,7 +244,7 @@ int main(int argc, char *argv[])
scalar
val
=
3
.
1415926535897931
;
Info
<<
"scalar "
<<
val
<<
" as word >"
<<
Foam
::
name
(
val
)
<<
"< or "
<<
Foam
::
name
(
"formatted >%.9f<"
,
val
)
<<
"
\n
"
;
<<
word
::
printf
(
"formatted >%.9f<"
,
val
)
<<
"
\n
"
;
}
// test formatting on uint
...
...
@@ -254,7 +254,7 @@ int main(int argc, char *argv[])
Info
<<
"uint64 "
<<
val
<<
" as word >"
<<
Foam
::
name
(
val
)
<<
"< or "
<<
Foam
::
name
(
"formatted >%08d<"
,
val
)
<<
"
\n
"
;
<<
word
::
printf
(
"formatted >%08d<"
,
val
)
<<
"
\n
"
;
}
// test startsWith, endsWith methods
...
...
applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
View file @
240e304b
...
...
@@ -853,7 +853,7 @@ int main(int argc, char *argv[])