@@ -9,7 +9,7 @@ use indicatif::{ProgressBar, ProgressStyle};
99use log:: { error, info, warn} ;
1010use rayon:: prelude:: * ;
1111use splashsurf_lib:: mesh:: {
12- AttributeData , Mesh3d , MeshAttribute , MeshWithData , MixedTriQuadMesh3d , TriMesh3d ,
12+ Mesh3d , MeshWithData , MixedTriQuadMesh3d , OwnedAttributeData , OwnedMeshAttribute , TriMesh3d ,
1313} ;
1414use splashsurf_lib:: nalgebra:: { Unit , Vector3 } ;
1515use splashsurf_lib:: sph_interpolation:: SphInterpolator ;
@@ -1009,7 +1009,7 @@ pub(crate) fn reconstruction_pipeline_from_args(
10091009/// in the post-processing parameters (see [`ReconstructionPostprocessingParameters`]).
10101010pub fn reconstruction_pipeline < I : Index , R : Real > (
10111011 particle_positions : & [ Vector3 < R > ] ,
1012- attributes : & [ MeshAttribute < R > ] ,
1012+ attributes : & [ OwnedMeshAttribute < R > ] ,
10131013 params : & splashsurf_lib:: Parameters < R > ,
10141014 postprocessing : & ReconstructionPostprocessingParameters ,
10151015) -> Result < ReconstructionResult < I , R > , anyhow:: Error > {
@@ -1220,15 +1220,19 @@ pub fn reconstruction_pipeline<I: Index, R: Real>(
12201220
12211221 if postprocessing. output_mesh_smoothing_weights {
12221222 // Raw distance-weighted number of neighbors value per vertex (can be used to determine normalization value)
1223- mesh_with_data. point_attributes . push ( MeshAttribute :: new (
1224- "wnn" . to_string ( ) ,
1225- AttributeData :: ScalarReal ( vertex_weighted_num_neighbors) ,
1226- ) ) ;
1223+ mesh_with_data
1224+ . point_attributes
1225+ . push ( OwnedMeshAttribute :: new (
1226+ "wnn" . to_string ( ) ,
1227+ OwnedAttributeData :: ScalarReal ( vertex_weighted_num_neighbors. into ( ) ) ,
1228+ ) ) ;
12271229 // Final smoothing weights per vertex
1228- mesh_with_data. point_attributes . push ( MeshAttribute :: new (
1229- "sw" . to_string ( ) ,
1230- AttributeData :: ScalarReal ( smoothing_weights. clone ( ) ) ,
1231- ) ) ;
1230+ mesh_with_data
1231+ . point_attributes
1232+ . push ( OwnedMeshAttribute :: new (
1233+ "sw" . to_string ( ) ,
1234+ OwnedAttributeData :: ScalarReal ( smoothing_weights. clone ( ) . into ( ) ) ,
1235+ ) ) ;
12321236 }
12331237
12341238 smoothing_weights
@@ -1296,21 +1300,27 @@ pub fn reconstruction_pipeline<I: Index, R: Real>(
12961300 smoothing_iters,
12971301 ) ;
12981302
1299- mesh_with_data. point_attributes . push ( MeshAttribute :: new (
1300- "normals" . to_string ( ) ,
1301- AttributeData :: Vector3Real ( smoothed_normals) ,
1302- ) ) ;
1303- if postprocessing. output_raw_normals {
1304- mesh_with_data. point_attributes . push ( MeshAttribute :: new (
1305- "raw_normals" . to_string ( ) ,
1306- AttributeData :: Vector3Real ( normals) ,
1303+ mesh_with_data
1304+ . point_attributes
1305+ . push ( OwnedMeshAttribute :: new (
1306+ "normals" . to_string ( ) ,
1307+ OwnedAttributeData :: Vector3Real ( smoothed_normals. into ( ) ) ,
13071308 ) ) ;
1309+ if postprocessing. output_raw_normals {
1310+ mesh_with_data
1311+ . point_attributes
1312+ . push ( OwnedMeshAttribute :: new (
1313+ "raw_normals" . to_string ( ) ,
1314+ OwnedAttributeData :: Vector3Real ( normals. into ( ) ) ,
1315+ ) ) ;
13081316 }
13091317 } else {
1310- mesh_with_data. point_attributes . push ( MeshAttribute :: new (
1311- "normals" . to_string ( ) ,
1312- AttributeData :: Vector3Real ( normals) ,
1313- ) ) ;
1318+ mesh_with_data
1319+ . point_attributes
1320+ . push ( OwnedMeshAttribute :: new (
1321+ "normals" . to_string ( ) ,
1322+ OwnedAttributeData :: Vector3Real ( normals. into ( ) ) ,
1323+ ) ) ;
13141324 }
13151325 }
13161326
@@ -1330,29 +1340,33 @@ pub fn reconstruction_pipeline<I: Index, R: Real>(
13301340
13311341 let particles_inside = reconstruction. particle_inside_aabb ( ) . map ( Vec :: as_slice) ;
13321342 match & attribute. data {
1333- AttributeData :: ScalarReal ( values) => {
1334- let filtered_values = filtered_quantity ( values, particles_inside) ;
1343+ OwnedAttributeData :: ScalarReal ( values) => {
1344+ let filtered_values = filtered_quantity ( & values, particles_inside) ;
13351345 let interpolated_values = interpolator. interpolate_scalar_quantity (
13361346 & filtered_values,
13371347 mesh_with_data. vertices ( ) ,
13381348 true ,
13391349 ) ;
1340- mesh_with_data. point_attributes . push ( MeshAttribute :: new (
1341- attribute. name . clone ( ) ,
1342- AttributeData :: ScalarReal ( interpolated_values) ,
1343- ) ) ;
1350+ mesh_with_data
1351+ . point_attributes
1352+ . push ( OwnedMeshAttribute :: new (
1353+ attribute. name . clone ( ) ,
1354+ OwnedAttributeData :: ScalarReal ( interpolated_values. into ( ) ) ,
1355+ ) ) ;
13441356 }
1345- AttributeData :: Vector3Real ( values) => {
1346- let filtered_values = filtered_quantity ( values, particles_inside) ;
1357+ OwnedAttributeData :: Vector3Real ( values) => {
1358+ let filtered_values = filtered_quantity ( & values, particles_inside) ;
13471359 let interpolated_values = interpolator. interpolate_vector_quantity (
13481360 & filtered_values,
13491361 mesh_with_data. vertices ( ) ,
13501362 true ,
13511363 ) ;
1352- mesh_with_data. point_attributes . push ( MeshAttribute :: new (
1353- attribute. name . clone ( ) ,
1354- AttributeData :: Vector3Real ( interpolated_values) ,
1355- ) ) ;
1364+ mesh_with_data
1365+ . point_attributes
1366+ . push ( OwnedMeshAttribute :: new (
1367+ attribute. name . clone ( ) ,
1368+ OwnedAttributeData :: Vector3Real ( interpolated_values. into ( ) ) ,
1369+ ) ) ;
13561370 }
13571371 _ => unimplemented ! ( "Interpolation of this attribute type not implemented" ) ,
13581372 }
0 commit comments