Skip to content

Commit fb14a03

Browse files
tidy
1 parent 9459cb1 commit fb14a03

13 files changed

Lines changed: 63 additions & 50 deletions

File tree

include/geode/stochastic/applications/fractures.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ namespace geode
2121
double death_ratio{ 1.0 };
2222
double change_ratio{ 1.0 };
2323

24-
std::string density_name() const
24+
[[nodiscard]] std::string density_name() const
2525
{
2626
return absl::StrCat( fset_name, "_p20" );
2727
}
2828
double p20{ 0. };
2929
std::optional< double > expected_number;
3030

31-
std::string intensity_name() const
31+
[[nodiscard]] std::string intensity_name() const
3232
{
3333
return absl::StrCat( fset_name, "_p21" );
3434
}
@@ -37,13 +37,13 @@ namespace geode
3737

3838
std::vector< std::array< geode::Point2D, 2 > > observed_fractures;
3939

40-
std::string spacing_name() const
40+
[[nodiscard]] std::string spacing_name() const
4141
{
4242
return absl::StrCat( fset_name, "_spacing" );
4343
}
4444
double minimal_spacing{ 0. };
4545

46-
std::string string() const
46+
[[nodiscard]] std::string string() const
4747
{
4848
auto message =
4949
absl::StrCat( "FractureSetDescription: ", fset_name );
@@ -94,14 +94,15 @@ namespace geode
9494

9595
std::vector< FractureSetDescription > fracture_sets;
9696

97-
FractureSetDescription& add_fracture_set( absl::string_view fset_name )
97+
[[nodiscard]] FractureSetDescription& add_fracture_set(
98+
absl::string_view fset_name )
9899
{
99100
auto& fracture_set = fracture_sets.emplace_back();
100101
fracture_set.fset_name = fset_name;
101102
return fracture_set;
102103
}
103104

104-
std::string string() const
105+
[[nodiscard]] std::string string() const
105106
{
106107
auto message =
107108
absl::StrCat( "FractureNetworkDescription: ", fnet_name );

include/geode/stochastic/applications/poisson_process.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,17 @@ namespace geode
2424
template < typename ObjectType >
2525
struct PoissonProcessDescription
2626
{
27+
std::string process_name{ "Poisson" };
2728
SpatialDomainConfig< ObjectType::dim > domain;
2829

2930
std::vector< PoissonSetDescription< ObjectType > > sets;
3031

3132
PoissonSetDescription< ObjectType >& add_set(
32-
absl::string_view set_name, absl::string_view density_name )
33+
absl::string_view set_name )
3334
{
3435
auto& set = sets.emplace_back();
3536
set.set_name = set_name;
36-
set.density_name = density_name;
37+
set.density_name = absl::StrCat( set_name, "_density" );
3738
return set;
3839
}
3940
};

include/geode/stochastic/applications/strauss_process.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ namespace geode
3232
std::vector< StraussInteractionDescription< ObjectType > > interactions;
3333

3434
PoissonSetDescription< ObjectType >& add_set(
35-
absl::string_view set_name, absl::string_view density_name )
35+
absl::string_view set_name )
3636
{
3737
auto& set = sets.emplace_back();
3838
set.set_name = set_name;
39-
set.density_name = density_name;
39+
set.density_name = absl::StrCat( set_name, "_density" );
40+
4041
return set;
4142
}
4243

include/geode/stochastic/sampling/direct/double_sampler.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace geode
4848

