Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
39000e8e
Commit
39000e8e
authored
2 months ago
by
Kutalmış Berçin
Browse files
Options
Downloads
Patches
Plain Diff
WIP: collect the data writer routines into functions
parent
5fa93325
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/functionObjects/field/fieldStatistics/fieldStatistics.C
+83
-67
83 additions, 67 deletions
src/functionObjects/field/fieldStatistics/fieldStatistics.C
src/functionObjects/field/fieldStatistics/fieldStatistics.H
+6
-0
6 additions, 0 deletions
src/functionObjects/field/fieldStatistics/fieldStatistics.H
with
89 additions
and
67 deletions
src/functionObjects/field/fieldStatistics/fieldStatistics.C
+
83
−
67
View file @
39000e8e
...
...
@@ -143,6 +143,87 @@ void Foam::functionObjects::fieldStatistics::writeFileHeader
}
void
Foam
::
functionObjects
::
fieldStatistics
::
writeStatData
()
{
for
(
const
word
&
fieldName
:
fieldSet_
.
selectionNames
())
{
const
auto
&
results
=
results_
(
fieldName
);
if
(
!
results
.
size
())
break
;
OFstream
&
file
=
*
filePtrs_
(
fieldName
);
writeCurrentTime
(
file
);
for
(
const
auto
&
iter
:
results
.
csorted
())
{
const
variantOutput
&
value
=
iter
.
val
();
std
::
visit
(
[
&
file
](
const
auto
&
v
)
{
if
constexpr
(
is_vectorspace_v
<
std
::
decay_t
<
decltype
(
v
)
>>
)
{
for
(
const
auto
&
val
:
v
)
file
<<
token
::
TAB
<<
val
;
}
else
{
file
<<
token
::
TAB
<<
v
;
}
},
value
);
}
file
<<
nl
;
}
}
void
Foam
::
functionObjects
::
fieldStatistics
::
logStatData
()
{
for
(
const
word
&
fieldName
:
fieldSet_
.
selectionNames
())
{
const
auto
&
results
=
results_
(
fieldName
);
if
(
!
results
.
size
())
break
;
Info
<<
nl
<<
" Field "
<<
fieldName
<<
nl
;
for
(
const
auto
&
iter
:
results
.
csorted
())
{
const
word
&
name
=
iter
.
key
();
const
variantOutput
&
value
=
iter
.
val
();
std
::
visit
(
[
name
](
const
auto
&
v
)
{
if
constexpr
(
is_vectorspace_v
<
std
::
decay_t
<
decltype
(
v
)
>>
)
{
Info
<<
" "
<<
name
<<
" "
;
for
(
const
auto
&
val
:
v
)
Info
<<
val
<<
" "
;
Info
<<
nl
;
}
else
{
Info
<<
" "
<<
name
<<
" "
<<
v
<<
nl
;
}
},
value
);
}
}
Info
<<
endl
;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
functionObjects
::
fieldStatistics
::
fieldStatistics
...
...
@@ -261,78 +342,13 @@ bool Foam::functionObjects::fieldStatistics::write()
// Write the statistical results to the output file if requested
if
(
writeToFile
())
{
for
(
const
word
&
fieldName
:
fieldSet_
.
selectionNames
())
{
const
auto
&
results
=
results_
(
fieldName
);
OFstream
&
file
=
*
filePtrs_
(
fieldName
);
writeCurrentTime
(
file
);
for
(
const
auto
&
iter
:
results
.
csorted
())
{
const
variantOutput
&
value
=
iter
.
val
();
std
::
visit
(
[
&
file
](
const
auto
&
v
)
{
if
constexpr
(
is_vectorspace_v
<
std
::
decay_t
<
decltype
(
v
)
>>
)
{
for
(
const
auto
&
val
:
v
)
file
<<
token
::
TAB
<<
val
;
}
else
{
file
<<
token
::
TAB
<<
v
;
}
},
value
);
}
file
<<
nl
;
}
writeStatData
();
}
// Print the statistical results to the standard stream if requested
if
(
log
)
{
for
(
const
word
&
fieldName
:
fieldSet_
.
selectionNames
())
{
const
auto
&
results
=
results_
(
fieldName
);
Info
<<
nl
<<
" Field "
<<
fieldName
<<
nl
;
for
(
const
auto
&
iter
:
results
.
csorted
())
{
const
word
&
name
=
iter
.
key
();
const
variantOutput
&
value
=
iter
.
val
();
std
::
visit
(
[
name
](
const
auto
&
v
)
{
if
constexpr
(
is_vectorspace_v
<
std
::
decay_t
<
decltype
(
v
)
>>
)
{
Info
<<
" "
<<
name
<<
" "
;
for
(
const
auto
&
val
:
v
)
Info
<<
val
<<
" "
;
Info
<<
nl
;
}
else
{
Info
<<
" "
<<
name
<<
" "
<<
v
<<
nl
;
}
},
value
);
}
}
Info
<<
endl
;
logStatData
();
}
return
true
;
...
...
This diff is collapsed.
Click to expand it.
src/functionObjects/field/fieldStatistics/fieldStatistics.H
+
6
−
0
View file @
39000e8e
...
...
@@ -249,6 +249,12 @@ class fieldStatistics
//- Output the file header information
void
writeFileHeader
(
Ostream
&
os
,
const
word
&
fieldName
);
//-
void
writeStatData
();
//-
void
logStatData
();
public
:
//- Runtime type information
...
...
This diff is collapsed.
Click to expand it.
Kutalmış Berçin
@kuti
mentioned in commit
cea23d3b
·
2 months ago
mentioned in commit
cea23d3b
mentioned in commit cea23d3bf048c9c13a5d397e1e47e37a6c878e67
Toggle commit list
Kutalmış Berçin
@kuti
mentioned in commit
4b88d5e1
·
2 months ago
mentioned in commit
4b88d5e1
mentioned in commit 4b88d5e1537d50dd72e6bf086c7a0adba12cc4b6
Toggle commit list
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment