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

Issue 502 - Implements new read_array templates dim3 absorbing boundaries write/read #503

Merged
merged 12 commits into from
Feb 25, 2025

Conversation

lsawade
Copy link
Collaborator

@lsawade lsawade commented Feb 21, 2025

Description

This PR implements

  • Further Kokkos::View reads of 2D and 3D views for read_array and read_index_array.
  • Writing function in the Fortran code to write boundary indeces to write/read faces in the first dimension
  • absorbing boundary struct
  • templated stacey boundary mass matrices as part of the absorbing boundary struct
  • free surface boundary struct
  • reading of the free surface
  • refactor of the reading catching errors to print information on the buffers
  • function to read check values and printing the associated error (if there is one)

Issue Number

Closes #502

Checklist

Please make sure to check developer documentation on specfem docs.

  • I ran the code through pre-commit to check style
  • My code passes all the integration tests
  • I have added sufficient unittests to test my changes
  • I have added/updated documentation for the changes I am proposing
  • I have updated CMakeLists to ensure my code builds
  • My code builds across all platforms

Copy link
Collaborator

@Rohit-Kakodkar Rohit-Kakodkar left a comment

Choose a reason for hiding this comment

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

One minor suggestion.

write(IOUT)

! Converting the logical arrays to integer arrays and writing them as ints
! call save_logical_nspec_array(ispec_is_acoustic)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be commented?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I initially wrote a function to write an integer array instead of the boolean array. But the error was something else. I think here, I agree with the last comment, that we should assign integers to the array in terms of which element is what, and then read those integers on the CPP side into tags.

I did not do that yet to move on with the rest of the file since reading the boolean array was not the issue.

template <typename T> using View2D = Kokkos::View<T **, Kokkos::HostSpace>;

template <typename T> using View3D = Kokkos::View<T ***, Kokkos::HostSpace>;

template <typename T> using View4D = Kokkos::View<T ****, Kokkos::HostSpace>;

template <typename T> using View5D = Kokkos::View<T *****, Kokkos::HostSpace>;

template <typename T> void read_array(std::ifstream &stream, View1D<T> &array);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should these be a single function? We could have a function like this -

template <typename ViewType>
void read_array(std::ifstream &stream, ViewType &array);

then have template specializations for different dimensions

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that can be done!

@lsawade lsawade requested a review from icui February 24, 2025 18:18
@lsawade lsawade merged commit bdbb756 into issue-390 Feb 25, 2025
3 checks passed
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