Skip to content
Snippets Groups Projects
Commit 9b48bd1e authored by Udo Eisenbarth's avatar Udo Eisenbarth :speech_balloon:
Browse files

Add report fn to Analysis trait.

parent 432f440c
No related branches found
No related tags found
No related merge requests found
//! Performing a (simple) energy flow analysis //! Performing a (simple) energy flow analysis
use std::path::Path;
use log::info; use log::info;
use crate::{error::OpmResult, light_result::LightResult, nodes::NodeGroup, optic_node::OpticNode}; use crate::{error::OpmResult, light_result::LightResult, nodes::NodeGroup, optic_node::OpticNode};
...@@ -22,6 +24,9 @@ impl Analyzer for EnergyAnalyzer { ...@@ -22,6 +24,9 @@ impl Analyzer for EnergyAnalyzer {
AnalysisEnergy::analyze(scenery, LightResult::default())?; AnalysisEnergy::analyze(scenery, LightResult::default())?;
Ok(()) Ok(())
} }
fn report(&self, scenery: &NodeGroup, report_dir: &Path) -> OpmResult<()> {
todo!()
}
} }
/// Trait for implementing the energy flow analysis. /// Trait for implementing the energy flow analysis.
pub trait AnalysisEnergy: OpticNode { pub trait AnalysisEnergy: OpticNode {
......
//! Analyzer performing a ghost focus analysis using ray tracing //! Analyzer performing a ghost focus analysis using ray tracing
use std::path::Path;
use log::{info, warn}; use log::{info, warn};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
...@@ -70,6 +72,9 @@ impl Analyzer for GhostFocusAnalyzer { ...@@ -70,6 +72,9 @@ impl Analyzer for GhostFocusAnalyzer {
AnalysisGhostFocus::analyze(scenery, LightRays::default(), &self.config)?; AnalysisGhostFocus::analyze(scenery, LightRays::default(), &self.config)?;
Ok(()) Ok(())
} }
fn report(&self, scenery: &NodeGroup, report_dir: &Path) -> OpmResult<()> {
todo!()
}
} }
/// Trait for implementing the energy flow analysis. /// Trait for implementing the energy flow analysis.
......
...@@ -13,10 +13,12 @@ use crate::{error::OpmResult, nodes::NodeGroup}; ...@@ -13,10 +13,12 @@ use crate::{error::OpmResult, nodes::NodeGroup};
pub use ghostfocus::GhostFocusConfig; pub use ghostfocus::GhostFocusConfig;
pub use raytrace::RayTraceConfig; pub use raytrace::RayTraceConfig;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::fmt::Display; use std::{fmt::Display, path::Path};
use strum::EnumIter; use strum::EnumIter;
/// Type of analysis to be performed. /// Type of analysis to be performed.
///
/// While the individual analyzers are implemented as traits, this enum is necessary for serialization / desrialization.
#[non_exhaustive] #[non_exhaustive]
#[derive(EnumIter, PartialEq, Debug, Serialize, Deserialize, Clone)] #[derive(EnumIter, PartialEq, Debug, Serialize, Deserialize, Clone)]
pub enum AnalyzerType { pub enum AnalyzerType {
...@@ -73,4 +75,11 @@ pub trait Analyzer { ...@@ -73,4 +75,11 @@ pub trait Analyzer {
/// # Errors /// # Errors
/// This function will return an error if the concrete implementation of the [`Analyzer`] returns an error. /// This function will return an error if the concrete implementation of the [`Analyzer`] returns an error.
fn analyze(&self, scenery: &mut NodeGroup) -> OpmResult<()>; fn analyze(&self, scenery: &mut NodeGroup) -> OpmResult<()>;
/// Generate an analysis report for this [`NodeGroup`].
///
/// # Errors
///
/// This function will return an error if .
fn report(&self, scenery: &NodeGroup, report_dir: &Path) -> OpmResult<()>;
} }
//! Analyzer for sequential ray tracing //! Analyzer for sequential ray tracing
use std::path::Path;
use super::Analyzer; use super::Analyzer;
use crate::{ use crate::{
error::{OpmResult, OpossumError}, error::{OpmResult, OpossumError},
...@@ -39,6 +41,9 @@ impl Analyzer for RayTracingAnalyzer { ...@@ -39,6 +41,9 @@ impl Analyzer for RayTracingAnalyzer {
AnalysisRayTrace::analyze(scenery, LightResult::default(), &self.config)?; AnalysisRayTrace::analyze(scenery, LightResult::default(), &self.config)?;
Ok(()) Ok(())
} }
fn report(&self, scenery: &NodeGroup, report_dir: &Path) -> OpmResult<()> {
todo!()
}
} }
/// Trait for implementing the ray trace analysis. /// Trait for implementing the ray trace analysis.
pub trait AnalysisRayTrace: OpticNode { pub trait AnalysisRayTrace: OpticNode {
...@@ -171,17 +176,6 @@ mod test { ...@@ -171,17 +176,6 @@ mod test {
joule, millimeter, joule, millimeter,
nodes::{round_collimated_ray_source, ParaxialSurface}, nodes::{round_collimated_ray_source, ParaxialSurface},
}; };
// #[test]
// fn ray_tracing_mode_default() {
// assert!(matches!(
// RayTracingMode::default(),
// RayTracingMode::Sequential
// ));
// }
// #[test]
// fn ray_tracing_mode_debug() {
// assert_eq!(format!("{:?}", RayTracingMode::default()), "Sequential");
// }
#[test] #[test]
fn ray_tracing_config_default() { fn ray_tracing_config_default() {
let rt_conf = RayTraceConfig::default(); let rt_conf = RayTraceConfig::default();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment