Skip to content

Rotate for json files. Fixes in nfde_rotate #188

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

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

adrianarce-elemwave
Copy link
Collaborator

No description provided.

Copy link
Contributor

@lmdiazangulo lmdiazangulo left a comment

Choose a reason for hiding this comment

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

I have some minor requests. Also, tests are currently failing.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is excessive to create so many files to test this function. Could you consider to put them in a single file (as separate tests) and include it maybe within test/system/ folder?

@@ -40,15 +40,17 @@ END SUBROUTINE nfde_rotate
SUBROUTINE rotate_generateSpaceSteps (this, mpidir)
Copy link
Contributor

Choose a reason for hiding this comment

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

why is the name of these functions rotate_generateWhatever? I understand these are rotating structures but there is no generation, which is made during parsing.

newrotate=.false. !!ojo tocar luego
#ifdef CompileWithSMBJSON
newrotate=.true.
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are going to always use the new rotate, then we should remove this flag.

@adrianarce-elemwave adrianarce-elemwave force-pushed the feature/rotate-json branch 5 times, most recently from c9f099b to 969c22b Compare June 16, 2025 10:42
DO
READ (UNIT_EF, '(A)', end=1010) l_aux
rawFileInfo%numero = rawFileInfo%numero + 1
IF (len_trim (adjustl(l_aux))>=BUFSIZE) then
Copy link
Contributor

Choose a reason for hiding this comment

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

When json files are modified using the json python module, they become oneliners. Many tests change minor things in the the json files to be able to tests several cases from a single test (chaning the materialId in the material association), or changing the number of steps, to run shorter tests. When those modified json reach this point, they are read a single line whose size is larger than BUFSIZE.

Copy link
Contributor

Choose a reason for hiding this comment

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

Attempted fix:

  • first, count the number of lines in the file
  • if > 1, read the same way
  • if == 1 and the file is *json, read chunks of the line (which has a large but a priori undefined size) with size 1024 (bufsize), and make newlines every time a "}" is found

Copy link
Contributor

Choose a reason for hiding this comment

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

Changed: it is irrelevant that lines end in some particular separator. Reading up to every "}" risks not reading the content between the separator and the end of the buffer. NOW: split the json oneliner into chuncks of 1024 characters, each one will be a line

@adrianarce-elemwave adrianarce-elemwave marked this pull request as ready for review July 10, 2025 12:55
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