Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
MostafaMollaali
dynamic
Commits
d0ea102c
Commit
d0ea102c
authored
8 years ago
by
Christoph Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
[PL] restructured Output class
parent
fe4fc9d2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ProcessLib/Output.cpp
+30
-30
30 additions, 30 deletions
ProcessLib/Output.cpp
ProcessLib/Output.h
+13
-17
13 additions, 17 deletions
ProcessLib/Output.h
with
43 additions
and
47 deletions
ProcessLib/Output.cpp
+
30
−
30
View file @
d0ea102c
...
...
@@ -86,25 +86,20 @@ newInstance(const BaseLib::ConfigTree &config, std::string const& output_directo
return
out
;
}
void
Output
::
initialize
(
Output
::
ProcessIter
first
,
const
Output
::
ProcessIter
&
last
)
void
Output
::
addProcess
(
ProcessLib
::
Process
const
&
process
,
const
unsigned
pcs_idx
)
{
for
(
unsigned
pcs_idx
=
0
;
first
!=
last
;
++
first
,
++
pcs_idx
)
{
auto
const
filename
=
_output_file_prefix
+
"_pcs_"
+
std
::
to_string
(
pcs_idx
)
+
".pvd"
;
_single_process_data
.
emplace
(
std
::
piecewise_construct
,
std
::
forward_as_tuple
(
&**
first
),
std
::
forward_as_tuple
(
pcs_idx
,
filename
));
}
auto
const
filename
=
_output_file_prefix
+
"_pcs_"
+
std
::
to_string
(
pcs_idx
)
+
".pvd"
;
_single_process_data
.
emplace
(
std
::
piecewise_construct
,
std
::
forward_as_tuple
(
&
process
),
std
::
forward_as_tuple
(
pcs_idx
,
filename
));
}
void
Output
::
doOutputAlways
(
Process
const
&
process
,
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
)
void
Output
::
doOutputAlways
(
Process
const
&
process
,
Process
Output
const
&
process
_output
,
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
)
{
BaseLib
::
RunTime
time_output
;
time_output
.
start
();
...
...
@@ -122,33 +117,36 @@ doOutputAlways(Process const& process,
+
"_t_"
+
std
::
to_string
(
t
)
+
".vtu"
;
DBUG
(
"output to %s"
,
output_file_name
.
c_str
());
process
.
output
(
output_file_name
,
timestep
,
x
);
doProcessOutput
(
output_file_name
,
x
,
process
.
getMesh
(),
process
.
getDOFTable
(),
process
.
getProcessVariables
(),
process
.
getSecondaryVariables
(),
process_output
);
spd
.
pvd_file
.
addVTUFile
(
output_file_name
,
t
);
INFO
(
"[time] Output took %g s."
,
time_output
.
elapsed
());
}
void
Output
::
doOutput
(
Process
const
&
process
,
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
)
void
Output
::
doOutput
(
Process
const
&
process
,
Process
Output
const
&
process
_output
,
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
)
{
if
(
shallDoOutput
(
timestep
,
_repeats_each_steps
))
doOutputAlways
(
process
,
timestep
,
t
,
x
);
doOutputAlways
(
process
,
process_output
,
timestep
,
t
,
x
);
}
void
Output
::
doOutputLastTimestep
(
Process
const
&
process
,
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
)
void
Output
::
doOutputLastTimestep
(
Process
const
&
process
,
Process
Output
const
&
process
_output
,
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
)
{
if
(
!
shallDoOutput
(
timestep
,
_repeats_each_steps
))
doOutputAlways
(
process
,
timestep
,
t
,
x
);
doOutputAlways
(
process
,
process_output
,
timestep
,
t
,
x
);
}
void
Output
::
doOutputNonlinearIteration
(
Process
const
&
process
,
ProcessOutput
const
&
process_output
,
const
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
,
const
unsigned
iteration
)
const
...
...
@@ -172,7 +170,9 @@ void Output::doOutputNonlinearIteration(Process const& process,
+
"_nliter_"
+
std
::
to_string
(
iteration
)
+
".vtu"
;
DBUG
(
"output iteration results to %s"
,
output_file_name
.
c_str
());
process
.
output
(
output_file_name
,
timestep
,
x
);
doProcessOutput
(
output_file_name
,
x
,
process
.
getMesh
(),
process
.
getDOFTable
(),
process
.
getProcessVariables
(),
process
.
getSecondaryVariables
(),
process_output
);
INFO
(
"[time] Output took %g s."
,
time_output
.
elapsed
());
}
...
...
This diff is collapsed.
Click to expand it.
ProcessLib/Output.h
+
13
−
17
View file @
d0ea102c
...
...
@@ -13,6 +13,7 @@
#include
"BaseLib/ConfigTree.h"
#include
"MeshLib/IO/VtkIO/PVDFile.h"
#include
"Process.h"
#include
"ProcessOutput.h"
namespace
ProcessLib
{
...
...
@@ -29,38 +30,33 @@ public:
newInstance
(
const
BaseLib
::
ConfigTree
&
config
,
const
std
::
string
&
output_directory
);
using
ProcessIter
=
std
::
vector
<
std
::
unique_ptr
<
ProcessLib
::
Process
>>
::
const_iterator
;
//! Opens a PVD file for each process.
void
initialize
(
ProcessIter
first
,
const
ProcessIter
&
last
);
//! TODO doc. Opens a PVD file for each process.
void
addProcess
(
ProcessLib
::
Process
const
&
process
,
const
unsigned
pcs_idx
);
//! Writes output for the given \c process if it should be written in the
//! given \c timestep.
void
doOutput
(
Process
const
&
process
,
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
);
void
doOutput
(
Process
const
&
process
,
ProcessOutput
const
&
process_output
,
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
);
//! Writes output for the given \c process if it has not been written yet.
//! This method is intended for doing output after the last timestep in order
//! to make sure that its results are written.
void
doOutputLastTimestep
(
Process
const
&
process
,
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
);
void
doOutputLastTimestep
(
Process
const
&
process
,
Process
Output
const
&
process
_output
,
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
);
//! Writes output for the given \c process.
//! This method will always write.
//! It is intended to write output in error handling routines.
void
doOutputAlways
(
Process
const
&
process
,
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
);
void
doOutputAlways
(
Process
const
&
process
,
ProcessOutput
const
&
process_output
,
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
);
//! Writes output for the given \c process.
//! To be used for debug output after an iteration of the nonlinear solver.
void
doOutputNonlinearIteration
(
Process
const
&
process
,
ProcessOutput
const
&
process_output
,
const
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
,
const
unsigned
iteration
)
const
;
...
...
This diff is collapsed.
Click to expand it.
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