Skip to content

Commit

Permalink
Merge pull request #136 from Geode-solutions/feat/ordered_horizons_st…
Browse files Browse the repository at this point in the history
…ack_range

feat(HorizonsStack): Added a functionnality to loop on horizons in st…
  • Loading branch information
MelchiorSchuh authored Nov 21, 2024
2 parents 6984d62 + 5a41783 commit 292e5d1
Show file tree
Hide file tree
Showing 22 changed files with 555 additions and 158 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
HorizonsStackBuilder##dimension##D::*) () >( \
&HorizonsStackBuilder##dimension##D:: \
add_stratigraphic_unit ) ) \
.def( "add_horizon_above", \
&HorizonsStackBuilder##dimension##D::add_horizon_above ) \
.def( "add_horizon_under", \
&HorizonsStackBuilder##dimension##D::add_horizon_under ) \
.def( "set_horizon_above", \
&HorizonsStackBuilder##dimension##D::set_horizon_above ) \
.def( "set_horizon_under", \
&HorizonsStackBuilder##dimension##D::set_horizon_under ) \
.def( "remove_horizon", \
&HorizonsStackBuilder##dimension##D::remove_horizon ) \
.def( "remove_stratigraphic_unit", \
Expand Down
8 changes: 4 additions & 4 deletions bindings/python/tests/implicit/test-py-horizons-stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ def test_horizons_stack():
raise ValueError( "[TEST] Stratigraphic Units Stack should have 3 horizons." )
if horizons_stack.nb_stratigraphic_units() != 2:
raise ValueError( "[TEST] Stratigraphic Units Stack should have 2 Stratigraphic Units." )
stack_builder.add_horizon_under( horizons_stack.horizon( hor0 ), horizons_stack.stratigraphic_unit( unit0 ) )
stack_builder.add_horizon_above( horizons_stack.horizon( hor1 ), horizons_stack.stratigraphic_unit( unit0 ) )
stack_builder.add_horizon_under( horizons_stack.horizon( hor1 ), horizons_stack.stratigraphic_unit( unit1 ) )
stack_builder.add_horizon_above( horizons_stack.horizon( hor2 ), horizons_stack.stratigraphic_unit( unit1 ) )
stack_builder.set_horizon_under( horizons_stack.horizon( hor0 ), horizons_stack.stratigraphic_unit( unit0 ) )
stack_builder.set_horizon_above( horizons_stack.horizon( hor1 ), horizons_stack.stratigraphic_unit( unit0 ) )
stack_builder.set_horizon_under( horizons_stack.horizon( hor1 ), horizons_stack.stratigraphic_unit( unit1 ) )
stack_builder.set_horizon_above( horizons_stack.horizon( hor2 ), horizons_stack.stratigraphic_unit( unit1 ) )

for unit in horizons_stack.stratigraphic_units():
unit_id = unit.id()
Expand Down
22 changes: 14 additions & 8 deletions include/geode/geosciences/explicit/mixin/core/fault_blocks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#pragma once

#include <geode/basic/passkey.hpp>
#include <geode/basic/pimpl.hpp>

#include <geode/geosciences/explicit/common.hpp>
Expand All @@ -41,10 +42,10 @@ namespace geode
class opengeode_geosciences_explicit_api FaultBlocks
{
OPENGEODE_DISABLE_COPY( FaultBlocks );
PASSKEY( FaultBlocksBuilder< dimension >, FaultBlocksBuilderKey );

public:
using Builder = FaultBlocksBuilder< dimension >;
friend Builder;

class opengeode_geosciences_explicit_api FaultBlockRangeBase
{
Expand Down Expand Up @@ -124,19 +125,24 @@ namespace geode
[[nodiscard]] FaultBlock< dimension >& operator*() const;
};

private:
[[nodiscard]] const uuid& create_fault_block();
public:
[[nodiscard]] const uuid& create_fault_block(
FaultBlocksBuilderKey key );

void create_fault_block( uuid fault_block_id );
void create_fault_block(
uuid fault_block_id, FaultBlocksBuilderKey key );

void delete_fault_block( const FaultBlock< dimension >& fault_block );
void delete_fault_block( const FaultBlock< dimension >& fault_block,
FaultBlocksBuilderKey key );

void load_fault_blocks( std::string_view directory );
void load_fault_blocks(
std::string_view directory, FaultBlocksBuilderKey key );

[[nodiscard]] ModifiableFaultBlockRange modifiable_fault_blocks();
[[nodiscard]] ModifiableFaultBlockRange modifiable_fault_blocks(
FaultBlocksBuilderKey key );

[[nodiscard]] FaultBlock< dimension >& modifiable_fault_block(
const uuid& id );
const uuid& id, FaultBlocksBuilderKey key );

private:
IMPLEMENTATION_MEMBER( impl_ );
Expand Down
28 changes: 17 additions & 11 deletions include/geode/geosciences/explicit/mixin/core/faults.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#pragma once

#include <geode/basic/passkey.hpp>
#include <geode/basic/pimpl.hpp>

#include <geode/geosciences/explicit/common.hpp>
Expand All @@ -41,10 +42,10 @@ namespace geode
class opengeode_geosciences_explicit_api Faults
{
OPENGEODE_DISABLE_COPY( Faults );
PASSKEY( FaultsBuilder< dimension >, FaultsBuilderKey );

public:
using Builder = FaultsBuilder< dimension >;
friend Builder;

class opengeode_geosciences_explicit_api FaultRangeBase
{
Expand Down Expand Up @@ -123,24 +124,29 @@ namespace geode
[[nodiscard]] Fault< dimension >& operator*() const;
};

private:
[[nodiscard]] const uuid& create_fault();
public:
[[nodiscard]] const uuid& create_fault( FaultsBuilderKey key );

[[nodiscard]] const uuid& create_fault(
typename Fault< dimension >::FAULT_TYPE type );
typename Fault< dimension >::FAULT_TYPE type,
FaultsBuilderKey key );

void create_fault( uuid fault_id );
void create_fault( uuid fault_id, FaultsBuilderKey key );

void create_fault(
uuid fault_id, typename Fault< dimension >::FAULT_TYPE type );
void create_fault( uuid fault_id,
typename Fault< dimension >::FAULT_TYPE type,
FaultsBuilderKey key );

void delete_fault( const Fault< dimension >& fault );
void delete_fault(
const Fault< dimension >& fault, FaultsBuilderKey key );

void load_faults( std::string_view directory );
void load_faults( std::string_view directory, FaultsBuilderKey key );

[[nodiscard]] ModifiableFaultRange modifiable_faults();
[[nodiscard]] ModifiableFaultRange modifiable_faults(
FaultsBuilderKey key );

[[nodiscard]] Fault< dimension >& modifiable_fault( const uuid& id );
[[nodiscard]] Fault< dimension >& modifiable_fault(
const uuid& id, FaultsBuilderKey key );

private:
IMPLEMENTATION_MEMBER( impl_ );
Expand Down
30 changes: 18 additions & 12 deletions include/geode/geosciences/explicit/mixin/core/horizons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#pragma once

#include <geode/basic/passkey.hpp>
#include <geode/basic/pimpl.hpp>

#include <geode/geosciences/explicit/common.hpp>
Expand All @@ -38,9 +39,10 @@ namespace geode
namespace geode
{
template < index_t dimension >
class opengeode_geosciences_explicit_api Horizons
class Horizons
{
OPENGEODE_DISABLE_COPY( Horizons );
PASSKEY( HorizonsBuilder< dimension >, HorizonsBuilderKey );

public:
using Builder = HorizonsBuilder< dimension >;
Expand Down Expand Up @@ -99,7 +101,6 @@ namespace geode
void save_horizons( std::string_view directory ) const;

protected:
friend class HorizonsBuilder< dimension >;
Horizons();
Horizons( Horizons&& other ) noexcept;

Expand All @@ -125,25 +126,30 @@ namespace geode
[[nodiscard]] Horizon< dimension >& operator*() const;
};

private:
[[nodiscard]] const uuid& create_horizon();
public:
[[nodiscard]] const uuid& create_horizon( HorizonsBuilderKey key );

[[nodiscard]] const uuid& create_horizon(
typename Horizon< dimension >::HORIZON_TYPE type );
typename Horizon< dimension >::HORIZON_TYPE type,
HorizonsBuilderKey key );

void create_horizon( uuid horizon_id );
void create_horizon( uuid horizon_id, HorizonsBuilderKey key );

void create_horizon(
uuid horizon_id, typename Horizon< dimension >::HORIZON_TYPE type );
void create_horizon( uuid horizon_id,
typename Horizon< dimension >::HORIZON_TYPE type,
HorizonsBuilderKey key );

void delete_horizon( const Horizon< dimension >& horizon );
void delete_horizon(
const Horizon< dimension >& horizon, HorizonsBuilderKey key );

void load_horizons( std::string_view directory );
void load_horizons(
std::string_view directory, HorizonsBuilderKey key );

[[nodiscard]] ModifiableHorizonRange modifiable_horizons();
[[nodiscard]] ModifiableHorizonRange modifiable_horizons(
HorizonsBuilderKey key );

[[nodiscard]] Horizon< dimension >& modifiable_horizon(
const uuid& id );
const uuid& id, HorizonsBuilderKey key );

private:
IMPLEMENTATION_MEMBER( impl_ );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#pragma once

#include <geode/basic/passkey.hpp>
#include <geode/basic/pimpl.hpp>

#include <geode/geosciences/explicit/common.hpp>
Expand All @@ -41,10 +42,11 @@ namespace geode
class opengeode_geosciences_explicit_api StratigraphicUnits
{
OPENGEODE_DISABLE_COPY( StratigraphicUnits );
PASSKEY( StratigraphicUnitsBuilder< dimension >,
StratigraphicUnitsBuilderKey );

public:
using Builder = StratigraphicUnitsBuilder< dimension >;
friend Builder;

class opengeode_geosciences_explicit_api StratigraphicUnitRangeBase
{
Expand Down Expand Up @@ -104,7 +106,6 @@ namespace geode
void save_stratigraphic_units( std::string_view directory ) const;

protected:
friend class StratigraphicUnitsBuilder< dimension >;
StratigraphicUnits();
StratigraphicUnits( StratigraphicUnits&& other ) noexcept;

Expand Down Expand Up @@ -132,21 +133,26 @@ namespace geode
[[nodiscard]] StratigraphicUnit< dimension >& operator*() const;
};

private:
[[nodiscard]] const uuid& create_stratigraphic_unit();
public:
[[nodiscard]] const uuid& create_stratigraphic_unit(
StratigraphicUnitsBuilderKey key );

void create_stratigraphic_unit( uuid stratigraphic_unit_id );
void create_stratigraphic_unit(
uuid stratigraphic_unit_id, StratigraphicUnitsBuilderKey key );

void delete_stratigraphic_unit(
const StratigraphicUnit< dimension >& stratigraphic_unit );
const StratigraphicUnit< dimension >& stratigraphic_unit,
StratigraphicUnitsBuilderKey key );

void load_stratigraphic_units( std::string_view directory );
void load_stratigraphic_units(
std::string_view directory, StratigraphicUnitsBuilderKey key );

[[nodiscard]] ModifiableStratigraphicUnitRange
modifiable_stratigraphic_units();
modifiable_stratigraphic_units( StratigraphicUnitsBuilderKey key );

[[nodiscard]] StratigraphicUnit< dimension >&
modifiable_stratigraphic_unit( const uuid& id );
modifiable_stratigraphic_unit(
const uuid& id, StratigraphicUnitsBuilderKey key );

private:
IMPLEMENTATION_MEMBER( impl_ );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,25 @@ namespace geode
InsertedHorizonInfo add_horizon_in_stratigraphic_unit(
const StratigraphicUnit< dimension >& strati_unit );

void add_horizon_above( const Horizon< dimension >& horizon_above,
void set_horizon_above( const Horizon< dimension >& horizon_above,
const StratigraphicUnit< dimension >& strati_unit_under );

void add_horizon_under( const Horizon< dimension >& horizon_under,
void set_horizon_under( const Horizon< dimension >& horizon_under,
const StratigraphicUnit< dimension >& strati_unit_above );

void add_erosion_above( const Horizon< dimension >& erosion_horizon,
void set_as_erosion_above( const Horizon< dimension >& erosion_horizon,
const StratigraphicUnit< dimension >& eroded_unit );

void add_baselap_under( const Horizon< dimension >& baselap_horizon,
void set_as_baselap_under( const Horizon< dimension >& baselap_horizon,
const StratigraphicUnit< dimension >& baselaping_unit );

void remove_horizon( const Horizon< dimension >& horizon );

void remove_stratigraphic_unit(
const StratigraphicUnit< dimension >& stratigraphic_unit );

void compute_top_and_bottom_horizons();

private:
HorizonsStack< dimension >& horizons_stack_;
};
Expand Down
Loading

0 comments on commit 292e5d1

Please sign in to comment.