10 const std::vector<Node>& nodes,
12 const unsigned int dimension)
26 throw std::runtime_error(
"Output format not yet supported.");
32 const std::string file_name =
name_ +
"_results.csv";
33 std::ofstream out(file_name);
35 throw std::runtime_error(
"Could not open file for writing: " + file_name);
39 out <<
"node_id,x,y,z,scalar_flux";
40 for (
size_t i = 0; i < n_ordinates; i++) {
41 out <<
",angular_flux_" << i;
43 out <<
",direction_cosine_" << i;
45 out <<
",azimuth_" << i <<
",polar_" << i;
49 out << std::setprecision(std::numeric_limits<double>::max_digits10);
50 for (
const auto& node :
nodes_) {
51 out << node.id <<
"," << node.x <<
"," << node.y <<
"," << node.z <<
","
53 for (
size_t i = 0; i < n_ordinates; i++) {
55 out <<
"," << node.angular_fluxes.at(i);
57 out <<
"," << ordinate.
x();
59 out <<
"," << ordinate.
azimuth() <<
"," << ordinate.
polar();
Defines a solid angle, or ordinate, in spherical geometry.
double polar() const
Getter for polar angle.
double x() const
Evaluate the x-direction cosine.
double azimuth() const
Getter for azimuthal angle.
Base class for defining a quadrature set.
const std::string & name_
Problem name, used to build the output file name.
const std::vector< Node > & nodes_
Mesh nodes holding the solution values to export.
const OutputFormat output_format_
Format to export results in.
const QuadratureBase< Ordinate > & angular_quadrature_
Angular quadrature set.
const unsigned int dimension_
Spatial dimension of the mesh.
void ToCSV()
Export the results as a CSV file.
Results(const std::string &name, const OutputFormat output_format, const std::vector< Node > &nodes, const QuadratureBase< Ordinate > &angular_quadrature, const unsigned int dimension)
Construct a new Results object.
void Export()
Export the results in the format given by output_format_.
OutputFormat
Output forms available for export.