Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Dmitri Naumov
ogs
Commits
8df3818e
Unverified
Commit
8df3818e
authored
7 years ago
by
wenqing
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2036 from wenqing/fix_output
[VTU] Fixed pvd output
parents
7b2d4f19
2045ff62
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ProcessLib/Output.cpp
+44
-33
44 additions, 33 deletions
ProcessLib/Output.cpp
ProcessLib/Output.h
+9
-3
9 additions, 3 deletions
ProcessLib/Output.h
ProcessLib/UncoupledProcessesTimeLoop.cpp
+2
-2
2 additions, 2 deletions
ProcessLib/UncoupledProcessesTimeLoop.cpp
with
55 additions
and
38 deletions
ProcessLib/Output.cpp
+
44
−
33
View file @
8df3818e
...
@@ -134,35 +134,30 @@ void Output::addProcess(ProcessLib::Process const& process,
...
@@ -134,35 +134,30 @@ void Output::addProcess(ProcessLib::Process const& process,
std
::
forward_as_tuple
(
filename
));
std
::
forward_as_tuple
(
filename
));
}
}
Output
::
SingleProcessData
Output
::
findSingleProcessData
(
Output
::
SingleProcessData
*
Output
::
findSingleProcessData
(
Process
const
&
process
,
const
unsigned
process_id
)
const
Process
const
&
process
,
const
int
process_id
)
{
{
if
(
process
.
isMonolithicSchemeUsed
())
{
auto
spd_it
=
_single_process_data
.
find
(
&
process
);
if
(
spd_it
==
_single_process_data
.
end
())
{
OGS_FATAL
(
"The given process is not contained in the output"
" configuration. Aborting."
);
}
return
spd_it
->
second
;
}
auto
spd_range
=
_single_process_data
.
equal_range
(
&
process
);
auto
spd_range
=
_single_process_data
.
equal_range
(
&
process
);
unsigned
counter
=
0
;
int
counter
=
0
;
SingleProcessData
*
spd_ptr
=
nullptr
;
for
(
auto
spd_it
=
spd_range
.
first
;
spd_it
!=
spd_range
.
second
;
++
spd_it
)
for
(
auto
spd_it
=
spd_range
.
first
;
spd_it
!=
spd_range
.
second
;
++
spd_it
)
{
{
if
(
counter
==
process_id
)
if
(
counter
==
process_id
)
{
{
return
spd_it
->
second
;
spd_ptr
=
&
spd_it
->
second
;
break
;
}
}
counter
++
;
counter
++
;
}
}
if
(
spd_ptr
==
nullptr
)
{
OGS_FATAL
(
"The given process is not contained in the output"
" configuration. Aborting."
);
}
OGS_FATAL
(
"The given process is not contained in the output"
return
spd_ptr
;
" configuration. Aborting."
);
}
}
void
Output
::
doOutputAlways
(
Process
const
&
process
,
void
Output
::
doOutputAlways
(
Process
const
&
process
,
const
int
process_id
,
const
int
process_id
,
ProcessOutput
const
&
process_output
,
ProcessOutput
const
&
process_output
,
...
@@ -173,7 +168,7 @@ void Output::doOutputAlways(Process const& process,
...
@@ -173,7 +168,7 @@ void Output::doOutputAlways(Process const& process,
BaseLib
::
RunTime
time_output
;
BaseLib
::
RunTime
time_output
;
time_output
.
start
();
time_output
.
start
();
auto
spd
=
findSingleProcessData
(
process
,
process_id
);
SingleProcessData
*
spd_ptr
=
findSingleProcessData
(
process
,
process_id
);
std
::
string
const
output_file_name
=
std
::
string
const
output_file_name
=
_output_file_prefix
+
"_pcs_"
+
std
::
to_string
(
process_id
)
_output_file_prefix
+
"_pcs_"
+
std
::
to_string
(
process_id
)
...
@@ -182,22 +177,27 @@ void Output::doOutputAlways(Process const& process,
...
@@ -182,22 +177,27 @@ void Output::doOutputAlways(Process const& process,
+
".vtu"
;
+
".vtu"
;
std
::
string
const
output_file_path
=
BaseLib
::
joinPaths
(
_output_directory
,
output_file_name
);
std
::
string
const
output_file_path
=
BaseLib
::
joinPaths
(
_output_directory
,
output_file_name
);
const
bool
make_out
=
!
(
process_id
<
static_cast
<
int
>
(
_single_process_data
.
size
())
-
1
&&
!
(
process
.
isMonolithicSchemeUsed
()));
if
(
make_out
)
// For the staggered scheme for the coupling, only the last process, which
// gives the latest solution within a coupling loop, is allowed to make
// output.
const
bool
make_output
=
process_id
==
static_cast
<
int
>
(
_single_process_data
.
size
())
-
1
||
process
.
isMonolithicSchemeUsed
();
if
(
make_output
)
{
DBUG
(
"output to %s"
,
output_file_path
.
c_str
());
DBUG
(
"output to %s"
,
output_file_path
.
c_str
());
}
doProcessOutput
(
output_file_path
,
make_out
,
_output_file_compression
,
// Need to add variables of process to vtu even no output takes place.
doProcessOutput
(
output_file_path
,
make_output
,
_output_file_compression
,
_output_file_data_mode
,
t
,
x
,
process
.
getMesh
(),
_output_file_data_mode
,
t
,
x
,
process
.
getMesh
(),
process
.
getDOFTable
(),
process
.
getProcessVariables
(),
process
.
getDOFTable
(),
process
.
getProcessVariables
(),
process
.
getSecondaryVariables
(),
process_output
);
process
.
getSecondaryVariables
(),
process_output
);
if
(
make_out
)
if
(
make_out
put
)
{
{
spd
.
pvd_file
.
addVTUFile
(
output_file_name
,
t
);
spd_ptr
->
pvd_file
.
addVTUFile
(
output_file_name
,
t
);
INFO
(
"[time] Output of timestep %d took %g s."
,
timestep
,
INFO
(
"[time] Output of timestep %d took %g s."
,
timestep
,
time_output
.
elapsed
());
time_output
.
elapsed
());
}
}
...
@@ -242,7 +242,7 @@ void Output::doOutputNonlinearIteration(Process const& process,
...
@@ -242,7 +242,7 @@ void Output::doOutputNonlinearIteration(Process const& process,
ProcessOutput
const
&
process_output
,
ProcessOutput
const
&
process_output
,
const
unsigned
timestep
,
const
double
t
,
const
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
,
GlobalVector
const
&
x
,
const
unsigned
iteration
)
const
const
unsigned
iteration
)
{
{
if
(
!
_output_nonlinear_iteration_results
)
if
(
!
_output_nonlinear_iteration_results
)
{
{
...
@@ -252,6 +252,7 @@ void Output::doOutputNonlinearIteration(Process const& process,
...
@@ -252,6 +252,7 @@ void Output::doOutputNonlinearIteration(Process const& process,
BaseLib
::
RunTime
time_output
;
BaseLib
::
RunTime
time_output
;
time_output
.
start
();
time_output
.
start
();
// Only check whether a process data is available for output.
findSingleProcessData
(
process
,
process_id
);
findSingleProcessData
(
process
,
process_id
);
std
::
string
const
output_file_name
=
std
::
string
const
output_file_name
=
...
@@ -261,17 +262,27 @@ void Output::doOutputNonlinearIteration(Process const& process,
...
@@ -261,17 +262,27 @@ void Output::doOutputNonlinearIteration(Process const& process,
+
"_nliter_"
+
std
::
to_string
(
iteration
)
+
"_nliter_"
+
std
::
to_string
(
iteration
)
+
".vtu"
;
+
".vtu"
;
std
::
string
const
output_file_path
=
BaseLib
::
joinPaths
(
_output_directory
,
output_file_name
);
std
::
string
const
output_file_path
=
BaseLib
::
joinPaths
(
_output_directory
,
output_file_name
);
DBUG
(
"output iteration results to %s"
,
output_file_path
.
c_str
());
const
bool
make_out
=
// For the staggered scheme for the coupling, only the last process, which
!
(
process_id
<
static_cast
<
int
>
(
_single_process_data
.
size
())
-
1
&&
// gives the latest solution within a coupling loop, is allowed to make
!
(
process
.
isMonolithicSchemeUsed
()));
// output.
doProcessOutput
(
output_file_path
,
make_out
,
_output_file_compression
,
const
bool
make_output
=
process_id
==
static_cast
<
int
>
(
_single_process_data
.
size
())
-
1
||
process
.
isMonolithicSchemeUsed
();
if
(
make_output
)
{
DBUG
(
"output iteration results to %s"
,
output_file_path
.
c_str
());
}
doProcessOutput
(
output_file_path
,
make_output
,
_output_file_compression
,
_output_file_data_mode
,
t
,
x
,
process
.
getMesh
(),
_output_file_data_mode
,
t
,
x
,
process
.
getMesh
(),
process
.
getDOFTable
(),
process
.
getProcessVariables
(),
process
.
getDOFTable
(),
process
.
getProcessVariables
(),
process
.
getSecondaryVariables
(),
process_output
);
process
.
getSecondaryVariables
(),
process_output
);
if
(
make_out
)
if
(
make_output
)
{
INFO
(
"[time] Output took %g s."
,
time_output
.
elapsed
());
INFO
(
"[time] Output took %g s."
,
time_output
.
elapsed
());
}
}
}
}
// namespace ProcessLib
}
// namespace ProcessLib
This diff is collapsed.
Click to expand it.
ProcessLib/Output.h
+
9
−
3
View file @
8df3818e
...
@@ -64,7 +64,7 @@ public:
...
@@ -64,7 +64,7 @@ public:
ProcessOutput
const
&
process_output
,
ProcessOutput
const
&
process_output
,
const
unsigned
timestep
,
const
double
t
,
const
unsigned
timestep
,
const
double
t
,
GlobalVector
const
&
x
,
GlobalVector
const
&
x
,
const
unsigned
iteration
)
const
;
const
unsigned
iteration
);
struct
PairRepeatEachSteps
struct
PairRepeatEachSteps
{
{
...
@@ -107,8 +107,14 @@ private:
...
@@ -107,8 +107,14 @@ private:
std
::
multimap
<
Process
const
*
,
SingleProcessData
>
_single_process_data
;
std
::
multimap
<
Process
const
*
,
SingleProcessData
>
_single_process_data
;
SingleProcessData
findSingleProcessData
(
/**
Process
const
&
process
,
const
unsigned
process_id
)
const
;
* Get the address of a SingleProcessData from _single_process_data.
* @param process Process.
* @param process_id Process ID.
* @return Address of a SingleProcessData.
*/
SingleProcessData
*
findSingleProcessData
(
Process
const
&
process
,
const
int
process_id
);
};
};
}
}
This diff is collapsed.
Click to expand it.
ProcessLib/UncoupledProcessesTimeLoop.cpp
+
2
−
2
View file @
8df3818e
...
@@ -417,8 +417,8 @@ std::vector<GlobalVector*> setInitialConditions(
...
@@ -417,8 +417,8 @@ std::vector<GlobalVector*> setInitialConditions(
bool
solveOneTimeStepOneProcess
(
const
unsigned
process_index
,
bool
solveOneTimeStepOneProcess
(
const
unsigned
process_index
,
GlobalVector
&
x
,
std
::
size_t
const
timestep
,
GlobalVector
&
x
,
std
::
size_t
const
timestep
,
double
const
t
,
double
const
delta_t
,
double
const
t
,
double
const
delta_t
,
SingleProcessData
&
process_data
,
SingleProcessData
const
&
process_data
,
Output
const
&
output_control
)
Output
&
output_control
)
{
{
auto
&
process
=
process_data
.
process
;
auto
&
process
=
process_data
.
process
;
auto
&
time_disc
=
*
process_data
.
time_disc
;
auto
&
time_disc
=
*
process_data
.
time_disc
;
...
...
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