Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clean changes
  • Loading branch information
zoeprieto committed Oct 15, 2024
commit 1c07c3463537c01ffa85a1a81dfb897ebf30d0e1
20 changes: 18 additions & 2 deletions openmc/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,8 +808,24 @@ class MeshFilter(Filter):
This array specifies a vector that is used to translate (shift) the mesh
for this filter
rotation : Iterable of float
This array specifies a vector that is used to rotate the mesh for this
filter
This array specifies the angles in degrees about the x, y, and z axes
that the filled universe should be rotated. The rotation applied
is an intrinsic rotation with specified Tait-Bryan angles. That is to
say, if the angles are :math:`(\phi, \theta, \psi)`, then the rotation
matrix applied is :math:`R_z(\psi) R_y(\theta) R_x(\phi)` or
Comment thread
zoeprieto marked this conversation as resolved.
Resolved

.. math::

\left [ \begin{array}{ccc} \cos\theta \cos\psi & -\cos\phi \sin\psi
+ \sin\phi \sin\theta \cos\psi & \sin\phi \sin\psi + \cos\phi
\sin\theta \cos\psi \\ \cos\theta \sin\psi & \cos\phi \cos\psi +
\sin\phi \sin\theta \sin\psi & -\sin\phi \cos\psi + \cos\phi
\sin\theta \sin\psi \\ -\sin\theta & \sin\phi \cos\theta & \cos\phi
\cos\theta \end{array} \right ]

A rotation matrix can also be specified directly by setting this
attribute to a nested list (or 2D numpy array) that specifies each
element of the matrix.
bins : list of tuple
A list of mesh indices for each filter bin, e.g. [(1, 1, 1), (2, 1, 1),
...]
Expand Down
21 changes: 1 addition & 20 deletions src/tallies/filter_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,7 @@ void MeshFilter::set_translation(const double translation[3])

void MeshFilter::set_rotation(const vector<double>& rot)
{
//rotated_ = true;
rotation_.clear();

//if (rot.size() != 3 && rot.size() != 9) {
// fatal_error(fmt::format("Non-3D rotation vector applied to mesh filter {}", id_));
//}
rotated_ = true;

// Compute and store the rotation matrix.
rotation_.clear();
Expand Down Expand Up @@ -274,14 +269,6 @@ extern "C" int openmc_mesh_filter_get_rotation(
std::memcpy(rot, mesh_filter->rotation().data(), *n * sizeof(mesh_filter->rotation()[0]));
return 0;

//// Get rotation from the mesh filter and set value
//auto mesh_filter = dynamic_cast<MeshFilter*>(filter.get());
//const auto& r = mesh_filter->rotation();
//for (int i = 0; i < 3; i++) {
// rotation[i] = r[i];
//}
//mesh_filter->set_rotation();
//return 0;
}

//! Set the flattened rotation matrix of a mesh filter
Expand All @@ -304,13 +291,7 @@ extern "C" int openmc_mesh_filter_set_rotation(
std::vector<double> vec_rot(rot, rot + rot_len);
mesh_filter->set_rotation(vec_rot);
return 0;
//// Get a pointer to the filter and downcast
//auto mesh_filter = dynamic_cast<MeshFilter*>(filter.get());

//// Set the rotation
//mesh_filter->set_rotation(rotation);

//return 0;
}

} // namespace openmc