https://mooseframework.inl.gov
RayTracingNemesis.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 // TODO: remove ignore warnings once std::tuple<> is instantiated as a StandardType
11 // Using push_parallel_vector_data with std::tuple<> leads to a -Wextra error
12 // https://github.com/libMesh/TIMPI/issues/52
13 #include "libmesh/ignore_warnings.h"
14 #include "RayTracingNemesis.h"
15 #include "libmesh/restore_warnings.h"
16 
17 // Local includes
18 #include "RayTracingStudy.h"
19 
20 // libMesh includes
21 #include "libmesh/nemesis_io.h"
22 
23 registerMooseObject("RayTracingApp", RayTracingNemesis);
24 
27 {
28  auto params = RayTracingMeshOutput::validParams();
29  params.addClassDescription("Outputs ray segments and data as segments using the Nemesis format.");
30  return params;
31 }
32 
34 {
35 }
36 
37 void
39 {
40  TIME_SECTION("outputMesh", 3, "Outputting Nemesis RayTracing Mesh");
41 
42  // Build the nemesis IO object
44  nemesis_io.set_hdf5_writing(false);
45 
46  // With nodal data, we need to output these variables in write_timestep
49  // Otherwise, there's no variables to write in write_timestep
50  else
51  nemesis_io.set_output_variables(std::vector<std::string>());
52  // Write the timestep, which is the mesh + nodal vars (if any)
53  nemesis_io.write_timestep(filename(), *_es, 1, time() + _app.getGlobalTimeOffset());
54 
55  // This will default to write_element_data getting all available elemental vars
56  nemesis_io.set_output_variables(std::vector<std::string>());
57  // Write the elemental variables, which are the variables with the constant Ray field data
58  nemesis_io.write_element_data(*_es);
59 
60  // We write a new file every time as we don't keep track of whether or not the rays change
61  ++_file_num;
62 }
const bool _output_data_nodal
Whether or not to output the Ray&#39;s data in a nodal, linear sense.
virtual Real time() override
const std::vector< std::string > & rayDataNames() const
The Ray data names.
const RayTracingStudy & _study
The RayTracingStudy.
RayTracingNemesis(const InputParameters &parameters)
static InputParameters validParams()
void write_timestep(const std::string &fname, const EquationSystems &es, const int timestep, const Real time)
void write_element_data(const EquationSystems &es)
static InputParameters validParams()
std::unique_ptr< libMesh::EquationSystems > _es
The EquationSystems.
registerMooseObject("RayTracingApp", RayTracingNemesis)
MooseApp & _app
std::unique_ptr< MeshBase > _segment_mesh
The mesh that contains the segments.
virtual void outputMesh() override
Output the mesh - to be overridden.
unsigned int & _file_num
void set_output_variables(const std::vector< std::string > &output_variables, bool allow_empty=true)
Base class for outputting Ray data in a mesh format, where EDGE2 elems represent the individual Ray s...
void set_hdf5_writing(bool write_hdf5)
Real getGlobalTimeOffset() const
virtual std::string filename() override