Skip to content

Commit

Permalink
Merge branch 'v15' into fix/replace-absl-string-view-with-std
Browse files Browse the repository at this point in the history
  • Loading branch information
BenPinet committed Jul 11, 2024
2 parents f976395 + 3d78ef5 commit 7173b81
Show file tree
Hide file tree
Showing 30 changed files with 66 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace geode
void set_fault_block_name( const uuid& id, std::string_view name );

protected:
FaultBlocksBuilder( FaultBlocks< dimension >& fault_blocks )
explicit FaultBlocksBuilder( FaultBlocks< dimension >& fault_blocks )
: fault_blocks_( fault_blocks )
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ namespace geode
void set_fault_name( const uuid& id, std::string_view name );

protected:
FaultsBuilder( Faults< dimension >& faults ) : faults_( faults ) {}
explicit FaultsBuilder( Faults< dimension >& faults )
: faults_( faults )
{
}

const uuid& create_fault();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace geode
void set_horizon_name( const uuid& id, std::string_view name );

protected:
HorizonsBuilder( Horizons< dimension >& horizons )
explicit HorizonsBuilder( Horizons< dimension >& horizons )
: horizons_( horizons )
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace geode
const uuid& id, std::string_view name );

protected:
StratigraphicUnitsBuilder(
explicit StratigraphicUnitsBuilder(
StratigraphicUnits< dimension >& stratigraphic_units )
: stratigraphic_units_( stratigraphic_units )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace geode
OPENGEODE_DISABLE_COPY_AND_MOVE( CrossSectionBuilder );

public:
CrossSectionBuilder( CrossSection& cross_section );
explicit CrossSectionBuilder( CrossSection& cross_section );

ModelCopyMapping copy( const CrossSection& cross_section );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace geode
OPENGEODE_DISABLE_COPY_AND_MOVE( StructuralModelBuilder );

public:
StructuralModelBuilder( StructuralModel& structural_model );
explicit StructuralModelBuilder( StructuralModel& structural_model );

ModelCopyMapping copy( const StructuralModel& structural_model );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace geode
virtual ~CrossSectionOutput() = default;

protected:
CrossSectionOutput( std::string_view filename )
explicit CrossSectionOutput( std::string_view filename )
: Output< CrossSection >{ filename }
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace geode
: public CrossSectionInput
{
public:
OpenGeodeCrossSectionInput( std::string_view filename );
explicit OpenGeodeCrossSectionInput( std::string_view filename );

static std::string_view extension()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace geode
: public CrossSectionOutput
{
public:
OpenGeodeCrossSectionOutput( std::string_view filename );
explicit OpenGeodeCrossSectionOutput( std::string_view filename );

static std::string_view extension()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace geode
: public StructuralModelInput
{
public:
OpenGeodeStructuralModelInput( std::string_view filename );
explicit OpenGeodeStructuralModelInput( std::string_view filename );

static std::string_view extension()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace geode
final : public StructuralModelOutput
{
public:
OpenGeodeStructuralModelOutput( std::string_view filename );
explicit OpenGeodeStructuralModelOutput( std::string_view filename );

static std::string_view extension()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace geode
virtual ~StructuralModelOutput() = default;

protected:
StructuralModelOutput( std::string_view filename )
explicit StructuralModelOutput( std::string_view filename )
: Output< StructuralModel >{ filename }
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ namespace geode
implicit_value_{ implicit_value }
{
}
StratigraphicPoint( const std::array< double, dimension >& values )
explicit StratigraphicPoint(
const std::array< double, dimension >& values )
: implicit_value_{ values[dimension - 1] }
{
for( const auto d : LRange{ location_dim } )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace geode
class opengeode_geosciences_implicit_api StratigraphicRelationshipsBuilder
{
public:
StratigraphicRelationshipsBuilder(
explicit StratigraphicRelationshipsBuilder(
StratigraphicRelationships& relationships );

/*!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ namespace geode
};

public:
HorizonsStackBuilder( HorizonsStack< dimension >& horizons_stack );
explicit HorizonsStackBuilder(
HorizonsStack< dimension >& horizons_stack );
HorizonsStackBuilder( HorizonsStackBuilder< dimension >&& ) = default;

ModelCopyMapping copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ namespace geode
: public CrossSectionBuilder
{
public:
ImplicitCrossSectionBuilder( ImplicitCrossSection& implicit_section );
explicit ImplicitCrossSectionBuilder(
ImplicitCrossSection& implicit_section );

ModelCopyMapping copy( const ImplicitCrossSection& implicit_model );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace geode
: public StructuralModelBuilder
{
public:
ImplicitStructuralModelBuilder(
explicit ImplicitStructuralModelBuilder(
ImplicitStructuralModel& implicit_model );

ModelCopyMapping copy( const ImplicitStructuralModel& implicit_model );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ namespace geode
: public ImplicitStructuralModelBuilder
{
public:
StratigraphicModelBuilder( StratigraphicModel& stratigraphic_model_ );
explicit StratigraphicModelBuilder(
StratigraphicModel& stratigraphic_model_ );

ModelCopyMapping copy( const StratigraphicModel& implicit_model );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace geode
: public ImplicitCrossSectionBuilder
{
public:
StratigraphicSectionBuilder(
explicit StratigraphicSectionBuilder(
StratigraphicSection& stratigraphic_section );

ModelCopyMapping copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#pragma once

#include <optional>

#include <geode/basic/pimpl.h>

#include <geode/geosciences/explicit/representation/core/cross_section.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#pragma once

#include <optional>

#include <geode/basic/pimpl.h>

#include <geode/geosciences/explicit/representation/core/structural_model.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#pragma once

#include <optional>

#include <geode/basic/pimpl.h>

#include <geode/geosciences/implicit/common.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ namespace geode

HorizonsStackBuilder2D ImplicitCrossSectionBuilder::horizons_stack_builder()
{
return { implicit_section_.modifiable_horizons_stack( {} ) };
return HorizonsStackBuilder2D{
implicit_section_.modifiable_horizons_stack( {} )
};
}
} // namespace geode
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ namespace geode
HorizonsStackBuilder3D
ImplicitStructuralModelBuilder::horizons_stack_builder()
{
return { implicit_model_.modifiable_horizons_stack( {} ) };
return HorizonsStackBuilder3D{
implicit_model_.modifiable_horizons_stack( {} )
};
}
} // namespace geode
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ namespace geode
auto xyz_attribute =
strati_surface->vertex_attribute_manager()
.find_or_create_attribute< VariableAttribute, Point2D >(
"geode_xyz", { { 0, 0 } }, { false, true } );
"geode_xyz", Point2D{ { 0, 0 } }, { false, true } );
for( const auto pt_id : Range{ strati_surface->nb_vertices() } )
{
xyz_attribute->set_value(
Expand Down Expand Up @@ -174,7 +174,8 @@ namespace geode
auto xyz_attribute =
strati_solid->vertex_attribute_manager()
.find_or_create_attribute< VariableAttribute, Point3D >(
"geode_xyz", { { 0, 0, 0 } }, { false, true } );
"geode_xyz", Point3D{ { 0, 0, 0 } },
{ false, true } );
for( const auto pt_id : Range{ strati_solid->nb_vertices() } )
{
xyz_attribute->set_value(
Expand Down Expand Up @@ -265,12 +266,12 @@ namespace geode
StratigraphicModel::stratigraphic_location_type >(
StratigraphicModel::
stratigraphic_location_attribute_name,
{ { 0, 0 } }, { false, true } );
Point2D{ { 0, 0 } }, { false, true } );
for( const auto vertex_id : Range{ block_mesh.nb_vertices() } )
{
const auto& vertex_point = block_mesh.point( vertex_id );
strati_location_attribute->set_value(
vertex_id, { { vertex_point.value( first_axis ),
vertex_id, Point2D{ { vertex_point.value( first_axis ),
vertex_point.value( second_axis ) } } );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ namespace geode
TetrahedralSolidPointFunction< 3, 2 >::create(
block.mesh< TetrahedralSolid3D >(),
stratigraphic_location_attribute_name,
{ { 0, 0 } } ) );
Point2D{ { 0, 0 } } ) );
}
else
{
Expand Down Expand Up @@ -334,7 +334,7 @@ namespace geode
}
box_vector[p] = std::move( bbox );
} );
return { box_vector };
return AABBTree3D{ std::move( box_vector ) };
}

void build_model_stratigraphic_distance_to_mesh_elements(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ namespace geode
TriangulatedSurfacePointFunction< 2, 1 >::create(
surface.mesh< TriangulatedSurface2D >(),
stratigraphic_location_attribute_name,
{ { 0 } } ) );
Point1D{ { 0 } } ) );
}
else
{
Expand Down Expand Up @@ -330,7 +330,7 @@ namespace geode
}
box_vector[p] = std::move( bbox );
} );
return { box_vector };
return AABBTree2D{ std::move( box_vector ) };
}

void build_model_stratigraphic_distance_to_mesh_elements(
Expand Down
2 changes: 1 addition & 1 deletion tests/explicit/test-geographic-coordinate-system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void test_crs()
{ "EPSG", "27571", "I" } };
for( const auto p : geode::TRange< double >{ nb_points } )
{
lambert1.set_point( p, { { p, p, p } } );
lambert1.set_point( p, geode::Point3D{ { p, p, p } } );
}
geode::GeographicCoordinateSystem3D lambert2{ manager,
{ "EPSG", "27572", "II" } };
Expand Down
15 changes: 8 additions & 7 deletions tests/implicit/test-stratigraphic-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,24 @@ void test_model(
{
const auto& block = model.block( block1_id );
const auto& strati_pt1 = model.stratigraphic_coordinates( block, 59 );
OPENGEODE_EXCEPTION( strati_pt1.stratigraphic_coordinates().inexact_equal(
{ { -0.213112, -0.188148, 0.472047 } } ),
OPENGEODE_EXCEPTION(
strati_pt1.stratigraphic_coordinates().inexact_equal(
geode::Point3D{ { -0.213112, -0.188148, 0.472047 } } ),
"[Test] Wrong stratigraphic coordinates for point 59 at position [",
model.block( block1_id ).mesh().point( 59 ).string(),
"] with stratigraphic coordinates [", strati_pt1.string(), "]." );
const geode::Point3D query2{ { 1, 0, 1 } };
const auto strati_pt2 = model.stratigraphic_coordinates( block, query2 );
OPENGEODE_EXCEPTION( strati_pt2->stratigraphic_coordinates().inexact_equal(
{ { 0.386272, -0.109477, 0. } } ),
geode::Point3D{ { 0.386272, -0.109477, 0. } } ),
"[Test] Wrong stratigraphic coordinates for point at position [",
query2.string(), "] with stratigraphic coordinates [",
strati_pt2->string(), "]." );
const geode::Point3D query3{ { 0.480373621, 0.5420120955, 0.6765933633 } };
const auto strati_pt3 = model.stratigraphic_coordinates( block, query3 );
OPENGEODE_EXCEPTION(
strati_pt3->stratigraphic_coordinates().inexact_equal(
{ { 0.03380647978, -0.002759957825, 0.3080064376 } } ),
strati_pt3->stratigraphic_coordinates().inexact_equal( geode::Point3D{
{ 0.03380647978, -0.002759957825, 0.3080064376 } } ),
"[Test] Wrong stratigraphic coordinates for point at position [",
query3.string(), "] with stratigraphic coordinates [",
strati_pt3->string(), "]." );
Expand Down Expand Up @@ -127,10 +128,10 @@ void test_model(

const auto stratigraphic_bbox = model.stratigraphic_bounding_box();
OPENGEODE_EXCEPTION( stratigraphic_bbox.min().inexact_equal(
{ { -0.8098155, -0.5378192, 0 } } ),
geode::Point3D{ { -0.8098155, -0.5378192, 0 } } ),
"[Test] Wrong stratigraphic coordinates bounding box minimum." );
OPENGEODE_EXCEPTION( stratigraphic_bbox.max().inexact_equal(
{ { 0.5643514, 0.6411656, 1 } } ),
geode::Point3D{ { 0.5643514, 0.6411656, 1 } } ),
"[Test] Wrong stratigraphic coordinates bounding box minimum." );

for( const auto& horizon : model.horizons() )
Expand Down
19 changes: 10 additions & 9 deletions tests/implicit/test-stratigraphic-section.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ geode::StratigraphicSection import_section_with_stratigraphy()
for( const auto vertex_id : geode::Range{ mesh.nb_vertices() } )
{
model_builder.set_stratigraphic_coordinates( surface, vertex_id,
{ { mesh.point( vertex_id ).value( 0 ),
geode::Point2D{ { mesh.point( vertex_id ).value( 0 ),
scalar_attribute->value( vertex_id ) } } );
}
}
Expand All @@ -75,8 +75,8 @@ void test_section( const geode::StratigraphicSection& implicit_model )
const auto& strati_pt1 =
implicit_model.stratigraphic_coordinates( surface0, 1773 );
OPENGEODE_EXCEPTION(
strati_pt1.stratigraphic_coordinates().inexact_equal(
{ { surface0.mesh().point( 1773 ).value( 0 ), -1.940964 } } ),
strati_pt1.stratigraphic_coordinates().inexact_equal( geode::Point2D{
{ surface0.mesh().point( 1773 ).value( 0 ), -1.940964 } } ),
"[Test] Wrong stratigraphic coordinates for point 1773 at position [",
surface0.mesh().point( 1773 ).string(),
"] with stratigraphic coordinates [", strati_pt1.string(), "]." );
Expand All @@ -93,17 +93,18 @@ void test_section( const geode::StratigraphicSection& implicit_model )
const geode::Point2D query3{ { 3.32700324, 4.44508266 } };
const auto strati_pt3 =
implicit_model.stratigraphic_coordinates( surface0, query3 );
OPENGEODE_EXCEPTION( strati_pt3->stratigraphic_coordinates().inexact_equal(
{ { query3.value( 0 ), -1.889619 } } ),
OPENGEODE_EXCEPTION(
strati_pt3->stratigraphic_coordinates().inexact_equal(
geode::Point2D{ { query3.value( 0 ), -1.889619 } } ),
"[Test] Wrong stratigraphic coordinates for point at position [",
query3.string(), "] with stratigraphic coordinates [",
strati_pt3->string(), "]." );
const auto stratigraphic_bbox = implicit_model.stratigraphic_bounding_box();
OPENGEODE_EXCEPTION(
stratigraphic_bbox.min().inexact_equal( { { 0, -6.5798343 } } ),
OPENGEODE_EXCEPTION( stratigraphic_bbox.min().inexact_equal(
geode::Point2D{ { 0, -6.5798343 } } ),
"[Test] Wrong stratigraphic coordinates bounding box minimum." );
OPENGEODE_EXCEPTION(
stratigraphic_bbox.max().inexact_equal( { { 15, 10.4703907 } } ),
OPENGEODE_EXCEPTION( stratigraphic_bbox.max().inexact_equal(
geode::Point2D{ { 15, 10.4703907 } } ),
"[Test] Wrong stratigraphic coordinates bounding box minimum." );
}

Expand Down

0 comments on commit 7173b81

Please sign in to comment.