22 #include "libmesh/quadrature.h" 56 virtual void execute()
override;
94 _mesh(_subproblem.
mesh()),
95 _qrule(_assembly.qRule()),
96 _q_point(_assembly.qPoints())
98 std::vector<std::string> material_property_names = getParam<std::vector<std::string>>(
"property");
99 for (
unsigned int i = 0; i < material_property_names.size(); ++i)
101 if (!hasMaterialProperty<T>(material_property_names[i]))
102 mooseError(
"In Sampler1DBase material property: " + material_property_names[i] +
110 template <
typename T>
117 template <
typename T>
121 std::vector<Real> values(_material_properties.size());
123 std::unordered_set<unsigned int> needed_mat_props;
124 const auto & mp_deps = getMatPropDependencies();
125 needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
126 _fe_problem.setActiveMaterialProperties(needed_mat_props, _tid);
128 ConstElemRange & elem_range = *(_mesh.getActiveLocalElementRange());
129 for (
typename ConstElemRange::const_iterator el = elem_range.begin(); el != elem_range.end();
132 const Elem * elem = *el;
134 if (elem->processor_id() != processor_id())
137 if (!hasBlocks(elem->subdomain_id()))
140 _subproblem.setCurrentSubdomainID(elem, _tid);
141 _subproblem.prepare(elem, _tid);
142 _subproblem.reinitElem(elem, _tid);
147 _fe_problem.reinitMaterials(elem->subdomain_id(), _tid);
149 for (
unsigned int qp = 0; qp < _qrule->n_points(); ++qp)
151 for (
unsigned int j = 0;
j < _material_properties.size(); ++
j)
152 values[
j] = getScalarFromProperty((*_material_properties[
j])[qp], _q_point[qp]);
155 addSample(_q_point[qp], _q_point[qp](0), values);
158 _fe_problem.clearActiveMaterialProperties(_tid);
161 template <
typename T>
virtual void initialize()
MooseMesh & _mesh
The mesh.
virtual Real getScalarFromProperty(const T &property, const Point &curr_point)=0
Reduce the material property to a scalar for output.
const QBase *const & _qrule
The quadrature rule.
StoredRange< MeshBase::const_element_iterator, const Elem *> ConstElemRange
This is a base class for sampling material properties for the integration points in all elements in a...
std::vector< const MaterialProperty< T > * > _material_properties
The material properties to be output.
void setupVariables(const std::vector< std::string > &variable_names)
virtual void initialize() override
Initialize Calls through to base class's initialize()
virtual void finalize() override
Finalize Calls through to base class's finalize()
virtual void swapBackMaterials(const THREAD_ID tid)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Sampler1DBase(const InputParameters ¶meters)
Class constructor Sets up variables for output based on the properties to be output.
void mooseError(Args &&... args) const
const InputParameters & parameters() const
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
static InputParameters validParams()
const MooseArray< Point > & _q_point
The quadrature points.
virtual void execute() override
Loops through all elements in a block and samples their material properties.