-
Notifications
You must be signed in to change notification settings - Fork 64
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
Conversation
bb038e0
to
dabcd73
Compare
There was a problem hiding this 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.
There was a problem hiding this 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
* @brief Constructs a new DagmcMetadata object. | ||
* | ||
* @param dagmc A pointer to the DagMC instance associated with this metadata. | ||
*/ // Constructor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*/ // Constructor | |
*/ |
There was a problem hiding this 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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
src/dagmc/DagMC.hpp
Outdated
* @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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
src/dagmc/DagMC.hpp
Outdated
* @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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mea culpa. Thanks!!
src/dagmc/DagMC.hpp
Outdated
* @brief Gets the angle between a specified surface and a ray from a given | ||
* point in a specified direction. |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
src/dagmc/dagmcmetadata.hpp
Outdated
/** | ||
* @brief Constructs a new DagmcMetadata object. | ||
* | ||
* @param dagmc A pointer to the DagMC instance associated with this metadata. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param dagmc A pointer to the DagMC instance associated with this metadata. | |
* @param DAGptr A pointer to the DagMC instance associated with this metadata. |
src/dagmc/dagmcmetadata.hpp
Outdated
* @brief Constructs a new DagmcMetadata object. | ||
* | ||
* @param dagmc A pointer to the DagMC instance associated with this metadata. | ||
*/ // Constructor |
There was a problem hiding this comment.
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?
src/dagmc/dagmcmetadata.hpp
Outdated
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
src/dagmc/dagmcmetadata.hpp
Outdated
|
||
/** | ||
* @brief Finalizes the counters after all data has been parsed. | ||
*/ | ||
void finalise_counters(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small clarification
src/dagmc/DagMC.hpp
Outdated
ErrorCode surface_sense(EntityHandle volume, EntityHandle surface, | ||
int& sense_out); | ||
|
||
/** | ||
* @brief Gets the angle between the normal of a specified surface and a ray |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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.
src/dagmc/DagMC.hpp
Outdated
* @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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this right?
There was a problem hiding this 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...
src/dagmc/DagMC.hpp
Outdated
* 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. |
There was a problem hiding this comment.
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 🤷
* 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. |
There was a problem hiding this comment.
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!
There was a problem hiding this 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pshriwise
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.