gitronics 0.5.14__tar.gz → 0.5.15__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gitronics-0.5.14 → gitronics-0.5.15}/Cargo.lock +1 -1
- {gitronics-0.5.14 → gitronics-0.5.15}/Cargo.toml +1 -1
- {gitronics-0.5.14 → gitronics-0.5.15}/PKG-INFO +1 -1
- {gitronics-0.5.14 → gitronics-0.5.15}/src/build_model.rs +111 -0
- gitronics-0.5.15/src/build_report.rs +721 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/src/lib.rs +1 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/src/project_manager.rs +20 -0
- gitronics-0.5.15/src/report.css +473 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/.github/workflows/ci.yml +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/.github/workflows/docs.yml +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/.github/workflows/release.yml +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/.gitignore +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/.vscode/settings.json +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/LICENSE +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/README.md +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/docs/assets/logo.png +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/docs/best-practices.md +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/docs/changelog.md +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/docs/examples.md +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/docs/getting-started.md +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/docs/index.md +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/docs/installation.md +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/docs/requirements.txt +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/docs/usage/build.md +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/docs/usage/configuration.md +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/docs/usage/migrate.md +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/assessment_specific/filler_model_3.mcnp +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/assessment_specific/filler_model_3.metadata +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/assessment_specific/small_override.yaml +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/configurations/valid_configuration.yaml +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/output/.gitignore +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/reference_model/data_cards/fine_mesh.tally +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/reference_model/data_cards/materials.mat +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/reference_model/data_cards/my_transform.transform +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/reference_model/data_cards/volumetric_source.source +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/reference_model/envelope_structure.mcnp +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/reference_model/envelope_structure.metadata +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/reference_model/filler_models/filler_model_1.mcnp +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/reference_model/filler_models/filler_model_1.metadata +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/reference_model/filler_models/filler_model_2.mcnp +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/example_project/reference_model/filler_models/filler_model_2.metadata +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/mkdocs.yml +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/pyproject.toml +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/python/gitronics/__init__.py +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/python/gitronics/__main__.py +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/python/gitronics/gitronics.pyi +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/python/tests/test_build_model.py +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/python/tests/test_cli_works.py +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/resources/simple_model.mcnp +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/src/cli.rs +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/src/main.rs +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/src/migrate_model.rs +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/src/model_config.rs +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/src/project_manager/load_metadata.rs +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/src/project_manager/load_model_config.rs +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/src/project_manager/load_project_files.rs +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/src/python.rs +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/src/types.rs +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/src/utils.rs +0 -0
- {gitronics-0.5.14 → gitronics-0.5.15}/tests/test_example_project.rs +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
use crate::build_report::{BuildReport, EnvelopeEntry, FillerEntry};
|
|
1
2
|
use crate::project_manager::ProjectManager;
|
|
2
3
|
use crate::types::{CellId, EnvelopeName, FillerName, UniverseId};
|
|
3
4
|
use crate::utils::GitronicsError;
|
|
@@ -45,6 +46,15 @@ pub fn build_model(config_path: &Path, output_path: &Path) -> Result<(), Gitroni
|
|
|
45
46
|
info!("Adapting envelope structure with FILL cards");
|
|
46
47
|
add_fill_cards_to_envelopes(&project_manager, &universe_ids, &mut envelope_structure)?;
|
|
47
48
|
|
|
49
|
+
// Collect build-report data before fillers are moved into the composed model
|
|
50
|
+
let report = collect_build_report(
|
|
51
|
+
config_path,
|
|
52
|
+
&project_manager,
|
|
53
|
+
&envelope_structure,
|
|
54
|
+
&fillers,
|
|
55
|
+
&universe_ids,
|
|
56
|
+
)?;
|
|
57
|
+
|
|
48
58
|
// Compose model
|
|
49
59
|
info!("Composing model");
|
|
50
60
|
fillers.into_iter().for_each(|filler| {
|
|
@@ -69,6 +79,11 @@ pub fn build_model(config_path: &Path, output_path: &Path) -> Result<(), Gitroni
|
|
|
69
79
|
envelope_structure.write_to_file(&assembled_path)?;
|
|
70
80
|
fs::write(output_path.join(".gitignore"), "*\n")?;
|
|
71
81
|
|
|
82
|
+
// Write build report
|
|
83
|
+
info!("Writing HTML build report");
|
|
84
|
+
let report_path = project_manager.output_path().join("build_report.html");
|
|
85
|
+
fs::write(&report_path, report.generate_html())?;
|
|
86
|
+
|
|
72
87
|
info!(
|
|
73
88
|
"Build completed successfully in: {}",
|
|
74
89
|
assembled_path.display()
|
|
@@ -79,6 +94,102 @@ pub fn build_model(config_path: &Path, output_path: &Path) -> Result<(), Gitroni
|
|
|
79
94
|
static ENVELOPE_RE: LazyLock<Regex> =
|
|
80
95
|
LazyLock::new(|| Regex::new(r"\$\s*@env:\s*(\w+)\s*").unwrap());
|
|
81
96
|
|
|
97
|
+
fn collect_build_report(
|
|
98
|
+
config_path: &Path,
|
|
99
|
+
project_manager: &ProjectManager,
|
|
100
|
+
envelope_structure: &Model,
|
|
101
|
+
fillers: &[Model],
|
|
102
|
+
universe_ids: &HashMap<FillerName, UniverseId>,
|
|
103
|
+
) -> Result<BuildReport, GitronicsError> {
|
|
104
|
+
let total_cells =
|
|
105
|
+
envelope_structure.cells.len() + fillers.iter().map(|f| f.cells.len()).sum::<usize>();
|
|
106
|
+
let total_surfaces =
|
|
107
|
+
envelope_structure.surfaces.len() + fillers.iter().map(|f| f.surfaces.len()).sum::<usize>();
|
|
108
|
+
|
|
109
|
+
let envelope_entries: Vec<EnvelopeEntry> = project_manager
|
|
110
|
+
.envelopes_in_config()
|
|
111
|
+
.map(|env_name| {
|
|
112
|
+
let filler_name: Option<FillerName> = project_manager
|
|
113
|
+
.filler_by_envelope(env_name)
|
|
114
|
+
.and_then(|opt| opt.clone());
|
|
115
|
+
|
|
116
|
+
let universe_id = filler_name
|
|
117
|
+
.as_ref()
|
|
118
|
+
.and_then(|f| universe_ids.get(f))
|
|
119
|
+
.copied();
|
|
120
|
+
|
|
121
|
+
let transform = filler_name.as_ref().and_then(|f| {
|
|
122
|
+
project_manager
|
|
123
|
+
.transformation(f, env_name)
|
|
124
|
+
.ok()
|
|
125
|
+
.flatten()
|
|
126
|
+
.map(str::to_string)
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
EnvelopeEntry {
|
|
130
|
+
envelope_name: env_name.clone(),
|
|
131
|
+
filler_name,
|
|
132
|
+
universe_id,
|
|
133
|
+
transform,
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
.collect();
|
|
137
|
+
|
|
138
|
+
let mut filler_envelope_counts: HashMap<FillerName, usize> = HashMap::new();
|
|
139
|
+
for entry in &envelope_entries {
|
|
140
|
+
if let Some(filler_name) = &entry.filler_name {
|
|
141
|
+
*filler_envelope_counts
|
|
142
|
+
.entry(filler_name.clone())
|
|
143
|
+
.or_insert(0) += 1;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
let filler_entries: Vec<FillerEntry> = fillers
|
|
148
|
+
.iter()
|
|
149
|
+
.filter_map(|filler| {
|
|
150
|
+
let name = FillerName::from(filler);
|
|
151
|
+
let universe_id = *universe_ids.get(&name)?;
|
|
152
|
+
let envelope_count = *filler_envelope_counts.get(&name).unwrap_or(&0);
|
|
153
|
+
Some(FillerEntry {
|
|
154
|
+
universe_id,
|
|
155
|
+
envelope_count,
|
|
156
|
+
cell_count: filler.cells.len(),
|
|
157
|
+
surface_count: filler.surfaces.len(),
|
|
158
|
+
name,
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
.collect();
|
|
162
|
+
|
|
163
|
+
Ok(BuildReport {
|
|
164
|
+
config_path: config_path.display().to_string(),
|
|
165
|
+
gitronics_version: env!("CARGO_PKG_VERSION"),
|
|
166
|
+
commit_hash: get_hash_of_project(),
|
|
167
|
+
date_time: chrono::Utc::now()
|
|
168
|
+
.format("%Y-%m-%d %H:%M:%S UTC")
|
|
169
|
+
.to_string(),
|
|
170
|
+
total_cells,
|
|
171
|
+
total_surfaces,
|
|
172
|
+
envelope_entries,
|
|
173
|
+
filler_entries,
|
|
174
|
+
materials: project_manager
|
|
175
|
+
.materials_names()
|
|
176
|
+
.iter()
|
|
177
|
+
.map(|n| n.to_string())
|
|
178
|
+
.collect(),
|
|
179
|
+
tallies: project_manager
|
|
180
|
+
.tallies_names()
|
|
181
|
+
.iter()
|
|
182
|
+
.map(|n| n.to_string())
|
|
183
|
+
.collect(),
|
|
184
|
+
transforms: project_manager
|
|
185
|
+
.transforms_names()
|
|
186
|
+
.iter()
|
|
187
|
+
.map(|n| n.to_string())
|
|
188
|
+
.collect(),
|
|
189
|
+
source: project_manager.source_name().map(|n| n.to_string()),
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
|
|
82
193
|
fn add_fill_cards_to_envelopes(
|
|
83
194
|
project_manager: &ProjectManager,
|
|
84
195
|
universe_ids: &HashMap<FillerName, UniverseId>,
|