Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
d42a8b7
file reoganisation
francoisbonneau Mar 27, 2026
b3e9957
feat(ObjectSets): add map registry in ObjectSets.
francoisbonneau Mar 31, 2026
5b95c35
keep refactoring
francoisbonneau Apr 1, 2026
3d7e55c
feat(EnergyTerm): builder for energy terms
francoisbonneau Apr 9, 2026
4e4a5a6
Apply prepare changes
francoisbonneau Apr 9, 2026
14e2055
static monitoring
francoisbonneau Apr 28, 2026
964ff1f
Apply prepare changes
francoisbonneau Apr 28, 2026
a1b1ea5
feat(Helpers): create inference helpers.
francoisbonneau May 25, 2026
b4cfae3
Merge remote-tracking branch 'origin/HEAD' into energy_term_refactoring
francoisbonneau May 25, 2026
2c94303
Apply prepare changes
francoisbonneau May 25, 2026
1dd751a
update to last OpenGeode Version
francoisbonneau May 25, 2026
538826d
fix wind compile
francoisbonneau May 25, 2026
79a054d
Merge pull request #36 from Geode-solutions/energy_term_refactoring
francoisbonneau May 25, 2026
43b70fb
PA comments
francoisbonneau May 25, 2026
adfec09
Apply prepare changes
francoisbonneau May 25, 2026
8ddb2df
feat(statisticstools): implement validator and quadratic loss.
francoisbonneau May 25, 2026
fda9aff
feat(StatsticTool): Implement validator
francoisbonneau May 25, 2026
f534c2c
Apply prepare changes
francoisbonneau May 25, 2026
9f30eda
fix clang error
francoisbonneau May 25, 2026
866cb84
try linking issue
francoisbonneau May 25, 2026
64cc95d
feat(StraussTest): reactivate Strauss and Poisson Tests.
francoisbonneau May 26, 2026
07bdc97
Apply prepare changes
francoisbonneau May 26, 2026
cf5d658
tidy 00
francoisbonneau May 26, 2026
8a30a3f
Apply prepare changes
francoisbonneau May 26, 2026
ddab952
tidy01
francoisbonneau May 26, 2026
2e072dd
Apply prepare changes
francoisbonneau May 26, 2026
c9128a9
tidy02
francoisbonneau May 26, 2026
405e0e4
tidy 04
francoisbonneau May 26, 2026
d436520
Apply prepare changes
francoisbonneau May 26, 2026
0a32698
tidy05
francoisbonneau May 26, 2026
a813370
reduce nb iteration
francoisbonneau May 26, 2026
4c2ec76
modif param
francoisbonneau May 26, 2026
683ebba
avoid generic capture in lambdas
francoisbonneau May 27, 2026
60b8dca
tidy 05
francoisbonneau May 27, 2026
40339c3
tidy06
francoisbonneau May 27, 2026
94c997a
tidy07
francoisbonneau May 27, 2026
3331379
Merge pull request #40 from Geode-solutions/update_test_strauss
francoisbonneau May 27, 2026
dbf2fdf
feat(SimulationContext): remove inheritance in simulation runner
francoisbonneau May 27, 2026
1dd8903
Apply prepare changes
francoisbonneau May 27, 2026
449ca08
fix execution
francoisbonneau May 28, 2026
3c30a67
tidy
francoisbonneau May 28, 2026
e0a5a94
Apply prepare changes
francoisbonneau May 28, 2026
d724578
create simulation context builder
francoisbonneau May 28, 2026
68f5d6f
tidy
francoisbonneau May 29, 2026
7d1a5be
Apply prepare changes
francoisbonneau May 29, 2026
fd01ad8
tidy2
francoisbonneau May 29, 2026
426a3a2
Update include/geode/stochastic/sampling/mcmc/simulation_runner.hpp
francoisbonneau May 29, 2026
3f3192a
Apply prepare changes
francoisbonneau May 29, 2026
2ae78a9
more tidy
francoisbonneau May 29, 2026
8e86a7b
Merge pull request #41 from Geode-solutions/refacto_simulation_runner
francoisbonneau May 29, 2026
9b52d61
feat(Sampler): add genericity
francoisbonneau May 29, 2026
700f135
fix strauss test
francoisbonneau May 29, 2026
6da78cf
feat(Helpers): add poisson and strauss helpers
francoisbonneau Jun 2, 2026
34eb84d
Apply prepare changes
francoisbonneau Jun 2, 2026
0f67b68
msvc try
francoisbonneau Jun 2, 2026
deed2f5
tidy
francoisbonneau Jun 2, 2026
10e578a
Apply prepare changes
francoisbonneau Jun 2, 2026
d526b8f
more tidy
francoisbonneau Jun 2, 2026
775427d
feat(applications): implement fracture application
francoisbonneau Jun 3, 2026
9459cb1
wind
francoisbonneau Jun 3, 2026
fb14a03
tidy
francoisbonneau Jun 3, 2026
03b893e
more tidy
francoisbonneau Jun 3, 2026
f558849
cleaning
francoisbonneau Jun 4, 2026
b832e33
Merge pull request #42 from Geode-solutions/improve_usability
francoisbonneau Jun 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindings/python/src/stochastic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
add_geode_python_binding(
NAME "py_stochastic"
SOURCES
"sampling/mcmc/helpers/fracture_simulation_runner.hpp"
# "sampling/mcmc/helpers/fracture_simulation_runner.hpp"
"sampling/mcmc/helpers/simulation_monitor.hpp"
"sampling/mcmc/helpers/simulation_printer.hpp"
"sampling/mcmc/simulation_runner.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{
void define_fracture_simulation( pybind11::module& module )
{
using namespace geode;

Check warning on line 30 in bindings/python/src/stochastic/sampling/mcmc/helpers/fracture_simulation_runner.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/stochastic/sampling/mcmc/helpers/fracture_simulation_runner.hpp:30:9 [google-build-using-namespace]

do not use namespace using-directives; use using-declarations instead

pybind11::class_< FractureSetDescription >(
module, "FractureSetDescription" )
Expand Down Expand Up @@ -88,7 +88,7 @@
// pybind11::arg( "engine" ), pybind11::arg( "steps"
// ), "Run simulation for a fixed number of steps." )
.def( "run",
static_cast< StatisticsMonitor ( FractureSimulationRunner::* )(
static_cast< StatisticsTracker ( FractureSimulationRunner::* )(
RandomEngine&, const SimulationConfigurator& ) >(
&FractureSimulationRunner::run ),
pybind11::arg( "engine" ), pybind11::arg( "config" ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,30 @@
*
*/

#include <geode/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp>
#include <geode/stochastic/inference/statistics_tracker.hpp>

namespace geode
{
void define_simulation_monitor( pybind11::module &module )

Check failure on line 28 in bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:28:37 [clang-diagnostic-error]

use of undeclared identifier 'pybind11'
{
pybind11::class_< geode::StatisticsMonitor >(
module, "StatisticsMonitor" )
pybind11::class_< geode::StatisticsTracker >(

Check failure on line 30 in bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:30:52 [clang-diagnostic-error]

expected '(' for function-style cast or type construction

Check failure on line 30 in bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:30:9 [clang-diagnostic-error]

use of undeclared identifier 'pybind11'
module, "StatisticsTracker" )
.def( pybind11::init< geode::index_t >(),

Check failure on line 32 in bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:32:52 [clang-diagnostic-error]

expected expression

Check failure on line 32 in bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:32:50 [clang-diagnostic-error]

expected '(' for function-style cast or type construction

Check failure on line 32 in bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:32:19 [clang-diagnostic-error]

use of undeclared identifier 'pybind11'
pybind11::arg( "nb_energy_terms" ),

Check failure on line 33 in bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:33:17 [clang-diagnostic-error]

use of undeclared identifier 'pybind11'
"Create a StatisticsMonitor for a given number of energy "
"Create a StatisticsTracker for a given number of energy "
"terms" )
.def( "add_realization", &geode::StatisticsMonitor::add_realization,
.def( "add_realization", &geode::StatisticsTracker::add_realization,

Check failure on line 36 in bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:36:46 [clang-diagnostic-error]

use of class template 'geode::StatisticsTracker' requires template arguments
pybind11::arg( "values" ),

Check failure on line 37 in bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:37:17 [clang-diagnostic-error]

use of undeclared identifier 'pybind11'
"Add a realization (vector of doubles) to update statistics" )
.def( "statiscal_count", &geode::StatisticsMonitor::statiscal_count,
.def( "statiscal_count", &geode::StatisticsTracker::statiscal_count,

Check failure on line 39 in bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:39:46 [clang-diagnostic-error]

use of class template 'geode::StatisticsTracker' requires template arguments
"Return the number of realizations added" )
.def_property_readonly( "means", &geode::StatisticsMonitor::means,
.def_property_readonly( "means", &geode::StatisticsTracker::means,
"Return the computed mean values for each energy term" )
.def_property_readonly( "variances",
&geode::StatisticsMonitor::variances,
&geode::StatisticsTracker::variances,
"Return the computed variances for each energy term" )
.def( "__repr__", []( const geode::StatisticsMonitor &self ) {
return "<StatisticsMonitor count="
.def( "__repr__", []( const geode::StatisticsTracker &self ) {
return "<StatisticsTracker count="
+ std::to_string( self.statiscal_count() ) + ">";
} );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace geode
// &SimulationPrinter::print_statistics_summary,
// pybind11::arg( "monitor" ),
// pybind11::arg( "energy_term_names" ) = "",
// "Print statistics summary from a StatisticsMonitor."
// "Print statistics summary from a StatisticsTracker."
// );
}
} // namespace geode
8 changes: 4 additions & 4 deletions bindings/python/src/stochastic/stochastic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

#include "sampling/direct/double_sampler.hpp"

#include "sampling/mcmc/helpers/fracture_simulation_runner.hpp"
#include "sampling/mcmc/helpers/simulation_monitor.hpp"
// #include "sampling/mcmc/helpers/fracture_simulation_runner.hpp"
// #include "sampling/mcmc/helpers/simulation_monitor.hpp"
#include "sampling/mcmc/helpers/simulation_printer.hpp"
#include "sampling/mcmc/simulation_runner.hpp"

Expand All @@ -49,8 +49,8 @@ PYBIND11_MODULE( opengeode_stochastic_py_stochastic, module )
geode::define_random_engine( module );
geode::define_double_sampler( module );

geode::define_simulation_monitor( module );
// geode::define_simulation_monitor( module );
geode::define_simulation_printer( module );
geode::define_simulation_runner( module );
geode::define_fracture_simulation( module );
// geode::define_fracture_simulation( module );
}
10 changes: 5 additions & 5 deletions bindings/python/tests/stochastic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

add_geode_python_test(
SOURCE "test-py-mh-fractures.py"
DEPENDENCIES
${PROJECT_NAME}::py_stochastic
)
#add_geode_python_test(
Comment thread
francoisbonneau marked this conversation as resolved.
# SOURCE "test-py-mh-fractures.py"
# DEPENDENCIES
# ${PROJECT_NAME}::py_stochastic
#)
163 changes: 163 additions & 0 deletions include/geode/stochastic/applications/fractures.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
/*
* Copyright (c) 2019 - 2026 Geode-solutions
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

#pragma once

#include <geode/stochastic/inference/target_statistics.hpp>
#include <geode/stochastic/sampling/direct/object_set_sampler/segment_set_sampler.hpp>
#include <geode/stochastic/sampling/mcmc/helpers/simulation_context.hpp>
#include <geode/stochastic/sampling/mcmc/simulation_runner.hpp>

namespace geode
{
using Fracture = OwnerSegment2D;
using FractureSamplerConfig = ObjectSamplerConfig< Fracture >;
using FractureSimulationContext = SimulationContext< Fracture >;
using FractureSimulationRunner = SimulationRunner< Fracture >;

struct FractureSetDescription
{
std::string fset_name;

FractureSamplerConfig sampler;
double birth_ratio{ 1.0 };
double death_ratio{ 1.0 };
double change_ratio{ 1.0 };

[[nodiscard]] std::string density_name() const
{
return absl::StrCat( fset_name, "_p20" );
}
double p20{ 0. };
std::optional< double > expected_number;

[[nodiscard]] std::string intensity_name() const
{
return absl::StrCat( fset_name, "_p21" );
}
double p21{ 0. };
std::optional< double > expected_total_length;

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

[[nodiscard]] std::string spacing_name() const
{
return absl::StrCat( fset_name, "_spacing" );
}
double minimal_spacing{ 0. };

[[nodiscard]] std::string string() const
{
auto message =
absl::StrCat( "FractureSetDescription: ", fset_name );
for( const auto& fixed_object : observed_fractures )
{
absl::StrAppend( &message,
"\n\t --> observation (x,y,z)start: ",
fixed_object[0].string(),
" (x,y,z)end: ", fixed_object[1].string() );
}
absl::StrAppend( &message,
"\n\t --> length distribution: ", sampler.length.string() );
absl::StrAppend( &message,
"\n\t --> azimuth distribution: ", sampler.azimuth.string() );
absl::StrAppend( &message, "\n\t --> ", density_name(), ": ", p20 );
absl::StrAppend(
&message, "\n\t --> ", intensity_name(), ": ", p21 );
absl::StrAppend(
&message, "\n\t --> ", spacing_name(), ": ", minimal_spacing );

absl::StrAppend( &message,
"\n\t --> dynamic move ratio - birth/death/change (",
birth_ratio, " / ", death_ratio, " / ", change_ratio, ")" );
return message;
}
};

// struct FractureInterSetDescription
// {
// std::string interaction_name;
//
// std::vector< std::string > set_names;
//
// double gamma{ 1. };
// double distance{ 0. };
//
// bool include_intra_set{ true };
// bool include_inter_set{ false };
//
// std::optional< double > expected_nb_interactions;
// };

struct opengeode_stochastic_stochastic_api FractureNetworkDescription
{
std::string fnet_name;

SpatialDomainConfig< 2 > domain;

std::vector< FractureSetDescription > fracture_sets;

[[nodiscard]] FractureSetDescription& add_fracture_set(
absl::string_view fset_name )
{
auto& fracture_set = fracture_sets.emplace_back();
fracture_set.fset_name = fset_name;
return fracture_set;
}

[[nodiscard]] std::string string() const
{
auto message =
absl::StrCat( "FractureNetworkDescription: ", fnet_name );
absl::StrAppend( &message, "\n\t --> ", domain.string() );
for( const auto& fset_desc : fracture_sets )
{
absl::StrAppend( &message, "\n\t --> ", fset_desc.string() );
}
return message;
}
// std::vector< StraussInteractionDescription< ObjectType > >
// inter_set_interactions;
//
// void add_x_node_monitoring( double beta_x_node )
// {
// OpenGeodeStochasticStochasticException::check_exception(
// beta_x_node <= 1.0 && beta_x_node >= 0., nullptr,
// OpenGeodeException::TYPE::data,
// "[FractureSimulationRunner] x node should be
// inhibitated, " "please provise a value in [0., 1.]."
// );
// beta_x_node_ = beta_x_node;
// }
};

opengeode_stochastic_stochastic_api FractureSimulationContext
build_fractures_simulation_context(
const FractureNetworkDescription& description );

opengeode_stochastic_stochastic_api
std::vector< geode::TargetStatisticConfig >
build_fractures_targeted_stat(
const FractureNetworkDescription& description );

} // namespace geode
73 changes: 73 additions & 0 deletions include/geode/stochastic/applications/poisson_process.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (c) 2019 - 2026 Geode-solutions
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

#pragma once

#include <geode/stochastic/inference/target_statistics.hpp>
#include <geode/stochastic/sampling/mcmc/helpers/simulation_context.hpp>

namespace geode
{
template < typename ObjectType >
struct PoissonSetDescription
{
std::string set_name;

ObjectSamplerConfig< ObjectType > sampler;

std::string density_name;
double lambda{ 0. };
std::optional< double > expected_nb_objects;

double birth_ratio{ 1.0 };
double death_ratio{ 1.0 };
double change_ratio{ 1.0 };
};

template < typename ObjectType >
struct PoissonProcessDescription
{
std::string process_name{ "Poisson" };
SpatialDomainConfig< ObjectType::dim > domain;

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

PoissonSetDescription< ObjectType >& add_set(
absl::string_view set_name )
{
auto& set = sets.emplace_back();
set.set_name = set_name;
set.density_name = absl::StrCat( set_name, "_density" );
return set;
}
};

template < typename ObjectType >
SimulationContext< ObjectType > build_poisson_process(
const PoissonProcessDescription< ObjectType >& description );

template < typename ObjectType >
std::vector< geode::TargetStatisticConfig > build_poisson_targeted_stat(
const PoissonProcessDescription< ObjectType >& description );

} // namespace geode
Loading
Loading