Skip to content

Update all template formatting - #505

Open
PhilipFackler wants to merge 4 commits into
developfrom
PhilipFackler/template-formatting
Open

Update all template formatting#505
PhilipFackler wants to merge 4 commits into
developfrom
PhilipFackler/template-formatting

Conversation

@PhilipFackler

Copy link
Copy Markdown
Collaborator

Description

Update templates everywhere to use new style guidelines

Closes #366

Checklist

  • All tests pass.
  • Code compiles cleanly with flags -Wall -Wpedantic -Wconversion -Wextra.
  • The new code follows GridKit™ style guidelines.
  • [N/A] There are unit tests for the new code.
  • [N/A] The new code is documented.
  • The feature branch is rebased with respect to the target branch.
  • [N/A] I have updated CHANGELOG.md to reflect the changes in this PR. If this is a minor PR that is part of a larger fix already included in the file, state so.

@PhilipFackler
PhilipFackler force-pushed the PhilipFackler/template-formatting branch 2 times, most recently from 25b463f to 29d6d5d Compare July 22, 2026 19:50
@PhilipFackler
PhilipFackler force-pushed the PhilipFackler/template-formatting branch 3 times, most recently from d3fa387 to 45cf5d5 Compare July 23, 2026 19:44
@PhilipFackler
PhilipFackler force-pushed the PhilipFackler/template-formatting branch from 45cf5d5 to 618fb79 Compare July 23, 2026 20:01

@pelesh pelesh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Some preliminary comments:

  • This PR changes the scope of scalar type aliases from private to public. This leads to an unintuitive code like void function<scalar_type>(ScalarT x);.
  • There is minor scope creep as type aliases other than scalar types were handled in a similar way. What is the motivation for that?

Comment on lines 20 to +23
public:
using RealT = GridKit::ScalarTraits<ScalarT>::RealT;
using ScalarT = scalar_type;
using IdxT = index_type;
using RealT = GridKit::ScalarTraits<ScalarT>::RealT;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why are these public? Shouldn't these be private as they are intended for use inside the class?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The intent is to make a consistent use of interface type aliases across all classes. Unless there is a good reason to hide these names from consumer contexts, the interface should be the same.

Comment thread GridKit/LinearAlgebra/SparseMatrix/CsrMatrix.cpp Outdated
Comment on lines -29 to +38
* @tparam Policy - Memory management policy (vendor specific)
* @tparam policy - Memory management policy (vendor specific)
*
* @author Slaven Peles <peless@ornl.gov>
*/
template <class Policy>
template <typename policy>
class MemoryUtils
{
public:
using Policy = policy;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why this change?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The issue is about consistent template parameter formatting. This is to follow the new guidelines.

Comment on lines 38 to +49

/// Parameters enum
using Parameters = parameters_type;
/// Buses enum
using Buses = buses_type;
/// Signal inputs enum
using SignalInputs = signal_inputs_type;
/// Signal outputs enum
using SignalOutputs = signal_outputs_type;
/// Monitorable variables enum
using MonitorableVariables = monitorable_variables_type;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is this necessary? I thought the issue was with scalar types?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This issue is about consistent template parameter format across all templates. ScalarT was used as an example, but the reasoning applies everywhere. Consumer contexts often need access to type aliases defined by the classes being used. It is rare that type aliases need to be restricted to be private to a class implementation.

Co-authored-by: pelesh <peless@ornl.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use different style for template parameters and public interface types

2 participants