mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 05:05:30 -04:00
Add a LocalCoord::rotate method as suggested by @pshriwise
This commit is contained in:
parent
1bdb92ff10
commit
11eb891e21
3 changed files with 18 additions and 10 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#include <memory> // for unique_ptr
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "openmc/constants.h"
|
||||
#include "openmc/position.h"
|
||||
|
|
@ -38,7 +39,13 @@ constexpr double CACHE_INVALID {-1.0};
|
|||
// Class declarations
|
||||
//==============================================================================
|
||||
|
||||
struct LocalCoord {
|
||||
class LocalCoord {
|
||||
public:
|
||||
void rotate(const std::vector<double>& rotation);
|
||||
|
||||
//! clear data from a single coordinate level
|
||||
void reset();
|
||||
|
||||
Position r; //!< particle position
|
||||
Direction u; //!< particle direction
|
||||
int cell {-1};
|
||||
|
|
@ -48,9 +55,6 @@ struct LocalCoord {
|
|||
int lattice_y {-1};
|
||||
int lattice_z {-1};
|
||||
bool rotated {false}; //!< Is the level rotated?
|
||||
|
||||
//! clear data from a single coordinate level
|
||||
void reset();
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -182,9 +182,7 @@ find_cell_inner(Particle* p, const NeighborList* neighbor_list)
|
|||
|
||||
// Apply rotation.
|
||||
if (!c.rotation_.empty()) {
|
||||
coord.r = coord.r.rotate(c.rotation_);
|
||||
coord.u = coord.u.rotate(c.rotation_);
|
||||
coord.rotated = true;
|
||||
coord.rotate(c.rotation_);
|
||||
}
|
||||
|
||||
// Update the coordinate level and recurse.
|
||||
|
|
@ -207,9 +205,7 @@ find_cell_inner(Particle* p, const NeighborList* neighbor_list)
|
|||
|
||||
// Apply rotation.
|
||||
if (!c.rotation_.empty()) {
|
||||
coord.r = coord.r.rotate(c.rotation_);
|
||||
coord.u = coord.u.rotate(c.rotation_);
|
||||
coord.rotated = true;
|
||||
coord.rotate(c.rotation_);
|
||||
}
|
||||
|
||||
// Determine lattice indices.
|
||||
|
|
|
|||
|
|
@ -33,6 +33,14 @@ namespace openmc {
|
|||
// LocalCoord implementation
|
||||
//==============================================================================
|
||||
|
||||
void
|
||||
LocalCoord::rotate(const std::vector<double>& rotation)
|
||||
{
|
||||
this->r = this->r.rotate(rotation);
|
||||
this->u = this->u.rotate(rotation);
|
||||
this->rotated = true;
|
||||
}
|
||||
|
||||
void
|
||||
LocalCoord::reset()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue