OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
parameter_validator.hpp File Reference

Parameter validation orchestration and reporting. More...

#include "parameter_metadata.hpp"
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <nlohmann/json.hpp>
#include <sstream>
#include <string>
#include <vector>
Include dependency graph for parameter_validator.hpp:

Go to the source code of this file.

Classes

struct  pfc::ui::ValidationResult
 Result of parameter validation. More...
 
class  pfc::ui::ParameterValidator
 Parameter validator for double-valued parameters. More...
 

Detailed Description

Parameter validation orchestration and reporting.

This file provides the validation engine that checks all parameters against their metadata and generates comprehensive error reports. It implements the "fail fast" philosophy: catch configuration errors immediately at startup rather than hours into a simulation.

Key features:

  • Validates all parameters in one pass
  • Collects all errors (not just first one)
  • Generates formatted validation reports
  • Prints parameter summaries for reproducibility

Usage:

// Create validator with metadata
ParameterValidator validator;
validator.add_metadata(temp_metadata);
validator.add_metadata(density_metadata);
// Validate configuration
auto result = validator.validate(json_config);
if (!result.is_valid()) {
std::cerr << result.format_errors() << std::endl;
throw std::invalid_argument("Invalid configuration");
}
// Print summary
std::cout << result.format_summary() << std::endl;
See also
parameter_metadata.hpp for individual parameter metadata
tungsten_input.hpp for usage example