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 @@ -26,6 +26,7 @@
#include <geode/basic/uuid.hpp>

#include <geode/model/mixin/builder/block_collections_builder.hpp>
#include <geode/model/mixin/core/block_collection.hpp>

#define PYTHON_BLOCK_COLLECTIONS_BUILDER( dimension ) \
const auto name##dimension = \
Expand All @@ -38,9 +39,9 @@

namespace geode
{
void define_block_collections_builder( pybind11::module& module )

Check warning on line 42 in bindings/python/src/model/mixin/builder/block_collections_builder.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/model/mixin/builder/block_collections_builder.cpp:42:10 [misc-use-internal-linkage]

function 'define_block_collections_builder' can be made static or moved into an anonymous namespace to enforce internal linkage
{
PYTHON_BLOCK_COLLECTIONS_BUILDER( 2 );

Check warning on line 44 in bindings/python/src/model/mixin/builder/block_collections_builder.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/model/mixin/builder/block_collections_builder.cpp:44:9 [cppcoreguidelines-pro-bounds-pointer-arithmetic]

do not use pointer arithmetic
PYTHON_BLOCK_COLLECTIONS_BUILDER( 3 );

Check warning on line 45 in bindings/python/src/model/mixin/builder/block_collections_builder.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/model/mixin/builder/block_collections_builder.cpp:45:9 [cppcoreguidelines-pro-bounds-pointer-arithmetic]

do not use pointer arithmetic
}
} // namespace geode
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <geode/basic/uuid.hpp>

#include <geode/model/mixin/builder/corner_collections_builder.hpp>
#include <geode/model/mixin/core/corner_collection.hpp>

#define PYTHON_CORNER_COLLECTIONS_BUILDER( dimension ) \
const auto name##dimension = \
Expand All @@ -38,9 +39,9 @@

namespace geode
{
void define_corner_collections_builder( pybind11::module& module )

Check warning on line 42 in bindings/python/src/model/mixin/builder/corner_collections_builder.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/model/mixin/builder/corner_collections_builder.cpp:42:10 [misc-use-internal-linkage]

function 'define_corner_collections_builder' can be made static or moved into an anonymous namespace to enforce internal linkage
{
PYTHON_CORNER_COLLECTIONS_BUILDER( 2 );

Check warning on line 44 in bindings/python/src/model/mixin/builder/corner_collections_builder.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/model/mixin/builder/corner_collections_builder.cpp:44:9 [cppcoreguidelines-pro-bounds-pointer-arithmetic]

do not use pointer arithmetic
PYTHON_CORNER_COLLECTIONS_BUILDER( 3 );

Check warning on line 45 in bindings/python/src/model/mixin/builder/corner_collections_builder.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/model/mixin/builder/corner_collections_builder.cpp:45:9 [cppcoreguidelines-pro-bounds-pointer-arithmetic]

do not use pointer arithmetic
}
} // namespace geode
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <geode/mesh/builder/point_set_builder.hpp>

#include <geode/model/mixin/builder/corners_builder.hpp>
#include <geode/model/mixin/core/corner.hpp>

#define PYTHON_CORNERS_BUILDER( dimension ) \
const auto name##dimension = \
Expand All @@ -41,9 +42,9 @@

namespace geode
{
void define_corners_builder( pybind11::module& module )

Check warning on line 45 in bindings/python/src/model/mixin/builder/corners_builder.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/model/mixin/builder/corners_builder.cpp:45:10 [misc-use-internal-linkage]

function 'define_corners_builder' can be made static or moved into an anonymous namespace to enforce internal linkage
{
PYTHON_CORNERS_BUILDER( 2 );

Check warning on line 47 in bindings/python/src/model/mixin/builder/corners_builder.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/model/mixin/builder/corners_builder.cpp:47:9 [cppcoreguidelines-pro-bounds-pointer-arithmetic]

do not use pointer arithmetic
PYTHON_CORNERS_BUILDER( 3 );

Check warning on line 48 in bindings/python/src/model/mixin/builder/corners_builder.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/model/mixin/builder/corners_builder.cpp:48:9 [cppcoreguidelines-pro-bounds-pointer-arithmetic]

do not use pointer arithmetic
}
} // namespace geode
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <geode/basic/uuid.hpp>

