Quantum 3xplorer (Q3)
Loading...
Searching...
No Matches
writer.hpp
Go to the documentation of this file.
1
#pragma once
2
3
/**
4
* VolumetricFieldWriter — abstract writer for one volumetric file format.
5
*
6
* Every format Q3 can put a real-space field into implements this: Gaussian
7
* cube, XCrySDen XSF, and any a build-time add-on registers. The caller builds
8
* a VolumetricField once and
9
* asks the factory for a writer by name, so adding a format never touches
10
* the code that produced the field.
11
*/
12
13
#include <string>
14
15
#include "
io/volumetric/field.hpp
"
16
17
namespace
q3
{
18
19
class
VolumetricFieldWriter
{
20
public
:
21
virtual
~VolumetricFieldWriter
() =
default
;
22
23
/// Write `field` to `path`, throwing std::runtime_error if it cannot be written.
24
virtual
void
write
(
const
std::string& path,
const
VolumetricField
& field)
const
= 0;
25
26
/**
27
* What a file of this format is conventionally called, given a run's
28
* prefix and the field's name. Cube and XSF take a suffix; a format whose
29
* file has a fixed name says so by returning that name unchanged.
30
*/
31
[[nodiscard]]
virtual
std::string
default_file_name
(
const
std::string& stem)
const
= 0;
32
};
33
34
}
// namespace q3
q3::VolumetricFieldWriter
Definition
writer.hpp:19
q3::VolumetricFieldWriter::~VolumetricFieldWriter
virtual ~VolumetricFieldWriter()=default
q3::VolumetricFieldWriter::default_file_name
virtual std::string default_file_name(const std::string &stem) const =0
q3::VolumetricFieldWriter::write
virtual void write(const std::string &path, const VolumetricField &field) const =0
Write field to path, throwing std::runtime_error if it cannot be written.
q3
Definition
q3_core_api.hpp:33
q3::VolumetricField
Definition
field.hpp:40
field.hpp
src
io
volumetric
writer.hpp
Generated by
1.9.8