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
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace
using GeoCRS = typename geode::GeographicCoordinateSystem< Mesh::dim >;
const auto& crs_manager =
mesh.main_coordinate_reference_system_manager();
OPENGEODE_EXCEPTION(
OPENGEODE_DATA_EXCEPTION(
!crs_manager.coordinate_reference_system_exists( crs_name ),
"[convert_components_coordinate_reference_system] New CRS name "
"already exists" );
Expand All @@ -67,7 +67,7 @@ namespace
std::make_shared< GeoCRS >( mesh.vertex_attribute_manager(), info );
if( mesh.nb_vertices() != 0 )
{
OPENGEODE_EXCEPTION(
OPENGEODE_DATA_EXCEPTION(
crs_manager.active_coordinate_reference_system().type_name()
== GeoCRS::type_name_static(),
"[convert_components_coordinate_reference_system] Only "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,12 @@ namespace geode
HorizonsStackBuilder< dimension >::add_horizon_in_stratigraphic_unit(
const StratigraphicUnit< dimension >& strati_unit )
{
OPENGEODE_EXCEPTION(
OPENGEODE_DATA_EXCEPTION(
horizons_stack_.has_stratigraphic_unit( strati_unit.id() ),
"[HorizonsStackBuilder::add_horizon_in_stratigraphic_"
"unit] Cannot add horizon: statigraphic unit ",
strati_unit.component_id().string() );
strati_unit.component_id().string(),
" does not exist in the HorizonsStack" );
InsertedHorizonInfo info;
info.new_horizon_id = this->create_horizon();
info.strati_unit_above_id = this->create_stratigraphic_unit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ namespace
void check_number_of_horizons_and_stratigraphic_units(
geode::index_t nb_horizons, geode::index_t nb_units )
{
OPENGEODE_EXCEPTION( nb_horizons <= nb_units + 1,
"[repair_horizon_stack_if_possible] Too many horizons compared "
OPENGEODE_DATA_EXCEPTION( nb_horizons <= nb_units + 1,
"[check_number_of_horizons_and_stratigraphic_units] Too many "
"horizons compared "
"to stratigraphic units (",
nb_horizons, ", should be less than ", nb_units, ")" );
OPENGEODE_EXCEPTION( nb_units <= nb_horizons + 1,
"[repair_horizon_stack_if_possible] Too many stratigraphic "
OPENGEODE_DATA_EXCEPTION( nb_units <= nb_horizons + 1,
"[check_number_of_horizons_and_stratigraphic_units] Too many "
"stratigraphic "
"units compared to horizons (",
nb_units, ", should be less than ", nb_horizons, ")" );
}
Expand Down Expand Up @@ -251,7 +253,7 @@ namespace geode
ImplicitStructuralModel&& implicit_model,
local_index_t implicit_axis )
{
OPENGEODE_EXCEPTION( implicit_axis < 3,
OPENGEODE_DATA_EXCEPTION( implicit_axis < 3,
"[create_stratigraphic_model_from_brep_attribute_and_coords] "
"Give a valid axis (0, 1, or 2)." );

Expand Down Expand Up @@ -283,15 +285,18 @@ namespace geode
absl::Span< const std::string > horizons_names,
absl::Span< const std::string > units_names )
{
OPENGEODE_EXCEPTION( !horizons_names.empty(),
"[horizons_stack_from_names] Cannot create HorizonsStack: "
"horizons_names list is empty." );
const auto nb_horizons = horizons_names.size();
const auto nb_units = units_names.size();
check_number_of_horizons_and_stratigraphic_units(
nb_horizons, nb_units );
HorizonsStack< dimension > stack;
HorizonsStackBuilder< dimension > builder{ stack };
if( nb_horizons == 0 )
{
const auto& only_su = builder.add_stratigraphic_unit();
builder.set_stratigraphic_unit_name( only_su, units_names[0] );
return stack;
}
auto current_horizon = builder.add_horizon();
builder.set_horizon_name( current_horizon, horizons_names[0] );
const auto& su_above = builder.add_stratigraphic_unit();
Expand Down Expand Up @@ -333,15 +338,18 @@ namespace geode
absl::Span< const std::string > horizons_names,
absl::Span< const std::string > units_names )
{
OPENGEODE_EXCEPTION( !horizons_names.empty(),
"[horizons_stack_from_names] Cannot create HorizonsStack: "
"horizons_names list is empty." );
const auto nb_horizons = horizons_names.size();
const auto nb_units = units_names.size();
check_number_of_horizons_and_stratigraphic_units(
nb_horizons, nb_units );
HorizonsStack< dimension > stack;
HorizonsStackBuilder< dimension > builder{ stack };
if( nb_horizons == 0 )
{
const auto& only_su = builder.add_stratigraphic_unit();
builder.set_stratigraphic_unit_name( only_su, units_names[0] );
return stack;
}
auto current_horizon = builder.add_horizon();
builder.set_horizon_name( current_horizon, horizons_names[0] );
const auto& su_under = builder.add_stratigraphic_unit();
Expand Down Expand Up @@ -408,7 +416,7 @@ namespace geode
su_above = horizon_stack.above( current_horizon.value() );
horizon_counter++;
}
OPENGEODE_EXCEPTION( horizon_counter == nb_horizons,
OPENGEODE_DATA_EXCEPTION( horizon_counter == nb_horizons,
"[repair_horizon_stack_if_possible] Missing or wrong "
"above/under relations between horizons and stratigraphic "
"units." );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ namespace geode
auto component_is_a_horizon = this->has_horizon( component );
OPENGEODE_EXCEPTION(
component_is_a_horizon || this->has_stratigraphic_unit( component ),
"[HorizonsStack::is_conformal_above] Component does not exist in "
"the stack." );
"[HorizonsStack::is_conformal_above] Given component with uuid ",
component.string(), " does not exist in the stack." );
if( component_is_a_horizon )
{
const auto contact_type = this->horizon( component ).contact_type();
Expand Down Expand Up @@ -210,8 +210,8 @@ namespace geode
auto component_is_a_horizon = this->has_horizon( component );
OPENGEODE_EXCEPTION(
component_is_a_horizon || this->has_stratigraphic_unit( component ),
"[HorizonsStack::is_conformal_above] Component does not exist in "
"the stack." );
"[HorizonsStack::is_conformal_above] Given component with uuid ",
component.string(), " does not exist in the stack." );
if( component_is_a_horizon )
{
const auto contact_type = this->horizon( component ).contact_type();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ namespace geode
std::optional< double > horizon_implicit_value(
const Horizon2D& horizon ) const
{
OPENGEODE_EXCEPTION( horizons_stack_.has_horizon( horizon.id() ),
OPENGEODE_DATA_EXCEPTION(
horizons_stack_.has_horizon( horizon.id() ),
"[horizon_implicit_value] You cannot access the isovalue of "
"Horizon ",
horizon.id().string(),
" because the horizon is not defined in the "
"HorizonsStack." );
" because the horizon is not defined in the HorizonsStack." );
const auto value = horizon_isovalues_.find( horizon.id() );
if( value == horizon_isovalues_.end() )
{
Expand All @@ -145,10 +145,10 @@ namespace geode
double implicit_function_value, const Horizon2D& horizon ) const
{
const auto increasing = increasing_stack_isovalues();
OPENGEODE_EXCEPTION( increasing.has_value(),
"[implicit_value_is_above_horizon] Could not define if "
"implicit values were "
"increasing or decreasing in the horizon stack." );
OPENGEODE_DATA_EXCEPTION( increasing.has_value(),
"[implicit_value_is_above_horizon] Could not find if "
"implicit values were increasing or decreasing in the horizon "
"stack." );
const auto it = horizon_isovalues_.find( horizon.id() );
OPENGEODE_EXCEPTION( it != horizon_isovalues_.end(),
"[implicit_value_is_above_horizon] Cannot find horizon "
Expand Down Expand Up @@ -218,7 +218,7 @@ namespace geode
implicit_attributes_.reserve( model.nb_surfaces() );
for( const auto& surface : model.surfaces() )
{
OPENGEODE_EXCEPTION(
OPENGEODE_DATA_EXCEPTION(
( surface.mesh().type_name()
== TriangulatedSurface2D::type_name_static() ),
"[ImplicitCrossSection::instantiate_implicit_"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ namespace geode
std::optional< double > horizon_implicit_value(
const Horizon3D& horizon ) const
{
OPENGEODE_EXCEPTION( horizons_stack_.has_horizon( horizon.id() ),
OPENGEODE_DATA_EXCEPTION(
horizons_stack_.has_horizon( horizon.id() ),
"[horizon_implicit_value] You cannot access the isovalue of "
"Horizon ",
horizon.id().string(),
Expand All @@ -144,9 +145,9 @@ namespace geode
{
const auto increasing = increasing_stack_isovalues();
OPENGEODE_EXCEPTION( increasing.has_value(),
"[implicit_value_is_above_horizon] Could not define if "
"implicit values were "
"increasing or decreasing in the horizon stack." );
"[implicit_value_is_above_horizon] Could not find if "
"implicit values were increasing or decreasing in the horizon "
"stack." );
const auto it = horizon_isovalues_.find( horizon.id() );
OPENGEODE_EXCEPTION( it != horizon_isovalues_.end(),
"[implicit_value_is_above_horizon] Cannot find horizon "
Expand Down Expand Up @@ -220,7 +221,7 @@ namespace geode
{
continue;
}
OPENGEODE_EXCEPTION(
OPENGEODE_DATA_EXCEPTION(
( block.mesh().type_name()
== TetrahedralSolid3D::type_name_static() ),
"[ImplicitStructuralModel::instantiate_implicit_attribute_"
Expand Down Expand Up @@ -248,8 +249,8 @@ namespace geode
void set_implicit_value(
const Block3D& block, index_t vertex_id, double value )
{
OPENGEODE_EXCEPTION( implicit_attributes_.find( block.id() )
!= implicit_attributes_.end(),
OPENGEODE_DATA_EXCEPTION( implicit_attributes_.find( block.id() )
!= implicit_attributes_.end(),
"[ImplicitStructuralModel::set_implicit_value] Couldn't find "
"block uuid in the attributes registered - Try instantiating "
"your attribute first." );
Expand All @@ -264,10 +265,11 @@ namespace geode
void set_horizon_implicit_value(
const Horizon3D& horizon, double isovalue )
{
OPENGEODE_EXCEPTION( horizons_stack_.has_horizon( horizon.id() ),
OPENGEODE_DATA_EXCEPTION(
horizons_stack_.has_horizon( horizon.id() ),
"[horizon_implicit_value] You cannot access the isovalue of "
"Horizon ",
horizon.id().string(),
"Horizon '",
horizon.name(), "' with uuid", horizon.id().string(),
" because the horizon is not defined in the HorizonsStack." );
horizon_isovalues_[horizon.id()] = isovalue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ namespace geode
{
for( const auto& block : model.blocks() )
{
OPENGEODE_EXCEPTION(
OPENGEODE_DATA_EXCEPTION(
( block.mesh().type_name()
== TetrahedralSolid3D::type_name_static() ),
"[StratigraphicModel::instantiate_stratigraphic_"
Expand Down Expand Up @@ -240,7 +240,7 @@ namespace geode
void set_stratigraphic_location(
const Block3D& block, index_t vertex_id, Point2D value )
{
OPENGEODE_EXCEPTION(
OPENGEODE_DATA_EXCEPTION(
stratigraphic_location_attributes_.find( block.id() )
!= stratigraphic_location_attributes_.end(),
"[StratigraphicModel::set_stratigraphic_location] "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ namespace geode
{
for( const auto& surface : model.surfaces() )
{
OPENGEODE_EXCEPTION(
OPENGEODE_DATA_EXCEPTION(
( surface.mesh().type_name()
== TriangulatedSurface2D::type_name_static() ),
"[StratigraphicSection::instantiate_stratigraphic_"
Expand Down