@@ -90,20 +90,22 @@ where
9090/// Checks that the provided quadrature rules are consistent, in the sense that
9191/// the number of elements for each table is identical, and that each rule has
9292/// consistent numbers of points, weights and data entries.
93- fn check_rules_consistency < T , D , Data > (
94- points : & NestedVec < OPoint < T , D > > ,
95- weights : & NestedVec < T > ,
96- data : & NestedVec < Data >
97- )
93+ fn check_rules_consistency < T , D , Data > ( points : & NestedVec < OPoint < T , D > > , weights : & NestedVec < T > , data : & NestedVec < Data > )
9894where
9995 T : Scalar ,
10096 D : DimName ,
101- DefaultAllocator : Allocator < T , D >
97+ DefaultAllocator : Allocator < T , D > ,
10298{
103- assert_eq ! ( points. len( ) , weights. len( ) ,
104- "Quadrature point and weight tables must have the same number of rules." ) ;
105- assert_eq ! ( points. len( ) , data. len( ) ,
106- "Quadrature point and data tables must have the same number of rules." ) ;
99+ assert_eq ! (
100+ points. len( ) ,
101+ weights. len( ) ,
102+ "Quadrature point and weight tables must have the same number of rules."
103+ ) ;
104+ assert_eq ! (
105+ points. len( ) ,
106+ data. len( ) ,
107+ "Quadrature point and data tables must have the same number of rules."
108+ ) ;
107109
108110 // Ensure that each element has a consistent quadrature rule
109111 let iter = izip ! ( points. iter( ) , weights. iter( ) , data. iter( ) ) ;
@@ -307,7 +309,7 @@ where
307309/// where the elements are the same but different quadrature data is needed in different
308310/// regions of the mesh.
309311#[ derive( Debug , Clone , PartialEq , Eq , Serialize , Deserialize ) ]
310- pub struct CompactQuadratureTable < T , D , Data = ( ) >
312+ pub struct CompactQuadratureTable < T , D , Data = ( ) >
311313where
312314 T : Scalar ,
313315 D : DimName ,
@@ -330,7 +332,7 @@ where
330332 pub fn from_points_weights_and_map (
331333 points : NestedVec < OPoint < T , D > > ,
332334 weights : NestedVec < T > ,
333- element_to_rule_map : Vec < usize >
335+ element_to_rule_map : Vec < usize > ,
334336 ) -> Self {
335337 let data = unit_data_table_for_weights ( & weights) ;
336338 Self :: from_quadrature_rules_and_map ( points, weights, data, element_to_rule_map)
@@ -356,20 +358,22 @@ where
356358 points : NestedVec < OPoint < T , D > > ,
357359 weights : NestedVec < T > ,
358360 data : NestedVec < Data > ,
359- element_to_rule_map : Vec < usize >
361+ element_to_rule_map : Vec < usize > ,
360362 ) -> Self {
361363 check_rules_consistency ( & points, & weights, & data) ;
362364 let num_rules = points. len ( ) ;
363365 let rule_indices_in_bounds = element_to_rule_map
364366 . iter ( )
365367 . all ( |rule_index| rule_index < & num_rules) ;
366- assert ! ( rule_indices_in_bounds,
367- "Each rule index must correspond to a provided quadrature rule." ) ;
368+ assert ! (
369+ rule_indices_in_bounds,
370+ "Each rule index must correspond to a provided quadrature rule."
371+ ) ;
368372 Self {
369373 element_to_rule_map,
370374 points,
371375 weights,
372- data
376+ data,
373377 }
374378 }
375379
@@ -389,25 +393,46 @@ where
389393
390394 fn element_quadrature_size ( & self , element_index : usize ) -> usize {
391395 let rule_index = self . rule_index_for_element ( element_index) ;
392- self . points . get ( rule_index) . expect ( "Internal error: Rule index out of bounds" ) . len ( )
396+ self . points
397+ . get ( rule_index)
398+ . expect ( "Internal error: Rule index out of bounds" )
399+ . len ( )
393400 }
394401
395402 fn populate_element_data ( & self , element_index : usize , data : & mut [ Self :: Data ] ) {
396403 let rule_index = self . rule_index_for_element ( element_index) ;
397- let data_array = self . data . get ( rule_index) . expect ( "Internal error: Rule index out of bounds" ) ;
398- assert_eq ! ( data. len( ) , data_array. len( ) ,
399- "Length mismatch in data array: Stored quadrature data array has different length than output array." ) ;
404+ let data_array = self
405+ . data
406+ . get ( rule_index)
407+ . expect ( "Internal error: Rule index out of bounds" ) ;
408+ assert_eq ! (
409+ data. len( ) ,
410+ data_array. len( ) ,
411+ "Length mismatch in data array: Stored quadrature data array has different length than output array."
412+ ) ;
400413 data. clone_from_slice ( data_array) ;
401414 }
402415
403416 fn populate_element_quadrature ( & self , element_index : usize , points : & mut [ OPoint < T , D > ] , weights : & mut [ T ] ) {
404417 let rule_index = self . rule_index_for_element ( element_index) ;
405- let points_array = self . points . get ( rule_index) . expect ( "Internal error: Rule index out of bounds" ) ;
406- let weights_array = self . weights . get ( rule_index) . expect ( "Internal error: Rule index out of bounds" ) ;
407- assert_eq ! ( points. len( ) , points_array. len( ) ,
408- "Length mismatch in points array: Stored points array has different length than output array." ) ;
409- assert_eq ! ( weights. len( ) , weights_array. len( ) ,
410- "Length mismatch in points array: Stored points array has different length than output array." ) ;
418+ let points_array = self
419+ . points
420+ . get ( rule_index)
421+ . expect ( "Internal error: Rule index out of bounds" ) ;
422+ let weights_array = self
423+ . weights
424+ . get ( rule_index)
425+ . expect ( "Internal error: Rule index out of bounds" ) ;
426+ assert_eq ! (
427+ points. len( ) ,
428+ points_array. len( ) ,
429+ "Length mismatch in points array: Stored points array has different length than output array."
430+ ) ;
431+ assert_eq ! (
432+ weights. len( ) ,
433+ weights_array. len( ) ,
434+ "Length mismatch in points array: Stored points array has different length than output array."
435+ ) ;
411436 points. clone_from_slice ( points_array) ;
412437 weights. clone_from_slice ( weights_array) ;
413438 }
0 commit comments