Skip to content

Commit

Permalink
Implement conversion of Uniform to GeneralQuadratureTable
Browse files Browse the repository at this point in the history
  • Loading branch information
w1th0utnam3 committed Nov 14, 2022
1 parent e3ee365 commit ce12ba9
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/assembly/local/quadrature_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ where
data: self.data,
}
}

/// Replaces the data of the quadrature table with the given data.
pub fn with_data<NewData>(self, data: NestedVec<NewData>) -> GeneralQuadratureTable<T, GeometryDim, NewData> {
GeneralQuadratureTable {
points: self.points,
weights: self.weights,
data: data,
}
}
}

pub struct GeneralQuadratureParts<T, GeometryDim, Data>
Expand Down Expand Up @@ -266,6 +275,28 @@ where
}
}

impl<T, GeometryDim, Data> UniformQuadratureTable<T, GeometryDim, Data>
where
T: Scalar,
GeometryDim: DimName,
DefaultAllocator: Allocator<T, GeometryDim>,
Data: Clone,
{
pub fn to_general(&self, num_elements: usize) -> GeneralQuadratureTable<T, GeometryDim, Data> {
let mut points = NestedVec::new();
let mut weights = NestedVec::new();
let mut data = NestedVec::new();

for _ in 0..num_elements {
points.push(&self.points);
weights.push(&self.weights);
data.push(&self.data);
}

GeneralQuadratureTable::from_points_weights_and_data(points, weights, data)
}
}

impl<T, GeometryDim, Data> QuadratureTable<T, GeometryDim> for UniformQuadratureTable<T, GeometryDim, Data>
where
T: Scalar,
Expand Down

0 comments on commit ce12ba9

Please sign in to comment.