Skip to content

Commit

Permalink
Apply prepare changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MelchiorSchuh committed May 28, 2024
1 parent 9e97f86 commit fd28d54
Show file tree
Hide file tree
Showing 13 changed files with 280 additions and 138 deletions.
4 changes: 2 additions & 2 deletions bindings/python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile bindings/python/requirements.in
# pip-compile --pre bindings/python/requirements.in
#
opengeode-core==14.*,>=14.19.2
opengeode-core==14.*,>=14.20.1rc2
# via -r bindings/python/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ namespace geode
CrossSection() = default;
CrossSection( CrossSection&& ) noexcept = default;
CrossSection( Section&& section ) noexcept;
CrossSection( CrossSection& initial_model,
CrossSection( const CrossSection& initial_model,
Section&& section,
const ModelGenericMapping& initial_to_section_mappings ) noexcept;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ namespace geode
StructuralModel() = default;
StructuralModel( StructuralModel&& ) noexcept = default;
StructuralModel( BRep&& brep ) noexcept;
StructuralModel( StructuralModel& initial_model,
StructuralModel( const StructuralModel& initial_model,
BRep&& brep,
const ModelGenericMapping& initial_to_brep_mappings ) noexcept;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace geode
ImplicitCrossSection();
ImplicitCrossSection( ImplicitCrossSection&& implicit_model ) noexcept;
ImplicitCrossSection( CrossSection&& cross_section ) noexcept;
ImplicitCrossSection( ImplicitCrossSection& initial_model,
ImplicitCrossSection( const ImplicitCrossSection& initial_model,
Section&& section,
const ModelGenericMapping& initial_to_section_mappings ) noexcept;
virtual ~ImplicitCrossSection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace geode
ImplicitStructuralModel(
ImplicitStructuralModel&& implicit_model ) noexcept;
ImplicitStructuralModel( StructuralModel&& structural_model ) noexcept;
ImplicitStructuralModel( ImplicitStructuralModel& initial_model,
ImplicitStructuralModel( const ImplicitStructuralModel& initial_model,
BRep&& brep,
const ModelGenericMapping& initial_to_brep_mappings ) noexcept;
virtual ~ImplicitStructuralModel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace geode
StratigraphicModel(
ImplicitStructuralModel&& structural_model ) noexcept;
StratigraphicModel( StructuralModel&& structural_model ) noexcept;
StratigraphicModel( StratigraphicModel& initial_model,
StratigraphicModel( const StratigraphicModel& initial_model,
BRep&& brep,
const ModelGenericMapping& initial_to_brep_mappings ) noexcept;
~StratigraphicModel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace geode
StratigraphicSection(
ImplicitCrossSection&& implicit_section ) noexcept;
StratigraphicSection( CrossSection&& cross_section ) noexcept;
StratigraphicSection( StratigraphicSection& initial_model,
StratigraphicSection( const StratigraphicSection& initial_model,
Section&& section,
const ModelGenericMapping& initial_to_section_mappings ) noexcept;
~StratigraphicSection();
Expand Down
196 changes: 133 additions & 63 deletions src/geode/geosciences/explicit/representation/core/cross_section.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,119 @@
#include <geode/geosciences/explicit/representation/builder/cross_section_builder.h>
#include <geode/geosciences/explicit/representation/core/detail/clone.h>

namespace
{
void copy_faults_items_from_mappings(
const geode::CrossSection& initial_model,
const geode::CrossSection& current_model,
geode::CrossSectionBuilder& builder,
const geode::GenericMapping< geode::uuid >& line_mappings ) noexcept
{
for( const auto& fault : initial_model.faults() )
{
const auto& this_fault = current_model.fault( fault.id() );
for( const auto& fault_line : initial_model.fault_items( fault ) )
{
if( !line_mappings.has_mapping_input( fault_line.id() ) )
{
continue;
}
for( const auto& out_line_id :
line_mappings.in2out( fault_line.id() ) )
{
builder.add_line_in_fault(
current_model.line( out_line_id ), this_fault );
}
}
}
}

void copy_horizons_items_from_mappings(
const geode::CrossSection& initial_model,
const geode::CrossSection& current_model,
geode::CrossSectionBuilder& builder,
const geode::GenericMapping< geode::uuid >& line_mappings ) noexcept
{
for( const auto& horizon : initial_model.horizons() )
{
const auto& this_horizon = current_model.horizon( horizon.id() );
for( const auto& horizon_line :
initial_model.horizon_items( horizon ) )
{
if( !line_mappings.has_mapping_input( horizon_line.id() ) )
{
continue;
}
for( const auto& out_line_id :
line_mappings.in2out( horizon_line.id() ) )
{
builder.add_line_in_horizon(
current_model.line( out_line_id ), this_horizon );
}
}
}
}

void copy_fault_blocks_items_from_mappings(
const geode::CrossSection& initial_model,
const geode::CrossSection& current_model,
geode::CrossSectionBuilder& builder,
const geode::GenericMapping< geode::uuid >& surface_mappings ) noexcept
{
for( const auto& fault_block : initial_model.fault_blocks() )
{
const auto& this_fault_block =
current_model.fault_block( fault_block.id() );
for( const auto& fault_block_surface :
initial_model.fault_block_items( fault_block ) )
{
if( !surface_mappings.has_mapping_input(
fault_block_surface.id() ) )
{
continue;
}
for( const auto& out_surface_id :
surface_mappings.in2out( fault_block_surface.id() ) )
{
builder.add_surface_in_fault_block(
current_model.surface( out_surface_id ),
this_fault_block );
}
}
}
}

void copy_stratigraphic_units_items_from_mappings(
const geode::CrossSection& initial_model,
const geode::CrossSection& current_model,
geode::CrossSectionBuilder& builder,
const geode::GenericMapping< geode::uuid >& surface_mappings ) noexcept
{
for( const auto& stratigraphic_unit :
initial_model.stratigraphic_units() )
{
const auto& this_stratigraphic_unit =
current_model.stratigraphic_unit( stratigraphic_unit.id() );
for( const auto& stratigraphic_unit_surface :
initial_model.stratigraphic_unit_items( stratigraphic_unit ) )
{
if( !surface_mappings.has_mapping_input(
stratigraphic_unit_surface.id() ) )
{
continue;
}
for( const auto& out_surface_id :
surface_mappings.in2out( stratigraphic_unit_surface.id() ) )
{
builder.add_surface_in_stratigraphic_unit(
current_model.surface( out_surface_id ),
this_stratigraphic_unit );
}
}
}
}
} // namespace

namespace geode
{
CrossSection::HorizonItemRange::HorizonItemRange(
Expand All @@ -45,8 +158,8 @@ namespace geode

CrossSection::HorizonItemRange::~HorizonItemRange() = default;

auto
CrossSection::HorizonItemRange::begin() const -> const HorizonItemRange&
auto CrossSection::HorizonItemRange::begin() const
-> const HorizonItemRange&
{
return *this;
}
Expand Down Expand Up @@ -149,7 +262,7 @@ namespace geode
const CrossSection& cross_section,
const StratigraphicUnit2D& stratigraphic_unit )
: Relationships::ItemRangeIterator(
cross_section, stratigraphic_unit.id() ),
cross_section, stratigraphic_unit.id() ),
cross_section_( cross_section )
{
}
Expand Down Expand Up @@ -194,7 +307,7 @@ namespace geode
{
}

CrossSection::CrossSection( CrossSection& initial_model,
CrossSection::CrossSection( const CrossSection& initial_model,
Section&& section,
const ModelGenericMapping& initial_to_section_mappings ) noexcept
: Section{ std::move( section ) }
Expand All @@ -203,68 +316,25 @@ namespace geode
ModelCopyMapping mappings;
detail::add_geology_clone_mapping( mappings, *this );
builder.copy_geological_components( mappings, *this );
const auto& line_mappings =
initial_to_section_mappings.at( Line3D::component_type_static() );
const auto& surface_mappings = initial_to_section_mappings.at(
Surface3D::component_type_static() );
for( const auto& fault : initial_model.faults() )
{
const auto& this_fault = this->fault( fault.id() );
for( const auto& fault_line : initial_model.fault_items( fault ) )
{
for( const auto& out_line_id :
line_mappings.in2out( fault_line.id() ) )
{
builder.add_line_in_fault(
this->line( out_line_id ), this_fault );
}
}
}
for( const auto& horizon : initial_model.horizons() )
{
const auto& this_horizon = this->horizon( horizon.id() );
for( const auto& horizon_line :
initial_model.horizon_items( horizon ) )
{
for( const auto& out_line_id :
line_mappings.in2out( horizon_line.id() ) )
{
builder.add_line_in_horizon(
this->line( out_line_id ), this_horizon );
}
}
}
for( const auto& fault_surface : initial_model.fault_blocks() )
if( initial_to_section_mappings.has_mapping_type(
Line2D::component_type_static() ) )
{
const auto& this_fault_surface =
this->fault_block( fault_surface.id() );
for( const auto& fault_surface_surface :
initial_model.fault_block_items( fault_surface ) )
{
for( const auto& out_surface_id :
surface_mappings.in2out( fault_surface_surface.id() ) )
{
builder.add_surface_in_fault_block(
this->surface( out_surface_id ), this_fault_surface );
}
}
const auto& line_mappings = initial_to_section_mappings.at(
Line2D::component_type_static() );
copy_faults_items_from_mappings(
initial_model, *this, builder, line_mappings );
copy_horizons_items_from_mappings(
initial_model, *this, builder, line_mappings );
}
for( const auto& stratigraphic_unit :
initial_model.stratigraphic_units() )
if( initial_to_section_mappings.has_mapping_type(
Surface2D::component_type_static() ) )
{
const auto& this_stratigraphic_unit =
this->stratigraphic_unit( stratigraphic_unit.id() );
for( const auto& stratigraphic_unit_surface :
initial_model.stratigraphic_unit_items( stratigraphic_unit ) )
{
for( const auto& out_surface_id :
surface_mappings.in2out( stratigraphic_unit_surface.id() ) )
{
builder.add_surface_in_stratigraphic_unit(
this->surface( out_surface_id ),
this_stratigraphic_unit );
}
}
const auto& surface_mappings = initial_to_section_mappings.at(
Surface2D::component_type_static() );
copy_fault_blocks_items_from_mappings(
initial_model, *this, builder, surface_mappings );
copy_stratigraphic_units_items_from_mappings(
initial_model, *this, builder, surface_mappings );
}
}

Expand Down
Loading

0 comments on commit fd28d54

Please sign in to comment.