Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inline documentation for the DagMC and dagmcmetadata classes. #945

Merged
merged 13 commits into from
Feb 27, 2024

Conversation

pshriwise
Copy link
Member

Please follow these guidelines when making a Pull Request.
This template was adapted from here and here.

Description

Adding some inline documentation so we can start leveraging it for rendered documentation.

Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

Looks like you ended up doubling a line here causing a build error.

src/dagmc/dagmcmetadata.hpp Show resolved Hide resolved
Copy link
Member

@ahnaf-tahmid-chowdhury ahnaf-tahmid-chowdhury left a comment

Choose a reason for hiding this comment

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

Thank you, @pshriwise, for creating this documentation support. It has been very helpful in understanding the source code. I have a few formatting suggestions, although they are not absolutely necessary.

src/dagmc/dagmcmetadata.hpp Outdated Show resolved Hide resolved
src/dagmc/dagmcmetadata.hpp Outdated Show resolved Hide resolved
* @brief Constructs a new DagmcMetadata object.
*
* @param dagmc A pointer to the DagMC instance associated with this metadata.
*/ // Constructor

Choose a reason for hiding this comment

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

Suggested change
*/ // Constructor
*/

Copy link
Member

@gonuke gonuke 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 this great effort @pshriwise. I have a few necessary changes (typos, etc) and a few additional requests, although I feel a little sheepish "punishing" your effort with additional requests.


/**
* @brief Determines whether a given point is inside a specified volume. This
* function is slower than point_in_volume.
Copy link
Member

Choose a reason for hiding this comment

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

Is it fair to say that this method is more robust? That is, should we provide some indication about when/why to use a slower method?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have a sense that it is more robust, but am not terribly familiar (or am no longer terribly familiar) with it myself. Do you recall in what situations we should use it over the point_in_volume method? I'd be happy to add them if so.

For now, I'll include where the method originates so a developer can make a decision based on the publication.

* @param xyz A 3-element array representing the coordinates of the point.
* @param[out] volume The volume containing the point.
* @param uvw Optional. A 3-element array representing the unit direction to
* be used when firing a test ray. Default is NULL.
Copy link
Member

Choose a reason for hiding this comment

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

Will this also use a random direction if nothing is specified?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep yep. I'll include that.

Comment on lines 308 to 309
* @param[out] result The result of the operation. If present and
* non-empty, the history is used to look up the surface facet at which the
Copy link
Member

Choose a reason for hiding this comment

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

It looks like there is an entry missing and that this description applies to the RayHistory and not this results parameter

Copy link
Member Author

Choose a reason for hiding this comment

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

Mea culpa. Thanks!!

Comment on lines 398 to 399
* @brief Gets the angle between a specified surface and a ray from a given
* point in a specified direction.
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why we named this get_angle but it appears to return the surface normal of the facet, and not an angle...

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure either, but probably not going to tackle that here. I did try to add some clarity to the brief description though.

/**
* @brief Constructs a new DagmcMetadata object.
*
* @param dagmc A pointer to the DagMC instance associated with this metadata.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @param dagmc A pointer to the DagMC instance associated with this metadata.
* @param DAGptr A pointer to the DagMC instance associated with this metadata.

* @brief Constructs a new DagmcMetadata object.
*
* @param dagmc A pointer to the DagMC instance associated with this metadata.
*/ // Constructor
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we include the two optional parameters?

bool try_to_make_int(std::string value);

// private member functions
private:
// parse the material data
/**
* @brief Parses the material data from the associated DagMC instance.
Copy link
Member

Choose a reason for hiding this comment

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

What does this actually do? Changes the state of some data structures in some way, but how? (And similarly for following methods)

std::map<moab::EntityHandle, std::vector<std::string>>
get_property_assignments(std::string property, int dimension,
std::string delimiters,
bool remove_duplicates = true);

// remove duplicate properties from the vector of properties
/**
* @brief Removes duplicate properties from a vector of properties.
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to give a simple example of how this might manifest itself? Like the neutron example you gave below for the set_remove_rich() method?

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -8,118 +8,316 @@

class dagmcMetaData {
Copy link
Member

Choose a reason for hiding this comment

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

This class would probably also benefit from some top level general description of how it all works, e.g. what's a "property" and how are key:value pairs specified, etc...

Copy link
Member Author

Choose a reason for hiding this comment

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

Gave it a go. Lemme know what you think.


/**
* @brief Finalizes the counters after all data has been parsed.
*/
void finalise_counters();
Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't see a definition for this method and have removed it.

Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

One small clarification

ErrorCode surface_sense(EntityHandle volume, EntityHandle surface,
int& sense_out);

/**
* @brief Gets the angle between the normal of a specified surface and a ray
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this gets an angle. I think it just gets the facet normal at the location of the surface crossing. (Hence my incomplete comment on the poor choice of name... that I don't expect you to fix.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, yeah you're right. Sorry. In a rush updating this last night. On it.

Comment on lines 407 to 412
* @brief Gets the angle between the normal of a specified surface and a ray
* from the ray origin in a specified direction.
*
* @param surf The surface with respect to which the angle is determined.
* @param xyz A 3-element array representing the coordinates of the point.
* @param angle[out] A 3-element array in which to store the determined angle.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @brief Gets the angle between the normal of a specified surface and a ray
* from the ray origin in a specified direction.
*
* @param surf The surface with respect to which the angle is determined.
* @param xyz A 3-element array representing the coordinates of the point.
* @param angle[out] A 3-element array in which to store the determined angle.
* @brief Gets the normal vector of the surface at the specified point of
* intersection by a ray from the ray origin in a specified direction.
*
* @param surf The surface with respect to which the normal vector is determined.
* @param xyz A 3-element array representing the coordinates of the point of
* intersection.
* @param angle[out] A 3-element array in which to store the determined normal vector.

Copy link
Member

Choose a reason for hiding this comment

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

I don't expect to change the name of the output parameter in this PR since it's only meant to update comments/documentation.

Choose a reason for hiding this comment

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

Is this right?

Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

Sorry for this clang-format concern...

Comment on lines 414 to 415
* calculation. The search for that triangle can be circumvented by providing a
* RayHistory, in which case the last triangle of the history will be used.
Copy link
Member

Choose a reason for hiding this comment

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

It looks like our clang-format wants to wrap this line differently 🤷

Suggested change
* calculation. The search for that triangle can be circumvented by providing a
* RayHistory, in which case the last triangle of the history will be used.
* calculation. The search for that triangle can be circumvented by providing
* a RayHistory, in which case the last triangle of the history will be used.

Copy link
Member Author

Choose a reason for hiding this comment

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

No worries! Ran clang-format locally and pushed before I saw this. Sorry to not incorporate the suggestion!

Copy link
Member

@ahnaf-tahmid-chowdhury ahnaf-tahmid-chowdhury left a comment

Choose a reason for hiding this comment

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

I think everything is fine now. Let's ask @gonuke to merge the changes.

Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

Thanks @pshriwise

@gonuke gonuke merged commit 96eab05 into svalinn:develop Feb 27, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants