whoops, including files

This commit is contained in:
Adam G Nelson 2018-10-08 14:01:52 -04:00
parent f3fb3d1979
commit 960f71e276
2 changed files with 52 additions and 0 deletions

View file

@ -0,0 +1,20 @@
//! \file physics_mg.h
//! Methods needed to perform the collision physics for multi-group mode
#ifndef OPENMC_PHYSICS_MG_H
#define OPENMC_PHYSICS_MG_H
#include "openmc/particle.h"
namespace openmc {
//==============================================================================
// SCATTER
//==============================================================================
//! \brief Samples the scattering event
extern "C" void
scatter(Particle* p, const double* energy_bin_avg);
} // namespace openmc
#endif // OPENMC_PHYSICS_MG_H

32
src/physics_mg.cpp Normal file
View file

@ -0,0 +1,32 @@
#include "openmc/physics_mg.h"
#include "openmc/constants.h"
#include "openmc/math_functions.h"
#include "openmc/mgxs_interface.h"
namespace openmc {
void scatter(Particle* p, const double* energy_bin_avg)
{
// Adjust indices for Fortran to C++ indexing
// TODO: Remove when no longer needed
int gin = p->last_g - 1;
int gout = p->g - 1;
int i_mat = p->material - 1;
macro_xs[i_mat].sample_scatter(gin, gout, p->mu, p->wgt);
// Adjust return value for fortran indexing
// TODO: Remove when no longer needed
p->g = gout + 1;
// Rotate the angle
rotate_angle_c(p->coord[0].uvw, p->mu, nullptr);
// Update energy value for downstream compatability (in tallying)
p->E = energy_bin_avg[gout];
// Set event component
p->event = EVENT_SCATTER;
}
} //namespace openmc