Skip to content

Make Field2D more like Field3D#3296

Open
dschwoerer wants to merge 18 commits intonextfrom
f2d-more-f3d
Open

Make Field2D more like Field3D#3296
dschwoerer wants to merge 18 commits intonextfrom
f2d-more-f3d

Conversation

@dschwoerer
Copy link
Contributor

Make it easier to write FCI compatible code.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions


std::weak_ptr<Options> getTracking() { return tracking; };

bool allowCalcParallelSlices{true};
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member variable 'allowCalcParallelSlices' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  bool allowCalcParallelSlices{true};
       ^

Copy link
Member

Choose a reason for hiding this comment

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

Could we add a public getter (and setter) instead of making the member variable public?

Copy link
Member

@ZedThree ZedThree left a comment

Choose a reason for hiding this comment

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

Nice, thanks @dschwoerer! I guess my main question is could/should the new methods actually be virtual? Then we could just have a default empty implementation on Field.

Comment on lines +138 to +141
void calcParallelSlices() const {}
void splitParallelSlices() const {}
void clearParallelSlices() const {}
int numberParallelSlices() const { return 0; }
Copy link
Member

Choose a reason for hiding this comment

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

Should these be virtual? Or do they only need to be dummy methods?


std::weak_ptr<Options> getTracking() { return tracking; };

bool allowCalcParallelSlices{true};
Copy link
Member

Choose a reason for hiding this comment

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

Could we add a public getter (and setter) instead of making the member variable public?

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

bendudson
bendudson previously approved these changes Mar 4, 2026
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

@dschwoerer dschwoerer dismissed ZedThree’s stale review March 5, 2026 13:23

All changes done

std::weak_ptr<Options> getTracking() { return tracking; };

bool allowCalcParallelSlices() const { return _allowCalcParallelSlices; };
void disallowCalcParallelSlices() { _allowCalcParallelSlices = false; };
Copy link
Member

Choose a reason for hiding this comment

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

What do these do? It doesn't look like they're used anywhere.

Also they sound like they should set _allowCalcParallelSlices to true/false, but the first one is a getter and the second one a setter.

Maybe the first should be areCalcParallelSlicesAllowed()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do these do? It doesn't look like they're used anywhere.

They slipped in from a different PR.

Also they sound like they should set _allowCalcParallelSlices to true/false, but the first one is a getter and the second one a setter.

Maybe the first should be areCalcParallelSlicesAllowed()?

Will change it 👍

/// Check if this field has yup and ydown fields
/// Return reference to yup field
Field3D& yup(std::vector<Field3D>::size_type index = 0) {
Field3D& yup(size_t index = 0) {
Copy link
Member

Choose a reason for hiding this comment

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

I would've thought we would also need these to be virtual to make things properly generic? Although I guess you're mostly interested in FieldMetric and compile-time polymorphism really, and not runtime polymorphism?

We could make these virtual by returning Field&, but we probably don't actually want that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is the reason. We do not want to return Field, so there is no way to make this virtual.
Compile time polymorphism is right now sufficient, as long as 3D metrics are a compile time choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants