Skip to content

Commit 9a2298f

Browse files
committed
Move read_ce_cross_sections to C++
1 parent fe9f774 commit 9a2298f

27 files changed

Lines changed: 454 additions & 497 deletions

‎CMakeLists.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ add_library(libopenmc SHARED
335335
src/random_lcg.F90
336336
src/reaction_header.F90
337337
src/relaxng
338-
src/sab_header.F90
339338
src/set_header.F90
340339
src/settings.F90
341340
src/simulation_header.F90

‎include/openmc/cross_sections.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ extern std::map<LibraryKey, std::size_t> library_map;
5757

5858
//! Read cross sections file (either XML or multigroup H5) and populate data
5959
//! libraries
60-
extern "C" void read_cross_sections_xml();
60+
void read_cross_sections_xml();
6161

6262
//! Read cross_sections.xml and populate data libraries
6363
void read_ce_cross_sections_xml();

‎include/openmc/geometry_aux.h‎

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,46 @@
66

77
#include <cstdint>
88
#include <string>
9-
9+
#include <vector>
1010

1111
namespace openmc {
1212

1313
//==============================================================================
1414
//! Replace Universe, Lattice, and Material IDs with indices.
1515
//==============================================================================
1616

17-
extern "C" void adjust_indices();
17+
void adjust_indices();
1818

1919
//==============================================================================
2020
//! Assign defaults to cells with undefined temperatures.
2121
//==============================================================================
2222

23-
extern "C" void assign_temperatures();
23+
void assign_temperatures();
24+
25+
//==============================================================================
26+
//! \brief Obtain a list of temperatures that each nuclide/thermal scattering
27+
//! table appears at in the model. Later, this list is used to determine the
28+
//! actual temperatures to read (which may be different if interpolation is
29+
//! used)
30+
//!
31+
//! \param[out] nuc_temps Vector of temperatures for each nuclide
32+
//! \param[out] thermal_temps Vector of tempratures for each thermal scattering
33+
//! table
34+
//==============================================================================
35+
36+
void get_temperatures(std::vector<std::vector<double>>& nuc_temps,
37+
std::vector<std::vector<double>>& thermal_temps);
38+
39+
//==============================================================================
40+
//! \brief Perform final setup for geometry
41+
//!
42+
//! \param[out] nuc_temps Vector of temperatures for each nuclide
43+
//! \param[out] thermal_temps Vector of tempratures for each thermal scattering
44+
//! table
45+
//==============================================================================
46+
47+
void finalize_geometry(std::vector<std::vector<double>>& nuc_temps,
48+
std::vector<std::vector<double>>& thermal_temps);
2449

2550
//==============================================================================
2651
//! Figure out which Universe is the root universe.
@@ -36,7 +61,7 @@ extern "C" int32_t find_root_universe();
3661
//! Populate all data structures needed for distribcells.
3762
//==============================================================================
3863

39-
extern "C" void prepare_distribcell();
64+
void prepare_distribcell();
4065

4166
//==============================================================================
4267
//! Recursively search through the geometry and count cell instances.

‎include/openmc/initialize.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ int parse_command_line(int argc, char* argv[]);
1111
#ifdef OPENMC_MPI
1212
void initialize_mpi(MPI_Comm intracomm);
1313
#endif
14+
void read_input_xml();
1415

1516
}
1617

‎include/openmc/material.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ class Material
9393
void calculate_photon_xs(const Particle& p) const;
9494
};
9595

96+
void read_ce_cross_sections(const std::vector<std::vector<double>>& nuc_temps,
97+
const std::vector<std::vector<double>>& thermal_temps);
98+
9699
//==============================================================================
97100
// Fortran compatibility
98101
//==============================================================================

‎include/openmc/nuclide.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ class Nuclide {
169169
static int XS_PHOTON_PROD;
170170
};
171171

172+
//==============================================================================
173+
// Non-member functions
174+
//==============================================================================
175+
176+
void check_data_version(hid_t file_id);
177+
172178
//==============================================================================
173179
// Global variables
174180
//==============================================================================

‎include/openmc/output.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extern "C" void print_particle(Particle* p);
3737
//! Display plot information.
3838
//==============================================================================
3939

40-
extern "C" void print_plot();
40+
void print_plot();
4141

4242
//==============================================================================
4343
//! Display information regarding cell overlap checking.

‎include/openmc/settings.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ extern double weight_survive; //!< Survival weight after Russian roulette
9797

9898
//! Read settings from XML file
9999
//! \param[in] root XML node for <settings>
100-
extern "C" void read_settings_xml();
100+
void read_settings_xml();
101101

102102
extern "C" void read_settings_xml_f(pugi::xml_node_struct* root_ptr);
103103

‎include/openmc/timer.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extern Timer time_bank_sendrecv;
2020
extern Timer time_finalize;
2121
extern Timer time_inactive;
2222
extern Timer time_initialize;
23+
extern Timer time_read_xs;
2324
extern Timer time_tallies;
2425
extern Timer time_total;
2526
extern Timer time_transport;

‎src/api.F90‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ end subroutine free_memory_bank
8787

8888
subroutine free_memory_cmfd() bind(C)
8989
end subroutine free_memory_cmfd
90+
91+
subroutine sab_clear() bind(C)
92+
end subroutine
9093
end interface
9194

9295
call free_memory_geometry()
@@ -97,7 +100,7 @@ end subroutine free_memory_cmfd
97100
call free_memory_nuclide()
98101
call free_memory_photon()
99102
call free_memory_settings()
100-
call free_memory_sab()
103+
call sab_clear()
101104
call free_memory_source()
102105
call free_memory_mesh()
103106
call free_memory_tally()

0 commit comments

Comments
 (0)