1+ #pragma once
2+
3+ #include < geode/stochastic/inference/target_statistics.hpp>
4+ #include < geode/stochastic/sampling/direct/object_set_sampler/segment_set_sampler.hpp>
5+ #include < geode/stochastic/sampling/mcmc/helpers/simulation_context.hpp>
6+ #include < geode/stochastic/sampling/mcmc/simulation_runner.hpp>
7+
8+ namespace geode
9+ {
10+ using Fracture = OwnerSegment2D;
11+ using FractureSamplerConfig = ObjectSamplerConfig< Fracture >;
12+ using FractureSimulationContext = SimulationContext< Fracture >;
13+ using FractureSimulationRunner = SimulationRunner< Fracture >;
14+
15+ struct FractureSetDescription
16+ {
17+ std::string fset_name;
18+
19+ FractureSamplerConfig sampler;
20+ double birth_ratio{ 1.0 };
21+ double death_ratio{ 1.0 };
22+ double change_ratio{ 1.0 };
23+
24+ std::string density_name () const
25+ {
26+ return absl::StrCat ( fset_name, " _p20" );
27+ }
28+ double p20{ 0 . };
29+ std::optional< double > expected_number;
30+
31+ std::string intensity_name () const
32+ {
33+ return absl::StrCat ( fset_name, " _p21" );
34+ }
35+ double p21{ 0 . };
36+ std::optional< double > expected_total_length;
37+
38+ std::vector< std::array< geode::Point2D, 2 > > observed_fractures;
39+
40+ std::string spacing_name () const
41+ {
42+ return absl::StrCat ( fset_name, " _spacing" );
43+ }
44+ double minimal_spacing{ 0 . };
45+
46+ std::string string () const
47+ {
48+ auto message =
49+ absl::StrCat ( " FractureSetDescription: " , fset_name );
50+ for ( const auto & fixed_object : observed_fractures )
51+ {
52+ absl::StrAppend ( &message,
53+ " \n\t --> observation (x,y,z)start: " ,
54+ fixed_object[0 ].string (),
55+ " (x,y,z)end: " , fixed_object[1 ].string () );
56+ }
57+ absl::StrAppend ( &message,
58+ " \n\t --> length distribution: " , sampler.length .string () );
59+ absl::StrAppend ( &message,
60+ " \n\t --> azimuth distribution: " , sampler.azimuth .string () );
61+ absl::StrAppend ( &message, " \n\t --> " , density_name (), " : " , p20 );
62+ absl::StrAppend (
63+ &message, " \n\t --> " , intensity_name (), " : " , p21 );
64+ absl::StrAppend (
65+ &message, " \n\t --> " , spacing_name (), " : " , minimal_spacing );
66+
67+ absl::StrAppend ( &message,
68+ " \n\t --> dynamic move ratio - birth/death/change (" ,
69+ birth_ratio, " / " , death_ratio, " / " , change_ratio, " )" );
70+ return message;
71+ }
72+ };
73+
74+ // struct FractureInterSetDescription
75+ // {
76+ // std::string interaction_name;
77+ //
78+ // std::vector< std::string > set_names;
79+ //
80+ // double gamma{ 1. };
81+ // double distance{ 0. };
82+ //
83+ // bool include_intra_set{ true };
84+ // bool include_inter_set{ false };
85+ //
86+ // std::optional< double > expected_nb_interactions;
87+ // };
88+
89+ struct FractureNetworkDescription
90+ {
91+ std::string fnet_name;
92+
93+ SpatialDomainConfig< 2 > domain;
94+
95+ std::vector< FractureSetDescription > fracture_sets;
96+
97+ FractureSetDescription& add_fracture_set ( absl::string_view fset_name )
98+ {
99+ auto & fracture_set = fracture_sets.emplace_back ();
100+ fracture_set.fset_name = fset_name;
101+ return fracture_set;
102+ }
103+
104+ std::string string () const
105+ {
106+ auto message =
107+ absl::StrCat ( " FractureNetworkDescription: " , fnet_name );
108+ absl::StrAppend ( &message, " \n\t --> " , domain.string () );
109+ for ( const auto & fset_desc : fracture_sets )
110+ {
111+ absl::StrAppend ( &message, " \n\t --> " , fset_desc.string () );
112+ }
113+ return message;
114+ }
115+ // std::vector< StraussInteractionDescription< ObjectType > >
116+ // inter_set_interactions;
117+ //
118+ // void add_x_node_monitoring( double beta_x_node )
119+ // {
120+ // OpenGeodeStochasticStochasticException::check_exception(
121+ // beta_x_node <= 1.0 && beta_x_node >= 0., nullptr,
122+ // OpenGeodeException::TYPE::data,
123+ // "[FractureSimulationRunner] x node should be
124+ // inhibitated, " "please provise a value in [0., 1.]."
125+ // );
126+ // beta_x_node_ = beta_x_node;
127+ // }
128+ };
129+
130+ FractureSimulationContext build_fractures_simulation_context (
131+ const FractureNetworkDescription& description );
132+
133+ std::vector< geode::TargetStatisticConfig > build_fractures_targeted_stat (
134+ const FractureNetworkDescription& description );
135+
136+ } // namespace geode
0 commit comments