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

global object registry to simplify Moose.C #10952

Merged
merged 11 commits into from
Mar 9, 2018

Conversation

rwcarlsen
Copy link
Contributor

@rwcarlsen rwcarlsen commented Mar 5, 2018

This creates a global object registry and new object registration macros that use it. Objects are now registered in their own .C files like this:

registerMooseObject("MyAppName", TheObjectBeingRegistered);

instead of in a central location (e.g. Moose.C). I modified the [Foo]App::registerObjects functions to just pull registrations from the global registry. This preserves backward compatibility and allows us to easily migrate to the new registration macros. This has several benefits:

  • This removes the need for Moose.C to include every single header allowing us to get better incremental compiles.
  • Makes it easier to add new objects - no more forgetting to add a register line to YourApp.C (or Moose.C)
  • Allows moose to know which app each object comes from - this will be helpful for moose docs stuff and also can help with dealing with test objects.

I wanted to get feedback/thoughts before I work to polish this up, add docs, etc. Does this seem like an okay approach?

@moosebuild
Copy link
Contributor

Job Precheck on b9cb2be : invalidated by @rwcarlsen

@brianmoose
Copy link
Contributor

FYI, Robert requested that we turn off the clang format check for this PR due to the "update tutorial" b21d151 commit having troubles with clang format.

Any commits after that will not be guaranteed to be clang format clean.

@rwcarlsen
Copy link
Contributor Author

rwcarlsen commented Mar 8, 2018 via email


using paramsPtr = InputParameters (*)();
using buildPtr = std::shared_ptr<MooseObject> (*)(const InputParameters & parameters);
using buildActionPtr = std::shared_ptr<Action> (*)(const InputParameters & parameters);
Copy link
Member

Choose a reason for hiding this comment

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

👍

ent->addChild(new hit::Field("type", hit::Field::Kind::String, "action"));
ent->addChild(new hit::Field("task", hit::Field::Kind::String, act._name));
ent->addChild(new hit::Field("class", hit::Field::Kind::String, act._classname));
ent->addChild(new hit::Field("file", hit::Field::Kind::String, act._file));
Copy link
Member

Choose a reason for hiding this comment

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

Lots of new raw allocations... I'm going to turn on the Valgrind target.

Copy link
Member

@permcody permcody Mar 9, 2018

Choose a reason for hiding this comment

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

BTW - I do realize that these are normally cleaned up in the tree destruction. I just know better than to assume that it always works when something changes.

@permcody permcody merged commit 339541e into idaholab:devel Mar 9, 2018
rwcarlsen added a commit to rwcarlsen/moose that referenced this pull request Mar 9, 2018
rwcarlsen added a commit to rwcarlsen/moose that referenced this pull request Mar 9, 2018
rwcarlsen added a commit to rwcarlsen/moose that referenced this pull request Mar 9, 2018
rwcarlsen added a commit to rwcarlsen/moose that referenced this pull request Mar 9, 2018
rwcarlsen added a commit to rwcarlsen/moose that referenced this pull request Mar 9, 2018
rwcarlsen added a commit to rwcarlsen/moose that referenced this pull request Mar 9, 2018
@rwcarlsen rwcarlsen deleted the obj-registry branch March 12, 2018 15:46
rwcarlsen added a commit to rwcarlsen/moose that referenced this pull request Mar 14, 2018
rwcarlsen added a commit to rwcarlsen/moose that referenced this pull request Mar 14, 2018
rwcarlsen added a commit to rwcarlsen/moose that referenced this pull request Mar 14, 2018
rwcarlsen added a commit to rwcarlsen/moose that referenced this pull request May 7, 2019
The typo caused the generated static var for the macro to not be unique
resulting in name clashes if more than one call exists in the same file.

ref idaholab#10952
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.

None yet

4 participants