Skip to content

Commit 028451f

Browse files
committed
check_
1 parent b112711 commit 028451f

15 files changed

Lines changed: 74 additions & 73 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ namespace geode
4040
: ObjectSetSampler< Point< dimension > >{}, domain_( domain )
4141
{
4242
auto volume = domain_.extended_n_volume();
43-
OpenGeodeStochasticStochasticException::check( volume != 0.,
44-
nullptr, OpenGeodeException::TYPE::data,
43+
OpenGeodeStochasticStochasticException::check_exception(
44+
volume != 0., nullptr, OpenGeodeException::TYPE::data,
4545
"[PointSetSampler] - Undefined Extended Bounding "
4646
"Box (volume ==0)." );
4747
this->log_pdf_ = -std::log( volume );
4848
step_move_ = define_step_for_move();
49-
OpenGeodeStochasticStochasticException::check( step_move_ > 0.,
50-
nullptr, OpenGeodeException::TYPE::data,
49+
OpenGeodeStochasticStochasticException::check_exception(
50+
step_move_ > 0., nullptr, OpenGeodeException::TYPE::data,
5151
"[PointSetSampler] - Undefined step length for move (value == ",
5252
step_move_, ")." );
5353
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ namespace geode
4545
azimuth_{ azimuth }
4646
{
4747
auto volume = domain_.extended_n_volume();
48-
OpenGeodeStochasticStochasticException::check( volume != 0.,
49-
nullptr, OpenGeodeException::TYPE::data,
48+
OpenGeodeStochasticStochasticException::check_exception(
49+
volume != 0., nullptr, OpenGeodeException::TYPE::data,
5050
"[SegmentSetSampler] - Undefined Extended Bounding "
5151
"Box (volume ==0)." );
5252
this->log_pdf_ = -std::log( volume );

include/geode/stochastic/sampling/mcmc/energy_terms/energy_term.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ namespace geode::detail
4040
{
4141
explicit EnergyScale( double param )
4242
{
43-
OpenGeodeStochasticStochasticException::check( param >= 0., nullptr,
44-
OpenGeodeException::TYPE::data,
43+
OpenGeodeStochasticStochasticException::check_exception(
44+
param >= 0., nullptr, OpenGeodeException::TYPE::data,
4545
"[Gibbs energy term] - The model parameter cannot be "
4646
"negative." );
4747

include/geode/stochastic/sampling/mcmc/energy_terms/energy_term_collection.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ namespace geode
7777
const uuid& term_id ) const
7878
{
7979
auto term_it = energy_terms_.find( term_id );
80-
OpenGeodeStochasticStochasticException::check(
80+
OpenGeodeStochasticStochasticException::check_exception(
8181
term_it != energy_terms_.end(), nullptr,
8282
OpenGeodeException::TYPE::data,
8383
"[EnergyTermCollection] Unknown energy term: ",
@@ -97,7 +97,7 @@ namespace geode
9797
terms_for_set( const uuid& set_id ) const
9898
{
9999
const auto it = set_to_terms_.find( set_id );
100-
OpenGeodeStochasticStochasticException::check(
100+
OpenGeodeStochasticStochasticException::check_exception(
101101
it != set_to_terms_.end(), nullptr,
102102
OpenGeodeException::TYPE::data,
103103
"[EnergyTermCollection] - Object Subset (", set_id.string(),

include/geode/stochastic/sampling/mcmc/helpers/fracture_simulation_runner.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ namespace geode
9191

9292
void add_x_node_monitoring( double beta_x_node )
9393
{
94-
OpenGeodeStochasticStochasticException::check(
94+
OpenGeodeStochasticStochasticException::check_exception(
9595
beta_x_node <= 1.0 && beta_x_node >= 0., nullptr,
9696
OpenGeodeException::TYPE::data,
9797
"[FractureSimulationRunner] x node should be inhibitated, "

include/geode/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace geode
4545

4646
void add_realization( const std::vector< double >& values )
4747
{
48-
OpenGeodeStochasticStochasticException::check(
48+
OpenGeodeStochasticStochasticException::check_exception(
4949
values.size() == means_.size(), nullptr,
5050
OpenGeodeException::TYPE::data,
5151
"[StatisticsMonitor] - Mismatch between realization size and "

include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace geode
5555
: gibbs_energy_{ energy_term_collection },
5656
proposal_kernel_( std::move( proposal_kernel ) )
5757
{
58-
OpenGeodeStochasticStochasticException::check(
58+
OpenGeodeStochasticStochasticException::check_exception(
5959
proposal_kernel_ != nullptr, nullptr,
6060
OpenGeodeException::TYPE::data, "[MH] null proposal kernel" );
6161
}
@@ -107,8 +107,9 @@ namespace geode
107107

108108
void set_beta( double b )
109109
{
110-
OpenGeodeStochasticStochasticException::check( b >= 0.0, nullptr,
111-
OpenGeodeException::TYPE::data, "[MH] beta must be >= 0" );
110+
OpenGeodeStochasticStochasticException::check_exception( b >= 0.0,
111+
nullptr, OpenGeodeException::TYPE::data,
112+
"[MH] beta must be >= 0" );
112113
if( b == 0 )
113114
{
114115
Logger::info(

include/geode/stochastic/sampling/mcmc/proposal/classical_proposals.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ namespace geode
4040
double change_ratio )
4141
{
4242
const auto total_ratio = birth_ratio + death_ratio;
43-
OpenGeodeStochasticStochasticException::check( total_ratio > 0.,
44-
nullptr, OpenGeodeException::TYPE::data,
43+
OpenGeodeStochasticStochasticException::check_exception(
44+
total_ratio > 0., nullptr, OpenGeodeException::TYPE::data,
4545
"BIRTH+DEATH ratio must be positive" );
4646

4747
const auto p_birth = birth_ratio / total_ratio;
@@ -78,8 +78,8 @@ namespace geode
7878
double death_prob )
7979
{
8080
auto birth_death_prob = birth_prob + death_prob;
81-
OpenGeodeStochasticStochasticException::check( birth_death_prob < 1.,
82-
nullptr, OpenGeodeException::TYPE::data,
81+
OpenGeodeStochasticStochasticException::check_exception(
82+
birth_death_prob < 1., nullptr, OpenGeodeException::TYPE::data,
8383
"[Proposal Kernel] - changes should be allowed." );
8484
auto kernel = std::make_unique< ProposalKernel< ObjectType > >();
8585
kernel->add_move(

include/geode/stochastic/sampling/mcmc/proposal/moves.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace geode
5050

5151
double transition_probability() const
5252
{
53-
OpenGeodeStochasticStochasticException::check(
53+
OpenGeodeStochasticStochasticException::check_exception(
5454
std::isfinite( log_forward_prob )
5555
&& std::isfinite( log_backward_prob ),
5656
nullptr, OpenGeodeException::TYPE::data,
@@ -116,7 +116,7 @@ namespace geode
116116
double proportion_weight )
117117
: sampler_( sampler ), proportion_weight_{ proportion_weight }
118118
{
119-
OpenGeodeStochasticStochasticException::check(
119+
OpenGeodeStochasticStochasticException::check_exception(
120120
proportion_weight_ > 0., nullptr,
121121
OpenGeodeException::TYPE::data,
122122
"[Move] - the weight factor for a move should be in higher "
@@ -187,7 +187,7 @@ namespace geode
187187

188188
void initialize_probability( double probability ) override
189189
{
190-
OpenGeodeStochasticStochasticException::check(
190+
OpenGeodeStochasticStochasticException::check_exception(
191191
birth_ratio_ > 0. && birth_ratio_ < 1., nullptr,
192192
OpenGeodeException::TYPE::data,
193193
"[BirthDeathMove]-the ratio of birth over mover should be in "

include/geode/stochastic/sampling/mcmc/proposal/proposal_kernel.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace geode
3636
MoveResult< ObjectType > proposed_move;
3737
ObjectRef< ObjectType > new_object()
3838
{
39-
OpenGeodeStochasticStochasticException::check(
39+
OpenGeodeStochasticStochasticException::check_exception(
4040
proposed_move.new_object.has_value(), nullptr,
4141
OpenGeodeException::TYPE::data,
4242
"[Proposal] Proposal has no new_object" );
@@ -46,7 +46,7 @@ namespace geode
4646

4747
ObjectId old_object_id()
4848
{
49-
OpenGeodeStochasticStochasticException::check(
49+
OpenGeodeStochasticStochasticException::check_exception(
5050
proposed_move.old_object_id.has_value(), nullptr,
5151
OpenGeodeException::TYPE::data,
5252
"[Proposal] Proposal has no old_object_id" );
@@ -70,8 +70,8 @@ namespace geode
7070
Proposal< ObjectType > propose( const ObjectSets< ObjectType >& current,
7171
RandomEngine& engine ) const
7272
{
73-
OpenGeodeStochasticStochasticException::check( !set_moves_.empty(),
74-
nullptr, OpenGeodeException::TYPE::data,
73+
OpenGeodeStochasticStochasticException::check_exception(
74+
!set_moves_.empty(), nullptr, OpenGeodeException::TYPE::data,
7575
"[MCMC Proposal Kernel] - no move are defined in the Kernel." );
7676
auto rnd = engine.sample_uniform( uniform_distribution_closed_ );
7777
for( const auto proba_id : Range{ cumulative_probs_.size() } )
@@ -131,7 +131,7 @@ namespace geode
131131
probabilities.begin(), probabilities.end(), 0.0 );
132132

133133
// Ensure total > 0
134-
OpenGeodeStochasticStochasticException::check(
134+
OpenGeodeStochasticStochasticException::check_exception(
135135
total > GLOBAL_EPSILON, nullptr,
136136
OpenGeodeException::TYPE::internal,
137137
"[MCMC Proposal Kernel] - Total "

0 commit comments

Comments
 (0)