Skip to content

Commit

Permalink
Merge pull request #1056 from Geode-solutions/fix/sharp-block-mappings
Browse files Browse the repository at this point in the history
fix(Mappings): add unmap function in GenericMapping
  • Loading branch information
MelchiorSchuh authored Nov 29, 2024
2 parents dee4fd3 + 2b9fc7d commit 083d225
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions include/geode/basic/mapping.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,24 @@ namespace geode
this->out2in_mapping()[out].push_back( in );
}

void unmap( const T1& in, const T2& out )
{
auto& in_map = this->in2out_mapping().at( in );
const auto itr = absl::c_find( in_map, out );
in_map.erase( itr );
if( this->in2out( in ).empty() )
{
this->in2out_mapping().erase( in );
}
auto& out_map = this->out2in_mapping().at( out );
const auto itr2 = absl::c_find( out_map, in );
out_map.erase( itr2 );
if( this->out2in( out ).empty() )
{
this->out2in_mapping().erase( out );
}
}

void erase_in( const T1& in )
{
if( !this->has_mapping_input( in ) )
Expand Down
2 changes: 1 addition & 1 deletion include/geode/model/helpers/surface_radial_sort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ namespace geode

[[nodiscard]] index_t next( index_t position ) const;

[[nodiscard]] absl::FixedArray< SidedSurface > surfaces;
absl::FixedArray< SidedSurface > surfaces;
};

[[nodiscard]] SortedSurfaces opengeode_model_api surface_radial_sort(
Expand Down

0 comments on commit 083d225

Please sign in to comment.