mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-21 14:35:27 -04:00
Some checks are pending
Tests and Coverage / filter-changes (push) Waiting to run
Tests and Coverage / Python 3.13 (omp=n, mpi=n, dagmc=, libmesh=, event= (push) Blocked by required conditions
Tests and Coverage / Python 3.14 (omp=n, mpi=n, dagmc=, libmesh=, event= (push) Blocked by required conditions
Tests and Coverage / Python 3.14t (omp=n, mpi=n, dagmc=, libmesh=, event= (push) Blocked by required conditions
Tests and Coverage / Python 3.12 (omp=n, mpi=n, dagmc=n, libmesh=n, event=n (push) Blocked by required conditions
Tests and Coverage / Python 3.12 (omp=y, mpi=n, dagmc=n, libmesh=n, event=n (push) Blocked by required conditions
Tests and Coverage / Python 3.12 (omp=n, mpi=y, dagmc=n, libmesh=n, event=n (push) Blocked by required conditions
Tests and Coverage / Python 3.12 (omp=y, mpi=y, dagmc=n, libmesh=n, event=n (push) Blocked by required conditions
Tests and Coverage / Python 3.12 (omp=y, mpi=n, dagmc=, libmesh=y, event= (push) Blocked by required conditions
Tests and Coverage / Python 3.12 (omp=y, mpi=n, dagmc=, libmesh=, event=y (push) Blocked by required conditions
Tests and Coverage / Python 3.12 (omp=y, mpi=y, dagmc=y, libmesh=, event= (push) Blocked by required conditions
Tests and Coverage / Python 3.12 (omp=y, mpi=y, dagmc=, libmesh=y, event= (push) Blocked by required conditions
Tests and Coverage / coverage (push) Blocked by required conditions
Tests and Coverage / Check CI status (push) Blocked by required conditions
dockerhub-publish-develop / main (push) Waiting to run
dockerhub-publish-develop-dagmc-libmesh / main (push) Waiting to run
dockerhub-publish-develop-dagmc / main (push) Waiting to run
dockerhub-publish-develop-libmesh / main (push) Waiting to run
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
35 lines
1 KiB
C++
35 lines
1 KiB
C++
#define _USE_MATH_DEFINES
|
|
#include <cmath> // for M_PI
|
|
#include <memory> // for unique_ptr
|
|
|
|
#include "openmc/particle.h"
|
|
#include "openmc/random_lcg.h"
|
|
#include "openmc/source.h"
|
|
|
|
class RingSource : public openmc::Source {
|
|
openmc::SourceSite sample(uint64_t* seed) const
|
|
{
|
|
openmc::SourceSite particle;
|
|
// particle type
|
|
particle.particle = openmc::ParticleType::neutron();
|
|
// position
|
|
double angle = 2.0 * M_PI * openmc::prn(seed);
|
|
double radius = 3.0;
|
|
particle.r.x = radius * std::cos(angle);
|
|
particle.r.y = radius * std::sin(angle);
|
|
particle.r.z = 0.0;
|
|
// angle
|
|
particle.u = {1.0, 0.0, 0.0};
|
|
particle.E = 14.08e6;
|
|
return particle;
|
|
}
|
|
};
|
|
|
|
// A function to create a unique pointer to an instance of this class when
|
|
// generated via a plugin call using dlopen/dlsym. You must have external C
|
|
// linkage here otherwise dlopen will not find the file
|
|
extern "C" std::unique_ptr<RingSource> openmc_create_source(
|
|
std::string parameters)
|
|
{
|
|
return std::make_unique<RingSource>();
|
|
}
|