| 215 /// Plotter |
215 /// Plotter |
| 216 pub type PlotFactory<'py> = |
216 pub type PlotFactory<'py> = |
| 217 PythonPlotFactory<'py, DerivativeCodomain<'py>, DerivativeCodomain<'py>>; |
217 PythonPlotFactory<'py, DerivativeCodomain<'py>, DerivativeCodomain<'py>>; |
| 218 } |
218 } |
| 219 |
219 |
| |
220 /// Available regularisation terms, exported to the Python side |
| 220 #[pyclass(module = "pointsource_pde", name = "RegTerm")] |
221 #[pyclass(module = "pointsource_pde", name = "RegTerm")] |
| 221 #[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)] |
222 #[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)] |
| 222 pub enum RegTermPy { |
223 pub enum RegTermPy { |
| 223 // Radon norm with weight `α`. |
224 /// Radon norm with weight `α`. |
| 224 Radon(f64), |
225 Radon(f64), |
| 225 // Radon norm ith weight `α` and a positivity constraint. |
226 /// Radon norm ith weight `α` and a positivity constraint. |
| 226 NonnegRadon(f64), |
227 NonnegRadon(f64), |
| 227 } |
228 } |
| 228 |
229 |
| 229 impl From<RegTermPy> for Regularisation { |
230 impl From<RegTermPy> for Regularisation { |
| 230 fn from(reg: RegTermPy) -> Regularisation { |
231 fn from(reg: RegTermPy) -> Regularisation { |
| 233 RegTermPy::NonnegRadon(α) => Regularisation::NonnegRadon(α), |
234 RegTermPy::NonnegRadon(α) => Regularisation::NonnegRadon(α), |
| 234 } |
235 } |
| 235 } |
236 } |
| 236 } |
237 } |
| 237 |
238 |
| |
239 /// Problem description, exported to the Python side to be filled there. |
| 238 #[pyclass(module = "pointsource_pde")] |
240 #[pyclass(module = "pointsource_pde")] |
| 239 #[derive(Debug)] |
241 #[derive(Debug)] |
| 240 pub struct Problem { |
242 pub struct Problem { |
| 241 /// Data term. On the python side, this should be a `class` that implements |
243 /// Data term. On the python side, this should be a `class` that implements |
| 242 /// `apply` from [`DiscreteMeasure_2_f64`] (TODO: extended parameters) to floats, and `diff` |
244 /// `apply` and `diff`. |
| 243 /// from the space space to [`DolfinxPyFunction_f64<2, 1, 2>`]. |
|
| 244 #[pyo3(set)] |
245 #[pyo3(set)] |
| 245 dataterm: Py<PyAny>, //exp_f64_2::DataTerm, |
246 dataterm: Py<PyAny>, |
| 246 |
247 |
| 247 // Regularisation |
248 /// Regularisation |
| 248 #[pyo3(set, get)] |
249 #[pyo3(set, get)] |
| 249 regterm: RegTermPy, |
250 regterm: RegTermPy, |
| 250 |
251 |
| 251 // Auxiliary variable regularisation term or similar |
252 /// Auxiliary variable regularisation term or similar |
| 252 #[pyo3(set, get)] |
253 #[pyo3(set, get)] |
| 253 auxterm: Option<Py<PyAny>>, |
254 auxterm: Option<Py<PyAny>>, |
| 254 |
255 |
| 255 // Initial auxiliary variable |
256 /// Initial auxiliary variable |
| 256 #[pyo3(set, get)] |
257 #[pyo3(set, get)] |
| 257 auxinit: Option<Py<PyAny>>, |
258 auxinit: Option<Py<PyAny>>, |
| 258 |
259 |
| 259 // Initial measure |
260 /// Initial measure |
| 260 #[pyo3(set, get)] |
261 #[pyo3(set, get)] |
| 261 μinit: Option<DiscreteMeasure<Loc<2, f64>, f64>>, |
262 μinit: Option<DiscreteMeasure<Loc<2, f64>, f64>>, |
| 262 |
263 |
| 263 // Plotter |
264 /// Plotter |
| 264 #[pyo3(set, get)] |
265 #[pyo3(set, get)] |
| 265 plot_factory: Option<Py<PyAny>>, |
266 plot_factory: Option<Py<PyAny>>, |
| 266 } |
267 } |
| 267 |
268 |
| 268 #[pymethods] |
269 #[pymethods] |