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
16 changes: 16 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export default {
extends: ["@commitlint/config-angular"],
rules: {
"scope-empty": [2, "never"],
"subject-empty": [2, "never"],
"subject-max-length": [0],
"body-leading-blank": [0],
"footer-leading-blank": [0],
"header-max-length": [0],
"scope-case": [0],
"subject-case": [0],
"subject-full-stop": [0],
"type-case": [0],
"type-empty": [0],
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ namespace geode
[[nodiscard]] bool is_above(
const uuid& above, const uuid& under ) const;

[[nodiscard]] bool is_directly_above(
const uuid& above, const uuid& under ) const;

[[nodiscard]] std::optional< uuid > above( const uuid& element ) const;

[[nodiscard]] std::optional< uuid > under( const uuid& element ) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,21 @@ namespace geode
initialize_relation_attributes();
}

bool is_above( const uuid& above, const uuid& under ) const
bool is_above( const uuid& above_id, const uuid& under_id ) const
{
auto current = under_id;
while( const auto directly_above = this->above( current ) )
{
if( directly_above.value() == above_id )
{
return true;
}
current = directly_above.value();
}
return false;
}

bool is_directly_above( const uuid& above, const uuid& under ) const
{
const auto edge_id = relation_edge( above, under );
if( !edge_id )
Expand Down Expand Up @@ -285,6 +299,12 @@ namespace geode
return impl_->is_above( above, under );
}

bool StratigraphicRelationships::is_directly_above(
const uuid& above, const uuid& under ) const
{
return impl_->is_directly_above( above, under );
}

std::optional< uuid > StratigraphicRelationships::above(
const uuid& element ) const
{
Expand Down
10 changes: 10 additions & 0 deletions tests/implicit/test-horizons-stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,23 @@ void test_horizons_stack()
OPENGEODE_EXCEPTION( horizons_stack.nb_stratigraphic_units() == 5,
"[Test] Horizons Stack should have 5 Stratigraphic Units after "
"repair." );
const auto bottom_horizon = horizons_stack.bottom_horizon();
OPENGEODE_EXCEPTION(
bottom_horizon, "[Test] There should be a bottom horizon" );
const auto bottom_unit_id = horizons_stack.under( bottom_horizon.value() );
OPENGEODE_EXCEPTION( bottom_unit_id,
"[Test] There should be a stratigraphic unit under the "
"bottom horizon" );
for( const auto& horizon : horizons_stack.horizons() )
{
const auto& horizon_id = horizon.id();
OPENGEODE_EXCEPTION( horizons_stack.above( horizon_id ),
"[Test] Horizon should have a unit above." );
OPENGEODE_EXCEPTION( horizons_stack.under( horizon_id ),
"[Test] Horizon should have a unit under." );
OPENGEODE_EXCEPTION(
horizons_stack.is_above( horizon_id, bottom_unit_id.value() ),
"[Test] Horizon should be above the bottom unit." );
}

const auto stack_path = absl::StrCat( "test_HorizonStack.",
Expand Down