mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Making Position/Direction structs more friendly for array-based signatures.
This commit is contained in:
parent
2e4809c8d5
commit
baa92194ef
3 changed files with 5 additions and 13 deletions
|
|
@ -57,9 +57,7 @@ struct Position {
|
|||
}
|
||||
|
||||
// Data members
|
||||
double x = 0.;
|
||||
double y = 0.;
|
||||
double z = 0.;
|
||||
union{ double xyz[3]; struct{ double x,y,z; }; };
|
||||
};
|
||||
|
||||
// Binary operators
|
||||
|
|
|
|||
|
|
@ -599,12 +599,10 @@ CADCell::CADCell() : Cell{} {};
|
|||
|
||||
std::pair<double, int32_t> CADCell::distance(Position p, Direction u, int32_t on_surface) const {
|
||||
|
||||
double xyz[3] = {p.x, p.y, p.z};
|
||||
double uvw[3] = {u.x, u.y, u.z};
|
||||
moab::EntityHandle vol = dagmc_ptr->entity_by_id(3, id);
|
||||
moab::EntityHandle hit_surf;
|
||||
double dist;
|
||||
dagmc_ptr->ray_fire(vol, xyz, uvw, hit_surf, dist);
|
||||
dagmc_ptr->ray_fire(vol, p.xyz, u.xyz, hit_surf, dist);
|
||||
|
||||
int surf_idx = dagmc_ptr->index_by_handle(hit_surf);
|
||||
|
||||
|
|
@ -615,12 +613,10 @@ std::pair<double, int32_t> CADCell::distance(Position p, Direction u, int32_t on
|
|||
|
||||
bool CADCell::contains(Position p, Direction u, int32_t on_surface) const {
|
||||
|
||||
double xyz[3] = {p.x, p.y, p.z};
|
||||
double uvw[3] = {u.x, u.y, u.z};
|
||||
moab::EntityHandle vol = dagmc_ptr->entity_by_id(3, id);
|
||||
|
||||
int result = 0;
|
||||
dagmc_ptr->point_in_volume(vol, xyz, result, uvw);
|
||||
dagmc_ptr->point_in_volume(vol, p.xyz, result, u.xyz);
|
||||
|
||||
return bool(result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -262,11 +262,9 @@ double CADSurface::distance(Position p, Direction u, bool coincident) const {
|
|||
|
||||
Direction CADSurface::normal(Position p) const {
|
||||
|
||||
double xyz[3] = {p.x, p.y, p.z};
|
||||
double uvw[3];
|
||||
Direction u;
|
||||
moab::EntityHandle surf = dagmc_ptr->entity_by_id(2, id);
|
||||
dagmc_ptr->get_angle(surf, xyz, uvw);
|
||||
Direction u = {uvw};
|
||||
dagmc_ptr->get_angle(surf, p.xyz, u.xyz);
|
||||
return u;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue