https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | List of all members
ConditionalSampleReporterTempl< T > Class Template Reference

This object is mainly meant for demonstration for eventual active learning algorithms, but could prove useful. More...

#include <ConditionalSampleReporter.h>

Inheritance diagram for ConditionalSampleReporterTempl< T >:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 
typedef GenericSymFunction< is_ad > SymFunction
 
typedef std::shared_ptr< SymFunctionSymFunctionPtr
 

Public Member Functions

 ConditionalSampleReporterTempl (const InputParameters &parameters)
 
virtual void execute () override
 Here we loop through the samples and call the needSample function to determine if the sample needs to be run and define a value in its place. More...
 
virtual void initialize () override
 
virtual void finalize () override
 
void threadJoin (const UserObject &) final
 
bool shouldStore () const override final
 
SubProblemgetSubProblem () const
 
bool shouldDuplicateInitialExecution () const
 
virtual Real spatialValue (const Point &) const
 
virtual const std::vector< Point > spatialPoints () const
 
void gatherSum (T &value)
 
void gatherMax (T &value)
 
void gatherMin (T &value)
 
void gatherProxyValueMax (T1 &proxy, T2 &value)
 
void gatherProxyValueMin (T1 &proxy, T2 &value)
 
void setPrimaryThreadCopy (UserObject *primary)
 
UserObjectprimaryThreadCopy ()
 
std::set< UserObjectName > getDependObjects () const
 
virtual bool needThreadedCopy () const
 
const std::set< std::string > & getRequestedItems () override
 
const std::set< std::string > & getSuppliedItems () override
 
unsigned int systemNumber () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
virtual void initialSetup ()
 
virtual void timestepSetup ()
 
virtual void jacobianSetup ()
 
virtual void residualSetup ()
 
virtual void customSetup (const ExecFlagType &)
 
const ExecFlagEnumgetExecuteOnEnum () const
 
UserObjectName getUserObjectName (const std::string &param_name) const
 
const T & getUserObject (const std::string &param_name, bool is_dependency=true) const
 
const T & getUserObjectByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const UserObjectgetUserObjectBase (const std::string &param_name, bool is_dependency=true) const
 
const UserObjectgetUserObjectBaseByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const std::vector< MooseVariableScalar *> & getCoupledMooseScalarVars ()
 
const std::set< TagID > & getScalarVariableCoupleableVectorTags () const
 
const std::set< TagID > & getScalarVariableCoupleableMatrixTags () const
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, MaterialData &material_data, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, MaterialData &material_data, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, const unsigned int state=0)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name, MaterialData &material_data)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data, const unsigned int state)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name)
 