#include <geode/model/mixin/builder/line_collections_builder.hpp>
#include <geode/model/mixin/core/line_collection.hpp>

#define PYTHON_LINE_COLLECTIONS_BUILDER( dimension ) \
const auto name##dimension = \
Expand All @@ -37,7 +38,7 @@

namespace geode
{
void define_line_collections_builder( pybind11::module& module )

Check warning on line 41 in bindings/python/src/model/mixin/builder/line_collections_builder.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

bindings/python/src/model/mixin/builder/line_collections_builder.cpp:41:10 [misc-use-internal-linkage]

function 'define_line_collections_builder' can be made static or moved into an anonymous namespace to enforce internal linkage
{
PYTHON_LINE_COLLECTIONS_BUILDER( 2 );
PYTHON_LINE_COLLECTIONS_BUILDER( 3 );
Expand Down
1 change: 1 addition & 0 deletions bindings/python/src/model/mixin/builder/lines_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <geode/mesh/builder/edged_curve_builder.hpp>

#include <geode/model/mixin/builder/lines_builder.hpp>
#include <geode/model/mixin/core/line.hpp>

#define PYTHON_LINES_BUILDER( dimension ) \
const auto name##dimension = \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <geode/basic/uuid.hpp>

#include <geode/model/mixin/builder/model_boundaries_builder.hpp>
#include <geode/model/mixin/core/model_boundary.hpp>

#define PYTHON_MODEL_BOUNDARIES_BUILDER( dimension ) \
const auto name##dimension = \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <geode/basic/uuid.hpp>

#include <geode/model/mixin/builder/surface_collections_builder.hpp>
#include <geode/model/mixin/core/surface_collection.hpp>

#define PYTHON_SURFACE_COLLECTIONS_BUILDER( dimension ) \
const auto name##dimension = \
Expand Down
18 changes: 9 additions & 9 deletions bindings/python/tests/model/test-py-brep.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def add_corners(brep, builder):
uuids = []
for i in range(nb):
uuids.append(builder.add_corner())
builder.set_corner_name(uuids[-1], "corner" + str(len(uuids)))
builder.set_corner_name(brep.corner(uuids[-1]),"corner" + str(len(uuids)))

temp_corner = brep.corner(builder.add_corner())
builder.remove_corner(temp_corner)
Expand All @@ -59,7 +59,7 @@ def add_lines(brep, builder):
uuids = []
for i in range(nb):
uuids.append(builder.add_line())
builder.set_line_name(uuids[-1], "line" + str(len(uuids)))
builder.set_line_name(brep.line(uuids[-1]), "line" + str(len(uuids)))

temp_line = brep.line(builder.add_line())
builder.remove_line(temp_line)
Expand All @@ -75,7 +75,7 @@ def add_surfaces(brep, builder):
uuids = []
for i in range(nb):
uuids.append(builder.add_surface())
builder.set_surface_name(uuids[-1], "surface" + str(len(uuids)))
builder.set_surface_name(brep.surface(uuids[-1]), "surface" + str(len(uuids)))

temp_surface = brep.surface(builder.add_surface())
builder.remove_surface(temp_surface)
Expand All @@ -88,7 +88,7 @@ def add_surfaces(brep, builder):

def add_block(brep, builder):
uuid = builder.add_block()
builder.set_block_name(uuid, "block1")
builder.set_block_name(brep.block(uuid), "block1")

temp_block = brep.block(builder.add_block())
builder.remove_block(temp_block)
Expand All @@ -104,7 +104,7 @@ def add_model_boundaries(brep, builder):
uuids = []
for i in range(nb):
uuids.append(builder.add_model_boundary())
builder.set_model_boundary_name(uuids[-1], "boundary" + str(len(uuids)))
builder.set_model_boundary_name(brep.model_boundary(uuids[-1]), "boundary" + str(len(uuids)))

temp_boundary = brep.model_boundary(builder.add_model_boundary())
builder.remove_model_boundary(temp_boundary)
Expand All @@ -120,7 +120,7 @@ def add_corner_collections(brep, builder):
uuids = []
for i in range(nb):
uuids.append(builder.add_corner_collection())
builder.set_corner_collection_name(uuids[-1], "collection" + str(len(uuids)))
builder.set_corner_collection_name(brep.corner_collection(uuids[-1]), "collection" + str(len(uuids)))

temp_collection = brep.corner_collection(builder.add_corner_collection())
builder.remove_corner_collection(temp_collection)
Expand All @@ -136,7 +136,7 @@ def add_line_collections(brep, builder):
uuids = []
for i in range(nb):
uuids.append(builder.add_line_collection())
builder.set_line_collection_name(uuids[-1], "collection" + str(len(uuids)))
builder.set_line_collection_name(brep.line_collection(uuids[-1]), "collection" + str(len(uuids)))

temp_collection = brep.line_collection(builder.add_line_collection())
builder.remove_line_collection(temp_collection)
Expand All @@ -152,7 +152,7 @@ def add_surface_collections(brep, builder):
uuids = []
for i in range(nb):
uuids.append(builder.add_surface_collection())
builder.set_surface_collection_name(uuids[-1], "collection" + str(len(uuids)))
builder.set_surface_collection_name(brep.surface_collection(uuids[-1]), "collection" + str(len(uuids)))

temp_collection = brep.surface_collection(builder.add_surface_collection())
builder.remove_surface_collection(temp_collection)
Expand All @@ -165,7 +165,7 @@ def add_surface_collections(brep, builder):

def add_block_collection(brep, builder):
uuid = builder.add_block_collection()
builder.set_block_collection_name(uuid, "collection1")
builder.set_block_collection_name(brep.block_collection(uuid), "collection1")

temp_collection = brep.block_collection(builder.add_block_collection())
builder.remove_block_collection(temp_collection)
Expand Down
8 changes: 4 additions & 4 deletions bindings/python/tests/model/test-py-section.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def add_model_boundaries(section, builder):
for i in range(nb):
uuids.append(builder.add_model_boundary())
builder.set_model_boundary_name(
uuids[-1], "boundary" + str(len(uuids)))
section.model_boundary(uuids[-1]), "boundary" + str(len(uuids)))

temp_boundary = section.model_boundary(builder.add_model_boundary())
builder.remove_model_boundary(temp_boundary)
Expand All @@ -98,7 +98,7 @@ def add_corner_collections(section, builder):
for i in range(nb):
uuids.append(builder.add_corner_collection())
builder.set_corner_collection_name(
uuids[-1], "collection" + str(len(uuids)))
section.corner_collection(uuids[-1]), "collection" + str(len(uuids)))

