equinor / equinor/tmatrix

Make C++ code more idiomatic

Open
#47 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5
Forks
3
Avg merge
6d 14h
Merged PRs (30d)
1

Description

This is kept as a future issue when larger changes is done to the C++ code

If you want to make it more idiomatic C++, you could replace the C-style array, `static_alphas[]`, with a `std::array` by adding `#include ` at the top and changing it to:

```suggestion
static const std::array, 4> static_alphas = {{
{.9, .1}, // DUAL_POR_MOSTLY_ROUNDED
{.58, .027}, // DUAL_POR_LITTLE_ROUNDED
{.9, .1, 1e-2}, // MIXED_PORES
{.9, .1, 1e-2, 1e-3} // FLAT_PORES_AND_CRACK
}};

static const std::array, 4> static_vs = {{
{.9, .1}, // DUAL_POR_MOSTLY_ROUNDED
{.85, .15}, // DUAL_POR_LITTLE_ROUNDED
{.8, .19, 1e-2}, // MIXED_PORES
{.689, .3, 1e-2, 1e-3} // FLAT_PORES_AND_CRACK
}};
```
Full change using `std::array` here: https://github.com/ajaust/tmatrix/commit/2de638d7d3f7e916cb9ab069b89bf3917bf33dd5

This is not strictly necessary and may break with the style in other files so see which version you prefer. 🙂

Note there was an accidental force-push to this PR by me when testing the approach using `std::array` on my branch. I removed my changes again and hope this does not cause any issue.

_Originally posted by @ajaust in https://github.com/equinor/tmatrix/pull/43#discussion_r2820957992_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.