https://mooseframework.inl.gov
SampledOutput.h
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 #pragma once
11 
12 // MOOSE includes
13 #include "AdvancedOutput.h"
14 
15 class MooseMesh;
16 
17 // libMesh forward declarations
18 namespace libMesh
19 {
20 template <typename T>
21 class NumericVector;
22 class MeshFunction;
23 }
24 
40 {
41 public:
43 
45 
46  virtual ~SampledOutput();
47 
48  virtual void initialSetup() override;
49  virtual void meshChanged() override;
50  virtual void outputStep(const ExecFlagType & type) override;
51 
52 protected:
56  virtual void updateSample();
57 
59  virtual void setFileBaseInternal(const std::string & file_base) override;
60 
62  const unsigned int _refinements;
63 
66 
68  const bool _change_position;
69 
72 
73 private:
80  void initSample();
81 
87  void cloneMesh();
88 
92  bool isSampledAtNodes(const FEType & fe_type) const;
93 
101  std::vector<std::vector<std::unique_ptr<libMesh::MeshFunction>>> _mesh_functions;
102 
104  std::vector<std::vector<unsigned int>> _variable_numbers_in_system;
105 
107  Point _position;
108 
111 
114 
117 
119  std::unique_ptr<EquationSystems> _sampling_es;
120 
122  std::unique_ptr<MooseMesh> _sampling_mesh_ptr;
123 
125  /* Each of the MeshFunctions keeps a reference to this vector, the vector is updated for the
126  * current system
127  * and variable before the MeshFunction is applied. This allows for the same MeshFunction object
128  * to be
129  * re-used, unless the mesh has changed due to adaptivity */
130  std::unique_ptr<NumericVector<Number>> _serialized_solution;
131 };
bool _use_sampled_output
Flag indicating that the sampled output should be used to re-sample the underlying EquationSystem of ...
Definition: SampledOutput.h:71
virtual void updateSample()
Performs the update of the solution vector for the sample/re-positioned mesh.
const bool _change_position
Flag for re-positioning.
Definition: SampledOutput.h:68
virtual void outputStep(const ExecFlagType &type) override
A single call to this function should output all the necessary data for a single timestep.
Definition: SampledOutput.C:85
SampledOutput(const InputParameters &parameters)
Definition: SampledOutput.C:61
const bool _using_external_sampling_file
Flag indicating another file is being used for the sampling.
Definition: SampledOutput.h:65
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual ~SampledOutput()
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
bool _mesh_subdomains_match
A flag tracking whether the sampling and source meshes match in terms of subdomains.
bool _serialize
Flag indicating whether we are outputting in serial or parallel.
Based class for providing re-positioning and oversampling support to output objects.
Definition: SampledOutput.h:39
std::unique_ptr< EquationSystems > _sampling_es
Equation system holding the solution vectors for the sampled variables.
std::vector< std::vector< unsigned int > > _variable_numbers_in_system
A vector of vectors that keeps track of the variable numbers in each system for each mesh function...
std::unique_ptr< MooseMesh > _sampling_mesh_ptr
Mesh used for sampling. The Output class&#39; _mesh_ptr will refer to this mesh if sampling is being used...
void initSample()
Setups the output object to produce re-positioned and/or sampled results.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:51
virtual void meshChanged() override
Called on this object when the mesh changes.
const unsigned int _refinements
The number of oversampling refinements.
Definition: SampledOutput.h:62
Based class for output objects.
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
Point _position
When oversampling, the output is shift by this amount.
bool _sampling_mesh_changed
A flag indicating that the mesh has changed and the sampled mesh needs to be re-initialized.
std::unique_ptr< NumericVector< Number > > _serialized_solution
Sample solution vector.
const InputParameters & parameters() const
Get the parameters of the object.
bool isSampledAtNodes(const FEType &fe_type) const
Used to decide which variable is sampled at nodes, then output as a nodal variable for (over)sampling...
std::vector< std::vector< std::unique_ptr< libMesh::MeshFunction > > > _mesh_functions
A vector of pointers to the mesh functions on the sampled mesh This is only populated when the initSa...
static InputParameters validParams()
Definition: SampledOutput.C:25
virtual void setFileBaseInternal(const std::string &file_base) override
Appends the base class&#39;s file base string.
void cloneMesh()
Clone mesh in preperation for re-positioning or oversampling.
virtual void initialSetup() override
Call init() method on setup.
Definition: SampledOutput.C:76