https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
15class MooseMesh;
16
17// libMesh forward declarations
18namespace libMesh
19{
20template <typename T>
21class NumericVector;
22class MeshFunction;
23}
24
40{
41public:
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
52protected:
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
73private:
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
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};
Based class for output objects.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
const std::string & type() const
Get the type of this class.
Definition MooseBase.h:93
Class for containing MooseEnum item information.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
Based class for providing re-positioning and oversampling support to output objects.
bool _use_sampled_output
Flag indicating that the sampled output should be used to re-sample the underlying EquationSystem of ...
std::unique_ptr< EquationSystems > _sampling_es
Equation system holding the solution vectors for the sampled variables.
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...
virtual void outputStep(const ExecFlagType &type) override
A single call to this function should output all the necessary data for a single timestep.
void cloneMesh()
Clone mesh in preperation for re-positioning or oversampling.
bool _sampling_mesh_changed
A flag indicating that the mesh has changed and the sampled mesh needs to be re-initialized.
const bool _using_external_sampling_file
Flag indicating another file is being used for the 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...
std::unique_ptr< NumericVector< Number > > _serialized_solution
Sample solution vector.
void initSample()
Setups the output object to produce re-positioned and/or sampled results.
const unsigned int _refinements
The number of oversampling refinements.
virtual void setFileBaseInternal(const std::string &file_base) override
Appends the base class's file base string.
virtual void updateSample()
Performs the update of the solution vector for the sample/re-positioned mesh.
bool _mesh_subdomains_match
A flag tracking whether the sampling and source meshes match in terms of subdomains.
const bool _change_position
Flag for re-positioning.
virtual ~SampledOutput()
virtual void initialSetup() override
Call init() method on setup.
bool _serialize
Flag indicating whether we are outputting in serial or parallel.
virtual void meshChanged() override
Called on this object when the mesh changes.
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' _mesh_ptr will refer to this mesh if sampling is being used...
Point _position
When oversampling, the output is shift by this amount.
static InputParameters validParams()
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...