Skip to content

refactor: File Session.#5054

Merged
prmukherj merged 7 commits intomainfrom
refactor/file_session
Apr 8, 2026
Merged

refactor: File Session.#5054
prmukherj merged 7 commits intomainfrom
refactor/file_session

Conversation

@prmukherj
Copy link
Copy Markdown
Collaborator

Context

The 'get_field_data' method of File Session is updated to be consistent with solver field data and use generic methods already available in the interface instead of new (duplicate) methods. These delicacies were the primary reason for error as reported in #5036. Moreover the method to get surface data was swallowing a data internally in such cases and returning wrong data.

Change Summary

Used common methods already available in field_data_interfaces.py to avoid any of the above issues.

Impact

The user will get expected output from "file_session.fields.field_data.get_field_data" now and also the output type will be consistent with "solver.fields.field_data.get_field_data".

A test has been added to check the return type.

Copilot AI review requested due to automatic review settings April 6, 2026 06:44
@prmukherj prmukherj linked an issue Apr 6, 2026 that may be closed by this pull request
2 tasks
@github-actions github-actions bot added documentation Documentation related (improving, adding, etc) enhancement Improve any current implemented feature labels Apr 6, 2026
@prmukherj
Copy link
Copy Markdown
Collaborator Author

The PR: #5037 will be superseded by this PR.

@prmukherj prmukherj requested a review from Gobot1234 April 6, 2026 06:46
@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 6, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors offline FileSession field-data retrieval to align return types/behavior with solver field data, addressing issue #5036 where SurfaceFieldDataRequest.data_types order could affect output shape/type.

Changes:

  • Reworked FileFieldData surface/scalar/vector fetch paths to build a common intermediate structure and delegate formatting to _ReturnFieldData.
  • Updated file-session tests to use the new SurfaceData object-style access (.vertices, .connectivity) and added a regression test for string data_types ordering.
  • Updated offline File Session user-guide examples to reflect the new access pattern.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/ansys/fluent/core/file_session.py Refactors surface/scalar/vector field-data retrieval to use _ReturnFieldData and provide consistent return types.
tests/test_file_session.py Updates assertions for new SurfaceData return type and adds regression coverage for string data_types order.
doc/source/user_guide/offline/file_session.rst Updates examples to use .vertices access (and combined surface request example).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ansys/fluent/core/file_session.py
Comment thread src/ansys/fluent/core/file_session.py Outdated
Comment thread src/ansys/fluent/core/file_session.py
Comment thread src/ansys/fluent/core/file_session.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ansys/fluent/core/file_session.py
Comment thread doc/source/user_guide/offline/file_session.rst Outdated
Comment thread doc/changelog.d/5054.miscellaneous.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 6, 2026 07:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ansys/fluent/core/file_session.py
Comment thread src/ansys/fluent/core/file_session.py Outdated
Comment thread src/ansys/fluent/core/file_session.py
@mkundu1
Copy link
Copy Markdown
Contributor

mkundu1 commented Apr 7, 2026

Please consider adding the following flake8 check to catch similar issues in future during pre-commit.

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b90b87c7f8a..dd9c0e1accc 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -33,6 +33,7 @@ repos:
       --max-complexity, "10",
       --max-line-length, "88",
       --extend-ignore, E203 E501 C901 B007 B009 B010 B011 B028,
+      --extend-select, B909,
       src, doc, examples, tests
     ]

@prmukherj
Copy link
Copy Markdown
Collaborator Author

Please consider adding the following flake8 check to catch similar issues in future during pre-commit.

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b90b87c7f8a..dd9c0e1accc 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -33,6 +33,7 @@ repos:
       --max-complexity, "10",
       --max-line-length, "88",
       --extend-ignore, E203 E501 C901 B007 B009 B010 B011 B028,
+      --extend-select, B909,
       src, doc, examples, tests
     ]

Done, Thank you.

@prmukherj prmukherj linked an issue Apr 7, 2026 that may be closed by this pull request
2 tasks
Copilot AI review requested due to automatic review settings April 7, 2026 17:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ansys/fluent/core/file_session.py
@prmukherj prmukherj merged commit 319fd5d into main Apr 8, 2026
101 of 112 checks passed
@prmukherj prmukherj deleted the refactor/file_session branch April 8, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation related (improving, adding, etc) enhancement Improve any current implemented feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential bug/documentation issue with FileFieldData._get_surface_data Potential bug with SurfaceFieldDataRequest.data_types

7 participants