6#ifndef OPALX_FROM_FILE_H
7#define OPALX_FROM_FILE_H
42 std::shared_ptr<ParticleContainer_t> pc, std::shared_ptr<FieldContainer_t> fc,
53 std::shared_ptr<ParticleContainer_t> pc, std::shared_ptr<FieldContainer_t> fc,
54 const std::string& filename);
79 void readFile(
const std::string& filename);
87 std::vector<size_t>
parseHeader(
const std::string& headerLine);
ippl::Vector< T, Dim > Vector_t
Implements the sampling method for reading particle phase space from ASCII files.
std::vector< size_t > parseHeader(const std::string &headerLine)
Parses the header line to get column indices. Header must contain all of x, y, z, px,...
size_t numParticles_m
Number of particles in the file.
ippl::detail::size_type size_type
void readFile(const std::string &filename)
Reads and parses the particle file. Format must be: N (particle count), then header line (column name...
std::string normalizeColumnName(const std::string &name)
Normalizes column name for comparison (case-insensitive, whitespace handling).
void generateParticles(size_t &numberOfParticles, Vector_t< double, 3 > nr) override
Generates particles by reading from file.
std::string filename_m
File path to read particle data from.
std::vector< size_t > columnIndices_m
Column indices mapping: [x_idx, y_idx, z_idx, px_idx, py_idx, pz_idx].
std::vector< std::vector< double > > particleData_m
Stored particle data: each element is a 6D phase space vector [x, y, z, px, py, pz].
void emitParticles(double t, double dt) override
Time-stepped emission hook for one-shot delayed file-based injection.