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 ability to use FieldPerp in Options #2152

Merged
merged 10 commits into from
Dec 2, 2020
Merged

Conversation

ZedThree
Copy link
Member

I've started work on trying to completely replace use of DataFile with OptionsNetCDF. In order to prevent that PR from being way too big, I'm trying to split it into smaller chunks. This is one necessary part that is useful even if we decide not to use OptionsNetCDF and could probably be backported?

This PR actually has a couple of other features itself:

  • Add FieldPerp::getGlobalIndex, FieldPerp::setIndexFromGlobal -- moved code from DataFormat methods to FieldPerp methods
    • Names maybe not the best?
  • Add Options::hasAttribute to check existence of attribute
    • This leads to slightly more readable, but less efficient, code
const auto attribute = options.attributes.find("key");
if (attribute != options.attributes.end()) {
  use(attribute->second);
} else {
  use(something_else);
}

vs

if (options.hasAttribute("key")) {
  use(options.attributes.at("key"));
} else {
  use(something_else);
}

@ZedThree ZedThree added the backport candidiate Does not break backward compatibility, so can be back-ported to v4.4 label Nov 24, 2020
@ZedThree ZedThree added this to the BOUT-5.0 milestone Nov 24, 2020
Copy link
Contributor

@johnomotani johnomotani left a comment

Choose a reason for hiding this comment

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

Looks good to me, although I'm not at all familiar with OptionsNetCDF.

src/field/fieldperp.cxx Outdated Show resolved Hide resolved
src/sys/options.cxx Outdated Show resolved Hide resolved
@ZedThree
Copy link
Member Author

@bendudson Would you mind have a quick glance over the OptionsNetCDF changes?

Copy link
Contributor

@bendudson bendudson left a comment

Choose a reason for hiding this comment

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

Thanks @ZedThree ! Looks good to me.

@ZedThree
Copy link
Member Author

ZedThree commented Dec 2, 2020

We've moved from travis-ci.org to .com, so the failed PR test was restarted, but on .com which doesn't clear the .org version... Basically all tests have passed, we've just got an old notification sticking around. This is likely to the be the case with a few open PRs

@ZedThree ZedThree merged commit df74b7a into next Dec 2, 2020
@ZedThree ZedThree deleted the add-fieldperp-options branch December 2, 2020 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport candidiate Does not break backward compatibility, so can be back-ported to v4.4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants