Skip to content
GitLab
Menu
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
8c5d0cd8
Commit
8c5d0cd8
authored
May 08, 2018
by
mattijs
Browse files
Merge remote-tracking branch 'origin/develop' into develop
parents
e3706cdc
0d7c5822
Changes
21
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/primitives/spatialVectorAlgebra/spatialTransform/spatialTransformI.H
View file @
8c5d0cd8
...
...
@@ -257,7 +257,7 @@ inline spatialTransform Xrx(const scalar& omega)
return
spatialTransform
(
Rx
(
omega
),
Zero
);
}
//- Rotational spatial transformation tensor about the
x
-axis by omega radians
//- Rotational spatial transformation tensor about the
y
-axis by omega radians
inline
spatialTransform
Xry
(
const
scalar
&
omega
)
{
return
spatialTransform
(
Ry
(
omega
),
Zero
);
...
...
src/fileFormats/ensight/file/ensightCase.C
View file @
8c5d0cd8
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016
-2018
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -103,14 +103,13 @@ Foam::label Foam::ensightCase::checkTimeset(const labelHashSet& lookup) const
}
else
if
(
tsTimes
.
size
()
==
timesUsed_
.
size
())
{
forAllConstIter
(
Map
<
scalar
>
,
timesUsed_
,
iter
)
forAllConstIter
s
(
timesUsed_
,
iter
)
{
tsTimes
.
erase
(
iter
.
key
());
}
// OR
// tsTimes -= timesUsed_.toc();
// tsTimes -= timesUsed_;
// tsTimes.unsetMany(timesUsed_.toc());
if
(
tsTimes
.
empty
())
{
...
...
@@ -171,9 +170,9 @@ Foam::scalar Foam::ensightCase::writeTimeset() const
<<
"filename numbers:"
<<
nl
;
count
=
0
;
for
All
(
indices
,
idx
)
for
(
const
label
idx
:
indices
)
{
*
os_
<<
" "
<<
setw
(
12
)
<<
indices
[
idx
]
;
*
os_
<<
' '
<<
setw
(
12
)
<<
idx
;
if
(
++
count
%
6
==
0
)
{
...
...
@@ -191,9 +190,9 @@ Foam::scalar Foam::ensightCase::writeTimeset() const
*
os_
<<
"time values:"
<<
nl
;
count
=
0
;
for
All
(
indices
,
idx
)
for
(
const
label
idx
:
indices
)
{
*
os_
<<
" "
<<
setw
(
12
)
<<
timesUsed_
[
indices
[
idx
]
]
+
timeCorrection
;
*
os_
<<
' '
<<
setw
(
12
)
<<
timesUsed_
[
idx
]
+
timeCorrection
;
if
(
++
count
%
6
==
0
)
{
...
...
@@ -220,7 +219,7 @@ void Foam::ensightCase::writeTimeset
labelHashSet
hashed
(
lookup
);
hashed
.
erase
(
-
1
);
const
labelList
indices
=
hashed
.
sortedToc
();
const
labelList
indices
(
hashed
.
sortedToc
()
)
;
label
count
=
indices
.
size
();
*
os_
...
...
@@ -229,9 +228,9 @@ void Foam::ensightCase::writeTimeset
<<
"filename numbers:"
<<
nl
;
count
=
0
;
for
All
(
indices
,
idx
)
for
(
const
label
idx
:
indices
)
{
*
os_
<<
" "
<<
setw
(
12
)
<<
indices
[
idx
]
;
*
os_
<<
' '
<<
setw
(
12
)
<<
idx
;
if
(
++
count
%
6
==
0
)
{
...
...
@@ -247,9 +246,9 @@ void Foam::ensightCase::writeTimeset
*
os_
<<
"time values:"
<<
nl
;
count
=
0
;
for
All
(
indices
,
idx
)
for
(
const
label
idx
:
indices
)
{
*
os_
<<
" "
<<
setw
(
12
)
<<
timesUsed_
[
indices
[
idx
]
]
+
timeCorrection
;
*
os_
<<
' '
<<
setw
(
12
)
<<
timesUsed_
[
idx
]
+
timeCorrection
;
if
(
++
count
%
6
==
0
)
{
...
...
@@ -333,19 +332,17 @@ Foam::ensightCase::createDataFile
const
word
&
name
)
const
{
autoPtr
<
ensightFile
>
output
;
if
(
Pstream
::
master
())
{
//
t
he data/ITER subdirectory must exist
//
T
he data/ITER subdirectory must exist
// Note that data/ITER is indeed a valid ensight::FileName
const
fileName
outdir
=
dataDir
()
/
padded
(
timeIndex_
);
mkDir
(
outdir
);
output
.
reset
(
new
ensightFile
(
outdir
,
name
,
format
())
)
;
return
autoPtr
<
ensightFile
>::
New
(
outdir
,
name
,
format
());
}
return
output
;
return
nullptr
;
}
...
...
@@ -356,8 +353,6 @@ Foam::ensightCase::createCloudFile
const
word
&
name
)
const
{
autoPtr
<
Foam
::
ensightFile
>
output
;
if
(
Pstream
::
master
())
{
// Write
...
...
@@ -373,10 +368,10 @@ Foam::ensightCase::createCloudFile
mkDir
(
outdir
);
// should be unnecessary after newCloud()
output
.
reset
(
new
ensightFile
(
outdir
,
name
,
format
())
)
;
return
autoPtr
<
ensightFile
>::
New
(
outdir
,
name
,
format
());
}
return
output
;
return
nullptr
;
}
...
...
@@ -490,20 +485,30 @@ void Foam::ensightCase::write() const
if
(
!
os_
)
return
;
// master only
// geometry timeset
bool
staticGeom
=
(
geomTimes_
.
size
()
==
1
&&
geomTimes_
.
found
(
-
1
));
const
bool
staticGeom
=
(
geomTimes_
.
size
()
==
1
&&
geomTimes_
.
found
(
-
1
));
label
tsGeom
=
staticGeom
?
0
:
checkTimeset
(
geomTimes_
);
// geometry index, when mesh is not moving but stored under data/XXX/
label
meshIndex
=
-
1
;
// cloud timeset
label
tsCloud
=
checkTimeset
(
cloudTimes_
);
//
i
ncrement time-sets to the correct indices
//
I
ncrement time-sets to the correct indices
if
(
tsGeom
<
0
)
{
tsGeom
=
2
;
// next available timeset
tsGeom
=
2
;
// Next available timeset
// Saved under data/XXX/geometry, but not actually moving
if
(
geomTimes_
.
size
()
==
1
)
{
tsGeom
=
0
;
meshIndex
=
*
(
geomTimes_
.
begin
());
}
}
if
(
tsCloud
<
0
)
{
tsCloud
=
tsGeom
+
1
;
//
n
ext available timeset
tsCloud
=
1
+
std
::
max
(
1
,
tsGeom
);
//
N
ext available timeset
}
writeHeader
();
...
...
@@ -525,27 +530,34 @@ void Foam::ensightCase::write() const
if
(
staticGeom
)
{
//
s
teady
//
S
teady
*
os_
<<
setw
(
16
)
<<
"model:"
<<
geometryName
<<
nl
;
}
else
if
(
meshIndex
>=
0
)
{
// Not really moving, but stored under data/XXXX/geometry
*
os_
<<
setw
(
16
)
<<
"model:"
<<
(
dataDirName
/
padded
(
meshIndex
)
/
geometryName
).
c_str
()
<<
nl
;
}
else
if
(
!
geomTimes_
.
empty
())
{
//
m
oving
//
M
oving
*
os_
<<
word
::
printf
(
"model: %-9d"
,
tsGeom
)
// width 16 (no quotes)
<<
(
dataMask
/
geometryName
).
c_str
()
<<
nl
;
}
// clouds and cloud variables
const
wordList
cloudNames
=
cloudVars_
.
sortedToc
();
forAll
(
cloudNames
,
cloudNo
)
{
const
word
&
cloudName
=
cloudNames
[
cloudNo
];
// Clouds and cloud variables
const
wordList
cloudNames
(
cloudVars_
.
sortedToc
());
for
(
const
word
&
cloudName
:
cloudNames
)
{
const
fileName
masked
=
(
separateCloud
()
...
...
@@ -572,11 +584,11 @@ void Foam::ensightCase::write() const
}
// field variables (always use timeset 1)
const
wordList
varNames
=
variables_
.
sortedToc
();
forAll
(
varNames
,
vari
)
// Field variables (always use timeset 1)
const
wordList
varNames
(
variables_
.
sortedToc
());
for
(
const
word
&
varName
:
varNames
)
{
const
word
&
varName
=
varNames
[
vari
];
const
string
&
ensType
=
variables_
[
varName
];
*
os_
...
...
@@ -592,13 +604,14 @@ void Foam::ensightCase::write() const
}
//
c
louds and cloud variables (using cloud timeset)
//
C
louds and cloud variables (using cloud timeset)
// Write
// as -> "data/********/lagrangian/<cloudName>/positions"
// or -> "lagrangian/<cloudName>/********/positions"
forAll
(
cloudNames
,
cloudNo
)
label
cloudNo
=
0
;
for
(
const
word
&
cloudName
:
cloudNames
)
{
const
word
&
cloudName
=
cloudNames
[
cloudNo
];
const
fileName
masked
=
(
separateCloud
()
...
...
@@ -607,11 +620,9 @@ void Foam::ensightCase::write() const
);
const
HashTable
<
string
>&
vars
=
cloudVars_
[
cloudName
];
const
wordList
tocVars
=
vars
.
sortedToc
();
for
All
(
tocVars
,
vari
)
for
(
const
word
&
varName
:
vars
.
sortedToc
()
)
{
const
word
&
varName
=
tocVars
[
vari
];
const
string
&
ensType
=
vars
[
varName
];
// prefix variables with 'c' (cloud) and cloud index
...
...
@@ -623,6 +634,8 @@ void Foam::ensightCase::write() const
<<
(
masked
/
varName
).
c_str
()
<<
nl
;
}
++
cloudNo
;
}
...
...
@@ -669,7 +682,7 @@ Foam::ensightCase::newGeometry
if
(
Pstream
::
master
())
{
//
s
et the path of the ensight file
//
S
et the path of the ensight file
fileName
path
;
if
(
moving
)
...
...
@@ -684,12 +697,12 @@ Foam::ensightCase::newGeometry
path
=
ensightDir_
;
}
output
.
reset
(
new
ensightGeoFile
(
path
,
geometryName
,
format
()));
noteGeometry
(
moving
);
// note for later use
return
autoPtr
<
ensightGeoFile
>::
New
(
path
,
geometryName
,
format
());
}
return
output
;
return
nullptr
;
}
...
...
@@ -705,10 +718,10 @@ Foam::ensightCase::newCloud
{
output
=
createCloudFile
(
cloudName
,
"positions"
);
//
t
ag binary format (just like geometry files)
//
T
ag binary format (just like geometry files)
output
().
writeBinaryHeader
();
//
d
escription
//
D
escription
output
().
write
(
cloud
::
prefix
/
cloudName
);
output
().
newline
();
...
...
src/fileFormats/ensight/file/ensightCase.H
View file @
8c5d0cd8
...
...
@@ -148,13 +148,13 @@ private:
)
const
;
//- Note geometry being used
//- Note
the
geometry being used
void
noteGeometry
(
const
bool
moving
)
const
;
//- Note cloud being used
//- Note
the
cloud being used
void
noteCloud
(
const
word
&
cloudName
)
const
;
//- Note cloud/variable being used
//- Note
the
cloud/variable being used
void
noteCloud
(
const
word
&
cloudName
,
...
...
@@ -162,7 +162,7 @@ private:
const
char
*
ensightType
)
const
;
//- Note field variable being used
//- Note
the
field variable being used
void
noteVariable
(
const
word
&
varName
,
...
...
@@ -172,7 +172,7 @@ private:
//- Open stream for new data file (on master), using the current index.
// File is without initial description lines.
autoPtr
<
ensightFile
>
createDataFile
(
const
word
&
)
const
;
autoPtr
<
ensightFile
>
createDataFile
(
const
word
&
name
)
const
;
//- Open stream for new cloud file (on master).
// File is without initial description lines.
...
...
@@ -183,16 +183,15 @@ private:
)
const
;
//-
Disallow default bitwise
copy construct
//-
No
copy construct
ensightCase
(
const
ensightCase
&
)
=
delete
;
//-
Disallow default bitwise
assignment
//-
No copy
assignment
void
operator
=
(
const
ensightCase
&
)
=
delete
;
public:
// Constructors
//- Construct from components
...
...
@@ -212,7 +211,6 @@ public:
);
//- Destructor
~
ensightCase
();
...
...
@@ -224,7 +222,7 @@ public:
//- Reference to the case options
inline
const
ensightCase
::
options
&
option
()
const
;
//-
A
scii/
B
inary
file output
//-
The output file format (a
scii/
b
inary
)
inline
IOstream
::
streamFormat
format
()
const
;
//- The nominal path to the case file
...
...
@@ -257,12 +255,12 @@ public:
//- Set current index and time for time-set 1.
// Create corresponding sub-directory
//
D
o not mix between nextTime and setTime in an application.
//
\note d
o not mix between nextTime and setTime in an application.
void
setTime
(
const
scalar
t
,
const
label
index
);
//- Set current index and time for time-set 1.
// Create corresponding sub-directory
//
D
o not mix between nextTime and setTime in an application.
//
\note d
o not mix between nextTime and setTime in an application.
void
setTime
(
const
instant
&
t
,
const
label
index
);
...
...
@@ -306,7 +304,7 @@ public:
inline
Ostream
&
operator
()()
const
;
//- Print some general information.
Ostream
&
printInfo
(
Ostream
&
)
const
;
Ostream
&
printInfo
(
Ostream
&
os
)
const
;
};
...
...
src/fileFormats/ensight/file/ensightCaseOptions.C
View file @
8c5d0cd8
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016
-2018
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -37,7 +37,7 @@ Foam::ensightCase::options::options(IOstream::streamFormat format)
nodeValues_
(
false
),
separateCloud_
(
false
)
{
width
(
8
);
//
e
nsures that
the
mask and printf-format are
also
resized
width
(
8
);
//
E
nsures that mask and printf-format are
properly
resized
}
...
...
@@ -63,7 +63,7 @@ Foam::word Foam::ensightCase::options::padded(const label i) const
::
snprintf
(
buf
,
32
,
printf_
.
c_str
(),
static_cast
<
int
>
(
i
));
buf
[
31
]
=
0
;
//
n
o stripping required
//
N
o stripping required
return
word
(
buf
,
false
);
}
...
...
@@ -76,21 +76,20 @@ Foam::label Foam::ensightCase::options::width() const
void
Foam
::
ensightCase
::
options
::
width
(
const
label
n
)
{
//
e
nforce min/max sanity limits
//
E
nforce min/max sanity limits
if
(
n
<
1
||
n
>
31
)
{
return
;
}
//
s
et mask accordingly
//
S
et mask accordingly
mask_
.
resize
(
n
,
'*'
);
//
a
ppropriate printf format
//
A
ppropriate printf format
printf_
=
"%0"
+
std
::
to_string
(
n
)
+
"d"
;
}
bool
Foam
::
ensightCase
::
options
::
overwrite
()
const
{
return
overwrite_
;
...
...
src/fileFormats/ensight/file/ensightCaseTemplates.C
View file @
8c5d0cd8
...
...
@@ -26,8 +26,7 @@ License
#include
"cloud.H"
#include
"ensightPTraits.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
<
class
Type
>
Foam
::
autoPtr
<
Foam
::
ensightFile
>
...
...
@@ -54,7 +53,7 @@ Foam::ensightCase::newData
);
output
().
newline
();
// note variable for later use
// note
field
variable for later use
noteVariable
(
varName
,
ensightPTraits
<
Type
>::
typeName
);
}
...
...
src/fileFormats/ensight/file/ensightFile.C
View file @
8c5d0cd8
...
...
@@ -335,15 +335,15 @@ void Foam::ensightFile::writeList
const
UList
<
scalar
>&
field
)
{
for
All
(
field
,
i
)
for
(
const
scalar
&
val
:
field
)
{
if
(
std
::
isnan
(
field
[
i
]
))
if
(
std
::
isnan
(
val
))
{
writeUndef
();
}
else
{
write
(
field
[
i
]
);
write
(
val
);
}
newline
();
...
...
@@ -359,15 +359,15 @@ void Foam::ensightFile::writeList
{
if
(
notNull
(
idList
))
{
for
All
(
idList
,
i
)
for
(
const
label
idx
:
idList
)
{
if
(
id
List
[
i
]
>=
field
.
size
()
||
std
::
isnan
(
field
[
id
List
[
i
]
]))
if
(
id
x
>=
field
.
size
()
||
std
::
isnan
(
field
[
id
x
]))
{
writeUndef
();
}
else
{
write
(
field
[
id
List
[
i
]
]);
write
(
field
[
id
x
]);
}
newline
();
...
...
@@ -375,7 +375,7 @@ void Foam::ensightFile::writeList
}
else
{
//
n
o idList => perNode
//
N
o idList => perNode
writeList
(
field
);
}
}
...
...
src/functionObjects/field/Make/files
View file @
8c5d0cd8
...
...
@@ -60,6 +60,7 @@ blendingFactor/blendingFactor.C
pressure/pressure.C
MachNo/MachNo.C
Curle/Curle.C
reference/reference.C
fieldsExpression/fieldsExpression.C
add/add.C
...
...
src/functionObjects/field/reference/reference.C
0 → 100644
View file @
8c5d0cd8
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include
"reference.H"
#include
"addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace
Foam
{
namespace
functionObjects
{
defineTypeNameAndDebug
(
reference
,
0
);
addToRunTimeSelectionTable
(
functionObject
,
reference
,
dictionary
);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool
Foam
::
functionObjects
::
reference
::
calc
()
{
Log
<<
type
()
<<
" "
<<
name
()
<<
" output:"
<<
nl
;
bool
processed
=
calcType
<
scalar
>
();
processed
=
processed
||
calcType
<
vector
>
();
processed
=
processed
||
calcType
<
sphericalTensor
>
();
processed
=
processed
||
calcType
<
symmTensor
>
();
processed
=
processed
||
calcType
<
tensor
>
();
Log
<<
endl
;
return
returnReduce
(
processed
,
orOp
<
bool
>
());
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
reference
::
reference
(
const
word
&
name
,
const
Time
&
runTime
,
const
dictionary
&
dict
)
:
fieldExpression
(
name
,
runTime
,
dict
),
localDict_
(
dict
),
position_
(
point
::
zero
),
celli_
(
-
1
),
interpolationScheme_
(
"cell"
),
scale_
(
1
)
{
read
(
dict
);
// Forcing default result name to include the name of the field
setResultName
(
typeName
,
word
::
null
);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
reference
::~
reference
()
{}
bool
Foam
::
functionObjects
::
reference
::
read
(
const
dictionary
&
dict
)
{
if
(
fieldExpression
::
read
(
dict
))
{
localDict_
=
dict
;