temp_collection = section.corner_collection(builder.add_corner_collection())
builder.remove_corner_collection(temp_collection)
Expand All @@ -114,7 +114,7 @@ def add_line_collections(section, builder):
for i in range(nb):
uuids.append(builder.add_line_collection())
builder.set_line_collection_name(
uuids[-1], "collection" + str(len(uuids)))
section.line_collection(uuids[-1]), "collection" + str(len(uuids)))

temp_collection = section.line_collection(builder.add_line_collection())
builder.remove_line_collection(temp_collection)
Expand All @@ -130,7 +130,7 @@ def add_surface_collections(section, builder):
for i in range(nb):
uuids.append(builder.add_surface_collection())
builder.set_surface_collection_name(
uuids[-1], "collection" + str(len(uuids)))
section.surface_collection(uuids[-1]), "collection" + str(len(uuids)))

temp_collection = section.surface_collection(builder.add_surface_collection())
builder.remove_surface_collection(temp_collection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ namespace geode
{
const auto& corner_id = builder_.add_corner();
const auto& corner = model_.corner( corner_id );
auto mesh_builder =
builder_.corner_mesh_builder( corner_id );
auto mesh_builder = builder_.corner_mesh_builder( corner );
create_point( *mesh_builder, corner, definition.vertex );
corners.push_back( corner_id );
}
Expand All @@ -85,7 +84,7 @@ namespace geode
{
const auto& line_id = builder_.add_line();
const auto& line = model_.line( line_id );
auto mesh_builder = builder_.line_mesh_builder( line_id );
auto mesh_builder = builder_.line_mesh_builder( line );
const auto& vertices = definition.vertices;
for( const auto vertex : vertices )
{
Expand Down Expand Up @@ -119,7 +118,7 @@ namespace geode
dimension >::type_name_static() ) );
const auto& surface = model_.surface( surface_id );
auto mesh_builder =
builder_.surface_mesh_builder( surface_id );
builder_.surface_mesh_builder( surface );
for( const auto vertex : definition.vertices )
{
create_point( *mesh_builder, surface, vertex );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ namespace geode
public:
void load_block_collections( std::string_view directory );

void set_block_collection_name( const uuid& id, std::string_view name );
void set_block_collection_name(
const BlockCollection< dimension >& block_collection,
std::string_view name );

void set_block_collection_active( const uuid& id, bool active );
void set_block_collection_active(
const BlockCollection< dimension >& block_collection, bool active );

protected:
explicit BlockCollectionsBuilder(
Expand Down
15 changes: 8 additions & 7 deletions include/geode/model/mixin/builder/blocks_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,29 @@ namespace geode

/*!
* Get a pointer to the builder of a Block mesh
* @param[in] id Unique index of the Block
* @param[in] Block Block component to get the builder of
*/
template < typename Mesh = SolidMesh< dimension > >
[[nodiscard]] std::unique_ptr< typename Mesh::Builder >
block_mesh_builder( const uuid& id )
block_mesh_builder( const Block< dimension >& block )
{
auto& mesh =
blocks_
.modifiable_block(
id, typename Block< dimension >::BlocksBuilderKey{} )
.modifiable_block( block.id(),
typename Block< dimension >::BlocksBuilderKey{} )
.modifiable_mesh(
typename Block< dimension >::BlocksBuilderKey{} );
return MeshBuilderFactory::create_mesh_builder<
typename Mesh::Builder >( dynamic_cast< Mesh& >( mesh ) );
}

void set_block_name( const uuid& id, std::string_view name );
void set_block_name(
const Block< dimension >& block, std::string_view name );

void set_block_active( const uuid& id, bool active );
void set_block_active( const Block< dimension >& block, bool active );

[[nodiscard]] std::unique_ptr< SolidMesh< dimension > >
steal_block_mesh( const uuid& id );
steal_block_mesh( const Block< dimension >& block );

protected:
explicit BlocksBuilder( Blocks< dimension >& blocks )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ namespace geode
void load_corner_collections( std::string_view directory );

void set_corner_collection_name(
const uuid& id, std::string_view name );
const CornerCollection< dimension >& corner_collection,
std::string_view name );

void set_corner_collection_active( const uuid& id, bool active );
void set_corner_collection_active(
const CornerCollection< dimension >& corner_collection,
bool active );

protected:
explicit CornerCollectionsBuilder(
Expand Down
12 changes: 7 additions & 5 deletions include/geode/model/mixin/builder/corners_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,19 @@ namespace geode

/*!
* Get a pointer to the builder of a Corner mesh
* @param[in] id Unique index of the Corner
* @param[in] corner Corner in the model
*/
[[nodiscard]] std::unique_ptr< PointSetBuilder< dimension > >
corner_mesh_builder( const uuid& id );
corner_mesh_builder( const Corner< dimension >& corner );

void set_corner_name( const uuid& id, std::string_view name );
void set_corner_name(
const Corner< dimension >& corner, std::string_view name );

void set_corner_active( const uuid& id, bool active );
void set_corner_active(
const Corner< dimension >& corner, bool active );

[[nodiscard]] std::unique_ptr< PointSet< dimension > >
steal_corner_mesh( const uuid& id );
steal_corner_mesh( const Corner< dimension >& corner );

protected:
explicit CornersBuilder( Corners< dimension >& corners )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ namespace geode
public:
void load_line_collections( std::string_view directory );

void set_line_collection_name( const uuid& id, std::string_view name );
void set_line_collection_name(
const LineCollection< dimension >& line_collection,
std::string_view name );

void set_line_collection_active( const uuid& id, bool active );
void set_line_collection_active(
const LineCollection< dimension >& line_collection, bool active );

protected:
explicit LineCollectionsBuilder(
Expand Down
11 changes: 6 additions & 5 deletions include/geode/model/mixin/builder/lines_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,18 @@ namespace geode

/*!
* Get a pointer to the builder of a Line mesh
* @param[in] id Unique index of the Line
* @param[in] line Line component to get the builder of
*/
[[nodiscard]] std::unique_ptr< EdgedCurveBuilder< dimension > >
line_mesh_builder( const uuid& id );
line_mesh_builder( const Line< dimension >& line );

void set_line_name( const uuid& id, std::string_view name );
void set_line_name(
const Line< dimension >& line, std::string_view name );

void set_line_active( const uuid& id, bool active );
void set_line_active( const Line< dimension >& line, bool active );

[[nodiscard]] std::unique_ptr< EdgedCurve< dimension > >
steal_line_mesh( const uuid& id );
steal_line_mesh( const Line< dimension >& line );

protected:
explicit LinesBuilder( Lines< dimension >& lines ) : lines_( lines ) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ namespace geode
public:
void load_model_boundaries( std::string_view directory );

void set_model_boundary_name( const uuid& id, std::string_view name );
void set_model_boundary_name(
const ModelBoundary< dimension >& id, std::string_view name );

void set_model_boundary_active( const uuid& id, bool active );
void set_model_boundary_active(
const ModelBoundary< dimension >& id, bool active );

protected:
explicit ModelBoundariesBuilder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ namespace geode
void load_surface_collections( std::string_view directory );

void set_surface_collection_name(
const uuid& id, std::string_view name );
const SurfaceCollection< dimension >& surface_collection,
std::string_view name );

void set_surface_collection_active( const uuid& id, bool active );
void set_surface_collection_active(
const SurfaceCollection< dimension >& surface_collection,
bool active );

protected:
explicit SurfaceCollectionsBuilder(
Expand Down
14 changes: 8 additions & 6 deletions include/geode/model/mixin/builder/surfaces_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,30 @@ namespace geode

/*!
* Get a pointer to the builder of a Surface mesh
* @param[in] id Unique index of the Surface
* @param[in] surface Surface component to get the builder of
*/
template < typename Mesh = SurfaceMesh< dimension > >
[[nodiscard]] std::unique_ptr< typename Mesh::Builder >
surface_mesh_builder( const uuid& id )
surface_mesh_builder( const Surface< dimension >& surface )
{
auto& mesh =
surfaces_
.modifiable_surface( id,
.modifiable_surface( surface.id(),
typename Surface< dimension >::SurfacesBuilderKey{} )
.modifiable_mesh(
typename Surface< dimension >::SurfacesBuilderKey{} );
return MeshBuilderFactory::create_mesh_builder<
typename Mesh::Builder >( dynamic_cast< Mesh& >( mesh ) );
}

void set_surface_name( const uuid& id, std::string_view name );
void set_surface_name(
const Surface< dimension >& surface, std::string_view name );

void set_surface_active( const uuid& id, bool active );
void set_surface_active(
const Surface< dimension >& surface, bool active );

[[nodiscard]] std::unique_ptr< SurfaceMesh< dimension > >
steal_surface_mesh( const uuid& id );
steal_surface_mesh( const Surface< dimension >& surface );

protected:
explicit SurfacesBuilder( Surfaces< dimension >& surfaces )
Expand Down
Loading
Loading