Skip to content
Draft

V18 #199

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7489aa0
feat(Attribute): changes due to changes for attributes
BenPinet Jun 22, 2026
2068905
Apply prepare changes
BenPinet Jun 22, 2026
fde9ce3
fix test
BenPinet Jun 22, 2026
985a316
remove geode uuid
BenPinet Jul 16, 2026
8183e1c
Merge branch 'next' into feat/add_uuid_to_attribute
BenPinet Jul 16, 2026
ba4394c
fix io
BenPinet Jul 16, 2026
1f4eb78
Merge pull request #191 from Geode-solutions/feat/add_uuid_to_attribute
BotellaA Jul 23, 2026
dbc17f9
feat(Attributes): add no-value property support
BenPinet Jul 29, 2026
4d55d70
add ways to save vtk files with no data value
BenPinet Jul 30, 2026
45499ea
Merge pull request #195 from Geode-solutions/feat/add_no_value_proper…
BotellaA Jul 31, 2026
a93a751
fix(Logger): replace warn with warning
BenPinet Aug 3, 2026
f9c2191
Merge pull request #197 from Geode-solutions/feat/replace_replace_war…
BotellaA Aug 3, 2026
af4c5eb
fix(SIGN): rename signe struct
BenPinet Aug 4, 2026
76ec5a2
Merge pull request #198 from Geode-solutions/feat/put_sign_struct_in_…
BotellaA Aug 4, 2026
fc8cf31
fix(Tuple): remove std::make_pair and std::make_tuple
BenPinet Aug 6, 2026
9c85535
Merge pull request #201 from Geode-solutions/fix/remove_make_pair_and…
BotellaA Aug 11, 2026
b814592
feat(ModelBuilders): model builder changes
BenPinet Aug 12, 2026
356c6ff
Merge pull request #202 from Geode-solutions/feat/change_input_parame…
BotellaA Aug 12, 2026
28484ee
Merge branch 'next' into v18
BenPinet Aug 13, 2026
31af7f7
fix(ComponentID): change componentid class to struct
BenPinet Aug 13, 2026
f726392
Merge pull request #203 from Geode-solutions/fix/change_ComponentID_t…
BotellaA Aug 14, 2026
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
15 changes: 10 additions & 5 deletions include/geode/io/image/detail/vtk_output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@

#include <geode/basic/attribute_manager.hpp>

namespace geode

Check warning on line 34 in include/geode/io/image/detail/vtk_output.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/image/detail/vtk_output.hpp:34:1 [modernize-concat-nested-namespaces]

