Skip to content

feat(EnergyTerm): builder for energy terms#36

Open
francoisbonneau wants to merge 4 commits intomcmc_configfrom
energy_term_refactoring
Open

feat(EnergyTerm): builder for energy terms#36
francoisbonneau wants to merge 4 commits intomcmc_configfrom
energy_term_refactoring

Conversation

@francoisbonneau
Copy link
Copy Markdown
Member

No description provided.

@francoisbonneau francoisbonneau requested a review from BotellaA April 9, 2026 12:26
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy (v20.1.8) reports: 233 concern(s)
  • include/geode/stochastic/inference/statistic_monitor.hpp:10:11: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: means_, m2_

       10 |     class StatMonitor
          |           ^
  • include/geode/stochastic/inference/statistic_monitor.hpp:14:25: error: [clang-diagnostic-error]

    no template named 'flat_hash_map' in namespace 'absl'

       14 |             const absl::flat_hash_map< uuid, double >& values )
          |                   ~~~~~~^
  • include/geode/stochastic/inference/statistic_monitor.hpp:29:9: warning: [clang-diagnostic-ignored-qualifiers]

    'const' type qualifier on return type has no effect

       29 |         const index_t statiscal_count() const
          |         ^
    note: this fix will not be applied because it overlaps with another fix
  • include/geode/stochastic/inference/statistic_monitor.hpp:29:9: warning: [modernize-use-nodiscard]

    function 'statiscal_count' should be marked [[nodiscard]]

       29 |         const index_t statiscal_count() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/inference/statistic_monitor.hpp:29:9: warning: [readability-const-return-type]

    return type 'const index_t' (aka 'const unsigned int') is 'const'-qualified at the top level, which may reduce code readability without improving const correctness

       29 |         const index_t statiscal_count() const
          |         ^~~~~
    note: this fix will not be applied because it overlaps with another fix
  • include/geode/stochastic/inference/statistic_monitor.hpp:34:9: warning: [modernize-use-nodiscard]

    function 'mean' should be marked [[nodiscard]]

       34 |         double mean( const uuid& id ) const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/inference/statistic_monitor.hpp:34:34: warning: [readability-identifier-length]

    parameter name 'id' is too short, expected at least 3 characters

       34 |         double mean( const uuid& id ) const
          |                                  ^
  • include/geode/stochastic/inference/statistic_monitor.hpp:39:9: warning: [modernize-use-nodiscard]

    function 'variance' should be marked [[nodiscard]]

       39 |         double variance( const uuid& id ) const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/inference/statistic_monitor.hpp:39:38: warning: [readability-identifier-length]

    parameter name 'id' is too short, expected at least 3 characters

       39 |         double variance( const uuid& id ) const
          |                                      ^
  • include/geode/stochastic/inference/statistic_monitor.hpp:41:29: warning: [google-readability-braces-around-statements]

    statement should be inside braces

       41 |             if( count_ < 2 )
          |                             ^
          |                              {
       42 |                 return 0.0;
          |                            
  • include/geode/stochastic/inference/statistic_monitor.hpp:47:15: error: [clang-diagnostic-error]

    no template named 'flat_hash_map' in namespace 'absl'

       47 |         absl::flat_hash_map< uuid, double > means_;
          |         ~~~~~~^
  • include/geode/stochastic/inference/statistic_monitor.hpp:47:45: warning: [clang-diagnostic-unused-private-field]

    private field 'means_' is not used

       47 |         absl::flat_hash_map< uuid, double > means_;
          |                                             ^
  • include/geode/stochastic/inference/statistic_monitor.hpp:48:15: error: [clang-diagnostic-error]

    no template named 'flat_hash_map' in namespace 'absl'

       48 |         absl::flat_hash_map< uuid, double > m2_;
          |         ~~~~~~^
  • include/geode/stochastic/inference/statistic_monitor.hpp:48:45: warning: [clang-diagnostic-unused-private-field]

    private field 'm2_' is not used

       48 |         absl::flat_hash_map< uuid, double > m2_;
          |                                             ^
  • include/geode/stochastic/inference/statistic_objective.hpp:36:9: warning: [modernize-use-nodiscard]

    function 'compute_loss' should be marked [[nodiscard]]

       36 |         double compute_loss( const StatMonitor& monitor,
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/inference/statistic_validator.hpp:36:27: error: [clang-diagnostic-error]

    unknown type name 'StatisticsMonitor'; did you mean 'StatisticsValidator'?

       36 |         void check( const StatisticsMonitor& monitor,
          |                           ^~~~~~~~~~~~~~~~~
          |                           StatisticsValidator
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/inference/statistic_validator.hpp:33:11: note: 'StatisticsValidator' declared here
       33 |     class StatisticsValidator
          |           ^
  • include/geode/stochastic/inference/statistic_validator.hpp:41:45: error: [clang-diagnostic-error]

    no member named 'mean' in 'StatisticsValidator'

       41 |                 const double mean = monitor.mean( target.term_id );
          |                                     ~~~~~~~ ^
  • include/geode/stochastic/inference/target_statistic.hpp:27:12: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: term_id, value

       27 |     struct TargetStatistic
          |            ^
       28 |     {
       29 |         geode::uuid term_id;
          |                            
          |                            {}
       30 |         double value;
          |                     
          |                     {}
  • include/geode/stochastic/inference/target_statistic.hpp:29:16: error: [clang-diagnostic-error]

    no type named 'uuid' in namespace 'geode'

       29 |         geode::uuid term_id;
          |         ~~~~~~~^
  • include/geode/stochastic/inference/target_statistic.hpp:31:27: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.05 is a magic number; consider replacing it with a named constant

       31 |         double tolerance{ 0.05 };
          |                           ^
  • include/geode/stochastic/models/energy_terms/energy_term_builder.hpp:68:9: warning: [misc-definitions-in-headers]

    function 'pairwise_builder_initialize_interactions_helper' defined in a header file; function definitions in header files can lead to ODR violations

       68 |         pairwise_builder_initialize_interactions_helper(
          |         ^
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/models/energy_terms/energy_term_builder.hpp:68:9: note: mark the definition as 'inline'
       66 |     std::pair< std::vector< geode::uuid >,
          |     inline 
       67 |         absl::flat_hash_map< uuid, std::vector< uuid > > >
       68 |         pairwise_builder_initialize_interactions_helper(
          |         ^
  • include/geode/stochastic/models/energy_terms/energy_term_builder.hpp:143:35: warning: [hicpp-named-parameter]

    all parameters should be named in a function

      143 |         const NewEnergyTypeConfig&,
          |                                   ^
          |                                    /*unused*/
      144 |         const ObjectSets< ObjectType >&,
          |                                        
          |                                         /*unused*/
      145 |         const SpatialDomain< ObjectType::dim >& )
          |                                                  /*unused*/
  • include/geode/stochastic/models/energy_terms/energy_term_builder.hpp:153:30: warning: [hicpp-named-parameter]

    all parameters should be named in a function

      153 |         const std::monostate&,
          |                              ^
          |                               /*unused*/
      154 |         const ObjectSets< ObjectType >&,
          |                                        
          |                                         /*unused*/
      155 |         const SpatialDomain< ObjectType::dim >& )
          |                                                  /*unused*/
  • include/geode/stochastic/models/model.hpp:51:11: warning: [cppcoreguidelines-special-member-functions]

    class 'Model' defines a copy constructor and a copy assignment operator but does not define a destructor, a move constructor or a move assignment operator

       51 |     class Model
          |           ^
  • include/geode/stochastic/models/model.hpp:57:9: warning: [google-explicit-constructor]

    single-argument constructors must be marked explicit to avoid unintentional implicit conversions

       57 |         Model( EnergyTermCollection< ObjectType >&& energy_terms )
          |         ^
          |         explicit 
  • include/geode/stochastic/sampling/mcmc/helpers/fracture_simulation_runner.hpp:28:10: error: [clang-diagnostic-error]

    'geode/stochastic/models/energy_terms/density_term.hpp' file not found

       28 | #include <geode/stochastic/models/energy_terms/density_term.hpp>
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:38:31: warning: [cppcoreguidelines-avoid-magic-numbers]

    1000 is a magic number; consider replacing it with a named constant

       38 |         index_t realizations{ 1000 };
          |                               ^
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:39:43: warning: [cppcoreguidelines-avoid-magic-numbers]

    1000 is a magic number; consider replacing it with a named constant

       39 |         index_t metropolis_hasting_steps{ 1000 };
          |                                           ^
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:40:32: warning: [cppcoreguidelines-avoid-magic-numbers]

    1000 is a magic number; consider replacing it with a named constant

       40 |         index_t burn_in_steps{ 1000 };
          |                                ^
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:44:9: warning: [modernize-use-nodiscard]

    function 'string' should be marked [[nodiscard]]

       44 |         std::string string() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:63:11: warning: [cppcoreguidelines-special-member-functions]

    class 'SimulationRunner' defines a default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator

       63 |     class SimulationRunner
          |           ^
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:66:9: warning: [google-explicit-constructor]

    single-argument constructors must be marked explicit to avoid unintentional implicit conversions

       66 |         SimulationRunner( const SpatialDomain< ObjectType::dim >& domain )
          |         ^
          |         explicit 
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:127:9: warning: [modernize-use-nodiscard]

    function 'state_statistics' should be marked [[nodiscard]]

      127 |         std::vector< double > state_statistics() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:142:9: warning: [modernize-use-nodiscard]

    function 'model_energy_term_names' should be marked [[nodiscard]]

      142 |         std::string model_energy_term_names() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:159:42: warning: [cppcoreguidelines-non-private-member-variables-in-classes]

    member variable 'domain_' has protected visibility

      159 |         SpatialDomain< ObjectType::dim > domain_;
          |                                          ^
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:161:13: warning: [cppcoreguidelines-non-private-member-variables-in-classes]

    member variable 'set_samplers_' has protected visibility

      161 |             set_samplers_;
          |             ^
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:163:36: warning: [cppcoreguidelines-non-private-member-variables-in-classes]

    member variable 'ordered_energy_terms_' has protected visibility

      163 |         std::vector< geode::uuid > ordered_energy_terms_;
          |                                    ^
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:164:31: warning: [cppcoreguidelines-non-private-member-variables-in-classes]

    member variable 'ordered_target_statistics_' has protected visibility

      164 |         std::vector< double > ordered_target_statistics_;
          |                               ^
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:166:44: warning: [cppcoreguidelines-non-private-member-variables-in-classes]

    member variable 'energy_terms_collection_' has protected visibility

      166 |         EnergyTermCollection< ObjectType > energy_terms_collection_;
          |                                            ^
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:167:68: warning: [cppcoreguidelines-non-private-member-variables-in-classes]

    member variable 'mh_sampler_' has protected visibility

      167 |         std::unique_ptr< geode::MetropolisHastings< ObjectType > > mh_sampler_;
          |                                                                    ^
  • include/geode/stochastic/sampling/mcmc/simulation_runner.hpp:169:34: warning: [cppcoreguidelines-non-private-member-variables-in-classes]

    member variable 'object_sets_' has protected visibility

      169 |         ObjectSets< ObjectType > object_sets_;
          |                                  ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:30:5: error: [clang-diagnostic-error]

    unknown type name 'FORWARD_DECLARATION_DIMENSION_CLASS'

       30 |     FORWARD_DECLARATION_DIMENSION_CLASS( BoundingBox );
          |     ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:30:42: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'BoundingBox' is non-const and globally accessible, consider making it const

       30 |     FORWARD_DECLARATION_DIMENSION_CLASS( BoundingBox );
          |                                          ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:30:42: warning: [readability-identifier-naming]

    invalid case style for variable 'BoundingBox'

       30 |     FORWARD_DECLARATION_DIMENSION_CLASS( BoundingBox );
          |                                          ^~~~~~~~~~~
          |                                          bounding_box
  • include/geode/stochastic/spatial/object_neighborhood.hpp:31:1: warning: [llvm-namespace-comment]

    namespace 'geode' not terminated with a closing comment

       31 | }
          | ^
          |   // namespace geode
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/spatial/object_neighborhood.hpp:28:11: note: namespace 'geode' starts here
       28 | namespace geode
          |           ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:35:12: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: index, fixed, set_id

       35 |     struct ObjectId
          |            ^
       36 |     {
       37 |         index_t index;
          |                      
          |                      {}
       38 |         bool fixed;
          |                   
          |                   {}
       39 |         uuid set_id;
          |                    
          |                    {}
  • include/geode/stochastic/spatial/object_neighborhood.hpp:37:9: error: [clang-diagnostic-error]

    unknown type name 'index_t'

       37 |         index_t index;
          |         ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:39:9: error: [clang-diagnostic-error]

    unknown type name 'uuid'

       39 |         uuid set_id;
          |         ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:57:16: error: [clang-diagnostic-error]

    unknown type name 'index_t'

       57 |     template < index_t dimension >
          |                ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:58:11: warning: [cppcoreguidelines-special-member-functions]

    class 'ObjectNeighborhood' defines a default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator

       58 |     class ObjectNeighborhood
          |           ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:64:25: error: [clang-diagnostic-error]

    no template named 'BoundingBox'

       64 |         void add( const BoundingBox< dimension >& box, const ObjectId& id );
          |                         ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:64:72: warning: [readability-identifier-length]

    parameter name 'id' is too short, expected at least 3 characters

       64 |         void add( const BoundingBox< dimension >& box, const ObjectId& id );
          |                                                                        ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:65:28: error: [clang-diagnostic-error]

    no template named 'BoundingBox'

       65 |         void update( const BoundingBox< dimension >& old_box,
          |                            ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:66:19: error: [clang-diagnostic-error]

    no template named 'BoundingBox'

       66 |             const BoundingBox< dimension >& new_box,
          |                   ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:67:29: warning: [readability-identifier-length]

    parameter name 'id' is too short, expected at least 3 characters

       67 |             const ObjectId& id );
          |                             ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:68:28: error: [clang-diagnostic-error]

    no template named 'BoundingBox'

       68 |         void update( const BoundingBox< dimension >& box,
          |                            ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:71:28: error: [clang-diagnostic-error]

    no template named 'BoundingBox'

       71 |         void remove( const BoundingBox< dimension >& box, const ObjectId& id );
          |                            ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:71:75: warning: [readability-identifier-length]

    parameter name 'id' is too short, expected at least 3 characters

       71 |         void remove( const BoundingBox< dimension >& box, const ObjectId& id );
          |                                                                           ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:73:9: warning: [modernize-use-nodiscard]

    function 'get_all_neighbor_ids' should be marked [[nodiscard]]

       73 |         std::vector< ObjectId > get_all_neighbor_ids(
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/object_neighborhood.hpp:74:19: error: [clang-diagnostic-error]

    no template named 'BoundingBox'

       74 |             const BoundingBox< dimension >& box,
          |                   ^
  • include/geode/stochastic/spatial/object_neighborhood.hpp:75:32: error: [clang-diagnostic-error]

    use of undeclared identifier 'uuid'

       75 |             const std::vector< uuid >& targeted_set_ids,
          |                                ^
  • include/geode/stochastic/spatial/object_sets.hpp:50:11: warning: [cppcoreguidelines-special-member-functions]

    class 'ObjectSets' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor

       50 |     class ObjectSets
          |           ^
  • include/geode/stochastic/spatial/object_sets.hpp:61:9: warning: [modernize-use-nodiscard]

    function 'get_all_object' should be marked [[nodiscard]]

       61 |         std::vector< ObjectId > get_all_object() const;
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/object_sets.hpp:62:9: warning: [modernize-use-nodiscard]

    function 'get_objects_in_set' should be marked [[nodiscard]]

       62 |         std::vector< ObjectId > get_objects_in_set( const uuid& set_id ) const;
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/object_sets.hpp:64:9: warning: [modernize-use-nodiscard]

    function 'nb_sets' should be marked [[nodiscard]]

       64 |         index_t nb_sets() const;
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/object_sets.hpp:65:9: warning: [modernize-use-nodiscard]

    function 'nb_objects_in_set' should be marked [[nodiscard]]

       65 |         index_t nb_objects_in_set( const uuid& set_id ) const;
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/object_sets.hpp:66:9: warning: [modernize-use-nodiscard]

    function 'nb_objects' should be marked [[nodiscard]]

       66 |         index_t nb_objects() const;
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/object_sets.hpp:78:9: warning: [modernize-use-nodiscard]

    function 'string' should be marked [[nodiscard]]

       78 |         std::string string() const;
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/object_sets.hpp:80:9: warning: [modernize-use-nodiscard]

    function 'get_set_uuid' should be marked [[nodiscard]]

       80 |         uuid get_set_uuid( std::string_view set_name ) const;
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/object_sets.hpp:81:9: warning: [modernize-use-nodiscard]

    function 'get_set_uuids' should be marked [[nodiscard]]

       81 |         std::vector< uuid > get_set_uuids(
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/object_sets.hpp:83:9: warning: [modernize-use-nodiscard]

    function 'get_set_uuid_pairs' should be marked [[nodiscard]]

       83 |         std::vector< std::pair< uuid, uuid > > get_set_uuid_pairs(
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/pairwise_interactions/pairwise_interactions_builder.hpp:50:70: warning: [hicpp-named-parameter]

    all parameters should be named in a function

       50 |         build_pairwise_interaction_impl( const NewInteractionConfig& )
          |                                                                      ^
          |                                                                       /*unused*/
  • include/geode/stochastic/spatial/pairwise_interactions/pairwise_interactions_builder.hpp:59:64: warning: [hicpp-named-parameter]

    all parameters should be named in a function

       59 |         build_pairwise_interaction_impl( const std::monostate& )
          |                                                                ^
          |                                                                 /*unused*/
  • include/geode/stochastic/spatial/single_object_features/segment_length_feature.hpp:35:9: warning: [modernize-use-nodiscard]

    function 'evaluate' should be marked [[nodiscard]]

       35 |         double evaluate( const OwnerSegment2D& segment,
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/single_object_features/single_object_feature.hpp:31:11: warning: [cppcoreguidelines-special-member-functions]

    class 'SingleObjectFeature' defines a default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator

       31 |     class SingleObjectFeature
          |           ^
  • include/geode/stochastic/spatial/single_object_features/single_object_feature_builder.hpp:35:48: warning: [misc-unused-parameters]

    parameter 'cfg' is unused

       35 |             const ObjectInDomainFeatureConfig& cfg )
          |                                                ^~~
          |                                                 /*cfg*/
  • include/geode/stochastic/spatial/single_object_features/single_object_feature_builder.hpp:60:73: warning: [hicpp-named-parameter]

    all parameters should be named in a function

       60 |         build_single_object_feature_impl( const NewObjectFeatureConfig& )
          |                                                                         ^
          |                                                                          /*unused*/
  • include/geode/stochastic/spatial/single_object_features/single_object_feature_builder.hpp:69:65: warning: [hicpp-named-parameter]

    all parameters should be named in a function

       69 |         build_single_object_feature_impl( const std::monostate& )
          |                                                                 ^
          |                                                                  /*unused*/
  • src/geode/stochastic/spatial/object_sets.cpp:14:14: warning: [readability-identifier-length]

    variable name 'it' is too short, expected at least 3 characters

       14 |         auto it = uuid_to_index_.find( set_id );
          |              ^
  • src/geode/stochastic/spatial/object_sets.cpp:177:43: warning: [cppcoreguidelines-avoid-magic-numbers]

    1. is a magic number; consider replacing it with a named constant
      177 |         box.extends( searching_distance * 2. );
          |                                           ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:32:19: warning: [cert-err58-cpp]

    initialization of 'set_name' with static storage duration may throw an exception that cannot be caught

       32 | const std::string set_name{ "segments" };
          |                   ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:533:7: note: possibly throwing constructor declared here
      533 |       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
          |       ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:32:19: warning: [readability-identifier-naming]

    invalid case style for global constant 'set_name'

       32 | const std::string set_name{ "segments" };
          |                   ^~~~~~~~
          |                   SET_NAME
       33 | 
       34 | geode::uuid init_object_set( geode::ObjectSets< geode::Point2D >& pattern )
       35 | {
       36 |     geode::Point2D p1{ { 0., 0. } };
       37 |     geode::Point2D p2{ { 1., 1. } };
       38 |     geode::Point2D p_buffer{ { 1.3, 0.1 } };
       39 | 
       40 |     auto set_id = pattern.add_set( set_name );
          |                                    ~~~~~~~~
          |                                    SET_NAME
  • tests/stochastic/models/energy_terms/test-density-term.cpp:34:13: warning: [misc-use-internal-linkage]

    function 'init_object_set' can be made static or moved into an anonymous namespace to enforce internal linkage

       34 | geode::uuid init_object_set( geode::ObjectSets< geode::Point2D >& pattern )
          |             ^
          | static 
  • tests/stochastic/models/energy_terms/test-density-term.cpp:36:20: warning: [readability-identifier-length]

    variable name 'p1' is too short, expected at least 3 characters

       36 |     geode::Point2D p1{ { 0., 0. } };
          |                    ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:37:20: warning: [readability-identifier-length]

    variable name 'p2' is too short, expected at least 3 characters

       37 |     geode::Point2D p2{ { 1., 1. } };
          |                    ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:38:32: warning: [cppcoreguidelines-avoid-magic-numbers]

    1.3 is a magic number; consider replacing it with a named constant

       38 |     geode::Point2D p_buffer{ { 1.3, 0.1 } };
          |                                ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:38:37: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.1 is a magic number; consider replacing it with a named constant

       38 |     geode::Point2D p_buffer{ { 1.3, 0.1 } };
          |                                     ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:41:25: warning: [hicpp-move-const-arg]

    std::move of the variable 'p1' of the trivially-copyable type 'geode::Point2D' (aka 'Point<2>') has no effect; remove std::move()

       41 |     pattern.add_object( std::move( p1 ), set_id, false );
          |                         ^~~~~~~~~~    ~
  • tests/stochastic/models/energy_terms/test-density-term.cpp:42:25: warning: [hicpp-move-const-arg]

    std::move of the variable 'p2' of the trivially-copyable type 'geode::Point2D' (aka 'Point<2>') has no effect; remove std::move()

       42 |     pattern.add_object( std::move( p2 ), set_id, false );
          |                         ^~~~~~~~~~    ~
  • tests/stochastic/models/energy_terms/test-density-term.cpp:43:25: warning: [hicpp-move-const-arg]

    std::move of the variable 'p_buffer' of the trivially-copyable type 'geode::Point2D' (aka 'Point<2>') has no effect; remove std::move()

       43 |     pattern.add_object( std::move( p_buffer ), set_id, false ); // buffer last
          |                         ^~~~~~~~~~          ~
  • tests/stochastic/models/energy_terms/test-density-term.cpp:48:27: warning: [misc-use-internal-linkage]

    function 'init_domain' can be made static or moved into an anonymous namespace to enforce internal linkage

       48 | geode::SpatialDomain< 2 > init_domain()
          |                           ^
          | static 
  • tests/stochastic/models/energy_terms/test-density-term.cpp:53:44: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

       53 |     return geode::SpatialDomain< 2 >{ box, 0.5 };
          |                                            ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:56:6: warning: [misc-use-internal-linkage]

    function 'run_density_test' can be made static or moved into an anonymous namespace to enforce internal linkage

       56 | void run_density_test( const geode::SingleObjectTermConfig& term_config,
          |      ^
          | static 
  • tests/stochastic/models/energy_terms/test-density-term.cpp:73:42: warning: [cppcoreguidelines-avoid-magic-numbers]

    1. is a magic number; consider replacing it with a named constant
       73 |         ( lambda > 0. ? neg_log_lambda * 2.
          |                                          ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:80:32: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

       80 |     geode::Point2D p_inside{ { 0.5, 0.5 } };
          |                                ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:80:37: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

       80 |     geode::Point2D p_inside{ { 0.5, 0.5 } };
          |                                     ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:87:32: warning: [cppcoreguidelines-avoid-magic-numbers]

    1.3 is a magic number; consider replacing it with a named constant

       87 |     geode::Point2D p_buffer{ { 1.3, 0.0 } };
          |                                ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:106:34: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.1 is a magic number; consider replacing it with a named constant

      106 |     geode::Point2D p_anchored{ { 0.1, 0.1 } };
          |                                  ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:106:39: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.1 is a magic number; consider replacing it with a named constant

      106 |     geode::Point2D p_anchored{ { 0.1, 0.1 } };
          |                                       ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:119:5: warning: [bugprone-exception-escape]

    an exception may be thrown in function 'main' which should not throw exceptions

      119 | int main()
          |     ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:127:14: warning: [clang-analyzer-deadcode.DeadStores]

    Value stored to 'set_id' during its initialization is never read

      127 |         auto set_id = init_object_set( pattern );
          |              ^~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/tests/stochastic/models/energy_terms/test-density-term.cpp:127:14: note: Value stored to 'set_id' during its initialization is never read
      127 |         auto set_id = init_object_set( pattern );
          |              ^~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
  • tests/stochastic/models/energy_terms/test-density-term.cpp:134:30: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

      134 |         term_config.lambda = 0.5;
          |                              ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:141:30: warning: [cppcoreguidelines-avoid-magic-numbers]

    100.0021165 is a magic number; consider replacing it with a named constant

      141 |         term_config.lambda = 100.0021165;
          |                              ^
  • tests/stochastic/models/energy_terms/test-density-term.cpp:155:14: warning: [clang-analyzer-deadcode.DeadStores]

    Value stored to 'set_id' during its initialization is never read

      155 |         auto set_id = init_object_set( pattern );
          |              ^~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/tests/stochastic/models/energy_terms/test-density-term.cpp:155:14: note: Value stored to 'set_id' during its initialization is never read
      155 |         auto set_id = init_object_set( pattern );
          |              ^~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
  • tests/stochastic/models/energy_terms/test-gibbs-energy.cpp:29:10: error: [clang-diagnostic-error]

    'geode/stochastic/models/energy_terms/density_term.hpp' file not found

       29 | #include <geode/stochastic/models/energy_terms/density_term.hpp>
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • tests/stochastic/models/energy_terms/test-gibbs-energy.cpp:34:6: warning: [misc-use-internal-linkage]

    function 'test_gibbs_energy' can be made static or moved into an anonymous namespace to enforce internal linkage

       34 | void test_gibbs_energy()
          |      ^
          | static 
  • tests/stochastic/models/energy_terms/test-gibbs-energy.cpp:43:20: warning: [readability-identifier-length]

    variable name 'p1' is too short, expected at least 3 characters

       43 |     geode::Point2D p1{ { 0., 0. } };
          |                    ^
  • tests/stochastic/models/energy_terms/test-gibbs-energy.cpp:44:20: warning: [readability-identifier-length]

    variable name 'p2' is too short, expected at least 3 characters

       44 |     geode::Point2D p2{ { 1., 1. } };
          |                    ^
  • tests/stochastic/models/energy_terms/test-gibbs-energy.cpp:58:13: warning: [cppcoreguidelines-avoid-magic-numbers]

    1000000 is a magic number; consider replacing it with a named constant

       58 |             1000000 );
          |             ^
  • tests/stochastic/models/energy_terms/test-gibbs-energy.cpp:79:20: warning: [readability-identifier-length]

    variable name 'p3' is too short, expected at least 3 characters

       79 |     geode::Point2D p3{ { 2., 2. } };
          |                    ^
  • tests/stochastic/models/energy_terms/test-gibbs-energy.cpp:79:26: warning: [cppcoreguidelines-avoid-magic-numbers]

    1. is a magic number; consider replacing it with a named constant
       79 |     geode::Point2D p3{ { 2., 2. } };
          |                          ^
  • tests/stochastic/models/energy_terms/test-gibbs-energy.cpp:79:30: warning: [cppcoreguidelines-avoid-magic-numbers]

    1. is a magic number; consider replacing it with a named constant
       79 |     geode::Point2D p3{ { 2., 2. } };
          |                              ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:31:19: warning: [cert-err58-cpp]

    initialization of 'set_name' with static storage duration may throw an exception that cannot be caught

       31 | const std::string set_name{ "segments" };
          |                   ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:533:7: note: possibly throwing constructor declared here
      533 |       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
          |       ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:31:19: warning: [readability-identifier-naming]

    invalid case style for global constant 'set_name'

       31 | const std::string set_name{ "segments" };
          |                   ^~~~~~~~
          |                   SET_NAME
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:33:13: warning: [misc-use-internal-linkage]

    function 'init_segment_set' can be made static or moved into an anonymous namespace to enforce internal linkage

       33 | geode::uuid init_segment_set(
          |             ^
          | static 
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:39:13: warning: [readability-identifier-length]

    variable name 's1' is too short, expected at least 3 characters

       39 |     Segment s1{ geode::Point2D{ { -0.5, 0.0 } },
          |             ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:39:36: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

       39 |     Segment s1{ geode::Point2D{ { -0.5, 0.0 } },
          |                                    ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:40:27: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

       40 |         geode::Point2D{ { 0.5, 0.0 } } }; // length = 1.0
          |                           ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:43:13: warning: [readability-identifier-length]

    variable name 's2' is too short, expected at least 3 characters

       43 |     Segment s2{ geode::Point2D{ { -2.0, 0.0 } },
          |             ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:43:36: warning: [cppcoreguidelines-avoid-magic-numbers]

    2.0 is a magic number; consider replacing it with a named constant

       43 |     Segment s2{ geode::Point2D{ { -2.0, 0.0 } },
          |                                    ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:47:41: warning: [cppcoreguidelines-avoid-magic-numbers]

    2.0 is a magic number; consider replacing it with a named constant

       47 |     Segment s_buffer{ geode::Point2D{ { 2.0, 2.0 } },
          |                                         ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:47:46: warning: [cppcoreguidelines-avoid-magic-numbers]

    2.0 is a magic number; consider replacing it with a named constant

       47 |     Segment s_buffer{ geode::Point2D{ { 2.0, 2.0 } },
          |                                              ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:48:27: warning: [cppcoreguidelines-avoid-magic-numbers]

    3.0 is a magic number; consider replacing it with a named constant

       48 |         geode::Point2D{ { 3.0, 3.0 } } }; // clipped = 0.0
          |                           ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:48:32: warning: [cppcoreguidelines-avoid-magic-numbers]

    3.0 is a magic number; consider replacing it with a named constant

       48 |         geode::Point2D{ { 3.0, 3.0 } } }; // clipped = 0.0
          |                                ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:58:27: warning: [misc-use-internal-linkage]

    function 'init_domain' can be made static or moved into an anonymous namespace to enforce internal linkage

       58 | geode::SpatialDomain< 2 > init_domain()
          |                           ^
          | static 
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:63:44: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

       63 |     return geode::SpatialDomain< 2 >{ box, 0.5 };
          |                                            ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:66:6: warning: [misc-use-internal-linkage]

    function 'run_intensity_test' can be made static or moved into an anonymous namespace to enforce internal linkage

       66 | void run_intensity_test( const geode::SingleObjectTermConfig& term_config,
          |      ^
          | static 
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:94:61: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

       94 |     geode::OwnerSegment2D s_inside{ geode::Point2D{ { 0.0, -0.5 } },
          |                                                             ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:95:32: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

       95 |         geode::Point2D{ { 0.0, 0.5 } } }; // length 1
          |                                ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:108:56: warning: [cppcoreguidelines-avoid-magic-numbers]

    2.0 is a magic number; consider replacing it with a named constant

      108 |     geode::OwnerSegment2D s_outside{ geode::Point2D{ { 2.0, 2.0 } },
          |                                                        ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:108:61: warning: [cppcoreguidelines-avoid-magic-numbers]

    2.0 is a magic number; consider replacing it with a named constant

      108 |     geode::OwnerSegment2D s_outside{ geode::Point2D{ { 2.0, 2.0 } },
          |                                                             ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:109:27: warning: [cppcoreguidelines-avoid-magic-numbers]

    3.0 is a magic number; consider replacing it with a named constant

      109 |         geode::Point2D{ { 3.0, 3.0 } } };
          |                           ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:109:32: warning: [cppcoreguidelines-avoid-magic-numbers]

    3.0 is a magic number; consider replacing it with a named constant

      109 |         geode::Point2D{ { 3.0, 3.0 } } };
          |                                ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:136:54: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.2 is a magic number; consider replacing it with a named constant

      136 |     geode::OwnerSegment2D s_same{ geode::Point2D{ { -0.2, 0.0 } },
          |                                                      ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:137:27: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.8 is a magic number; consider replacing it with a named constant

      137 |         geode::Point2D{ { 0.8, 0.0 } } }; // length still 1
          |                           ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:153:14: warning: [clang-analyzer-deadcode.DeadStores]

    Value stored to 'set_id' during its initialization is never read

      153 |         auto set_id = init_segment_set( pattern );
          |              ^~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/tests/stochastic/models/energy_terms/test-intensity-term.cpp:153:14: note: Value stored to 'set_id' during its initialization is never read
      153 |         auto set_id = init_segment_set( pattern );
          |              ^~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:156:22: warning: [readability-identifier-length]

    variable name 'L0' is too short, expected at least 3 characters

      156 |         const double L0 = 1.0;
          |                      ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:156:22: warning: [readability-identifier-naming]

    invalid case style for variable 'L0'

      156 |         const double L0 = 1.0;
          |                      ^~
          |                      l0
      157 | 
      158 |         geode::SingleObjectTermConfig term_config;
      159 |         geode::SegmentLengthInsideBoxFeatureConfig object_length{ L0 };
          |                                                                   ~~
          |                                                                   l0
      160 | 
      161 |         term_config.term_name = "intensity";
      162 |         term_config.object_set_names = { set_name };
      163 |         term_config.lambda = 0.5;
      164 |         term_config.object_feature = object_length;
      165 | 
      166 |         run_intensity_test( term_config, pattern, domain, L0 );
          |                                                           ~~
          |                                                           l0
      167 |         term_config.lambda = geode::GLOBAL_EPSILON;
      168 |         run_intensity_test( term_config, pattern, domain, L0 );
          |                                                           ~~
          |                                                           l0
      169 |         term_config.lambda = 50.0;
      170 |         run_intensity_test( term_config, pattern, domain, L0 );
          |                                                           ~~
          |                                                           l0
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:163:30: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

      163 |         term_config.lambda = 0.5;
          |                              ^
  • tests/stochastic/models/energy_terms/test-intensity-term.cpp:169:30: warning: [cppcoreguidelines-avoid-magic-numbers]

    50.0 is a magic number; consider replacing it with a named constant

      169 |         term_config.lambda = 50.0;
          |                              ^
  • tests/stochastic/models/energy_terms/test-pairwise-term.cpp:35:19: warning: [cert-err58-cpp]

    initialization of 'object_set_name' with static storage duration may throw an exception that cannot be caught

       35 | const std::string object_set_name = "single_set";
          |                   ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:533:7: note: possibly throwing constructor declared here
      533 |       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
          |       ^
  • tests/stochastic/models/energy_terms/test-pairwise-term.cpp:35:19: warning: [readability-identifier-naming]

    invalid case style for global constant 'object_set_name'

       35 | const std::string object_set_name = "single_set";
          |                   ^~~~~~~~~~~~~~~
          |                   OBJECT_SET_NAME
       36 | 
       37 | geode::uuid init_object_set( geode::ObjectSets< geode::Point2D >& pattern )
       38 | {
       39 |     geode::Point2D p1{ { 0.1, 0.1 } }; // VOI
       40 |     geode::Point2D p2{ { 0.9, 0.9 } }; // VOI
       41 |     geode::Point2D p3{ { 1.3, 1.3 } }; // buffer
       42 | 
       43 |     auto set_id = pattern.add_set( object_set_name );
          |                                    ~~~~~~~~~~~~~~~
          |                                    OBJECT_SET_NAME
  • tests/stochastic/models/energy_terms/test-pairwise-term.cpp:37:13: warning: [misc-use-internal-linkage]

    function 'init_object_set' can be made static or moved into an anonymous namespace to enforce internal linkage

       37 | geode::uuid init_object_set( geode::ObjectSets< geode::Point2D >& pattern )
          |             ^
          | static 
  • tests/stochastic/models/energy_terms/test-pairwise-term.cpp:39:20: warning: [readability-identifier-length]

    variable name 'p1' is too short, expected at least 3 characters

       39 |     geode::Point2D p1{ { 0.1, 0.1 } }; // VOI
          |                    ^
  • tests/stochastic/models/energy_terms/test-pairwise-term.cpp:39:26: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.1 is a magic number; consider replacing it with a named constant

       39 |     geode::Point2D p1{ { 0.1, 0.1 } }; // VOI
          |                          ^
  • tests/stochastic/models/energy_terms/test-pairwise-term.cpp:39:31: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.1 is a magic number; consider replacing it with a named constant

       39 |     geode::Point2D p1{ { 0.1, 0.1 } }; // VOI
          |                               ^
  • tests/stochastic/models/energy_terms/test-pairwise-term.cpp:40:20: warning: [readability-identifier-length]

    variable name 'p2' is too short, expected at least 3 characters

       40 |     geode::Point2D p2{ { 0.9, 0.9 } }; // VOI
          |                    ^
  • tests/stochastic/models/energy_terms/test-pairwise-term.cpp:40:26: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.9 is a magic number; consider replacing it with a named constant

       40 |     geode::Point2D p2{ { 0.9, 0.9 } }; // VOI
          |                          ^
  • tests/stochastic/models/energy_terms/test-pairwise-term.cpp:40:31: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.9 is a magic number; consider replacing it with a named constant

       40 |     geode::Point2D p2{ { 0.9, 0.9 } }; // VOI
          |                               ^
  • tests/stochastic/models/energy_terms/test-pairwise-term.cpp:41:20: warning: [readability-identifier-length]

    variable name 'p3' is too short, expected at least 3 characters

       41 |     geode::Point2D p3{ { 1.3, 1.3 } }; // buffer
          |                    ^

Have any feedback or feature suggestions? Share it here.

Comment thread include/geode/stochastic/models/energy_terms/energy_term.hpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants