Skip to content

Conversation

@AndrewNJ03
Copy link
Contributor

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.

@AndrewNJ03 AndrewNJ03 force-pushed the new_quadrature_types branch 5 times, most recently from f967aa2 to a2f3d2a Compare January 18, 2026 20:46
@AndrewNJ03
Copy link
Contributor Author

@andrsd @wdhawkins @ragusa

Would y'all mind reviewing this code? This PR should also close out the last milestone on Issue #245.

@ragusa ragusa requested review from andrsd, quocdang1998, ragusa and wdhawkins and removed request for andrsd and quocdang1998 January 19, 2026 16:25
Copy link
Contributor

@ragusa ragusa left a comment

Choose a reason for hiding this comment

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

making good progress. several things need adjustments, maybe the biggest one is creating a dedicated triangular class. @wdhawkins can you concur or amend this statement?

class LebedevQuadrature2DXY : public AngularQuadrature
{
public:
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

@andrsd @wdhawkins what are our standards for doxygen tags/doco?

Copy link
Collaborator

@andrsd andrsd Jan 19, 2026

Choose a reason for hiding this comment

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

There are no detailed instructions for all doxygen comments, but roughly this.

The use of brief is not enforced, but should be since JAVADOC_AUTOBRIEF = NO in the Doxyfile.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I changed to JAVADOC_AUTOBRIEF = YES in PR 902. \brief and \details usage should be removed in the future.

@AndrewNJ03 AndrewNJ03 force-pushed the new_quadrature_types branch from 6d8b695 to f933ceb Compare January 20, 2026 20:00
@AndrewNJ03 AndrewNJ03 requested review from andrsd and ragusa January 20, 2026 20:30
Copy link
Contributor

@ragusa ragusa left a comment

Choose a reason for hiding this comment

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

thanks for using tquad and not pquad in examples :-)

@AndrewNJ03 AndrewNJ03 force-pushed the new_quadrature_types branch from b15ff5c to 463c446 Compare January 21, 2026 15:40
Comment on lines +115 to +118
// Calculate number of azimuthal angles per polar level
// At equator: Nazimuthal angles
// Each level away from equator: 4 less azimuthal angles (1 less per octant)
// This maintains octant symmetry in the triangular pattern
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these kind of comments allowed? @ragusa

Copy link
Contributor

Choose a reason for hiding this comment

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

is the issue // versus /// or the text itself (too basic)? maybe @wdhawkins can chime in

Copy link
Collaborator

Choose a reason for hiding this comment

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

// is allowed for in-code comments. Even if they were /// they would be ignored by doxygen.

class LebedevQuadrature2DXY : public AngularQuadrature
{
public:
/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

I changed to JAVADOC_AUTOBRIEF = YES in PR 902. \brief and \details usage should be removed in the future.

Comment on lines 89 to 91
* Return a reference to the precomputed discrete-to-moment operator.
*
* The operator is accessed as [m][d], where m is the moment index and d is the direction index.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a setter/getter? @andrsd @wdhawkins

If yes, we don't need any documentation here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well, the function name is GetDiscreteToMomentOperator. In code, we access it via [d][m], so the comment has it wrong :-) Plus, telling the users how to access the 2D array is useful, so I would fix the comment, at minimum.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to bring this to @wdhawkins 's attention. Andrew's implementation followed the math derivation at first, until I remember that we likely have M and D indexed similarly, like [d][m] whereas D should be [m][d], so Andrew did a transpose operation to abide by how it is implemented in the code. But once D and M are exposed to the user, the user will also be confused about [d][m] versus [m][d], unless we return the object to them in python with indexing that abides with the math notation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I missed these related comment when I went back through and transposed the D2M matrix back to how OpenSn stores it. I can fix the comment to read [d][m].

Copy link
Contributor Author

@AndrewNJ03 AndrewNJ03 Jan 21, 2026

Choose a reason for hiding this comment

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

Well, the function name is GetDiscreteToMomentOperator. In code, we access it via [d][m], so the comment has it wrong :-) Plus, telling the users how to access the 2D array is useful, so I would fix the comment, at minimum.

Sorry, looking back over this, this fix is specific to the next section regarding the D2M operator right? The M2D operator in OpenSn is stored equivalently to its definition in literature, so this comment is correct since the GetMomentToDiscreteOperator is still accessed as [m][d] unless I'm misunderstanding how it is used in the sweeper. The issue is the * Return a reference to the precomputed discrete-to-moment operator. since this is getting the M2D operator, not the D2M operator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ignore the above, I somehow read the comments upside down :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed to be [d][m] for now. Leaving this thread open.

* direction index.
* Return a reference to the precomputed moment-to-discrete operator.
*
* The operator is accessed as [m][d], where m is the moment index and d is the direction index.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This could be fixed too. The indexing is really [d][m]

Copy link
Contributor

Choose a reason for hiding this comment

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

pinging @wdhawkins here too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed to be [d][m] for now. I'm going to leave this thread open so that it isn't hidden.

@AndrewNJ03 AndrewNJ03 force-pushed the new_quadrature_types branch from 463c446 to f58cebf Compare January 21, 2026 19:07
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.
@wdhawkins
Copy link
Collaborator

Be sure to update doc/source/pyapi/index.rst with the new classes. Also, you'll need to update doc/source/tutorials/aquad/introduction.rst.

Vector3 new_omega;
new_omega.x = sin(qpoint.theta) * cos(qpoint.phi);
new_omega.y = sin(qpoint.theta) * sin(qpoint.phi);
new_omega.z = cos(qpoint.theta);
Copy link
Collaborator

Choose a reason for hiding this comment

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

In lebedev_quadrature.cc‎, you use the C++ versions of math functions, so you may want to do it here as well.

  • sin -> std::sin
  • cos -> std::cos

std::vector<double> polar;
polar.reserve(Npolar);
for (unsigned int j = 0; j < Npolar; ++j)
polar.emplace_back(M_PI - acos(gl_polar.qpoints[j][0]));
Copy link
Collaborator

Choose a reason for hiding this comment

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

acos -> std::acos

Vector3 new_omega;
new_omega.x = sin(qpoint.theta) * cos(qpoint.phi);
new_omega.y = sin(qpoint.theta) * sin(qpoint.phi);
new_omega.z = cos(qpoint.theta);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use std::sin, std::cos here as well

{
static const std::vector<std::string> required_keys = {"n_polar", "scattering_order"};
static const std::vector<std::pair<std::string, py::object>> optional_keys = {{"verbose", py::bool_(false)}};
return construct_from_kwargs<GLCTriangularQuadrature3DXYZ, int, int, bool>(params, required_keys, optional_keys);
Copy link
Collaborator

Choose a reason for hiding this comment

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

The types after the class name should match the types of the class constructor arguments. Since we changed that to unsigned int, these need to be changed as well.

Also, update on line 295, 581.

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.

5 participants