mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Remove Fortan compatibility functions
This commit is contained in:
parent
6712de2ad9
commit
3cac2a6702
27 changed files with 115 additions and 635 deletions
|
|
@ -106,7 +106,7 @@ private:
|
|||
};
|
||||
|
||||
//==============================================================================
|
||||
// Fortran compatibility
|
||||
// Non-member functions
|
||||
//==============================================================================
|
||||
|
||||
//! Read material data from materials.xml
|
||||
|
|
@ -114,12 +114,5 @@ void read_materials_xml();
|
|||
|
||||
void free_memory_material();
|
||||
|
||||
//==============================================================================
|
||||
// Fortran compatibility
|
||||
//==============================================================================
|
||||
|
||||
extern "C" int* material_element(int i_material);
|
||||
extern "C" bool material_isotropic(int i_material, int i_nuc_mat);
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_MATERIAL_H
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ private:
|
|||
//! Checks for the right version of nuclear data within HDF5 files
|
||||
void check_data_version(hid_t file_id);
|
||||
|
||||
extern "C" bool multipole_in_range(const Nuclide* nuc, double E);
|
||||
bool multipole_in_range(const Nuclide* nuc, double E);
|
||||
|
||||
//==============================================================================
|
||||
// Global variables
|
||||
|
|
@ -209,14 +209,6 @@ extern MaterialMacroXS material_xs;
|
|||
|
||||
void nuclides_clear();
|
||||
|
||||
//==============================================================================
|
||||
// Fortran compatibility
|
||||
//==============================================================================
|
||||
|
||||
extern "C" void set_micro_xs();
|
||||
extern "C" void nuclide_calculate_urr_xs(bool use_mp, int i_nuclide,
|
||||
int i_temp, double E);
|
||||
|
||||
} // namespace openmc
|
||||
|
||||
#endif // OPENMC_NUCLIDE_H
|
||||
|
|
|
|||
|
|
@ -56,5 +56,7 @@ void print_runtime();
|
|||
//! Display results for global tallies including k-effective estimators
|
||||
void print_results();
|
||||
|
||||
void write_tallies();
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_OUTPUT_H
|
||||
|
|
|
|||
|
|
@ -38,151 +38,133 @@ enum class ParticleType {
|
|||
neutron, photon, electron, positron
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
struct LocalCoord {
|
||||
int cell {-1};
|
||||
int universe {-1};
|
||||
int lattice {-1};
|
||||
int lattice_x {-1};
|
||||
int lattice_y {-1};
|
||||
int lattice_z {-1};
|
||||
double xyz[3]; //!< particle position
|
||||
double uvw[3]; //!< particle direction
|
||||
bool rotated {false}; //!< Is the level rotated?
|
||||
|
||||
struct LocalCoord {
|
||||
int cell {-1};
|
||||
int universe {-1};
|
||||
int lattice {-1};
|
||||
int lattice_x {-1};
|
||||
int lattice_y {-1};
|
||||
int lattice_z {-1};
|
||||
double xyz[3]; //!< particle position
|
||||
double uvw[3]; //!< particle direction
|
||||
bool rotated {false}; //!< Is the level rotated?
|
||||
//! clear data from a single coordinate level
|
||||
void reset();
|
||||
};
|
||||
|
||||
//! clear data from a single coordinate level
|
||||
void reset();
|
||||
};
|
||||
//============================================================================
|
||||
//! State of a particle being transported through geometry
|
||||
//============================================================================
|
||||
|
||||
//============================================================================
|
||||
//! State of a particle being transported through geometry
|
||||
//============================================================================
|
||||
struct Particle {
|
||||
int64_t id; //!< Unique ID
|
||||
int type; //!< Particle type (n, p, e, etc.)
|
||||
|
||||
struct Particle {
|
||||
int64_t id; //!< Unique ID
|
||||
int type; //!< Particle type (n, p, e, etc.)
|
||||
int n_coord; //!< number of current coordinate levels
|
||||
int cell_instance; //!< offset for distributed properties
|
||||
LocalCoord coord[MAX_COORD]; //!< coordinates for all levels
|
||||
|
||||
int n_coord; //!< number of current coordinate levels
|
||||
int cell_instance; //!< offset for distributed properties
|
||||
LocalCoord coord[MAX_COORD]; //!< coordinates for all levels
|
||||
// Particle coordinates before crossing a surface
|
||||
int last_n_coord; //!< number of current coordinates
|
||||
int last_cell[MAX_COORD]; //!< coordinates for all levels
|
||||
|
||||
// Particle coordinates before crossing a surface
|
||||
int last_n_coord; //!< number of current coordinates
|
||||
int last_cell[MAX_COORD]; //!< coordinates for all levels
|
||||
// Energy data
|
||||
double E; //!< post-collision energy in eV
|
||||
double last_E; //!< pre-collision energy in eV
|
||||
int g; //!< post-collision energy group (MG only)
|
||||
int last_g; //!< pre-collision energy group (MG only)
|
||||
|
||||
// Energy data
|
||||
double E; //!< post-collision energy in eV
|
||||
double last_E; //!< pre-collision energy in eV
|
||||
int g; //!< post-collision energy group (MG only)
|
||||
int last_g; //!< pre-collision energy group (MG only)
|
||||
// Other physical data
|
||||
double wgt; //!< particle weight
|
||||
double mu; //!< angle of scatter
|
||||
bool alive; //!< is particle alive?
|
||||
|
||||
// Other physical data
|
||||
double wgt; //!< particle weight
|
||||
double mu; //!< angle of scatter
|
||||
bool alive; //!< is particle alive?
|
||||
// Other physical data
|
||||
double last_xyz_current[3]; //!< coordinates of the last collision or
|
||||
//!< reflective/periodic surface crossing for
|
||||
//!< current tallies
|
||||
double last_xyz[3]; //!< previous coordinates
|
||||
double last_uvw[3]; //!< previous direction coordinates
|
||||
double last_wgt; //!< pre-collision particle weight
|
||||
double absorb_wgt; //!< weight absorbed for survival biasing
|
||||
|
||||
// Other physical data
|
||||
double last_xyz_current[3]; //!< coordinates of the last collision or
|
||||
//!< reflective/periodic surface crossing for
|
||||
//!< current tallies
|
||||
double last_xyz[3]; //!< previous coordinates
|
||||
double last_uvw[3]; //!< previous direction coordinates
|
||||
double last_wgt; //!< pre-collision particle weight
|
||||
double absorb_wgt; //!< weight absorbed for survival biasing
|
||||
// What event took place
|
||||
bool fission; //!< did particle cause implicit fission
|
||||
int event; //!< scatter, absorption
|
||||
int event_nuclide; //!< index in nuclides array
|
||||
int event_MT; //!< reaction MT
|
||||
int delayed_group; //!< delayed group
|
||||
|
||||
// What event took place
|
||||
bool fission; //!< did particle cause implicit fission
|
||||
int event; //!< scatter, absorption
|
||||
int event_nuclide; //!< index in nuclides array
|
||||
int event_MT; //!< reaction MT
|
||||
int delayed_group; //!< delayed group
|
||||
// Post-collision physical data
|
||||
int n_bank; //!< number of fission sites banked
|
||||
double wgt_bank; //!< weight of fission sites banked
|
||||
int n_delayed_bank[MAX_DELAYED_GROUPS]; //!< number of delayed fission
|
||||
//!< sites banked
|
||||
|
||||
// Post-collision physical data
|
||||
int n_bank; //!< number of fission sites banked
|
||||
double wgt_bank; //!< weight of fission sites banked
|
||||
int n_delayed_bank[MAX_DELAYED_GROUPS]; //!< number of delayed fission
|
||||
//!< sites banked
|
||||
// Indices for various arrays
|
||||
int surface; //!< index for surface particle is on
|
||||
int cell_born; //!< index for cell particle was born in
|
||||
int material; //!< index for current material
|
||||
int last_material; //!< index for last material
|
||||
|
||||
// Indices for various arrays
|
||||
int surface; //!< index for surface particle is on
|
||||
int cell_born; //!< index for cell particle was born in
|
||||
int material; //!< index for current material
|
||||
int last_material; //!< index for last material
|
||||
// Temperature of current cell
|
||||
double sqrtkT; //!< sqrt(k_Boltzmann * temperature) in eV
|
||||
double last_sqrtkT; //!< last temperature
|
||||
|
||||
// Temperature of current cell
|
||||
double sqrtkT; //!< sqrt(k_Boltzmann * temperature) in eV
|
||||
double last_sqrtkT; //!< last temperature
|
||||
// Statistical data
|
||||
int n_collision; //!< number of collisions
|
||||
|
||||
// Statistical data
|
||||
int n_collision; //!< number of collisions
|
||||
// Track output
|
||||
bool write_track {false};
|
||||
|
||||
// Track output
|
||||
bool write_track {false};
|
||||
// Secondary particles created
|
||||
int64_t n_secondary {};
|
||||
Bank secondary_bank[MAX_SECONDARY];
|
||||
|
||||
// Secondary particles created
|
||||
int64_t n_secondary {};
|
||||
Bank secondary_bank[MAX_SECONDARY];
|
||||
//! resets all coordinate levels for the particle
|
||||
void clear();
|
||||
|
||||
//! resets all coordinate levels for the particle
|
||||
void clear();
|
||||
//! create a secondary particle
|
||||
//
|
||||
//! stores the current phase space attributes of the particle in the
|
||||
//! secondary bank and increments the number of sites in the secondary bank.
|
||||
//! \param uvw Direction of the secondary particle
|
||||
//! \param E Energy of the secondary particle in [eV]
|
||||
//! \param type Particle type
|
||||
//! \param run_CE Whether continuous-energy data is being used
|
||||
void create_secondary(const double* uvw, double E, int type, bool run_CE);
|
||||
|
||||
//! create a secondary particle
|
||||
//
|
||||
//! stores the current phase space attributes of the particle in the
|
||||
//! secondary bank and increments the number of sites in the secondary bank.
|
||||
//! \param uvw Direction of the secondary particle
|
||||
//! \param E Energy of the secondary particle in [eV]
|
||||
//! \param type Particle type
|
||||
//! \param run_CE Whether continuous-energy data is being used
|
||||
void create_secondary(const double* uvw, double E, int type, bool run_CE);
|
||||
//! sets default attributes for a particle
|
||||
void initialize();
|
||||
|
||||
//! sets default attributes for a particle
|
||||
void initialize();
|
||||
//! initialize from a source site
|
||||
//
|
||||
//! initializes a particle from data stored in a source site. The source
|
||||
//! site may have been produced from an external source, from fission, or
|
||||
//! simply as a secondary particle.
|
||||
//! \param src Source site data
|
||||
void from_source(const Bank* src);
|
||||
|
||||
//! initialize from a source site
|
||||
//
|
||||
//! initializes a particle from data stored in a source site. The source
|
||||
//! site may have been produced from an external source, from fission, or
|
||||
//! simply as a secondary particle.
|
||||
//! \param src Source site data
|
||||
void from_source(const Bank* src);
|
||||
//! Transport a particle from birth to death
|
||||
void transport();
|
||||
|
||||
//! Transport a particle from birth to death
|
||||
void transport();
|
||||
//! Cross a surface and handle boundary conditions
|
||||
void cross_surface();
|
||||
|
||||
//! Cross a surface and handle boundary conditions
|
||||
void cross_surface();
|
||||
//! mark a particle as lost and create a particle restart file
|
||||
//! \param message A warning message to display
|
||||
void mark_as_lost(const char* message);
|
||||
|
||||
//! mark a particle as lost and create a particle restart file
|
||||
//! \param message A warning message to display
|
||||
void mark_as_lost(const char* message);
|
||||
void mark_as_lost(const std::string& message)
|
||||
{mark_as_lost(message.c_str());}
|
||||
|
||||
void mark_as_lost(const std::string& message)
|
||||
{mark_as_lost(message.c_str());}
|
||||
void mark_as_lost(const std::stringstream& message)
|
||||
{mark_as_lost(message.str());}
|
||||
|
||||
void mark_as_lost(const std::stringstream& message)
|
||||
{mark_as_lost(message.str());}
|
||||
|
||||
//! create a particle restart HDF5 file
|
||||
void write_restart() const;
|
||||
};
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Fortran compatibility functions
|
||||
//============================================================================
|
||||
|
||||
void reset_coord(LocalCoord* c);
|
||||
void particle_clear(Particle* p);
|
||||
void particle_create_secondary(Particle* p, const double* uvw, double E,
|
||||
int type, bool run_CE);
|
||||
void particle_initialize(Particle* p);
|
||||
void particle_from_source(Particle* p, const Bank* src);
|
||||
void particle_mark_as_lost(Particle* p, const char* message);
|
||||
void particle_write_restart(Particle* p);
|
||||
|
||||
} // extern "C"
|
||||
//! create a particle restart HDF5 file
|
||||
void write_restart() const;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
|
||||
|
|
|
|||
|
|
@ -46,28 +46,6 @@ public:
|
|||
|
||||
std::string reaction_name(int mt);
|
||||
|
||||
//==============================================================================
|
||||
// Fortran compatibility functions
|
||||
//==============================================================================
|
||||
|
||||
extern "C" {
|
||||
int reaction_mt(Reaction* rx);
|
||||
double reaction_q_value(Reaction* rx);
|
||||
bool reaction_scatter_in_cm(Reaction* rx);
|
||||
bool reaction_redundant(Reaction* rx);
|
||||
double reaction_product_decay_rate(Reaction* rx, int product);
|
||||
int reaction_product_emission_mode(Reaction* rx, int product);
|
||||
int reaction_product_particle(Reaction* rx, int product);
|
||||
void reaction_product_sample(Reaction* rx, int product, double E_in,
|
||||
double* E_out, double* mu);
|
||||
int reaction_products_size(Reaction* rx);
|
||||
double reaction_product_yield(Reaction* rx, int product, double E);
|
||||
double reaction_sample_elastic_mu(Reaction* rx, double E);
|
||||
double reaction_xs(Reaction* xs, int temperature, int energy);
|
||||
int reaction_xs_size(Reaction* xs, int temperature);
|
||||
int reaction_xs_threshold(Reaction* xs, int temperature);
|
||||
}
|
||||
|
||||
} // namespace openmc
|
||||
|
||||
#endif // OPENMC_REACTION_H
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ namespace model {
|
|||
|
||||
Filter* allocate_filter(const std::string& type);
|
||||
|
||||
// Filter-related Fortran functions that will be called from C++
|
||||
//! Make sure index corresponds to a valid filter
|
||||
int verify_filter(int32_t index);
|
||||
|
||||
} // namespace openmc
|
||||
|
|
|
|||
|
|
@ -7,9 +7,8 @@
|
|||
|
||||
namespace openmc {
|
||||
|
||||
//TODO: those integer values are not needed when Fortran interop is removed
|
||||
enum class SphericalHarmonicsCosine {
|
||||
scatter = 1, particle = 2
|
||||
scatter, particle
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -7,9 +7,8 @@
|
|||
|
||||
namespace openmc {
|
||||
|
||||
//TODO: those integer values are not needed when Fortran interop is removed
|
||||
enum class LegendreAxis {
|
||||
x = 1, y = 2, z = 3
|
||||
x, y, z
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue