Line data Source code
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 : #include "ElementVariableVectorPostprocessor.h" 13 : #include "SpatialUserObjectFunctor.h" 14 : 15 : /** 16 : * This ExtraIDIntegralVectorPostprocessor source code is to integrate variables based on parsed 17 : * extra IDs 18 : */ 19 : class ExtraIDIntegralVectorPostprocessor 20 : : public SpatialUserObjectFunctor<ElementVariableVectorPostprocessor> 21 : { 22 : public: 23 : static InputParameters validParams(); 24 : ExtraIDIntegralVectorPostprocessor(const InputParameters & parameters); 25 : 26 : virtual void initialize() override; 27 : virtual void execute() override; 28 : virtual void finalize() override; 29 : virtual void threadJoin(const UserObject & uo) override; 30 : /// Return extra ID list 31 30 : const std::vector<VectorPostprocessorValue *> & getUniqueExtraIds() const { return _extra_ids; }; 32 : /// Return Integral values 33 30 : const std::vector<VectorPostprocessorValue *> & getIntegrals() const { return _integrals; }; 34 : 35 : using SpatialUserObjectFunctor<ElementVariableVectorPostprocessor>::evaluate; 36 : 37 : /// Get values for an element based on the element extra element id 38 : virtual Real evaluate(const ElemArg & elem, const Moose::StateArg & state) const override; 39 : /// Get values for an element on qps based on the element extra element id 40 : virtual Real evaluate(const ElemQpArg & qp, const Moose::StateArg & state) const override; 41 : 42 : protected: 43 : /// Get the value for an element based on the element extra element id 44 : Real elementValue(const Elem * elem) const; 45 : /// whether or not to compute volume average 46 : const bool _average; 47 : /// Number of variables to be integrated 48 : const unsigned int _nvar; 49 : /// Number of material properties to be integrated 50 : const unsigned int _nprop; 51 : /// Name of material properties 52 : const std::vector<MaterialPropertyName> _prop_names; 53 : /// Extra IDs in use 54 : const std::vector<ExtraElementIDName> _extra_id; 55 : /// Number of extra IDs in use 56 : const unsigned int _n_extra_id; 57 : // Map of element ids to parsed vpp ids 58 : std::unordered_map<dof_id_type, dof_id_type> _unique_vpp_ids; 59 : /// Vectors holding extra IDs 60 : std::vector<VectorPostprocessorValue *> _extra_ids; 61 : /// Coupled MOOSE variables to be integrated 62 : std::vector<const MooseVariable *> _vars; 63 : /// Quadrature point values of coupled MOOSE variables 64 : std::vector<const VariableValue *> _var_values; 65 : /// Material properties to be integrated 66 : std::vector<const MaterialProperty<Real> *> _props; 67 : /// Vectors holding integrals over extra IDs 68 : std::vector<VectorPostprocessorValue *> _integrals; 69 : /// Vector holding the volume of extra IDs 70 : std::vector<Real> _volumes; 71 : /// The index to the values that is used in 'evaluate' function 72 : unsigned int _spatial_evaluation_index; 73 : };