Skip to content

Commit 263b003

Browse files
authored
Merge pull request #34 from Geode-solutions/file_reorganisation
fix(Refactoring): file reorganisation
2 parents 28227cb + bb0e5ed commit 263b003

34 files changed

Lines changed: 499 additions & 295 deletions

.clang-format

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,25 @@ AlwaysBreakTemplateDeclarations: true
2121
BinPackArguments: true
2222
BinPackParameters: false
2323
BraceWrapping:
24-
AfterClass: true
25-
AfterControlStatement: true
26-
AfterEnum: true
27-
AfterFunction: true
28-
AfterNamespace: true
29-
AfterObjCDeclaration: true
30-
AfterStruct: true
31-
AfterUnion: true
32-
BeforeCatch: true
33-
BeforeElse: true
34-
IndentBraces: false
24+
AfterClass: true
25+
AfterControlStatement: true
26+
AfterEnum: true
27+
AfterFunction: true
28+
AfterNamespace: true
29+
AfterObjCDeclaration: true
30+
AfterStruct: true
31+
AfterUnion: true
32+
BeforeCatch: true
33+
BeforeElse: true
34+
IndentBraces: false
3535
BreakBeforeBinaryOperators: NonAssignment
3636
BreakBeforeBraces: Custom
3737
BreakBeforeTernaryOperators: true
3838
BreakConstructorInitializers: BeforeColon
3939
BreakInheritanceList: BeforeColon
4040
#BreakStringLiterals
4141
ColumnLimit: 80
42-
CommentPragmas: ''
42+
CommentPragmas: ""
4343
CompactNamespaces: false
4444
ConstructorInitializerAllOnOneLineOrOnePerLine: true
4545
ConstructorInitializerIndentWidth: 4

.clang-tidy

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,36 @@
55
Checks: >
66
*,
77
-altera*,
8+
-boost*,
89
-fuchsia*,
910
-llvmlibc*,
1011
-llvm-header-guard,
12+
-llvm-prefer-static-over-anonymous-namespace,
13+
-google-readability-todo,
1114
-misc-no-recursion,
15+
-misc-include-cleaner,
16+
-misc-const-correctness,
1217
-modernize-use-trailing-return-type,
18+
-portability-avoid-pragma-once,
19+
-readability-use-anyofallof,
1320
-readability-redundant-access-specifiers,
1421
-readability-convert-member-functions-to-static,
1522
-cppcoreguidelines-avoid-const-or-ref-data-members
1623
1724
CheckOptions:
18-
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
19-
value: '1'
25+
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
26+
value: "1"
2027
- key: readability-identifier-length.MinimumLoopCounterNameLength
2128
value: 1
2229
- key: readability-identifier-length.IgnoredVariableNames
23-
value: '^[defijkptuvw]$'
30+
value: "^[_defijkptuvwxyz]$"
2431
# More options here: https://clang.llvm.org/extra/clang-tidy/checks/readability/identifier-naming.html
2532
- key: readability-identifier-naming.NamespaceCase
2633
value: lower_case
2734
- key: readability-identifier-naming.ClassCase
28-
value: CamelCase
35+
value: CamelCase
2936
- key: readability-identifier-naming.StructCase
30-
value: CamelCase
37+
value: CamelCase
3138
- key: readability-identifier-naming.FunctionCase
3239
value: lower_case
3340
- key: readability-identifier-naming.VariableCase
@@ -51,14 +58,10 @@ CheckOptions:
5158
- key: readability-identifier-naming.GlobalFunctionCase
5259
value: lower_case
5360
- key: readability-identifier-naming.MemberConstantCase
54-
value: CamelCase
61+
value: CamelCase
5562
- key: readability-identifier-naming.StaticConstantCase
56-
value: lower_case
63+
value: lower_case
5764
- key: readability-function-cognitive-complexity.Threshold
5865
value: 10
5966
- key: readability-function-size.ParameterThreshold
6067
value: 4
61-
- key: misc-include-cleaner.IgnoreHeaders
62-
value: utility;cstddef;geode/.*_export\.h;geode/.*/common\.h;geode/basic/types\.h;geode/basic/assert\.h;
63-
64-

