Exposing print_plot through C. Using in input_xml now.

This commit is contained in:
Patrick Shriwise 2018-10-13 21:24:25 -05:00
parent d11b90aa47
commit 41b58e0b9b
4 changed files with 26 additions and 74 deletions

View file

@ -31,6 +31,8 @@ std::string time_stamp();
void print_overlap_check();
extern "C" void print_plot();
extern "C" void title();
} // namespace openmc

View file

@ -23,7 +23,7 @@ module input_xml
use mgxs_interface
use nuclide_header
use multipole_header
use output, only: title, header, print_plot
use output, only: title, header
use photon_header
use plot_header
use random_lcg, only: prn
@ -102,6 +102,9 @@ module input_xml
type(C_PTR) :: node_ptr
end subroutine read_plots
subroutine print_plot() bind(C)
end subroutine print_plot
subroutine set_particle_energy_bounds(particle, E_min, E_max) bind(C)
import C_INT, C_DOUBLE
integer(C_INT), value :: particle

View file

@ -412,79 +412,6 @@ contains
end subroutine print_batch_keff
!===============================================================================
! PRINT_PLOT displays selected options for plotting
!===============================================================================
subroutine print_plot()
integer :: i ! loop index for plots
type(ObjectPlot), pointer :: pl
! Display header for plotting
call header("PLOTTING SUMMARY", 5)
do i = 1, n_plots
pl => plots(i)
! Plot id
write(ou,100) "Plot ID:", trim(to_str(pl % id))
! Plot filename
write(ou,100) "Plot file:", trim(pl % path_plot)
! Plot level
write(ou,100) "Universe depth:", trim(to_str(pl % level))
! Plot type
if (pl % type == PLOT_TYPE_SLICE) then
write(ou,100) "Plot Type:", "Slice"
else if (pl % type == PLOT_TYPE_VOXEL) then
write(ou,100) "Plot Type:", "Voxel"
end if
! Plot parameters
write(ou,100) "Origin:", trim(to_str(pl % origin(1))) // &
" " // trim(to_str(pl % origin(2))) // " " // &
trim(to_str(pl % origin(3)))
if (pl % type == PLOT_TYPE_SLICE) then
write(ou,100) "Width:", trim(to_str(pl % width(1))) // &
" " // trim(to_str(pl % width(2)))
else if (pl % type == PLOT_TYPE_VOXEL) then
write(ou,100) "Width:", trim(to_str(pl % width(1))) // &
" " // trim(to_str(pl % width(2))) // &
" " // trim(to_str(pl % width(3)))
end if
if (pl % color_by == PLOT_COLOR_CELLS) then
write(ou,100) "Coloring:", "Cells"
else if (pl % color_by == PLOT_COLOR_MATS) then
write(ou,100) "Coloring:", "Materials"
end if
if (pl % type == PLOT_TYPE_SLICE) then
select case (pl % basis)
case (PLOT_BASIS_XY)
write(ou,100) "Basis:", "xy"
case (PLOT_BASIS_XZ)
write(ou,100) "Basis:", "xz"
case (PLOT_BASIS_YZ)
write(ou,100) "Basis:", "yz"
end select
write(ou,100) "Pixels:", trim(to_str(pl % pixels(1))) // " " // &
trim(to_str(pl % pixels(2)))
else if (pl % type == PLOT_TYPE_VOXEL) then
write(ou,100) "Voxels:", trim(to_str(pl % pixels(1))) // " " // &
trim(to_str(pl % pixels(2))) // " " // trim(to_str(pl % pixels(3)))
end if
write(ou,*)
end do
! Format descriptor for columns
100 format (1X,A,T25,A)
end subroutine print_plot
!===============================================================================
! PRINT_RUNTIME displays the total time elapsed for the entire run, for
! initialization, for computation, and for intergeneration synchronization.

View file

@ -59,6 +59,7 @@ std::string time_stamp()
//===============================================================================
void print_plot() {
header("PLOTTING SUMMARY", 5);
for (auto pl : plots) {
@ -80,6 +81,25 @@ void print_plot() {
std::cout << "Origin: " << pl->origin[0] << " "
<< pl->origin[1] << " "
<< pl->origin[2] << std::endl;
if (PLOT_TYPE::SLICE == pl->type) {
std::cout << std::setprecision(4)
<< "Width: "
<< pl->width[0] << " "
<< pl->width[1] << std::endl;
} else if (PLOT_TYPE::VOXEL == pl->type) {
std::cout << std::setprecision(4)
<< "Width: "
<< pl->width[0] << " "
<< pl->width[1] << " "
<< pl->width[2] << std::endl;
}
if (PLOT_COLOR_BY::CELLS == pl->color_by) {
std::cout << "Coloring: Cells" << std::endl;
} else if (PLOT_COLOR_BY::MATS == pl->color_by) {
std::cout << "Coloring: Materials" << std::endl;
}
if (PLOT_TYPE::SLICE == pl->type) {
switch(pl->basis) {