mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Remove C++/Fortran interop code
This commit is contained in:
parent
b3191e3c9c
commit
2286b245bb
11 changed files with 81 additions and 312 deletions
|
|
@ -350,9 +350,7 @@ add_library(libopenmc SHARED
|
|||
src/tallies/tally_derivative_header.F90
|
||||
src/tallies/tally_filter.F90
|
||||
src/tallies/tally_filter_header.F90
|
||||
src/tallies/tally_filter_delayedgroup.F90
|
||||
src/tallies/tally_filter_distribcell.F90
|
||||
src/tallies/tally_filter_energy.F90
|
||||
src/tallies/tally_filter_particle.F90
|
||||
src/tallies/tally_filter_sph_harm.F90
|
||||
src/tallies/tally_header.F90
|
||||
|
|
|
|||
|
|
@ -51,20 +51,19 @@ extern "C" void
|
|||
calculate_xs_c(int i_mat, int gin, double sqrtkT, const double uvw[3],
|
||||
double& total_xs, double& abs_xs, double& nu_fiss_xs);
|
||||
|
||||
extern "C" double
|
||||
get_nuclide_xs_c(int index, int xstype, int gin, int* gout, double* mu, int* dg);
|
||||
double
|
||||
get_nuclide_xs(int index, int xstype, int gin, int* gout, double* mu, int* dg);
|
||||
|
||||
extern "C" double
|
||||
get_macro_xs_c(int index, int xstype, int gin, int* gout, double* mu, int* dg);
|
||||
inline double
|
||||
get_nuclide_xs(int index, int xstype, int gin)
|
||||
{return get_nuclide_xs(index, xstype, gin, nullptr, nullptr, nullptr);}
|
||||
|
||||
extern "C" void
|
||||
set_nuclide_angle_index_c(int index, const double uvw[3]);
|
||||
double
|
||||
get_macro_xs(int index, int xstype, int gin, int* gout, double* mu, int* dg);
|
||||
|
||||
extern "C" void
|
||||
set_macro_angle_index_c(int index, const double uvw[3]);
|
||||
|
||||
extern "C" void
|
||||
set_nuclide_temperature_index_c(int index, double sqrtkT);
|
||||
inline double
|
||||
get_macro_xs(int index, int xstype, int gin)
|
||||
{return get_macro_xs(index, xstype, gin, nullptr, nullptr, nullptr);}
|
||||
|
||||
//==============================================================================
|
||||
// General Mgxs methods
|
||||
|
|
|
|||
|
|
@ -35,53 +35,6 @@ module mgxs_interface
|
|||
real(C_DOUBLE) :: awr
|
||||
end function get_awr_c
|
||||
|
||||
function get_nuclide_xs_c(index, xstype, gin, gout, mu, dg) result(val) &
|
||||
bind(C)
|
||||
use ISO_C_BINDING
|
||||
implicit none
|
||||
integer(C_INT), value, intent(in) :: index
|
||||
integer(C_INT), value, intent(in) :: xstype
|
||||
integer(C_INT), value, intent(in) :: gin
|
||||
integer(C_INT), optional, intent(in) :: gout
|
||||
real(C_DOUBLE), optional, intent(in) :: mu
|
||||
integer(C_INT), optional, intent(in) :: dg
|
||||
real(C_DOUBLE) :: val
|
||||
end function get_nuclide_xs_c
|
||||
|
||||
function get_macro_xs_c(index, xstype, gin, gout, mu, dg) result(val) &
|
||||
bind(C)
|
||||
use ISO_C_BINDING
|
||||
implicit none
|
||||
integer(C_INT), value, intent(in) :: index
|
||||
integer(C_INT), value, intent(in) :: xstype
|
||||
integer(C_INT), value, intent(in) :: gin
|
||||
integer(C_INT), optional, intent(in) :: gout
|
||||
real(C_DOUBLE), optional, intent(in) :: mu
|
||||
integer(C_INT), optional, intent(in) :: dg
|
||||
real(C_DOUBLE) :: val
|
||||
end function get_macro_xs_c
|
||||
|
||||
subroutine set_nuclide_angle_index_c(index, uvw) bind(C)
|
||||
use ISO_C_BINDING
|
||||
implicit none
|
||||
integer(C_INT), value, intent(in) :: index
|
||||
real(C_DOUBLE), intent(in) :: uvw(1:3)
|
||||
end subroutine set_nuclide_angle_index_c
|
||||
|
||||
subroutine set_macro_angle_index_c(index, uvw) bind(C)
|
||||
use ISO_C_BINDING
|
||||
implicit none
|
||||
integer(C_INT), value, intent(in) :: index
|
||||
real(C_DOUBLE), intent(in) :: uvw(1:3)
|
||||
end subroutine set_macro_angle_index_c
|
||||
|
||||
subroutine set_nuclide_temperature_index_c(index, sqrtkT) bind(C)
|
||||
use ISO_C_BINDING
|
||||
implicit none
|
||||
integer(C_INT), value, intent(in) :: index
|
||||
real(C_DOUBLE), value, intent(in) :: sqrtkT
|
||||
end subroutine set_nuclide_temperature_index_c
|
||||
|
||||
end interface
|
||||
|
||||
! Number of energy groups
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ calculate_xs_c(int i_mat, int gin, double sqrtkT, const double uvw[3],
|
|||
//==============================================================================
|
||||
|
||||
double
|
||||
get_nuclide_xs_c(int index, int xstype, int gin, int* gout, double* mu, int* dg)
|
||||
get_nuclide_xs(int index, int xstype, int gin, int* gout, double* mu, int* dg)
|
||||
{
|
||||
int gout_c;
|
||||
int* gout_c_p;
|
||||
|
|
@ -255,7 +255,7 @@ get_nuclide_xs_c(int index, int xstype, int gin, int* gout, double* mu, int* dg)
|
|||
//==============================================================================
|
||||
|
||||
double
|
||||
get_macro_xs_c(int index, int xstype, int gin, int* gout, double* mu, int* dg)
|
||||
get_macro_xs(int index, int xstype, int gin, int* gout, double* mu, int* dg)
|
||||
{
|
||||
int gout_c;
|
||||
int* gout_c_p;
|
||||
|
|
@ -276,33 +276,6 @@ get_macro_xs_c(int index, int xstype, int gin, int* gout, double* mu, int* dg)
|
|||
return data::macro_xs[index - 1].get_xs(xstype, gin - 1, gout_c_p, mu, dg_c_p);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
||||
void
|
||||
set_nuclide_angle_index_c(int index, const double uvw[3])
|
||||
{
|
||||
// Update the values
|
||||
data::nuclides_MG[index - 1].set_angle_index(uvw);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
||||
void
|
||||
set_macro_angle_index_c(int index, const double uvw[3])
|
||||
{
|
||||
// Update the values
|
||||
data::macro_xs[index - 1].set_angle_index(uvw);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
||||
void
|
||||
set_nuclide_temperature_index_c(int index, double sqrtkT)
|
||||
{
|
||||
// Update the values
|
||||
data::nuclides_MG[index - 1].set_temperature_index(sqrtkT);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// General Mgxs methods
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -48,11 +48,4 @@ DelayedGroupFilter::text_label(int bin) const
|
|||
return "Delayed Group " + std::to_string(groups_[bin-1]);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// Fortran interoperability
|
||||
//==============================================================================
|
||||
|
||||
extern "C" int delayedgroup_filter_groups(DelayedGroupFilter* filt, int i)
|
||||
{return filt->groups_[i-1];}
|
||||
|
||||
} // namespace openmc
|
||||
|
|
|
|||
|
|
@ -112,24 +112,6 @@ EnergyoutFilter::text_label(int bin) const
|
|||
return out.str();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// Fortran interoperability
|
||||
//==============================================================================
|
||||
|
||||
extern "C" bool energy_filter_matches_transport_groups(EnergyFilter* filt)
|
||||
{return filt->matches_transport_groups_;}
|
||||
|
||||
extern "C" int
|
||||
energy_filter_search(const EnergyFilter* filt, double val)
|
||||
{
|
||||
if (val < filt->bins_.front() || val > filt->bins_.back()) {
|
||||
return -1;
|
||||
} else {
|
||||
//TODO: off-by-one
|
||||
return lower_bound_index(filt->bins_.begin(), filt->bins_.end(), val) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// C-API functions
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "openmc/mgxs_interface.h"
|
||||
#include "openmc/nuclide.h"
|
||||
#include "openmc/reaction_product.h"
|
||||
#include "openmc/search.h"
|
||||
#include "openmc/settings.h"
|
||||
#include "openmc/simulation.h"
|
||||
#include "openmc/tallies/derivative.h"
|
||||
|
|
@ -46,19 +47,6 @@ energy_filter_search(const EnergyFilter* filt, double val);
|
|||
|
||||
extern "C" double get_precursor_decay_rate(int i_nuclide, int d);
|
||||
|
||||
//==============================================================================
|
||||
// MG mode helper functions
|
||||
//TODO: move these or remove the need for them
|
||||
//==============================================================================
|
||||
|
||||
double
|
||||
get_nuclide_xs(int index, int xstype, int gin)
|
||||
{return get_nuclide_xs_c(index, xstype, gin, nullptr, nullptr, nullptr);}
|
||||
|
||||
double
|
||||
get_macro_xs(int index, int xstype, int gin)
|
||||
{return get_macro_xs_c(index, xstype, gin, nullptr, nullptr, nullptr);}
|
||||
|
||||
//==============================================================================
|
||||
// Global variable definitions
|
||||
//==============================================================================
|
||||
|
|
@ -772,10 +760,15 @@ score_fission_eout(Particle* p, int i_tally, int i_score, int score_bin)
|
|||
E_out = data::energy_bin_avg[static_cast<int>(bank.E)];
|
||||
}
|
||||
|
||||
//TODO: do this without the extern "C" function
|
||||
auto i_match = energy_filter_search(&eo_filt, E_out);
|
||||
if (i_match == -1) continue;
|
||||
simulation::filter_matches[i_eout_filt].bins_[i_bin-1] = i_match;
|
||||
// Set EnergyoutFilter bin index
|
||||
if (E_out < eo_filt.bins_.front() || E_out > eo_filt.bins_.back()) {
|
||||
continue;
|
||||
} else {
|
||||
//TODO: off-by-one
|
||||
auto i_match = lower_bound_index(eo_filt.bins_.begin(),
|
||||
eo_filt.bins_.end(), E_out) + 1;
|
||||
simulation::filter_matches[i_eout_filt].bins_[i_bin-1] = i_match;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1922,17 +1915,17 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
|
|||
score = p->last_wgt * flux;
|
||||
if (i_nuclide >= 0) {
|
||||
score *= atom_density
|
||||
* get_nuclide_xs_c(i_nuclide+1, MG_GET_XS_SCATTER_FMU_MULT,
|
||||
p->last_g, &p->g, &p->mu, nullptr)
|
||||
/ get_macro_xs_c(p->material, MG_GET_XS_SCATTER_FMU_MULT,
|
||||
p->last_g, &p->g, &p->mu, nullptr);
|
||||
* get_nuclide_xs(i_nuclide+1, MG_GET_XS_SCATTER_FMU_MULT,
|
||||
p->last_g, &p->g, &p->mu, nullptr)
|
||||
/ get_macro_xs(p->material, MG_GET_XS_SCATTER_FMU_MULT,
|
||||
p->last_g, &p->g, &p->mu, nullptr);
|
||||
}
|
||||
} else {
|
||||
if (i_nuclide >= 0) {
|
||||
score = atom_density * flux * get_nuclide_xs_c(
|
||||
score = atom_density * flux * get_nuclide_xs(
|
||||
i_nuclide+1, MG_GET_XS_SCATTER_MULT, p_g, nullptr, &p->mu, nullptr);
|
||||
} else {
|
||||
score = flux * get_macro_xs_c(
|
||||
score = flux * get_macro_xs(
|
||||
p->material, MG_GET_XS_SCATTER_MULT, p_g, nullptr, &p->mu, nullptr);
|
||||
}
|
||||
}
|
||||
|
|
@ -1952,10 +1945,10 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
|
|||
// adjust the score by the actual probability for that nuclide.
|
||||
if (i_nuclide >= 0) {
|
||||
score *= atom_density
|
||||
* get_nuclide_xs_c(i_nuclide+1, MG_GET_XS_SCATTER_FMU,
|
||||
p->last_g, &p->g, &p->mu, nullptr)
|
||||
/ get_macro_xs_c(p->material, MG_GET_XS_SCATTER_FMU,
|
||||
p->last_g, &p->g, &p->mu, nullptr);
|
||||
* get_nuclide_xs(i_nuclide+1, MG_GET_XS_SCATTER_FMU,
|
||||
p->last_g, &p->g, &p->mu, nullptr)
|
||||
/ get_macro_xs(p->material, MG_GET_XS_SCATTER_FMU,
|
||||
p->last_g, &p->g, &p->mu, nullptr);
|
||||
}
|
||||
} else {
|
||||
if (i_nuclide >= 0) {
|
||||
|
|
@ -2162,12 +2155,12 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
|
|||
score = p->absorb_wgt * flux;
|
||||
if (i_nuclide >= 0) {
|
||||
score *=
|
||||
get_nuclide_xs_c(i_nuclide+1, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
get_nuclide_xs(i_nuclide+1, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
/ get_macro_xs(p->material, MG_GET_XS_ABSORPTION, p_g);
|
||||
} else {
|
||||
score *=
|
||||
get_macro_xs_c(p->material, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
get_macro_xs(p->material, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
/ get_macro_xs(p->material, MG_GET_XS_ABSORPTION, p_g);
|
||||
}
|
||||
|
|
@ -2243,12 +2236,12 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
|
|||
auto d = filt.groups_[d_bin];
|
||||
if (i_nuclide >= 0) {
|
||||
score = flux * atom_density
|
||||
* get_nuclide_xs_c(i_nuclide+1, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d);
|
||||
* get_nuclide_xs(i_nuclide+1, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d);
|
||||
} else {
|
||||
score = flux
|
||||
* get_macro_xs_c(p->material, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d);
|
||||
* get_macro_xs(p->material, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d);
|
||||
}
|
||||
score_fission_delayed_dg(i_tally, d_bin+1, score, score_index);
|
||||
}
|
||||
|
|
@ -2284,17 +2277,17 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
|
|||
score = p->absorb_wgt * flux;
|
||||
if (i_nuclide >= 0) {
|
||||
score *=
|
||||
get_nuclide_xs_c(i_nuclide+1, MG_GET_XS_DECAY_RATE,
|
||||
get_nuclide_xs(i_nuclide+1, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_nuclide_xs(i_nuclide+1, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
*get_nuclide_xs_c(i_nuclide+1, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
/ get_macro_xs(p->material, MG_GET_XS_ABSORPTION, p_g);
|
||||
} else {
|
||||
score *=
|
||||
get_macro_xs_c(p->material, MG_GET_XS_DECAY_RATE,
|
||||
get_macro_xs(p->material, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_macro_xs(p->material, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_macro_xs_c(p->material, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
/ get_macro_xs(p->material, MG_GET_XS_ABSORPTION, p_g);
|
||||
}
|
||||
score_fission_delayed_dg(i_tally, d_bin+1, score,
|
||||
|
|
@ -2310,17 +2303,17 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
|
|||
for (auto d = 0; d < data::num_delayed_groups; ++d) {
|
||||
if (i_nuclide >= 0) {
|
||||
score += p->absorb_wgt * flux
|
||||
* get_nuclide_xs_c(i_nuclide+1, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
*get_nuclide_xs_c(i_nuclide+1, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_nuclide_xs(i_nuclide+1, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_nuclide_xs(i_nuclide+1, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
/ get_macro_xs(p->material, MG_GET_XS_ABSORPTION, p_g);
|
||||
} else {
|
||||
score += p->absorb_wgt * flux
|
||||
* get_macro_xs_c(p->material, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_macro_xs_c(p->material, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_macro_xs(p->material, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_macro_xs(p->material, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
/ get_macro_xs(p->material, MG_GET_XS_ABSORPTION, p_g);
|
||||
}
|
||||
}
|
||||
|
|
@ -2344,14 +2337,14 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
|
|||
if (g != 0) {
|
||||
if (i_nuclide >= 0) {
|
||||
score += simulation::keff * atom_density * bank.wgt * flux
|
||||
* get_nuclide_xs_c(i_nuclide+1, MG_GET_XS_DECAY_RATE, p_g,
|
||||
nullptr, nullptr, &g)
|
||||
* get_nuclide_xs(i_nuclide+1, MG_GET_XS_DECAY_RATE, p_g,
|
||||
nullptr, nullptr, &g)
|
||||
* get_nuclide_xs(i_nuclide+1, MG_GET_XS_FISSION, p_g)
|
||||
/ get_macro_xs(p->material, MG_GET_XS_FISSION, p_g);
|
||||
} else {
|
||||
score += simulation::keff * bank.wgt * flux
|
||||
* get_macro_xs_c(p->material, MG_GET_XS_DECAY_RATE, p_g,
|
||||
nullptr, nullptr, &g);
|
||||
* get_macro_xs(p->material, MG_GET_XS_DECAY_RATE, p_g,
|
||||
nullptr, nullptr, &g);
|
||||
}
|
||||
if (tally.delayedgroup_filter_ > 0) {
|
||||
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
|
||||
|
|
@ -2382,16 +2375,16 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
|
|||
auto d = filt.groups_[d_bin];
|
||||
if (i_nuclide >= 0) {
|
||||
score += atom_density * flux
|
||||
* get_nuclide_xs_c(i_nuclide+1, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_nuclide_xs_c(i_nuclide+1, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d);
|
||||
* get_nuclide_xs(i_nuclide+1, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_nuclide_xs(i_nuclide+1, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d);
|
||||
} else {
|
||||
score += flux
|
||||
* get_macro_xs_c(p->material, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_macro_xs_c(p->material, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d);
|
||||
* get_macro_xs(p->material, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_macro_xs(p->material, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d);
|
||||
}
|
||||
score_fission_delayed_dg(i_tally, d_bin+1, score, score_index);
|
||||
}
|
||||
|
|
@ -2401,16 +2394,16 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
|
|||
for (auto d = 0; d < data::num_delayed_groups; ++d) {
|
||||
if (i_nuclide >= 0) {
|
||||
score += atom_density * flux
|
||||
* get_nuclide_xs_c(i_nuclide+1, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_nuclide_xs_c(i_nuclide+1, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d);
|
||||
* get_nuclide_xs(i_nuclide+1, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_nuclide_xs(i_nuclide+1, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d);
|
||||
} else {
|
||||
score += flux
|
||||
* get_macro_xs_c(p->material, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_macro_xs_c(p->material, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d);
|
||||
* get_macro_xs(p->material, MG_GET_XS_DECAY_RATE,
|
||||
p_g, nullptr, nullptr, &d)
|
||||
* get_macro_xs(p->material, MG_GET_XS_DELAYED_NU_FISSION,
|
||||
p_g, nullptr, nullptr, &d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@ module tally_filter
|
|||
use tally_filter_header
|
||||
|
||||
! Inherit other filters
|
||||
use tally_filter_delayedgroup
|
||||
use tally_filter_distribcell
|
||||
use tally_filter_energy
|
||||
use tally_filter_particle
|
||||
use tally_filter_sph_harm
|
||||
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
module tally_filter_delayedgroup
|
||||
|
||||
use, intrinsic :: ISO_C_BINDING
|
||||
|
||||
use tally_filter_header
|
||||
|
||||
implicit none
|
||||
private
|
||||
|
||||
!===============================================================================
|
||||
! DELAYEDGROUPFILTER bins outgoing fission neutrons in their delayed groups.
|
||||
! The get_all_bins functionality is not actually used. The bins are manually
|
||||
! iterated over in the scoring subroutines.
|
||||
!===============================================================================
|
||||
|
||||
type, public, extends(TallyFilter) :: DelayedGroupFilter
|
||||
contains
|
||||
procedure :: groups
|
||||
end type DelayedGroupFilter
|
||||
|
||||
contains
|
||||
|
||||
function groups(this, i) result(group)
|
||||
class(DelayedGroupFilter), intent(in) :: this
|
||||
integer, intent(in) :: i
|
||||
integer :: group
|
||||
interface
|
||||
function delayedgroup_filter_groups(filt, i) result(group) bind(C)
|
||||
import C_PTR, C_INT
|
||||
type(C_PTR), value :: filt
|
||||
integer(C_INT), value :: i
|
||||
integer(C_INT) :: group
|
||||
end function
|
||||
end interface
|
||||
group = delayedgroup_filter_groups(this % ptr, i)
|
||||
end function groups
|
||||
|
||||
end module tally_filter_delayedgroup
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
module tally_filter_energy
|
||||
|
||||
use, intrinsic :: ISO_C_BINDING
|
||||
|
||||
use tally_filter_header
|
||||
use xml_interface
|
||||
|
||||
implicit none
|
||||
private
|
||||
public :: openmc_energy_filter_get_bins
|
||||
public :: openmc_energy_filter_set_bins
|
||||
|
||||
interface
|
||||
function openmc_energy_filter_get_bins(index, energies, n) result(err) bind(C)
|
||||
import C_INT32_T, C_PTR, C_INT
|
||||
integer(C_INT32_T), value :: index
|
||||
type(C_PTR), intent(out) :: energies
|
||||
integer(C_INT32_T), intent(out) :: n
|
||||
integer(C_INT) :: err
|
||||
end function
|
||||
function openmc_energy_filter_set_bins(index, n, energies) result(err) bind(C)
|
||||
import C_INT32_T, C_DOUBLE, C_INT
|
||||
integer(C_INT32_T), value, intent(in) :: index
|
||||
integer(C_INT32_T), value, intent(in) :: n
|
||||
real(C_DOUBLE), intent(in) :: energies(n)
|
||||
integer(C_INT) :: err
|
||||
end function
|
||||
end interface
|
||||
|
||||
!===============================================================================
|
||||
! ENERGYFILTER bins the incident neutron energy.
|
||||
!===============================================================================
|
||||
|
||||
type, public, extends(TallyFilter) :: EnergyFilter
|
||||
! True if transport group number can be used directly to get bin number
|
||||
logical :: matches_transport_groups = .false.
|
||||
contains
|
||||
procedure :: from_xml => from_xml_energy
|
||||
procedure :: search
|
||||
end type EnergyFilter
|
||||
|
||||
!===============================================================================
|
||||
! ENERGYOUTFILTER bins the outgoing neutron energy. Only scattering events use
|
||||
! the get_all_bins functionality. Nu-fission tallies manually iterate over the
|
||||
! filter bins.
|
||||
!===============================================================================
|
||||
|
||||
type, public, extends(EnergyFilter) :: EnergyoutFilter
|
||||
end type EnergyoutFilter
|
||||
|
||||
contains
|
||||
|
||||
!===============================================================================
|
||||
! EnergyFilter methods
|
||||
!===============================================================================
|
||||
|
||||
subroutine from_xml_energy(this, node)
|
||||
class(EnergyFilter), intent(inout) :: this
|
||||
type(XMLNode), intent(in) :: node
|
||||
|
||||
interface
|
||||
function energy_filter_matches_transport_groups(filt) result(matches) &
|
||||
bind(C)
|
||||
import C_PTR, C_BOOL
|
||||
type(C_PTR), value :: filt
|
||||
logical(C_BOOL) :: matches
|
||||
end function
|
||||
end interface
|
||||
|
||||
call this % from_xml_cpp(node)
|
||||
this % n_bins = this % n_bins_cpp()
|
||||
this % matches_transport_groups = &
|
||||
energy_filter_matches_transport_groups(this % ptr)
|
||||
end subroutine from_xml_energy
|
||||
|
||||
function search(this, val) result(bin)
|
||||
class(EnergyFilter), intent(in) :: this
|
||||
real(8), intent(in) :: val
|
||||
integer :: bin
|
||||
interface
|
||||
function energy_filter_search(filt, val) result(bin) bind(C)
|
||||
import C_PTR, C_DOUBLE, C_INT
|
||||
type(C_PTR), value :: filt
|
||||
real(C_DOUBLE), value :: val
|
||||
integer(C_INT) :: bin
|
||||
end function
|
||||
end interface
|
||||
bin = energy_filter_search(this % ptr, val)
|
||||
end function search
|
||||
|
||||
end module tally_filter_energy
|
||||
|
|
@ -79,6 +79,15 @@ module tally_filter_header
|
|||
type, public, extends(CellFilter) :: CellFromFilter
|
||||
end type
|
||||
|
||||
type, public, extends(TallyFilter) :: DelayedGroupFilter
|
||||
end type
|
||||
|
||||
type, public, extends(TallyFilter) :: EnergyFilter
|
||||
end type
|
||||
|
||||
type, public, extends(EnergyFilter) :: EnergyoutFilter
|
||||
end type
|
||||
|
||||
type, public, extends(TallyFilter) :: EnergyFunctionFilter
|
||||
end type
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue