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
2 changes: 2 additions & 0 deletions include/geode/mesh/core/light_regular_grid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
namespace geode
{
template < index_t dimension >
class LightRegularGrid : public Grid< dimension >, public Identifier

Check warning on line 43 in include/geode/mesh/core/light_regular_grid.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/mesh/core/light_regular_grid.hpp:43:11 [cppcoreguidelines-special-member-functions]

class 'LightRegularGrid' defines a destructor, a move constructor and a move assignment operator but does not define a copy constructor or a copy assignment operator
{
public:
static constexpr auto dim = dimension;
using CellIndices = typename Grid< dimension >::CellIndices;
using VertexIndices = typename Grid< dimension >::VertexIndices;
using VerticesAroundVertex =
absl::InlinedVector< index_t, 2 * dimension >;

Check warning on line 50 in include/geode/mesh/core/light_regular_grid.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/mesh/core/light_regular_grid.hpp:50:43 [bugprone-implicit-widening-of-multiplication-result]

performing an implicit widening conversion to type 'size_t' (aka 'unsigned long') of a multiplication performed in type 'index_t' (aka 'unsigned int')

LightRegularGrid( Point< dimension > origin,
std::array< index_t, dimension > cells_number,
Expand Down Expand Up @@ -94,6 +94,8 @@

[[nodiscard]] BoundingBox< dimension > bounding_box() const;

[[nodiscard]] LightRegularGrid< dimension > clone() const;

private:
friend class bitsery::Access;
template < typename Archive >
Expand Down
23 changes: 23 additions & 0 deletions src/geode/mesh/core/light_regular_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
{
auto builder = GridBuilder< dimension >{ *this };
builder.set_grid_origin( std::move( origin ) );
std::array< double, dimension > cells_length;

Check warning on line 100 in src/geode/mesh/core/light_regular_grid.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/mesh/core/light_regular_grid.cpp:100:9 [cppcoreguidelines-pro-type-member-init]

uninitialized record type: 'cells_length'
for( const auto d : LRange{ dimension } )
{
cells_length[d] = directions[d].length();
Expand Down Expand Up @@ -195,6 +195,29 @@
return this->grid_bounding_box();
}

template < index_t dimension >
LightRegularGrid< dimension > LightRegularGrid< dimension >::clone() const
{
auto origin_position = this->vertex_indices( 0 );
auto origin = this->grid_point( origin_position );
std::array< index_t, dimension > cells_number;
std::array< Vector< dimension >, dimension > directions;
for( const auto axis : LRange{ dimension } )
{
cells_number[axis] = this->nb_cells_in_direction( axis );
directions[axis] = Vector< dimension >{ origin,
this->grid_point(
this->next_vertex( origin_position, axis ).value() ) };
}
LightRegularGrid< dimension > clone{ origin, cells_number, directions };
IdentifierBuilder builder{ clone };

Check failure on line 213 in src/geode/mesh/core/light_regular_grid.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/mesh/core/light_regular_grid.cpp:213:27 [clang-diagnostic-error]

variable has incomplete type 'IdentifierBuilder'
builder.copy_identifier( *this );
clone.grid_vertex_attribute_manager().copy(
this->grid_vertex_attribute_manager() );
clone.cell_attribute_manager().copy( this->cell_attribute_manager() );
return clone;
}

template < index_t dimension >
template < typename Archive >
void LightRegularGrid< dimension >::serialize( Archive& serializer )
Expand Down
Loading