nested namespaces can be concatenated
{
namespace detail
{
template < typename Mesh >
class VTKOutputImpl

Check warning on line 39 in include/geode/io/image/detail/vtk_output.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/image/detail/vtk_output.hpp:39:15 [cppcoreguidelines-special-member-functions]

class 'VTKOutputImpl' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator
{
public:
void write_file()
Expand All @@ -59,7 +59,7 @@
"[VTKOutput] Error while writing file: ", filename );
}

virtual ~VTKOutputImpl() {}

Check warning on line 62 in include/geode/io/image/detail/vtk_output.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/image/detail/vtk_output.hpp:62:21 [hicpp-use-equals-default]

use '= default' to define a trivial destructor

const Mesh& mesh() const
{
Expand All @@ -79,27 +79,32 @@
write_attributes( attribute_node, manager, elements );
}

void write_attributes( pugi::xml_node& attribute_node,

Check warning on line 82 in include/geode/io/image/detail/vtk_output.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/image/detail/vtk_output.hpp:82:18 [readability-function-cognitive-complexity]

function 'write_attributes' has cognitive complexity of 13 (threshold 10)
const AttributeManager& manager,
absl::Span< const index_t > elements ) const
{
for( const auto& name : manager.attribute_names() )
for( const auto& id : manager.attribute_ids() )

Check warning on line 86 in include/geode/io/image/detail/vtk_output.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/image/detail/vtk_output.hpp:86:34 [readability-identifier-length]

variable name 'id' is too short, expected at least 3 characters
{
const auto attribute =
manager.find_generic_attribute( name );
const auto attribute = manager.find_generic_attribute( id );
if( !attribute || !attribute->is_genericable() )
{
continue;
}
auto data_array = write_attribute_header(
attribute_node, name, attribute->nb_items() );
auto data_array = write_attribute_header( attribute_node,
attribute->name().value(), attribute->nb_items() );
auto min = std::numeric_limits< float >::max();
auto max = std::numeric_limits< float >::lowest();
std::string values;
for( const auto e : elements )
{
for( const auto i : LRange{ attribute->nb_items() } )
{
if( !attribute->has_value( e ) )
{
absl::StrAppend(
&values, std::nanf( " " ), " " );
continue;
}
const auto value =
attribute->generic_item_value( e, i );
absl::StrAppend( &values, value, " " );
Expand Down
33 changes: 24 additions & 9 deletions include/geode/io/mesh/detail/vtk_input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@

#include <geode/geometry/point.hpp>

namespace geode

Check warning on line 42 in include/geode/io/mesh/detail/vtk_input.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/mesh/detail/vtk_input.hpp:42:1 [modernize-concat-nested-namespaces]

nested namespaces can be concatenated
{
namespace detail
{
template < typename Mesh >
class VTKInputImpl

Check warning on line 47 in include/geode/io/mesh/detail/vtk_input.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/mesh/detail/vtk_input.hpp:47:15 [cppcoreguidelines-special-member-functions]

class 'VTKInputImpl' defines a default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator
{
public:
virtual ~VTKInputImpl() = default;
Expand All @@ -59,17 +59,17 @@
return std::move( mesh_ );
}

Percentage is_loadable()

Check failure on line 62 in include/geode/io/mesh/detail/vtk_input.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/mesh/detail/vtk_input.hpp:62:13 [clang-diagnostic-error]

unknown type name 'Percentage'
{
read_common_data();
std::vector< Percentage > percentages;

Check failure on line 65 in include/geode/io/mesh/detail/vtk_input.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/mesh/detail/vtk_input.hpp:65:30 [clang-diagnostic-error]

use of undeclared identifier 'Percentage'
for( const auto& vtk_object : root_.children( type_ ) )
{
is_vtk_object_loadable( vtk_object, percentages );
}
if( percentages.empty() )
{
return Percentage{ 0 };

Check failure on line 72 in include/geode/io/mesh/detail/vtk_input.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/mesh/detail/vtk_input.hpp:72:38 [clang-diagnostic-error]

expected ';' after return statement

Check failure on line 72 in include/geode/io/mesh/detail/vtk_input.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/mesh/detail/vtk_input.hpp:72:28 [clang-diagnostic-error]

use of undeclared identifier 'Percentage'; did you mean 'percentages'?
}
const auto nb_percentages = percentages.size();
double value{ 0 };
Expand All @@ -77,7 +77,7 @@
{
value += percentage.value();
}
return Percentage{ value / nb_percentages };

Check failure on line 80 in include/geode/io/mesh/detail/vtk_input.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/mesh/detail/vtk_input.hpp:80:34 [clang-diagnostic-error]

expected ';' after return statement

Check failure on line 80 in include/geode/io/mesh/detail/vtk_input.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/mesh/detail/vtk_input.hpp:80:24 [clang-diagnostic-error]

use of undeclared identifier 'Percentage'; did you mean 'percentages'?
}

protected:
Expand All @@ -97,7 +97,7 @@

virtual void is_vtk_object_loadable(
const pugi::xml_node& vtk_object,
std::vector< Percentage >& percentages ) const = 0;

Check failure on line 100 in include/geode/io/mesh/detail/vtk_input.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/mesh/detail/vtk_input.hpp:100:30 [clang-diagnostic-error]

use of undeclared identifier 'Percentage'

void read_common_data()
{
Expand All @@ -124,20 +124,20 @@
index_t read_attribute(
const pugi::xml_node& piece, std::string_view attribute ) const
{
return string_to_index(

Check failure on line 127 in include/geode/io/mesh/detail/vtk_input.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/mesh/detail/vtk_input.hpp:127:24 [clang-diagnostic-error]

use of undeclared identifier 'string_to_index'
piece.attribute( attribute.data() ).value() );

Check warning on line 128 in include/geode/io/mesh/detail/vtk_input.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/mesh/detail/vtk_input.hpp:128:48 [bugprone-suspicious-stringview-data-usage]

result of a `data()` call may not be null terminated, provide size information to the callee to prevent potential issues
}

template < typename T >
std::vector< T > read_integer_data_array(
const pugi::xml_node& data ) const
{
const auto format = data.attribute( "format" ).value();

Check warning on line 135 in include/geode/io/mesh/detail/vtk_input.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/mesh/detail/vtk_input.hpp:135:17 [llvm-qualified-auto]

'const auto format' can be declared as 'const auto *const format'
if( match( format, "appended" ) )
{
return decode< T >( read_appended_data( data ) );
}
else

Check warning on line 140 in include/geode/io/mesh/detail/vtk_input.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/mesh/detail/vtk_input.hpp:140:17 [llvm-else-after-return]

do not use 'else' after 'return'
{
const auto data_string =
absl::StripAsciiWhitespace( data.child_value() );
Expand Down Expand Up @@ -220,16 +220,21 @@
OpenGeodeException::TYPE::data,
"[VTKInput::build_attribute] Number of attribute "
"values is not a multiple of number of components" );
if( manager.find_generic_attribute( name ) )
{
return;
}
if( nb_components == 1 )
{
AttributeValues< T > default_values;
default_values.default_value = T{};
default_values.no_value = T{};
AttributeProperties properties;
properties.assignable = false;
properties.interpolable = false;
properties.transferable = true;
auto attribute_id =
manager.create_attribute< VariableAttribute, T >(
name, default_values, properties );
auto attribute =
manager
.find_or_create_attribute< VariableAttribute, T >(
name, T{} );
manager.find_attribute< VariableAttribute, T >(
attribute_id );
for( const auto i : Indices{ values } )
{
attribute->set_value( i + offset, values[i] );
Expand Down Expand Up @@ -374,9 +379,19 @@
std::string_view name,
index_t offset )
{
AttributeValues< Container > default_values;
default_values.default_value = default_value;
default_values.no_value = default_value;
AttributeProperties properties;
properties.assignable = false;
properties.interpolable = false;
properties.transferable = true;
const auto attribute_id =
manager.create_attribute< VariableAttribute, Container >(
name, default_values, properties );
auto attribute =
manager.find_or_create_attribute< VariableAttribute,
Container >( name, default_value );
manager.find_attribute< VariableAttribute, Container >(
attribute_id );
for( const auto i : Range{ values.size() / nb_components } )
{
for( const auto c : Range{ nb_components } )
Expand Down
6 changes: 3 additions & 3 deletions include/geode/io/model/detail/vtm_output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ namespace geode
{
index_t counter{ 0 };
const auto level = Logger::level();
Logger::set_level( Logger::LEVEL::warn );
Logger::set_level( Logger::LEVEL::warning );
absl::FixedArray< async::task< void > > tasks(
this->mesh().nb_corners() );
absl::FixedArray< uuid > corner_ids(
Expand Down Expand Up @@ -187,7 +187,7 @@ namespace geode
{
index_t counter{ 0 };
const auto level = Logger::level();
Logger::set_level( Logger::LEVEL::warn );
Logger::set_level( Logger::LEVEL::warning );
absl::FixedArray< async::task< void > > tasks(
this->mesh().nb_lines() );
absl::FixedArray< uuid > line_ids( this->mesh().nb_lines() );
Expand Down Expand Up @@ -243,7 +243,7 @@ namespace geode
{
index_t counter{ 0 };
const auto level = Logger::level();
Logger::set_level( Logger::LEVEL::warn );
Logger::set_level( Logger::LEVEL::warning );
absl::FixedArray< async::task< void > > tasks(
this->mesh().nb_surfaces() );
absl::FixedArray< uuid > surface_ids(
Expand Down
70 changes: 35 additions & 35 deletions include/geode/io/model/internal/msh_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@
{
return physical_ids.find( physical_id ) != physical_ids.end();
}
absl::flat_hash_map< GmshElementID, geode::uuid > elementary_ids;
absl::flat_hash_map< GmshElementID, geode::uuid > physical_ids;
absl::flat_hash_map< GmshElementID, uuid > elementary_ids;
absl::flat_hash_map< GmshElementID, uuid > physical_ids;
};

class GMSHElement
Expand All @@ -131,7 +131,7 @@
nb_vertices_( nb_vertices ),
vertex_ids_str_( vertex_ids )
{
OpenGeodeIOModelException::check_exception(

Check failure on line 134 in include/geode/io/model/internal/msh_common.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/io/model/internal/msh_common.hpp:134:17 [clang-diagnostic-error]

use of undeclared identifier 'OpenGeodeIOModelException'; did you mean 'OpenGeodeModelException'?
elementary_entity_id > 0, nullptr,
OpenGeodeException::TYPE::data,
"[GMSHElement] GMSH tag for elementary entity "
Expand Down Expand Up @@ -215,7 +215,7 @@
};
const auto existing_id =
id_map.contains_elementary_id( cur_gmsh_id );
geode::uuid corner_uuid;
uuid corner_uuid;
geode::BRepBuilder builder{ brep };
if( existing_id )
{
Expand All @@ -229,7 +229,8 @@
}

const auto v_id =
builder.corner_mesh_builder( corner_uuid )->create_vertex();
builder.corner_mesh_builder( brep.corner( corner_uuid ) )
->create_vertex();
builder.set_unique_vertex(
{ brep.corner( corner_uuid ).component_id(), v_id },
vertex_ids()[0] - GMSH_OFFSET_START );
Expand All @@ -255,7 +256,7 @@
const auto existing_id =
id_map.contains_elementary_id( cur_gmsh_id );
geode::BRepBuilder builder{ brep };
geode::uuid line_uuid;
uuid line_uuid;
if( existing_id )
{
line_uuid = id_map.elementary_ids.at( cur_gmsh_id );
Expand All @@ -265,14 +266,13 @@
line_uuid = builder.add_line();
id_map.elementary_ids.insert( { cur_gmsh_id, line_uuid } );
}
const auto& line = brep.line( line_uuid );
const auto first_v_id =
builder.line_mesh_builder( line_uuid )
->create_vertices( vertex_ids().size() );
builder.line_mesh_builder( line )->create_vertices(
vertex_ids().size() );
const auto edge_id =
builder.line_mesh_builder( line_uuid )
->create_edge( first_v_id, first_v_id + 1 );

const auto& line = brep.line( line_uuid );
builder.line_mesh_builder( line )->create_edge(
first_v_id, first_v_id + 1 );
for( const auto v_id : geode::LIndices{ vertex_ids() } )
{
builder.set_unique_vertex(
Expand Down Expand Up @@ -303,7 +303,7 @@
const auto existing_id =
id_map.contains_elementary_id( cur_gmsh_id );
geode::BRepBuilder builder{ brep };
geode::uuid surface_uuid;
uuid surface_uuid;
if( existing_id )
{
surface_uuid = id_map.elementary_ids.at( cur_gmsh_id );
Expand All @@ -314,16 +314,16 @@
id_map.elementary_ids.insert(
{ cur_gmsh_id, surface_uuid } );
}
const auto& surface = brep.surface( surface_uuid );
const auto first_v_id =
builder.surface_mesh_builder( surface_uuid )
->create_vertices( vertex_ids().size() );
builder.surface_mesh_builder( surface )->create_vertices(
vertex_ids().size() );
std::vector< geode::index_t > v_ids( vertex_ids().size() );
std::iota( v_ids.begin(), v_ids.end(), first_v_id );
const auto polygon_id =
builder.surface_mesh_builder( surface_uuid )
->create_polygon( v_ids );
builder.surface_mesh_builder( surface )->create_polygon(
v_ids );

const auto& surface = brep.surface( surface_uuid );
for( const auto v_id : geode::LIndices{ vertex_ids() } )
{
builder.set_unique_vertex(
Expand Down Expand Up @@ -372,7 +372,7 @@

virtual geode::index_t create_gmsh_polyhedron(
geode::BRepBuilder& builder,
const geode::uuid& block_uuid,
const Block3D& block,
const std::vector< geode::index_t >& v_ids ) = 0;

void add_element( geode::BRep& brep, GmshId2Uuids& id_map ) final
Expand All @@ -383,7 +383,7 @@
const auto existing_id =
id_map.contains_elementary_id( cur_gmsh_id );
geode::BRepBuilder builder{ brep };
geode::uuid block_uuid;
uuid block_uuid;
if( existing_id )
{
block_uuid = id_map.elementary_ids.at( cur_gmsh_id );
Expand All @@ -395,16 +395,16 @@
geode::HybridSolid3D::type_name_static() ) );
id_map.elementary_ids.insert( { cur_gmsh_id, block_uuid } );
}
const auto& block = brep.block( block_uuid );

const auto first_v_id =
builder.block_mesh_builder( block_uuid )
->create_vertices( vertex_ids().size() );
builder.block_mesh_builder( block )->create_vertices(
vertex_ids().size() );
std::vector< geode::index_t > v_ids( vertex_ids().size() );
std::iota( v_ids.begin(), v_ids.end(), first_v_id );
const auto polyhedron_id =
create_gmsh_polyhedron( builder, block_uuid, v_ids );
create_gmsh_polyhedron( builder, block, v_ids );

const auto& block = brep.block( block_uuid );
for( const auto v_id : geode::LIndices{ vertex_ids() } )
{
builder.set_unique_vertex(
Expand All @@ -427,15 +427,15 @@
}

geode::index_t create_gmsh_polyhedron( geode::BRepBuilder& builder,
const geode::uuid& block_uuid,
const Block3D& block,
const std::vector< geode::index_t >& v_ids ) override final
{
static const std::array< std::vector< geode::local_index_t >,
4 >
gmsh_tetrahedron_faces{ { { 0, 1, 2 }, { 0, 2, 3 },
{ 1, 3, 2 }, { 0, 3, 1 } } };
return builder.block_mesh_builder( block_uuid )
->create_polyhedron( v_ids, gmsh_tetrahedron_faces );
return builder.block_mesh_builder( block )->create_polyhedron(
v_ids, gmsh_tetrahedron_faces );
}
};

Expand All @@ -451,16 +451,16 @@
}

geode::index_t create_gmsh_polyhedron( geode::BRepBuilder& builder,
const geode::uuid& block_uuid,
const Block3D& block,
const std::vector< geode::index_t >& v_ids ) override final
{
static const std::array< std::vector< geode::local_index_t >,
6 >
gmsh_hexahedron_faces{ { { 0, 1, 2, 3 }, { 7, 6, 5, 4 },
{ 0, 3, 7, 4 }, { 1, 5, 6, 2 }, { 2, 6, 7, 3 },
{ 0, 4, 5, 1 } } };
return builder.block_mesh_builder( block_uuid )
->create_polyhedron( v_ids, gmsh_hexahedron_faces );
return builder.block_mesh_builder( block )->create_polyhedron(
v_ids, gmsh_hexahedron_faces );
}
};

Expand All @@ -476,15 +476,15 @@
}

geode::index_t create_gmsh_polyhedron( geode::BRepBuilder& builder,
const geode::uuid& block_uuid,
const Block3D& block,
const std::vector< geode::index_t >& v_ids ) override final
{
static const std::array< std::vector< geode::local_index_t >,
5 >
gmsh_prism_faces{ { { 0, 1, 2 }, { 5, 4, 3 },
{ 0, 2, 5, 3 }, { 0, 3, 4, 1 }, { 1, 4, 5, 2 } } };
return builder.block_mesh_builder( block_uuid )
->create_polyhedron( v_ids, gmsh_prism_faces );
return builder.block_mesh_builder( block )->create_polyhedron(
v_ids, gmsh_prism_faces );
}
};

Expand All @@ -500,15 +500,15 @@
}

geode::index_t create_gmsh_polyhedron( geode::BRepBuilder& builder,
const geode::uuid& block_uuid,
const Block3D& block,
const std::vector< geode::index_t >& v_ids ) override final
{
static const std::array< std::vector< geode::local_index_t >,
5 >
gmsh_pyramid_faces{ { { 0, 3, 4 }, { 0, 4, 1 }, { 4, 3, 2 },
{ 1, 4, 2 }, { 0, 1, 2, 3 } } };
return builder.block_mesh_builder( block_uuid )
->create_polyhedron( v_ids, gmsh_pyramid_faces );
return builder.block_mesh_builder( block )->create_polyhedron(
v_ids, gmsh_pyramid_faces );
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/geode/io/mesh/assimp_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ namespace geode
}
catch( const OpenGeodeException& e )
{
Logger::warn( e.what() );
Logger::warning( e.what() );
}
}
}
Expand Down
16 changes: 14 additions & 2 deletions src/geode/io/mesh/csv_input_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,21 @@ namespace geode
{
continue;
}
AttributeValues< double > default_values;
default_values.default_value = value;
default_values.no_value = value;
AttributeProperties properties;
properties.assignable = false;
properties.interpolable = false;
properties.transferable = true;
const auto attribute_id =
attribute_manager
.create_attribute< VariableAttribute, double >(
attribute_name, default_values, properties );
double_attrs[col] =
attribute_manager.find_or_create_attribute<
VariableAttribute, double >( attribute_name, 0.0 );
attribute_manager
.find_attribute< VariableAttribute, double >(
attribute_id );
}
}
for( const auto col : geode::Range{ line_values.size() } )
Expand Down
Loading
Loading