bindings/python/src/common.hpp

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright (c) 2019 - 2026 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#include <pybind11/operators.h>
25+
#include <pybind11/pybind11.h>
26+
#include <pybind11/stl.h>
27+
28+
#include <absl/container/fixed_array.h>
29+
#include <absl/container/flat_hash_map.h>
30+
#include <absl/container/inlined_vector.h>
31+
#include <absl/types/span.h>
32+
33+
namespace pybind11
34+
{
35+
namespace detail
36+
{
37+
template < typename Type >
38+
struct type_caster< absl::FixedArray< Type > >
39+
: list_caster< absl::FixedArray< Type >, Type >
40+
{
41+
};
42+
43+
template < typename Type, size_t dimension >
44+
struct type_caster< absl::InlinedVector< Type, dimension > >
45+
: list_caster< absl::InlinedVector< Type, dimension >, Type >
46+
{
47+
};
48+
49+
template < typename Type >
50+
struct type_caster< absl::Span< Type > >
51+
: list_caster< absl::Span< Type >, Type >
52+
{
53+
using value_conv = make_caster< Type >;
54+
55+
bool load( handle src, bool convert )
56+
{
57+
cpp_.clear();
58+
auto s = reinterpret_borrow< sequence >( src );
59+
cpp_.reserve( s.size() );
60+
for( auto it : s )
61+
{
62+
value_conv conv;
63+
if( !conv.load( it, convert ) )
64+
return false;
65+
cpp_.push_back( cast_op< Type&& >( std::move( conv ) ) );
66+
}
67+
this->value = absl::MakeConstSpan( cpp_ );
68+
return true;
69+
}
70+
71+
std::vector< typename std::remove_const< Type >::type > cpp_;
72+
};
73+
74+
template < typename Key, typename Value >
75+
struct type_caster< absl::flat_hash_map< Key, Value > >
76+
: map_caster< absl::flat_hash_map< Key, Value >, Key, Value >
77+
{
78+
};
79+
} // namespace detail
80+
} // namespace pybind11

bindings/python/src/stochastic/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ add_geode_python_binding(
2424
"sampling/mcmc/helpers/fracture_simulation_runner.hpp"
2525
"sampling/mcmc/helpers/simulation_monitor.hpp"
2626
"sampling/mcmc/helpers/simulation_printer.hpp"
27-
"sampling/mcmc/helpers/simulation_runner.hpp"
27+
"sampling/mcmc/simulation_runner.hpp"
2828
"sampling/direct/double_sampler.hpp"
2929
"sampling/random_engine.hpp"
3030
"sampling/distributions.hpp"

bindings/python/src/stochastic/sampling/mcmc/helpers/simulation_runner.hpp renamed to bindings/python/src/stochastic/sampling/mcmc/simulation_runner.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
* SOFTWARE.
2121
*
2222
*/
23+
#include "../../../common.hpp"
2324

2425
#include <geode/stochastic/sampling/mcmc/helpers/simulation_printer.hpp>
25-
#include <geode/stochastic/sampling/mcmc/helpers/simulation_runner.hpp>
26+
#include <geode/stochastic/sampling/mcmc/simulation_runner.hpp>
2627

2728
namespace geode
2829
{

bindings/python/src/stochastic/stochastic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "sampling/mcmc/helpers/fracture_simulation_runner.hpp"
3030
#include "sampling/mcmc/helpers/simulation_monitor.hpp"
3131
#include "sampling/mcmc/helpers/simulation_printer.hpp"
32-
#include "sampling/mcmc/helpers/simulation_runner.hpp"
32+
#include "sampling/mcmc/simulation_runner.hpp"
3333

3434
#include "sampling/distributions.hpp"
3535
#include "sampling/random_engine.hpp"

include/geode/stochastic/common.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <geode/basic/common.hpp>
2727
#include <geode/basic/library.hpp>
2828
#include <geode/basic/logger.hpp>
29+
2930
#include <geode/stochastic/opengeode_stochastic_stochastic_export.hpp>
3031

3132
namespace geode
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2019 - 2026 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2019 - 2026 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/

include/geode/stochastic/sampling/direct/bounding_box_sampler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace geode
3737
namespace geode
3838
{
3939

40-
template < index_t dimension >
40+
template < local_index_t dimension >
4141
class BoundingBoxSampler
4242
{
4343
public:

0 commit comments

Comments
 (0)