Skip to content

Commit d6f5d23

Browse files
Merge pull request #157 from Geode-solutions/fix/create_horizon_stack
fix(Helper): create horizon stoack from top to bottom
2 parents 0cf9796 + 436bd67 commit d6f5d23

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

src/geode/geosciences/implicit/representation/core/detail/helpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ namespace geode
317317
stack.stratigraphic_unit( su_under ) );
318318
}
319319
const auto& su_under = builder.add_stratigraphic_unit();
320-
builder.set_horizon_under( stack.horizon( current_horizon ),
320+
builder.set_horizon_above( stack.horizon( current_horizon ),
321321
stack.stratigraphic_unit( su_under ) );
322322
if( nb_units > nb_horizons )
323323
{

tests/implicit/test-horizons-stack.cpp

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,10 @@ void test_horizons_stack()
114114
absl::StrCat( geode::DATA_PATH, "test_HorizonStack_v0.og_hst3d" ) );
115115
}
116116

117-
void test_create_horizons_stack()
117+
void test_horizons_stack( const geode::HorizonsStack2D& horizons_stack )
118118
{
119119
std::array< std::string, 4 > horizons_list{ "h1", "h2", "h3", "h4" };
120120
std::array< std::string, 3 > units_list{ "su1", "su2", "su3" };
121-
const auto horizons_stack =
122-
geode::detail::horizons_stack_from_bottom_to_top_names< 2 >(
123-
horizons_list, units_list );
124121
OPENGEODE_EXCEPTION( horizons_stack.nb_horizons() == 4,
125122
"[Test] Created Horizons Stack should have 4 horizons." );
126123
OPENGEODE_EXCEPTION( horizons_stack.nb_stratigraphic_units() == 5,
@@ -194,14 +191,35 @@ void test_create_horizons_stack()
194191
"pass through all stratigraphic units" );
195192
}
196193

194+
void test_create_horizons_stack_top_to_bottom()
195+
{
196+
std::array< std::string, 4 > horizons_list{ "h4", "h3", "h2", "h1" };
197+
std::array< std::string, 3 > units_list{ "su3", "su2", "su1" };
198+
const auto horizons_stack =
199+
geode::detail::horizons_stack_from_top_to_bottom_names< 2 >(
200+
horizons_list, units_list );
201+
test_horizons_stack( horizons_stack );
202+
}
203+
204+
void test_create_horizons_stack_bottom_to_top()
205+
{
206+
std::array< std::string, 4 > horizons_list{ "h1", "h2", "h3", "h4" };
207+
std::array< std::string, 3 > units_list{ "su1", "su2", "su3" };
208+
const auto horizons_stack =
209+
geode::detail::horizons_stack_from_bottom_to_top_names< 2 >(
210+
horizons_list, units_list );
211+
test_horizons_stack( horizons_stack );
212+
}
213+
197214
int main()
198215
{
199216
try
200217
{
201218
geode::Logger::info( "Starting test" );
202219
geode::GeosciencesImplicitLibrary::initialize();
203220
test_horizons_stack();
204-
test_create_horizons_stack();
221+
test_create_horizons_stack_bottom_to_top();
222+
test_create_horizons_stack_top_to_bottom();
205223

206224
geode::Logger::info( "TEST SUCCESS" );
207225
return 0;

0 commit comments

Comments
 (0)