std::pair< const MaterialProperty< T > *, std::set< SubdomainID > > getBlockMaterialProperty (const MaterialPropertyName &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty ()
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialPropertyByName (const std::string &prop_name)
 
const MaterialProperty< T > & getZeroMaterialProperty (Ts... args)
 
std::set< SubdomainIDgetMaterialPropertyBlocks (const std::string &name)
 
std::vector< SubdomainName > getMaterialPropertyBlockNames (const std::string &name)
 
std::set< BoundaryIDgetMaterialPropertyBoundaryIDs (const std::string &name)
 
std::vector< BoundaryName > getMaterialPropertyBoundaryNames (const std::string &name)
 
void checkBlockAndBoundaryCompatibility (std::shared_ptr< MaterialBase > discrete)
 
std::unordered_map< SubdomainID, std::vector< MaterialBase *> > buildRequiredMaterials (bool allow_stateful=true)
 
void statefulPropertiesAllowed (bool)
 
bool getMaterialPropertyCalled () const
 
virtual const std::unordered_set< unsigned int > & getMatPropDependencies () const
 
virtual void resolveOptionalProperties ()
 
const GenericMaterialProperty< T, is_ad > & getPossiblyConstantGenericMaterialPropertyByName (const MaterialPropertyName &prop_name, MaterialData &material_data, const unsigned int state)
 
bool isImplicit ()
 
Moose::StateArg determineState () const
 
virtual void store (nlohmann::json &json) const
 
virtual void declareLateValues ()
 
void buildOutputHideVariableList (std::set< std::string > variable_names)
 
const std::set< OutputName > & getOutputs ()
 
virtual void subdomainSetup () override
 
virtual void subdomainSetup () override
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
const GenericOptionalMaterialProperty< T, is_ad > & getGenericOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const GenericOptionalMaterialProperty< T, is_ad > & getGenericOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalMaterialProperty< T > & getOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalMaterialProperty< T > & getOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalADMaterialProperty< T > & getOptionalADMaterialProperty (const std::string &name)
 
const OptionalADMaterialProperty< T > & getOptionalADMaterialProperty (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOld (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOld (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOlder (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOlder (const std::string &name)
 
MaterialBasegetMaterial (const std::string &name)
 
MaterialBasegetMaterial (const std::string &name)
 
MaterialBasegetMaterialByName (const std::string &name, bool no_warn=false)
 
MaterialBasegetMaterialByName (const std::string &name, bool no_warn=false)
 
bool hasMaterialProperty (const std::string &name)
 
bool hasMaterialProperty (const std::string &name)
 
bool hasMaterialPropertyByName (const std::string &name)
 
bool hasMaterialPropertyByName (const std::string &name)
 
bool hasADMaterialProperty (const std::string &name)
 
bool hasADMaterialProperty (const std::string &name)
 
bool hasADMaterialPropertyByName (const std::string &name)
 
bool hasADMaterialPropertyByName (const std::string &name)
 
bool hasGenericMaterialProperty (const std::string &name)
 
bool hasGenericMaterialProperty (const std::string &name)
 
bool hasGenericMaterialPropertyByName (const std::string &name)
 
bool hasGenericMaterialPropertyByName (const std::string &name)
 
const FunctiongetFunction (const std::string &name) const
 
const FunctiongetFunctionByName (const FunctionName &name) const
 
bool hasFunction (const std::string &param_name) const
 
bool hasFunctionByName (const FunctionName &name) const
 
bool isDefaultPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessor (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessorByName (const PostprocessorName &name) const
 
std::size_t coupledPostprocessors (const std::string &param_name) const
 
const PostprocessorName & getPostprocessorName (const std::string &param_name, const unsigned int index=0) const
 
const VectorPostprocessorValuegetVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
bool hasVectorPostprocessor (const std::string &param_name, const std::string &vector_name) const
 
bool hasVectorPostprocessor (const std::string &param_name) const
 
bool hasVectorPostprocessorByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
bool hasVectorPostprocessorByName (const VectorPostprocessorName &name) const
 
const VectorPostprocessorName & getVectorPostprocessorName (const std::string &param_name) const
 
T & getSampler (const std::string &name)
 
SamplergetSampler (const std::string &name)
 
T & getSamplerByName (const SamplerName &name)
 
SamplergetSamplerByName (const SamplerName &name)
 
virtual void meshChanged ()
 
virtual void meshDisplaced ()
 
PerfGraphperfGraph ()
 
const PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
virtual const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name) const
 
virtual const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (const PostprocessorName &name) const
 
bool isVectorPostprocessorDistributed (const std::string &param_name) const
 
bool isVectorPostprocessorDistributed (const std::string &param_name) const
 
bool isVectorPostprocessorDistributedByName (const VectorPostprocessorName &name) const
 
bool isVectorPostprocessorDistributedByName (const VectorPostprocessorName &name) const
 
const DistributiongetDistribution (const std::string &name) const
 
const T & getDistribution (const std::string &name) const
 
const DistributiongetDistribution (const std::string &name) const
 
const T & getDistribution (const std::string &name) const
 
const DistributiongetDistributionByName (const DistributionName &name) const
 
const T & getDistributionByName (const std::string &name) const
 
const DistributiongetDistributionByName (const DistributionName &name) const
 
const T & getDistributionByName (const std::string &name) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
void setParserFeatureFlags (SymFunctionPtr &) const
 

Static Public Member Functions

static InputParameters validParams ()
 
static void sort (typename std::vector< T > &vector)
 
static void sortDFS (typename std::vector< T > &vector)
 
static void cyclicDependencyError (CyclicDependencyException< T2 > &e, const std::string &header)
 

Public Attributes

const ConsoleStream _console
 

Static Public Attributes

static constexpr PropertyValue::id_type default_property_id
 
static constexpr PropertyValue::id_type zero_property_id
 
static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Types

enum  FailureMethod
 

Protected Member Functions

virtual bool needSample (const std::vector< Real > &row, dof_id_type local_ind, dof_id_type global_ind, T &val) override
 This evaluates the inputted function to determine whether a multiapp solve is necessary/allowed, otherwise it replaces the "transferred" quantity with a default value. More...
 
virtual ReporterName declareStochasticReporterClone (const Sampler &sampler, const ReporterData &from_data, const ReporterName &from_reporter, std::string prefix="") override
 This is overriden for the following reasons: 1) Only one vector can be declared and must match the type of this class. More...
 
const Samplersampler () const
 Get a const reference to the sampler from the parameters. More...
 
const std::vector< std::vector< Real > > & getGlobalInputData () const
 
const std::vector< T > & getGlobalOutputData () const
 Get a const reference to the output data. More...
 
virtual void preNeedSample ()
 Optional virtual function that is called before the sampler loop calling needSample. More...
 
template<typename T >
std::vector< T > & declareStochasticReporter (std::string value_name, const Sampler &sampler)
 
virtual void addPostprocessorDependencyHelper (const PostprocessorName &name) const override
 
virtual void addVectorPostprocessorDependencyHelper (const VectorPostprocessorName &name) const override
 
virtual void addUserObjectDependencyHelper (const UserObject &uo) const override
 
void addReporterDependencyHelper (const ReporterName &reporter_name) override
 
const ReporterNamegetReporterName (const std::string &param_name) const
 
T & declareRestartableData (const std::string &data_name, Args &&... args)
 
ManagedValue< T > declareManagedRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
const T & getRestartableData (const std::string &data_name) const
 
T & declareRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
T & declareRecoverableData (const std::string &data_name, Args &&... args)
 
T & declareRestartableDataWithObjectName (const std::string &data_name, const std::string &object_name, Args &&... args)
 
T & declareRestartableDataWithObjectNameWithContext (const std::string &data_name, const std::string &object_name, void *context, Args &&... args)
 
std::string restartableName (const std::string &data_name) const
 
const T & getMeshProperty (const std::string &data_name, const std::string &prefix)
 
const T & getMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 
std::string timedSectionName (const std::string &section_name) const
 
bool isCoupledScalar (const std::string &var_name, unsigned int i=0) const
 
unsigned int coupledScalarComponents (const std::string &var_name) const
 
unsigned int coupledScalar (const std::string &var_name, unsigned int comp=0) const
 
libMesh::Order coupledScalarOrder (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< is_ad > & coupledGenericScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< false > & coupledGenericScalarValue (const std::string &var_name, const unsigned int comp) const
 
const GenericVariableValue< true > & coupledGenericScalarValue (const std::string &var_name, const unsigned int comp) const
 
const VariableValuecoupledVectorTagScalarValue (const std::string &var_name, TagID tag, unsigned int comp=0) const
 
const VariableValuecoupledMatrixTagScalarValue (const std::string &var_name, TagID tag, unsigned int comp=0) const
 
const VariableValuecoupledScalarValueOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarValueOlder (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDot (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledScalarDot (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDot (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDotOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDu (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDotDu (const std::string &var_name, unsigned int comp=0) const
 
const MooseVariableScalargetScalarVar (const std::string &var_name, unsigned int comp) const
 
virtual void checkMaterialProperty (const std::string &name, const unsigned int state)
 
void markMatPropRequested (const std::string &)
 
MaterialPropertyName getMaterialPropertyName (const std::string &name) const
 
void checkExecutionStage ()
 
T & declareUnusedValue (Args &&... args)
 
const T & getReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const T & getReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const T & getReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
const GenericMaterialProperty< T, is_ad > * defaultGenericMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > * defaultGenericMaterialProperty (const std::string &name)
 
const MaterialProperty< T > * defaultMaterialProperty (const std::string &name)
 
const MaterialProperty< T > * defaultMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > * defaultADMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > * defaultADMaterialProperty (const std::string &name)
 
T & declareValue (const std::string &param_name, Args &&... args)
 
T & declareValue (const std::string &param_name, ReporterMode mode, Args &&... args)
 
T & declareValue (const std::string &param_name, Args &&... args)
 
T & declareValue (const std::string &param_name, ReporterMode mode, Args &&... args)
 
T & declareValue (const std::string &param_name, Args &&... args)
 
T & declareValue (const std::string &param_name, ReporterMode mode, Args &&... args)
 
T & declareValue (const std::string &param_name, Args &&... args)
 
T & declareValue (const std::string &param_name, ReporterMode mode, Args &&... args)
 
T & declareValueByName (const ReporterValueName &value_name, Args &&... args)
 
T & declareValueByName (const ReporterValueName &value_name, ReporterMode mode, Args &&... args)
 
T & declareValueByName (const ReporterValueName &value_name, Args &&... args)
 
T & declareValueByName (const ReporterValueName &value_name, ReporterMode mode, Args &&... args)
 
T & declareValueByName (const ReporterValueName &value_name, Args &&... args)
 
T & declareValueByName (const ReporterValueName &value_name, ReporterMode mode, Args &&... args)
 
T & declareValueByName (const ReporterValueName &value_name, Args &&... args)
 
T & declareValueByName (const ReporterValueName &value_name, ReporterMode mode, Args &&... args)
 
GenericReal< is_ad > evaluate (SymFunctionPtr &, const std::string &object_name="")
 
GenericReal< is_ad > evaluate (SymFunctionPtr &, const std::vector< GenericReal< is_ad >> &, const std::string &object_name="")
 
void addFParserConstants (SymFunctionPtr &parser, const std::vector< std::string > &constant_names, const std::vector< std::string > &constant_expressions) const
 
virtual void functionsOptimize (SymFunctionPtr &parsed_function)
 
void functionsOptimize (SymFunctionPtr &parsed_function)
 
void functionsOptimize (SymFunctionPtr &parsed_function)
 
void parsedFunctionSetup (SymFunctionPtr &function, const std::string &expression, const std::string &variables, const std::vector< std::string > &constant_names, const std::vector< std::string > &constant_expressions, const libMesh::Parallel::Communicator &comm) const
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

Sampler_sampler
 Sampler given in the parameters, must match the one used to declare the transferred values. More...
 
SubProblem_subproblem
 
FEProblemBase_fe_problem
 
SystemBase_sys
 
const THREAD_ID _tid
 
Assembly_assembly
 
const Moose::CoordinateSystemType_coord_sys
 
const bool _duplicate_initial_execution
 
std::set< std::string > _depend_uo
 
const bool & _enabled
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
const ExecFlagEnum_execute_enum
 
const ExecFlagType_current_execute_flag
 
MooseApp_restartable_app
 
const std::string _restartable_system_name
 
const THREAD_ID _restartable_tid
 
const bool _restartable_read_only
 
FEProblemBase_mci_feproblem
 
FEProblemBase_mdi_feproblem
 
MooseApp_pg_moose_app
 
const std::string _prefix
 
FEProblemBase_sc_fe_problem
 
const THREAD_ID _sc_tid
 
const Real_real_zero
 
const VariableValue_scalar_zero
 
const Point & _point_zero
 
const InputParameters_mi_params
 
const std::string _mi_name
 
const MooseObjectName _mi_moose_object_name
 
FEProblemBase_mi_feproblem
 
SubProblem_mi_subproblem
 
const THREAD_ID _mi_tid
 
const Moose::MaterialDataType _material_data_type
 
MaterialData_material_data
 
bool _stateful_allowed
 
bool _get_material_property_called
 
std::vector< std::unique_ptr< PropertyValue > > _default_properties
 
std::unordered_set< unsigned int_material_property_dependencies
 
const MaterialPropertyName _get_suffix
 
const bool _use_interpolated_state
 
const InputParameters_ti_params
 
FEProblemBase_ti_feproblem
 
bool _is_implicit
 
Real_t
 
const Real_t_old
 
int_t_step
 
Real_dt
 
Real_dt_old
 
bool _is_transient
 
const Parallel::Communicator & _communicator
 
enum FunctionParserUtils::FailureMethod _evalerror_behavior
 
const Real _quiet_nan
 
std::vector< GenericReal< is_ad > > _func_params
 
const Real _epsilon
 
bool _enable_jit
 
bool _enable_ad_cache
 
bool _disable_fpoptimizer
 
bool _enable_auto_optimize
 

Static Protected Attributes

static const std::string _interpolated_old
 
static const std::string _interpolated_older
 
static const char * _eval_error_msg []
 

Private Attributes

const std::string & _function
 User-inputted function string. More...
 
const T & _default_value
 User-inputted default value. More...
 
const std::vector< std::pair< std::string, unsigned int > > _sampler_vars
 Pairs between the variables in the function string and their associated sampler column index. More...
 
const bool _use_time
 Whether or not the function string includes a time variable. More...
 
SymFunctionPtr _func_F
 Parsed function pointer. More...
 

Detailed Description

template<typename T>
class ConditionalSampleReporterTempl< T >

This object is mainly meant for demonstration for eventual active learning algorithms, but could prove useful.

Basically, it enables a inputted function to determine if a multiapp solve is "possible". For instance, maybe a certain sampled value needs to be possitive, this class can filter those samples out and replace quantities of interest with a default value.

Definition at line 17 of file ConditionalSampleReporter.h.

Constructor & Destructor Documentation

◆ ConditionalSampleReporterTempl()

template<typename T >
ConditionalSampleReporterTempl< T >::ConditionalSampleReporterTempl ( const InputParameters parameters)

Definition at line 41 of file ConditionalSampleReporter.C.

45  _function(this->template getParam<std::string>("function")),
46  _default_value(this->template getParam<T>("default_value")),
48  this->template getParam<std::string, unsigned int>("sampler_vars", "sampler_var_indices")),
49  _use_time(this->template getParam<bool>("use_time"))
50 {
51  // Gather variables and see if any of the indexes are out-of-bounds
52  std::stringstream vars;
53  std::string sep = "";
54  for (const auto & it : _sampler_vars)
55  {
56  vars << sep << it.first;
57  if (it.second >= this->sampler().getNumberOfCols())
58  this->paramError("sampler_var_indices",
59  "Provided index ",
60  it.second,
61  " must be smaller than the sampler number of columns (",
62  this->sampler().getNumberOfCols(),
63  ").");
64  sep = ",";
65  }
66  if (_use_time)
67  vars << sep << "t";
68 
69  // Parse the inputted function
70  _func_F = std::make_shared<SymFunction>();
72  if (_func_F->Parse(_function, vars.str()) >= 0)
73  this->paramError("function", "Invalid function:\n", _function, "\n", _func_F->ErrorMsg());
75  _func_F->Optimize();
76 
77  if (_enable_jit)
78  {
79  // let rank 0 do the JIT compilation first
80  if (this->_communicator.rank() != 0)
81  this->_communicator.barrier();
82 
83  _func_F->JITCompile();
84 
85  // wait for ranks > 0 to catch up
86  if (this->_communicator.rank() == 0)
87  this->_communicator.barrier();
88  }
89 
90  _func_params.resize(_sampler_vars.size() + (_use_time ? 1 : 0));
91 }
const std::vector< std::pair< std::string, unsigned int > > _sampler_vars
Pairs between the variables in the function string and their associated sampler column index...
char ** vars
processor_id_type rank() const
const Parallel::Communicator & _communicator
void paramError(const std::string &param, Args... args) const
SymFunctionPtr _func_F
Parsed function pointer.
const std::string & _function
User-inputted function string.
std::vector< GenericReal< is_ad > > _func_params
const InputParameters & parameters() const
const T & _default_value
User-inputted default value.
This is a base class for performing active learning routines, meant to be used in conjunction with Sa...
void setParserFeatureFlags(SymFunctionPtr &) const
const bool _use_time
Whether or not the function string includes a time variable.

Member Function Documentation

◆ declareStochasticReporter()

template<typename T >
std::vector< T > & StochasticReporter::declareStochasticReporter ( std::string  value_name,
const Sampler sampler 
)
protectedinherited

Definition at line 131 of file StochasticReporter.h.

Referenced by StochasticReporter::declareStochasticReporterClone(), and SamplerReporterTransfer::intitializeStochasticReporters().

132 {
133  const ReporterMode mode =
135  return this->template declareValueByName<std::vector<T>, StochasticReporterContext<T>>(
136  value_name, mode, sampler);
137 }
const ReporterMode REPORTER_MODE_ROOT
const unsigned int _parallel_type
const ReporterMode REPORTER_MODE_DISTRIBUTED

◆ declareStochasticReporterClone()

template<typename T >
ReporterName ActiveLearningReporterTempl< T >::declareStochasticReporterClone ( const Sampler sampler,
const ReporterData from_data,
const ReporterName from_reporter,
std::string  prefix = "" 
)
overrideprotectedvirtualinherited

This is overriden for the following reasons: 1) Only one vector can be declared and must match the type of this class.

2) Check that the inputted sampler matches the one given in the parameters. 3) We actually get a pointer to the declared value so we can replace it (if necessary) in the needSample routine. 4) Declare the "need_sample" value which can be used to evaluate the sample or not.

Reimplemented from StochasticReporter.

Definition at line 176 of file ActiveLearningReporterBase.h.

180 {
181  // Only one value is allowed to be declared
182  if (_data)
183  this->mooseError(type(), " can only declare a single reporter value.");
184  // Make sure the inputted sampler is the same one in the parameters
185  else if (sampler.name() != _sampler.name())
186  this->paramError("sampler",
187  "Inputted sampler, ",
188  _sampler.name(),
189  ", is not the same as the one producing data, ",
190  sampler.name(),
191  ".");
192  // Make sure reporter value exists
193  else if (!from_data.hasReporterValue(from_reporter))
194  this->mooseError("Reporter value ", from_reporter, " has not been declared.");
195  // Make sure the reporter value is the right type
196  else if (!from_data.hasReporterValue<T>(from_reporter))
197  this->mooseError(
198  type(), " can only use reporter values of type ", MooseUtils::prettyCppType<T>(), ".");
199 
200  std::string value_name = (prefix.empty() ? "" : prefix + ":") + from_reporter.getObjectName() +
201  ":" + from_reporter.getValueName();
202  _data = &this->declareStochasticReporter<T>(value_name, sampler);
203  return {name(), value_name};
204 }
const Sampler & sampler() const
Get a const reference to the sampler from the parameters.
virtual const std::string & name() const
std::vector< T > * _data
Reporter value declared with the transfer.
const std::string & type() const
void paramError(const std::string &param, Args... args) const
const std::string & getObjectName() const
void mooseError(Args &&... args) const
bool hasReporterValue(const ReporterName &reporter_name) const
const std::string & getValueName() const
Sampler & _sampler
Sampler given in the parameters, must match the one used to declare the transferred values...

◆ execute()

template<typename T >
void ActiveLearningReporterTempl< T >::execute ( )
overridevirtualinherited

Here we loop through the samples and call the needSample function to determine if the sample needs to be run and define a value in its place.

Reimplemented from StochasticReporter.

Definition at line 138 of file ActiveLearningReporterBase.h.

139 {
140  // If requesting global data, fill it in
142  {
143  // Gather inputs for the current step
145  std::vector<Real>(_sampler.getNumberOfCols(), 0.0));
148  for (auto & inp : _input_data)
149  gatherSum(inp);
150  }
152  {
153  if (!_data)
154  mooseError("Output data has been requested, but none was declared in this object.");
155  _output_data = *_data;
157  }
158 
159  // Optional call for before sampler loop
160  preNeedSample();
161 
162  // Dummy value in case _data has not been declared yet
163  T dummy;
164  // Loop over samples to determine if sample is needed. Replace value in _data
165  // (typically only if a sample is not needed). We insert a dummy value in case
166  // _data has not been declared.
167  for (const auto & i : make_range(_sampler.getNumberOfLocalRows()))
169  i,
171  (_data ? (*_data)[i] : dummy));
172 }
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
std::vector< Real > getNextLocalRow()
dof_id_type getLocalRowBegin() const
virtual void preNeedSample()
Optional virtual function that is called before the sampler loop calling needSample.
const Parallel::Communicator & _communicator
dof_id_type getNumberOfLocalRows() const
virtual bool needSample(const std::vector< Real > &, dof_id_type, dof_id_type, T &)
This routine is called during the sampler loop in execute() and is meant to fill in the "need_sample"...
std::vector< T > * _data
Reporter value declared with the transfer.
bool _output_data_requested
Whether or not to gather global output data.
void gatherSum(T &value)
std::vector< T > _output_data
Global output data from sampler.
std::vector< bool > & _need_sample
Reporter value determining whether we need to evaluate the sample through a multiapp or other means...
bool _input_data_requested
Whether or not to gather global input data.
dof_id_type getLocalRowEnd() const
dof_id_type getNumberOfRows() const
std::vector< std::vector< Real > > _input_data
Global input data from sampler.
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
Sampler & _sampler
Sampler given in the parameters, must match the one used to declare the transferred values...
dof_id_type getNumberOfCols() const
uint8_t dof_id_type

◆ finalize()

virtual void StochasticReporter::finalize ( )
inlineoverridevirtualinherited

Implements GeneralReporter.

Reimplemented in MappingReporter, and EvaluateSurrogate.

Definition at line 114 of file StochasticReporter.h.

114 {}

◆ getGlobalInputData()

template<typename T>
const std::vector<std::vector<Real> >& ActiveLearningReporterTempl< T >::getGlobalInputData ( ) const
inlineprotectedinherited

Definition at line 59 of file ActiveLearningReporterBase.h.

60  {
61  _input_data_requested = true;
62  return _input_data;
63  }
bool _input_data_requested
Whether or not to gather global input data.
std::vector< std::vector< Real > > _input_data
Global input data from sampler.

◆ getGlobalOutputData()

template<typename T>
const std::vector<T>& ActiveLearningReporterTempl< T >::getGlobalOutputData ( ) const
inlineprotectedinherited

Get a const reference to the output data.

Definition at line 68 of file ActiveLearningReporterBase.h.

69  {
71  return _output_data;
72  }
bool _output_data_requested
Whether or not to gather global output data.
std::vector< T > _output_data
Global output data from sampler.

◆ initialize()

virtual void StochasticReporter::initialize ( )
inlineoverridevirtualinherited

Implements GeneralReporter.

Reimplemented in MappingReporter, and EvaluateSurrogate.

Definition at line 112 of file StochasticReporter.h.

112 {}

◆ needSample()

template<typename T >
bool ConditionalSampleReporterTempl< T >::needSample ( const std::vector< Real > &  row,
dof_id_type  local_ind,
dof_id_type  global_ind,
T &  val 
)
overrideprotectedvirtual

This evaluates the inputted function to determine whether a multiapp solve is necessary/allowed, otherwise it replaces the "transferred" quantity with a default value.

Reimplemented from ActiveLearningReporterTempl< T >.

Definition at line 95 of file ConditionalSampleReporter.C.

99 {
100  // Input sampler values
101  for (const auto & p : index_range(_sampler_vars))
102  _func_params[p] = row[_sampler_vars[p].second];
103  // Input time
104  if (_use_time)
105  _func_params[_sampler_vars.size()] = this->_t;
106 
107  // If the function is not zero, then a sample is needed
108  if (evaluate(_func_F))
109  return true;
110  // Otherwise we will set the quantitiy of interest to the default value
111  else
112  {
113  val = _default_value;
114  return false;
115  }
116 }
GenericReal< is_ad > evaluate(SymFunctionPtr &, const std::string &object_name="")
const std::vector< std::pair< std::string, unsigned int > > _sampler_vars
Pairs between the variables in the function string and their associated sampler column index...
SymFunctionPtr _func_F
Parsed function pointer.
std::vector< GenericReal< is_ad > > _func_params
const T & _default_value
User-inputted default value.
auto index_range(const T &sizable)
const bool _use_time
Whether or not the function string includes a time variable.

◆ preNeedSample()

template<typename T>
virtual void ActiveLearningReporterTempl< T >::preNeedSample ( )
inlineprotectedvirtualinherited

Optional virtual function that is called before the sampler loop calling needSample.

Reimplemented in ActiveLearningGPDecision, and BiFidelityActiveLearningGPDecision.

Definition at line 77 of file ActiveLearningReporterBase.h.

77 {}

◆ sampler()

template<typename T>
const Sampler& ActiveLearningReporterTempl< T >::sampler ( ) const
inlineprotectedinherited

Get a const reference to the sampler from the parameters.

This is preferred over having _sampler being a protected member since we don't want derived classes changing the state of the sampler during the loop in execute.

Definition at line 57 of file ActiveLearningReporterBase.h.

57 { return _sampler; }
Sampler & _sampler
Sampler given in the parameters, must match the one used to declare the transferred values...

◆ validParams()

template<typename T >
InputParameters ConditionalSampleReporterTempl< T >::validParams ( )
static

Definition at line 16 of file ConditionalSampleReporter.C.

17 {
20  params.addClassDescription("Evaluates parsed function to determine if sample needs to be "
21  "evaluated, otherwise data is set to a default value.");
22 
23  params.addRequiredCustomTypeParam<std::string>(
24  "function",
25  "FunctionExpression",
26  "function expression that should evaluate to 0 if sample should NOT be evaluated.");
27  params.addRequiredParam<T>("default_value",
28  "Value to replace in data when sample is not evaluated.");
29  params.addParam<std::vector<std::string>>(
30  "sampler_vars", std::vector<std::string>(), "Vector of variables defined by sampler values.");
31  params.addParam<std::vector<unsigned int>>("sampler_var_indices",
32  std::vector<unsigned int>(),
33  "Vector of indices defining the sampler column index "
34  "associated with the variables in 'sampler_vars'.");
35  params.addParam<bool>(
36  "use_time", true, "Make time (t) variable available in the function expression.");
37  return params;
38 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
void addRequiredCustomTypeParam(const std::string &name, const std::string &custom_type, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()

Member Data Documentation

◆ _default_value

template<typename T >
const T& ConditionalSampleReporterTempl< T >::_default_value
private

User-inputted default value.

Definition at line 52 of file ConditionalSampleReporter.h.

◆ _func_F

template<typename T >
SymFunctionPtr ConditionalSampleReporterTempl< T >::_func_F
private

Parsed function pointer.

Definition at line 59 of file ConditionalSampleReporter.h.

Referenced by ConditionalSampleReporterTempl< T >::ConditionalSampleReporterTempl().

◆ _function

template<typename T >
const std::string& ConditionalSampleReporterTempl< T >::_function
private

User-inputted function string.

Definition at line 50 of file ConditionalSampleReporter.h.

Referenced by ConditionalSampleReporterTempl< T >::ConditionalSampleReporterTempl().

◆ _sampler

template<typename T>
Sampler& ActiveLearningReporterTempl< T >::_sampler
protectedinherited

Sampler given in the parameters, must match the one used to declare the transferred values.

Definition at line 100 of file ActiveLearningReporterBase.h.

Referenced by ActiveLearningReporterTempl< Real >::sampler().

◆ _sampler_vars

template<typename T >
const std::vector<std::pair<std::string, unsigned int> > ConditionalSampleReporterTempl< T >::_sampler_vars
private

Pairs between the variables in the function string and their associated sampler column index.

Definition at line 55 of file ConditionalSampleReporter.h.

Referenced by ConditionalSampleReporterTempl< T >::ConditionalSampleReporterTempl().

◆ _use_time

template<typename T >
const bool ConditionalSampleReporterTempl< T >::_use_time
private

Whether or not the function string includes a time variable.

Definition at line 57 of file ConditionalSampleReporter.h.

Referenced by ConditionalSampleReporterTempl< T >::ConditionalSampleReporterTempl().


The documentation for this class was generated from the following files: