Skip to content

Commit

Permalink
Incorporate decapodes ACSet serialization (#600)
Browse files Browse the repository at this point in the history
- First pass on extracting and serializing the Decapodes ACSet
representation.
   - Includes working example of Halfar dome PDE.
- Math Expression handles Gradient and Absolute value explicitly.
- Math Expression explicitly incorporates multiplication operations for
consecutive Mrows, and handles equals operators.
- Minor bug fixes and insertion of asserts.

---------

Co-authored-by: Deepsana Shahi <[email protected]>
Co-authored-by: ualiangzhang <[email protected]>
Co-authored-by: Justin <[email protected]>
  • Loading branch information
4 people authored Oct 27, 2023
1 parent dd1e4ec commit fe6a8c1
Show file tree
Hide file tree
Showing 7 changed files with 857 additions and 39 deletions.
7 changes: 6 additions & 1 deletion skema/skema-rs/mathml/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ pub enum MathExpression {
//GroupTuple(Vec<MathExpression>),
Ci(Ci),
Differential(Differential),
AbsoluteSup(Box<MathExpression>, Box<MathExpression>),
//Differential(Box<MathExpression>, Box<MathExpression>),
#[default]
None,
Expand Down Expand Up @@ -97,9 +98,13 @@ impl fmt::Display for MathExpression {
Ok(())
}
MathExpression::Differential(Differential { diff, func }) => {
write!(f, "{diff}");
write!(f, "{diff}")?;
write!(f, "{func}")
}
MathExpression::AbsoluteSup(base, superscript) => {
write!(f, "{:?}", base)?;
write!(f, "{superscript:?}")
}
expression => write!(f, "{expression:?}"),
}
}
Expand Down
6 changes: 5 additions & 1 deletion skema/skema-rs/mathml/src/ast/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub enum Operator {
Comma,
Grad,
Dot,
Div,
Abs,
Derivative(Derivative),
Sin,
Cos,
Expand Down Expand Up @@ -64,7 +66,7 @@ impl fmt::Display for Operator {
var_index,
bound_var,
}) => {
write!(f, "D({order}, {var_index}, {bound_var})")
write!(f, "D({order}, {bound_var})")
}
Operator::Exp => write!(f, "exp"),
Operator::Power => write!(f, "^"),
Expand All @@ -84,6 +86,8 @@ impl fmt::Display for Operator {
Operator::Mean => write!(f, "Mean"),
Operator::Grad => write!(f, "Grad"),
Operator::Dot => write!(f, "Dot"),
Operator::Div => write!(f, "Div"),
Operator::Abs => write!(f, "Abs"),
}
}
}
1 change: 1 addition & 0 deletions skema/skema-rs/mathml/src/parsers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod decapodes_serialization;
pub mod first_order_ode;
pub mod generic_mathml;
pub mod interpreted_mathml;
Expand Down
Loading

0 comments on commit fe6a8c1

Please sign in to comment.