Skip to content

Conversation

@Aggie04
Copy link

@Aggie04 Aggie04 commented Sep 19, 2025

This PR will add the Galerkin Quadrature methods 1, 2, and 3 into OpenSn to offer another option when forming the scattering source.

@Aggie04 Aggie04 changed the title DRAFT: Implementation of of Galerkin Quadrature methods DRAFT: Implementation of Galerkin Quadrature methods Sep 19, 2025
@Aggie04 Aggie04 marked this pull request as draft September 19, 2025 14:29
@ragusa ragusa requested review from andrsd, quocdang1998 and wdhawkins and removed request for andrsd and quocdang1998 September 19, 2025 14:40
Comment on lines 117 to 172
angular_quadrature.def(
"GetDiscreteToMomentOperator",
[](const AngularQuadrature& self) {
const auto& op = self.GetDiscreteToMomentOperator();
// Convert to list of lists for Python
py::list result;
for (const auto& row : op) {
py::list py_row;
for (double val : row) {
py_row.append(val);
}
result.append(py_row);
}
return result;
},
"Get the discrete-to-moment operator as a list of lists."
);
angular_quadrature.def(
"GetMomentToDiscreteOperator",
[](const AngularQuadrature& self) {
const auto& op = self.GetMomentToDiscreteOperator();
// Convert to list of lists for Python
py::list result;
for (const auto& row : op) {
py::list py_row;
for (double val : row) {
py_row.append(val);
}
result.append(py_row);
}
return result;
},
"Get the moment-to-discrete operator as a list of lists."
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, these functions are not necessary to be exported to Python.

And if you really need to export it, you should export this as a NumPy array The results of these methods are matrices, not lists of lists.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaving these in for now (updated to be numpy arrays), mostly because I am interested in the structure of the two matrices. If it's preferred to just have it be accessible through direct manipulation of the C++ code, I can remove it.

: type_(type),
dimension_(dimension),
scattering_order_(scattering_order),
construction_method_(method)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you add the construction_method_ to the constructor, don't forget to update the constructor of derived classes as well.

@AndrewNJ03 AndrewNJ03 force-pushed the galerkinQuadratureMethods branch 2 times, most recently from 43e64a0 to 83b5966 Compare September 26, 2025 05:11
@AndrewNJ03 AndrewNJ03 force-pushed the galerkinQuadratureMethods branch from 4dcc5f5 to 9ec1483 Compare November 14, 2025 17:00
@AndrewNJ03 AndrewNJ03 force-pushed the galerkinQuadratureMethods branch from 1c49ae4 to 53b5d05 Compare December 12, 2025 13:17
@AndrewNJ03 AndrewNJ03 force-pushed the galerkinQuadratureMethods branch from 6549aa4 to 80be68b Compare January 16, 2026 17:54
3 new angular quadrature types have been introduced, along with corresponding regression tests. 2D Lebedev, a modification of its 3D variant, as well as 2D and 3D GLC Triangular Sets.
Removed GQ2.

Removed building D2M and M2D from python binding.

Changed D2M/M2D constructors to internally handle methods instead of unique constructors.

Moved InvertMatrix method to math.cc for general usage. Optimization changes were made.

Added OrthogonalizeHouseholder method.

Added basis for GQ3 method.

New harmonic_selection_rules file to contain and house the various rules of quadratures.
Cross sections do not yet see the correct moment orders.
Functionality for the process is complete. Works for Lebedev and LDFE sets up to a given limit. Additionally works for Product Quadrature Squares.

There are still some minor changes that need to be made, a few random lebedev order's don't have emperically derived harmonic sets yet.
nb_dir -> num_dir
@AndrewNJ03 AndrewNJ03 force-pushed the galerkinQuadratureMethods branch from e157729 to 92ca94f Compare January 22, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants