Skip to content

Conversation

@Rohit-Kakodkar
Copy link
Collaborator

Description

Please describe the changes/features in this pull request.

  • Adds documentation for assembly::kernels

Issue Number

If there is an issue created for these changes, link it here

Checklist

Please make sure to check developer documentation on specfem docs.

  • I ran the code through pre-commit to check style
  • THE DOCUMENTATION BUILDS WITHOUT WARNINGS/ERRORS
  • I have added labels to the PR (see right hand side of the PR page)
  • 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

- Adds documentation for `assembly::kernels`
Copy link
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

This PR adds comprehensive Doxygen documentation for the specfem::assembly::kernels module, which manages misfit kernels for seismic inversion in spectral element simulations.

Key Changes:

  • Added detailed class-level documentation for 2D and 3D kernel template specializations with physical context and usage examples
  • Refactored data access functions from inline definitions into separate header files organized by operation type (load/store/add) and execution space (host/device)
  • Updated RST documentation to include dimension-specific implementations and corrected the Doxygen group reference

Reviewed changes

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

Show a summary per file
File Description
docs/sections/api/specfem/assembly/kernels/kernels.rst Added documentation sections for dimension-specific kernel implementations and updated group reference
core/specfem/assembly/kernels/dim3/kernels.hpp Enhanced documentation with comprehensive class overview, detailed constructor descriptions, and usage examples
core/specfem/assembly/kernels/dim2/kernels.hpp Enhanced documentation with comprehensive class overview, detailed constructor descriptions, and usage examples
core/specfem/assembly/kernels/data_access/store_on_host.hpp New file containing host-side store function with documentation
core/specfem/assembly/kernels/data_access/store_on_device.hpp New file containing device-side store function with documentation
core/specfem/assembly/kernels/data_access/load_on_host.hpp New file containing host-side load function with documentation
core/specfem/assembly/kernels/data_access/load_on_device.hpp New file containing device-side load function with documentation
core/specfem/assembly/kernels/data_access/add_on_host.hpp New file containing host-side accumulation function with documentation
core/specfem/assembly/kernels/data_access/add_on_device.hpp New file containing device-side accumulation function with documentation
core/specfem/assembly/kernels.hpp Refactored to move inline function definitions to separate headers and added improved documentation

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

Comment on lines +36 to +37
* const int specfem::point::index<...> index = ...; // Current element and GLL
* point const specfem::point::kernels<...> point_kernels = ...;
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The code example contains invalid C++ syntax. Line 36 has: const int specfem::point::index<...> index = ...; which is incorrect. The const int should be removed - it should just be const specfem::point::index<...> index = ...; or const auto index = ...;.

Suggested change
* const int specfem::point::index<...> index = ...; // Current element and GLL
* point const specfem::point::kernels<...> point_kernels = ...;
* const auto index = ...; // Current element and GLL
* const specfem::point::kernels<...> point_kernels = ...;

Copilot uses AI. Check for mistakes.
// clang-format off
* @code
* // Example: Accumulate elastic kernels during adjoint simulation
* const int specfem::point::index<...> index = ...; // Current element and GLL
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The code example contains invalid C++ syntax. Line 35 has: const int specfem::point::index<...> index = ...; which is incorrect. The const int should be removed - it should just be const specfem::point::index<...> index = ...; or const auto index = ...;.

Suggested change
* const int specfem::point::index<...> index = ...; // Current element and GLL
* const specfem::point::index<...> index = ...; // Current element and GLL

Copilot uses AI. Check for mistakes.
Comment on lines +69 to +70
kernels(const int nspec, const int ngllz, const int nglly, const int ngllx,
const specfem::assembly::element_types<dimension_tag> &element_types);
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The documentation states this is a constructor, but the order is inconsistent with typical C++ documentation patterns. The parameterized constructor documentation appears before the default constructor, but the actual declarations show the default constructor (line 76) after the parameterized constructor (lines 69-70). Consider documenting them in the order they appear in the code.

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +35
* const int specfem::point::index<...> index = ...; // Current element and GLL
* point const specfem::point::kernels<...> point_kernels = ...;
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The code example contains invalid C++ syntax. Line 34 has: const int specfem::point::index<...> index = ...; which is incorrect. The const int should be removed - it should just be const specfem::point::index<...> index = ...; or const auto index = ...;.

Suggested change
* const int specfem::point::index<...> index = ...; // Current element and GLL
* point const specfem::point::kernels<...> point_kernels = ...;
* const specfem::point::index<...> index = ...; // Current element and GLL point
* const specfem::point::kernels<...> point_kernels = ...;

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +18
*
* @ingroup KernelsDataAccess
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The @ingroup tag is inconsistently placed. In this file it appears on line 18 after the brief description, but in other similar files (store_on_host.hpp, store_on_device.hpp, add_on_device.hpp, add_on_host.hpp) it appears on line 20 or later. For consistency, the @ingroup tag should be placed immediately after the @brief tag as it is in the other files.

Suggested change
*
* @ingroup KernelsDataAccess
* @ingroup KernelsDataAccess
*

Copilot uses AI. Check for mistakes.
Comment on lines +67 to +68
kernels(const int nspec, const int ngllz, const int ngllx,
const specfem::assembly::element_types<dimension_tag> &element_types);
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The documentation states this is a constructor, but the order is inconsistent with typical C++ documentation patterns. The parameterized constructor documentation appears before the default constructor, but the actual declarations show the default constructor (line 74) after the parameterized constructor (lines 67-68). Consider documenting them in the order they appear in the code.

Copilot uses AI. Check for mistakes.

/**
* @brief Construct a new kernels object
* @brief Default destructor
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The documentation says "Default destructor" but this is actually the default constructor (kernels() = default;). It should be labeled as "Default constructor".

Suggested change
* @brief Default destructor
* @brief Default constructor

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +35
* const int specfem::point::index<...> index = ...; // Current element and GLL
* point const specfem::point::kernels<...> point_kernels = ...;
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The code example contains invalid C++ syntax. Line 34 has: const int specfem::point::index<...> index = ...; which is incorrect. The const int should be removed - it should just be const specfem::point::index<...> index = ...; or const auto index = ...;.

Suggested change
* const int specfem::point::index<...> index = ...; // Current element and GLL
* point const specfem::point::kernels<...> point_kernels = ...;
* const specfem::point::index<...> index = ...; // Current element and GLL point
* const specfem::point::kernels<...> point_kernels = ...;

Copilot uses AI. Check for mistakes.
// clang-format off
* @code
* // Example: Load elastic kernels during adjoint simulation
* const int specfem::point::index<...> index = ...; // Current element and GLL
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The code example contains invalid C++ syntax. Line 33 has: const int specfem::point::index<...> index = ...; which is incorrect. The const int should be removed - it should just be const specfem::point::index<...> index = ...; or const auto index = ...;.

Suggested change
* const int specfem::point::index<...> index = ...; // Current element and GLL
* const specfem::point::index<...> index = ...; // Current element and GLL

Copilot uses AI. Check for mistakes.
// clang-format off
* @code
* // Example: Load elastic kernels during adjoint simulation
* const int specfem::point::index<...> index = ...; // Current element and GLL
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The code example contains invalid C++ syntax. Line 35 has: const int specfem::point::index<...> index = ...; which is incorrect. The const int should be removed - it should just be const specfem::point::index<...> index = ...; or const auto index = ...;.

Suggested change
* const int specfem::point::index<...> index = ...; // Current element and GLL
* const auto index = /* specfem::point::index<...> */ ...; // Current element and GLL

Copilot uses AI. Check for mistakes.
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.

2 participants