4949
struct DistributionDescription
5050
{
51-
DistributionDescription( absl::string_view name_in )
51+
explicit DistributionDescription( absl::string_view name_in )
5252
: name{ name_in }
5353
{
5454
}
@@ -67,7 +67,7 @@ namespace geode
6767
std::optional< double >
6868
alpha; // exponent parameter for power law distribution
6969

70-
std::string string() const
70+
[[nodiscard]] std::string string() const
7171
{
7272
auto message = absl::StrCat( "Distribution - ", name );
7373
absl::StrAppend( &message,

include/geode/stochastic/sampling/direct/object_set_sampler/point_set_sampler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace geode
3131
struct ObjectSamplerConfig< Point< dimension > >
3232
{
3333
// use to define the step for change move (move_ratio*domain volume)
34-
// NOLINTBEGING(*-magic-numbers)
34+
// NOLINTBEGIN(*-magic-numbers)
3535
double move_ratio{ 0.1 };
3636
// NOLINTEND(*-magic-numbers)
3737
};

include/geode/stochastic/sampling/direct/object_set_sampler/segment_set_sampler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace geode
3333
template <>
3434
struct ObjectSamplerConfig< OwnerSegment2D >
3535
{
36-
// NOLINTBEGING(*-magic-numbers)
36+
// NOLINTBEGIN(*-magic-numbers)
3737
double move_ratio{ 0.1 };
3838
// NOLINTEND(*-magic-numbers)
3939

include/geode/stochastic/spatial/spatial_domain.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ namespace geode
152152
Point< dimension > min_point;
153153
Point< dimension > max_point;
154154
double buffer_size{ 0.0 };
155-
std::string string() const
155+
156+
[[nodiscard]] std::string string() const
156157
{
157158
std::string message = "Domain: ";
158159
absl::StrAppend(

src/geode/stochastic/applications/fractures.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ namespace
3030
fracture_extremities )
3131
{
3232
std::vector< geode::Fracture > fractures;
33+
fractures.reserve( fracture_extremities.size() );
3334
for( const auto& extremities : fracture_extremities )
3435
{
35-
fractures.emplace_back(
36-
geode::OwnerSegment2D{ extremities[0], extremities[1] } );
36+
fractures.emplace_back( extremities[0], extremities[1] );
3737
}
3838
return fractures;
3939
}
@@ -75,9 +75,10 @@ namespace geode
7575
intensity.term_name = fset_desc.intensity_name();
7676
intensity.object_set_names = { fset_desc.fset_name };
7777
intensity.lambda = fset_desc.p21;
78-
constexpr double caracteristic_length = 1.0;
78+
constexpr double CARACTERISTIC_LENGTH = 1.0; // mean fracture
79+
// length?
7980
intensity.object_feature =
80-
SegmentLengthInsideBoxFeatureConfig{ caracteristic_length };
81+
SegmentLengthInsideBoxFeatureConfig{ CARACTERISTIC_LENGTH };
8182
simulation_config.model.terms.emplace_back(
8283
std::move( intensity ) );
8384

tests/stochastic/applications/test-fractures.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ namespace
3838
// NOLINTBEGIN(*-magic-numbers)
3939
geode::FractureNetworkDescription fnet_desc;
4040
fnet_desc.fnet_name = "One_Set_FNet";
41-
constexpr double domain_buffer{ 10 };
41+
constexpr double DOMAIN_BUFFER{ 10 };
4242
fnet_desc.domain = { geode::Point2D{ { 0, 0 } },
43-
geode::Point2D{ { 100.0, 100.0 } }, domain_buffer };
43+
geode::Point2D{ { 100.0, 100.0 } }, DOMAIN_BUFFER };
4444

4545
// --- Object set
4646
auto& fset = fnet_desc.add_fracture_set( "fset_A" );

tests/stochastic/applications/test-poisson-process.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace
4747
geode::PoissonProcessDescription< geode::Point2D > poisson;
4848
poisson.domain = { geode::Point2D{ { 0, 0 } },
4949
geode::Point2D{ { 10, 10 } }, 0. };
50-
auto& set_config = poisson.add_set( "set_A", "density_A" );
50+
auto& set_config = poisson.add_set( "set_A" );
5151
set_config.lambda = 0.3;
5252
set_config.expected_nb_objects = 30;
5353
set_config.birth_ratio = birth_ratio[config];
@@ -96,21 +96,21 @@ namespace
9696
geode::PoissonProcessDescription< geode::Point2D > poisson;
9797
poisson.domain = { geode::Point2D{ { 0, 0 } },
9898
geode::Point2D{ { 10, 10 } }, 0. };
99-
auto& set_config_01 = poisson.add_set( "set01", "density_01" );
99+
auto& set_config_01 = poisson.add_set( "set01" );
100100
set_config_01.lambda = 0.1;
101101
set_config_01.expected_nb_objects = 10;
102102
set_config_01.birth_ratio = 2.0;
103103
set_config_01.death_ratio = 3.0;
104104
set_config_01.change_ratio = 1.0;
105105

106-
auto& set_config_02 = poisson.add_set( "set02", "density_02" );
106+
auto& set_config_02 = poisson.add_set( "set02" );
107107
set_config_02.lambda = 0.4;
108108
set_config_01.expected_nb_objects = 40;
109109
set_config_02.birth_ratio = 3.0;
110110
set_config_02.death_ratio = 0.5;
111111
set_config_02.change_ratio = 1.0;
112112

113-
auto& set_config_03 = poisson.add_set( "set03", "density_03" );
113+
auto& set_config_03 = poisson.add_set( "set03" );
114114
set_config_03.lambda = 0.3;
115115
set_config_01.expected_nb_objects = 30;
116116
set_config_03.birth_ratio = 4.0;

0 commit comments

Comments
 (0)