celeritas-project / celeritas

Celeritas is a new Monte Carlo transport code designed to accelerate scientific discovery in high energy physics by improving detector simulation throughput and energy efficiency using GPUs.
https://celeritas-project.github.io/celeritas/
Other
66 stars 35 forks source link

Add optical model importer and refactor imported optical materials #1520

Open hhollenb opened 4 days ago

hhollenb commented 4 days ago

Refactoring imported optical materials

Added ImportedMaterials to act as a common storage for material data used by optical models (Rayleigh and WLS). Like with ImportedModels it helps prevent unnecessary copies of std::vector<ImportOpticalRayleigh> and std::vector<ImportWavelengthShift>.

RayleighModel was also updated to use an Input struct to concisely manage material dependencies for building MFP tables.

Model Importer

Similar to phys/ProcessBuilder, I added the ModelImporter to create models from imported data, as well as provide user build functionality like warn-and-ignore. The ModelBuilder concrete base class is meant to serve a similar purpose to phys/Process, and is just meant to build optical models with an action ID.

I'm trying to maintain the behavior of phys/PhysicsParams where importing processes/models is separate from being built and registered in the action registry, so a layer between ModelImporter and optical/PhysicsParams is necessary. The input for optical::PhysicsParams will look something like:

Input
{
    ActionRegistry* action_reg;
    std::vector<std::shared_ptr<ModelBuilder>> model_builders;
};

Simple builders are added to the model .cpp files and made accessible through static factory methods. There's some freedom in determining where the builders live (or even using some type-erased lambdas if we want to be fancy).

N.B.: This loosely depends on #1519 so I'm leaving this as a draft PR, but can be more or less independently reviewed.

github-actions[bot] commented 4 days ago

Test summary

1 680 files  2 640 suites   49s :stopwatch: 1 090 tests 1 079 :white_check_mark: 11 :zzz: 0 :x: 8 784 runs  8 760 :white_check_mark: 24 :zzz: 0 :x:

Results for commit e92b0260.