Skip to content

Commit 506ceee

Browse files
committed
Formatting
1 parent 16d54c1 commit 506ceee

3 files changed

Lines changed: 66 additions & 35 deletions

File tree

src/assembly/local/quadrature_table.rs

Lines changed: 51 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -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>)
9894
where
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 = ()>
311313
where
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
}

src/element/tetrahedron.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ where
5353
}
5454

5555
impl<T> ElementConnectivity<T> for Tet20Connectivity
56-
where
57-
T: Real,
56+
where
57+
T: Real,
5858
{
5959
type Element = Tet20Element<T>;
6060
type GeometryDim = U3;

src/quadrature/canonical.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use crate::assembly::local::{UniformQuadratureTable};
1+
use crate::assembly::local::UniformQuadratureTable;
2+
use crate::connectivity::*;
23
use crate::element::Tet4Element;
34
use crate::element::*;
4-
use crate::connectivity::*;
55
use crate::mesh::Mesh;
66
use crate::quadrature::QuadraturePair;
77
use crate::quadrature::{tensor, total_order};
@@ -48,23 +48,26 @@ macro_rules! impl_canonical_rule_for_element {
4848

4949
impl<T> $trait_name for Mesh<T, ConnectivityGeometryDim<T, $connectivity>, $connectivity>
5050
where
51-
T: Real
51+
T: Real,
5252
{
5353
type Quadrature = UniformQuadratureTable<T, ConnectivityReferenceDim<T, $connectivity>>;
5454

5555
fn $method_name(&self) -> Self::Quadrature {
5656
UniformQuadratureTable::from_quadrature($quadrature)
5757
}
5858
}
59-
}
59+
};
6060
}
6161

6262
macro_rules! impl_canonical_mass_for_element {
6363
($connectivity:ty, $element:ty, $quadrature:expr) => {
6464
impl_canonical_rule_for_element!(
6565
CanonicalMassQuadrature,
6666
canonical_mass_quadrature,
67-
$connectivity, $element, $quadrature);
67+
$connectivity,
68+
$element,
69+
$quadrature
70+
);
6871
};
6972
}
7073

@@ -73,7 +76,10 @@ macro_rules! impl_canonical_stiffness_for_element {
7376
impl_canonical_rule_for_element!(
7477
CanonicalStiffnessQuadrature,
7578
canonical_stiffness_quadrature,
76-
$connectivity, $element, $quadrature);
79+
$connectivity,
80+
$element,
81+
$quadrature
82+
);
7783
};
7884
}
7985

@@ -103,4 +109,4 @@ impl_canonical_mass_for_element!(Hex20Connectivity, Hex20Element<T>, tensor::hex
103109
impl_canonical_mass_for_element!(Hex27Connectivity, Hex27Element<T>, tensor::hexahedron_gauss(3));
104110
impl_canonical_stiffness_for_element!(Hex8Connectivity, Hex8Element<T>, tensor::hexahedron_gauss(2));
105111
impl_canonical_stiffness_for_element!(Hex20Connectivity, Hex20Element<T>, tensor::hexahedron_gauss(3));
106-
impl_canonical_stiffness_for_element!(Hex27Connectivity, Hex27Element<T>, tensor::hexahedron_gauss(3));
112+
impl_canonical_stiffness_for_element!(Hex27Connectivity, Hex27Element<T>, tensor::hexahedron_gauss(3));

0 commit comments

Comments
 (0)