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

Upgraded and updated version of the setMinkowski function with improv… #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MiChaelinzo
Copy link

…ed functionality, better error handling, and enhanced readability.

Key Improvements:

  1. Input Validation: Added a check to ensure gridSize is a 4-element vector.
  2. Struct Initialization: Initialized the metric struct with type and coordinate system information.
  3. Loop for Cross Terms: Used a loop to set the cross terms, making the code more concise and less error-prone.
  4. Error Handling: Added an error message for invalid gridSize input.

Notes:

  • The function now returns a metric struct that includes the type and coordinate system, making it more versatile for future extensions.
  • The use of a loop for setting cross terms ensures that all off-diagonal elements are correctly initialized to zero.

…ed functionality, better error handling, and enhanced readability.


### Key Improvements:
1. **Input Validation**: Added a check to ensure `gridSize` is a 4-element vector.
2. **Struct Initialization**: Initialized the `metric` struct with type and coordinate system information.
3. **Loop for Cross Terms**: Used a loop to set the cross terms, making the code more concise and less error-prone.
4. **Error Handling**: Added an error message for invalid `gridSize` input.

### Notes:
- The function now returns a `metric` struct that includes the type and coordinate system, making it more versatile for future extensions.
- The use of a loop for setting cross terms ensures that all off-diagonal elements are correctly initialized to zero.

% dt^2 term
metric{1,1} = -ones(gridSize);
% Initialize metric struct
Copy link
Contributor

Choose a reason for hiding this comment

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

The intent for this function is not to return a struct. Use Metrics/Minkowski/metricGet_Minkowski.m instead.

Copy link
Contributor

@pbbp0904 pbbp0904 left a comment

Choose a reason for hiding this comment

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

The checks and readability are fine, Metrics/setMinkowski.m should not return a struct. Use Metrics/Minkowski/metricGet_Minkowski.m instead.

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