Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 12 additions & 12 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
#BreakStringLiterals
ColumnLimit: 80
CommentPragmas: ''
CommentPragmas: ""
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
Expand Down
25 changes: 14 additions & 11 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,36 @@
Checks: >
*,
-altera*,
-boost*,
-fuchsia*,
-llvmlibc*,
-llvm-header-guard,
-llvm-prefer-static-over-anonymous-namespace,
-google-readability-todo,
-misc-no-recursion,
-misc-include-cleaner,
-misc-const-correctness,
-modernize-use-trailing-return-type,
-portability-avoid-pragma-once,
-readability-use-anyofallof,
-readability-redundant-access-specifiers,
-readability-convert-member-functions-to-static,
-cppcoreguidelines-avoid-const-or-ref-data-members

CheckOptions:
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: "1"
- key: readability-identifier-length.MinimumLoopCounterNameLength
value: 1
- key: readability-identifier-length.IgnoredVariableNames
value: '^[defijkptuvw]$'
value: "^[_defijkptuvwxyz]$"
# More options here: https://clang.llvm.org/extra/clang-tidy/checks/readability/identifier-naming.html
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.ClassCase
value: CamelCase
value: CamelCase
- key: readability-identifier-naming.StructCase
value: CamelCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: lower_case
- key: readability-identifier-naming.VariableCase
Expand All @@ -51,14 +58,10 @@ CheckOptions:
- key: readability-identifier-naming.GlobalFunctionCase
value: lower_case
- key: readability-identifier-naming.MemberConstantCase
value: CamelCase
value: CamelCase
- key: readability-identifier-naming.StaticConstantCase
value: lower_case
value: lower_case
- key: readability-function-cognitive-complexity.Threshold
value: 10
- key: readability-function-size.ParameterThreshold
value: 4
- key: misc-include-cleaner.IgnoreHeaders
value: utility;cstddef;geode/.*_export\.h;geode/.*/common\.h;geode/basic/types\.h;geode/basic/assert\.h;


80 changes: 80 additions & 0 deletions bindings/python/src/common.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* 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.
*
*/

#include <pybind11/operators.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include <absl/container/fixed_array.h>
#include <absl/container/flat_hash_map.h>
#include <absl/container/inlined_vector.h>
#include <absl/types/span.h>

namespace pybind11

Check warning on line 33 in bindings/python/src/common.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/common.hpp:33:1 [modernize-concat-nested-namespaces]

nested namespaces can be concatenated
{
namespace detail
{
template < typename Type >
struct type_caster< absl::FixedArray< Type > >
: list_caster< absl::FixedArray< Type >, Type >
{
};

template < typename Type, size_t dimension >
struct type_caster< absl::InlinedVector< Type, dimension > >
: list_caster< absl::InlinedVector< Type, dimension >, Type >
{
};

template < typename Type >
struct type_caster< absl::Span< Type > >
: list_caster< absl::Span< Type >, Type >
{
using value_conv = make_caster< Type >;

bool load( handle src, bool convert )
{
cpp_.clear();
auto s = reinterpret_borrow< sequence >( src );
cpp_.reserve( s.size() );
for( auto it : s )
{
value_conv conv;
if( !conv.load( it, convert ) )
return false;
cpp_.push_back( cast_op< Type&& >( std::move( conv ) ) );
}
this->value = absl::MakeConstSpan( cpp_ );
return true;
}

std::vector< typename std::remove_const< Type >::type > cpp_;
};

template < typename Key, typename Value >
struct type_caster< absl::flat_hash_map< Key, Value > >
: map_caster< absl::flat_hash_map< Key, Value >, Key, Value >
{
};
} // namespace detail
} // namespace pybind11
2 changes: 1 addition & 1 deletion bindings/python/src/stochastic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ add_geode_python_binding(
"sampling/mcmc/helpers/fracture_simulation_runner.hpp"
"sampling/mcmc/helpers/simulation_monitor.hpp"
"sampling/mcmc/helpers/simulation_printer.hpp"
"sampling/mcmc/helpers/simulation_runner.hpp"
"sampling/mcmc/simulation_runner.hpp"
"sampling/direct/double_sampler.hpp"
"sampling/random_engine.hpp"
"sampling/distributions.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
* SOFTWARE.
*
*/
#include "../../../common.hpp"

#include <geode/stochastic/sampling/mcmc/helpers/simulation_printer.hpp>
#include <geode/stochastic/sampling/mcmc/helpers/simulation_runner.hpp>
#include <geode/stochastic/sampling/mcmc/simulation_runner.hpp>

namespace geode
{
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/src/stochastic/stochastic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#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/helpers/simulation_runner.hpp"
#include "sampling/mcmc/simulation_runner.hpp"

#include "sampling/distributions.hpp"
#include "sampling/random_engine.hpp"
Expand Down
1 change: 1 addition & 0 deletions include/geode/stochastic/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <geode/basic/common.hpp>
#include <geode/basic/library.hpp>
#include <geode/basic/logger.hpp>

#include <geode/stochastic/opengeode_stochastic_stochastic_export.hpp>

namespace geode
Expand Down
22 changes: 22 additions & 0 deletions include/geode/stochastic/inference/abc_shadow.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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.
*
*/
22 changes: 22 additions & 0 deletions include/geode/stochastic/models/spatial_model.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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.
*
*/
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
namespace geode
{

template < index_t dimension >
template < local_index_t dimension >
class BoundingBoxSampler

Check warning on line 41 in include/geode/stochastic/sampling/direct/bounding_box_sampler.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/stochastic/sampling/direct/bounding_box_sampler.hpp:41:11 [cppcoreguidelines-special-member-functions]

class 'BoundingBoxSampler' defines a destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator
{
public:
explicit BoundingBoxSampler( const BoundingBox< dimension >& box );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#include <variant>

#include <geode/stochastic/common.hpp>

namespace geode
{
FORWARD_DECLARATION_DIMENSION_CLASS( BoundingBox );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <geode/stochastic/spatial/object_sets.hpp>

#include <geode/stochastic/sampling/mcmc/models/components/single_object_term.hpp>
#include <geode/stochastic/sampling/mcmc/energy_terms/single_object_term.hpp>

namespace geode
{
Expand All @@ -46,10 +46,9 @@ namespace geode
std::move( targeted_set_ids ),
1.0, // scale by domain area to get density per unit
[]( const ObjectType& obj,
const SpatialDomain< ObjectType::dim >& domain ) {
if( SpatialDomainChecker<
ObjectType >::is_anchored_in_domain( domain,
obj ) )
const SpatialDomain< ObjectType::dim >& spatial_domain ) {
if( SpatialDomainChecker< ObjectType >::
is_anchored_in_domain( spatial_domain, obj ) )
{
return 1.0;
}
Expand Down
Loading
Loading