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

Update Input-File.md to describe the Factory Function method of alloc… #1763

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

jmpenn
Copy link
Contributor

@jmpenn jmpenn commented Aug 27, 2024

…ating objects from the input file.

@coveralls
Copy link

coveralls commented Aug 27, 2024

Coverage Status

coverage: 55.889% (+0.05%) from 55.836%
when pulling 7eedd46 on FactoryFunction
into de1cb67 on master.

Copy link
Contributor

@hchen99 hchen99 left a comment

Choose a reason for hiding this comment

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

Placement new explanation and example are very helpful. Thanks!


The first method is to call the `Trick::MemoryManager` routines to allocate memory. This is the preferred method.
### 1. Call `Trick::MemoryManager` allocation routines directly.
Copy link
Contributor

Choose a reason for hiding this comment

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

How about changing it to "Call Trick::MemoryManger Allocation Routines Directly" -- no period and capitalize the first letter of each word to be consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


This creates and initializes seven *Ball* objects needed to configure a Newton's cradle.

### 3. Call the Wrapped Class Constructor Directly.
Copy link
Contributor

Choose a reason for hiding this comment

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

Either remove the period or add for all other bullets

Copy link
Contributor

Choose a reason for hiding this comment

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

Hong demands absolute clarity

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

```

Because this function is bound to Python by SWIG, it can be called from the input file.
For examaple, :
Copy link
Contributor

Choose a reason for hiding this comment

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

Keep either , or :

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also corrected spelling : examaple --> example

@@ -188,7 +190,80 @@ food[2] = trick.alloc_type(6, "double")

Memory allocated using the above routines are tracked by the memory manager and is checkpointable and data recordable.

The second method is to call the wrapped constructor of the class directly. This is analogous to declaring local
### 2. Use a Factory Function
This benefit of this method is flexibility in how objects are initialized. For example, we might want to initialize our objects with a non-default constructor. So, the requirements for our factory function are:
Copy link
Contributor

Choose a reason for hiding this comment

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

This benefit --> The benefit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@jmpenn jmpenn merged commit b794aba into master Aug 28, 2024
7 of 8 checks passed
@jmpenn jmpenn deleted the FactoryFunction branch August 28, 2024 15:40
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.

4 participants