29 std::unique_ptr<OutputDataReader> reader(OutputDataReadFactory::getReader(file_name));
31 return reader->getOutputData();
35 OutputData<double>* IntensityDataIOFactory::readReflectometryData(
const std::string& file_name)
39 std::unique_ptr<OutputDataReader> reader(
40 OutputDataReadFactory::getReflectometryReader(file_name));
42 return reader->getOutputData();
48 std::unique_ptr<OutputData<double>> data(
readOutputData(file_name));
50 throw std::runtime_error(
"Could not read " + file_name);
51 return IHistogram::createHistogram(*data);
55 const std::string& file_name)
57 auto* writer = OutputDataWriteFactory::getWriter(file_name);
58 writer->writeOutputData(data);
63 const std::string& file_name)
70 const std::string& file_name)
72 auto data = result.data();
Defines namespace FileSystemUtils.
Defines class IHistogram.
Defines class IntensityDataIOFactory.
Defines class OutputDataReadFactory.
Defines class OutputDataWriteFactory.
Defines class SimulationResult.
Base class for 1D and 2D histograms holding values of double type.
OutputData< double > * createOutputData(DataType dataType=DataType::INTEGRAL) const
creates new OutputData with histogram's shape and values corresponding to DataType
static OutputData< double > * readOutputData(const std::string &file_name)
Reads file and returns newly created OutputData object.
static void writeOutputData(const OutputData< double > &data, const std::string &file_name)
Writes OutputData in file.
static IHistogram * readIntensityData(const std::string &file_name)
Reads file and returns newly created Histogram object.
static void writeIntensityData(const IHistogram &histogram, const std::string &file_name)
Writes histogram in file.
static void writeSimulationResult(const SimulationResult &result, const std::string &file_name)
Writes OutputData contained in the given SimulationResult object.
Wrapper around OutputData<double> that also provides unit conversions.
bool IsFileExists(const std::string &str)
Returns true if file with given name exists on disk.