https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
MappingReporter Class Reference

A tool to reduce solution fields to coordinates in the latent space. More...

#include <MappingReporter.h>

Inheritance diagram for MappingReporter:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 MappingReporter (const InputParameters &parameters)
 
virtual void initialize () override
 
void initialSetup () override
 
virtual void execute () 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 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
 
VariableMappingBasegetMapping (const std::string &name) const
 Get the mapping using the parameters of the moose object. More...
 
VariableMappingBasegetMappingByName (const UserObjectName &name) const
 Get the mapping by supplying the name of the object in the warehouse. More...
 

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 Member Functions

void mapParallelStorageData ()
 Map the available data in a parallel storage into the latent space. More...
 
void mapVariableData ()
 Map the available data in variables into the latent space. More...
 
virtual ReporterName declareStochasticReporterClone (const Sampler &sampler, const ReporterData &from_data, const ReporterName &from_reporter, std::string prefix="")
 
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)
 

Static Protected Member Functions

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

Protected Attributes

const ParallelSolutionStorage *const _parallel_storage
 If we already have solution fields stored from previous runs, we can use their ParallelStorageObject to obtain the corresponding coefficients. More...
 
Sampler *const _sampler
 We only need the sampler to check which coefficients would go to which processor in case a ParallelSolutionStorage is used. More...
 
const UserObjectName & _mapping_name
 The name of the mapping object we would like to use. More...
 
VariableMappingBase_mapping
 Link to the mapping object, we need this to be a pointer due to the fact that we can only fetch this in initialSetup. More...
 
const std::vector< VariableName > & _variable_names
 The variables we would like to map. 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
 
std::vector< std::vector< std::vector< Real > > * > _vector_real_values_parallel_storage
 
std::vector< std::vector< Real > * > _vector_real_values
 

Static Protected Attributes

static const std::string _interpolated_old
 
static const std::string _interpolated_older
 

Detailed Description

A tool to reduce solution fields to coordinates in the latent space.

Definition at line 21 of file MappingReporter.h.

Constructor & Destructor Documentation

◆ MappingReporter()

MappingReporter::MappingReporter ( const InputParameters parameters)

Definition at line 43 of file MappingReporter.C.

45  MappingInterface(this),
46  _parallel_storage(isParamValid("parallel_storage")
47  ? &getUserObject<ParallelSolutionStorage>("parallel_storage")
48  : nullptr),
49  _sampler(isParamValid("sampler") ? &getSampler("sampler") : nullptr),
50  _mapping_name(getParam<UserObjectName>("mapping")),
51  _variable_names(getParam<std::vector<VariableName>>("variables"))
52 {
54  {
55  if (_sampler)
56  {
57  // Declaring the reporters for every variable. This is a collection of vectors which describe
58  // the coordinates of the solution fields in the latent space.
60  for (auto var_i : index_range(_variable_names))
61  {
62  _vector_real_values_parallel_storage[var_i] = &declareStochasticReporter<std::vector<Real>>(
63  _variable_names[var_i] + "_" + _mapping_name, *_sampler);
64  }
65  }
66  else
67  paramError("sampler",
68  "We need a sampler object if the parallel storage is supplied! The sampler object "
69  "shall be the same as the one used to generate the solution fields in the "
70  "parallel storage object.");
71  }
72  else
73  {
74  // Declaring the reporters for every variable. This is a collection of vectors which describe
75  // the coordinates of the solution fields in the latent space.
76  _vector_real_values.resize(_variable_names.size());
77  for (auto var_i : index_range(_variable_names))
78  _vector_real_values[var_i] = &declareValueByName<std::vector<Real>>(
79  _variable_names[var_i] + "_" + _mapping_name, REPORTER_MODE_ROOT);
80  }
81 }
T & declareValueByName(const ReporterValueName &value_name, Args &&... args)
Sampler *const _sampler
We only need the sampler to check which coefficients would go to which processor in case a ParallelSo...
const std::vector< VariableName > & _variable_names
The variables we would like to map.
const UserObjectName & _mapping_name
The name of the mapping object we would like to use.
StochasticReporter(const InputParameters &parameters)
bool isParamValid(const std::string &name) const
const ParallelSolutionStorage *const _parallel_storage
If we already have solution fields stored from previous runs, we can use their ParallelStorageObject ...
const T & getParam(const std::string &name) const
void paramError(const std::string &param, Args... args) const
T & getSampler(const std::string &name)
const InputParameters & parameters() const
std::vector< std::vector< Real > * > _vector_real_values
MappingInterface(const MooseObject *moose_object)
Construct using a moose object (usually the object which inherits from the interface) ...
std::vector< std::vector< std::vector< Real > > * > _vector_real_values_parallel_storage
auto index_range(const T &sizable)

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()

ReporterName StochasticReporter::declareStochasticReporterClone ( const Sampler sampler,
const ReporterData from_data,
const ReporterName from_reporter,
std::string  prefix = "" 
)
protectedvirtualinherited

Reimplemented in ActiveLearningReporterTempl< T >, ActiveLearningReporterTempl< Real >, and StochasticMatrix.

Definition at line 39 of file StochasticReporter.C.

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

43 {
44  std::string value_name = (prefix.empty() ? "" : prefix + ":") + from_reporter.getObjectName() +
45  ":" + from_reporter.getValueName();
46 
47  if (!from_data.hasReporterValue(from_reporter))
48  mooseError("Reporter value ", from_reporter, " has not been declared.");
49 
50  // Single quantities
51  if (from_data.hasReporterValue<bool>(from_reporter))
52  declareStochasticReporter<bool>(value_name, sampler);
53  else if (from_data.hasReporterValue<int>(from_reporter))
54  declareStochasticReporter<int>(value_name, sampler);
55  else if (from_data.hasReporterValue<Real>(from_reporter))
56  declareStochasticReporter<Real>(value_name, sampler);
57  else if (from_data.hasReporterValue<std::string>(from_reporter))
58  declareStochasticReporter<std::string>(value_name, sampler);
59  // Vector quantities
60  else if (from_data.hasReporterValue<std::vector<bool>>(from_reporter))
61  declareStochasticReporter<std::vector<bool>>(value_name, sampler);
62  else if (from_data.hasReporterValue<std::vector<int>>(from_reporter))
63  declareStochasticReporter<std::vector<int>>(value_name, sampler);
64  else if (from_data.hasReporterValue<std::vector<Real>>(from_reporter))
65  declareStochasticReporter<std::vector<Real>>(value_name, sampler);
66  else if (from_data.hasReporterValue<std::vector<std::string>>(from_reporter))
67  declareStochasticReporter<std::vector<std::string>>(value_name, sampler);
68  // Vector of vector quantities
69  else if (from_data.hasReporterValue<std::vector<std::vector<bool>>>(from_reporter))
70  declareStochasticReporter<std::vector<std::vector<bool>>>(value_name, sampler);
71  else if (from_data.hasReporterValue<std::vector<std::vector<int>>>(from_reporter))
72  declareStochasticReporter<std::vector<std::vector<int>>>(value_name, sampler);
73  else if (from_data.hasReporterValue<std::vector<std::vector<Real>>>(from_reporter))
74  declareStochasticReporter<std::vector<std::vector<Real>>>(value_name, sampler);
75  else if (from_data.hasReporterValue<std::vector<std::vector<std::string>>>(from_reporter))
76  declareStochasticReporter<std::vector<std::vector<std::string>>>(value_name, sampler);
77  else
78  return {}; // Empty ReporterName to show that reporter value is unsupported type
79 
80  return {name(), value_name};
81 }
virtual const std::string & name() const
const std::string & getObjectName() const
void mooseError(Args &&... args) const
bool hasReporterValue(const ReporterName &reporter_name) const
std::vector< T > & declareStochasticReporter(std::string value_name, const Sampler &sampler)
const std::string & getValueName() const

◆ execute()

void MappingReporter::execute ( )
overridevirtual

Reimplemented from StochasticReporter.

Definition at line 90 of file MappingReporter.C.

91 {
92  // We have two execution modes. If the parallel storage is supplied we loop over the snapshots in
93  // the parallel storage, and project them to obtain their coefficients.
96  // The alternative option is to just fetch the variables and reduce them
97  else
99 }
const ParallelSolutionStorage *const _parallel_storage
If we already have solution fields stored from previous runs, we can use their ParallelStorageObject ...
void mapParallelStorageData()
Map the available data in a parallel storage into the latent space.
void mapVariableData()
Map the available data in variables into the latent space.

◆ finalize()

virtual void MappingReporter::finalize ( )
inlineoverridevirtual

Reimplemented from StochasticReporter.

Definition at line 30 of file MappingReporter.h.

30 {}

◆ getMapping()

VariableMappingBase & MappingInterface::getMapping ( const std::string &  name) const
inherited

Get the mapping using the parameters of the moose object.

Parameters
nameThe parameter name

Definition at line 40 of file MappingInterface.C.

Referenced by SingularTripletReporter::initialSetup(), and InverseMapping::initialSetup().

41 {
42  return getMappingByName(_smi_params.get<UserObjectName>(name));
43 }
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
const std::string name
Definition: Setup.h:20
VariableMappingBase & getMappingByName(const UserObjectName &name) const
Get the mapping by supplying the name of the object in the warehouse.
const InputParameters & _smi_params
Parameters of the object with this interface.

◆ getMappingByName()

VariableMappingBase & MappingInterface::getMappingByName ( const UserObjectName &  name) const
inherited

Get the mapping by supplying the name of the object in the warehouse.

Parameters
nameThe name of the mapping object

Definition at line 26 of file MappingInterface.C.

Referenced by MappingInterface::getMapping(), initialSetup(), and MappingOutput::output().

27 {
28  std::vector<VariableMappingBase *> models;
30  .query()
31  .condition<AttribName>(name)
32  .condition<AttribSystem>("VariableMappingBase")
33  .queryInto(models);
34  if (models.empty())
35  mooseError("Unable to find a Mapping object with the name '" + name + "'");
36  return *(models[0]);
37 }
void mooseError(Args &&... args)
FEProblemBase & _smi_feproblem
Reference to FEProblemBase instance.
TheWarehouse & theWarehouse() const
const std::string name
Definition: Setup.h:20
Query query()

◆ initialize()

virtual void MappingReporter::initialize ( )
inlineoverridevirtual

Reimplemented from StochasticReporter.

Definition at line 27 of file MappingReporter.h.

27 {}

◆ initialSetup()

void MappingReporter::initialSetup ( )
overridevirtual

Reimplemented from GeneralReporter.

Definition at line 84 of file MappingReporter.C.

85 {
87 }
VariableMappingBase * _mapping
Link to the mapping object, we need this to be a pointer due to the fact that we can only fetch this ...
const UserObjectName & _mapping_name
The name of the mapping object we would like to use.
VariableMappingBase & getMappingByName(const UserObjectName &name) const
Get the mapping by supplying the name of the object in the warehouse.

◆ mapParallelStorageData()

void MappingReporter::mapParallelStorageData ( )
protected

Map the available data in a parallel storage into the latent space.

Definition at line 102 of file MappingReporter.C.

Referenced by execute().

103 {
104  // If the mapping is not built yet, we shall build it using the solutions in the parallel
105  // storage. The conditional process is decided in the mapping object.
106  for (const auto & var : _variable_names)
107  _mapping->buildMapping(var);
108 
109  // Since the solution fields can be distributed among the processes of each sub-application
110  // (unlike samples and reporter values which are just on the root process), we need to use the
111  // information in the sampler to check which solution is where.
112  const auto rank_config = _sampler->getRankConfig(true);
113 
114  // We need to do some parallel communication in case we have snapshots on processes other than
115  // the roots of the sub-applications. This will collect the vectors that we need to send in the
116  // following format:
117  // <to which processor, (variable index, global sample index, solution field)>
118  std::unordered_map<processor_id_type,
119  std::vector<std::tuple<unsigned int, unsigned int, std::vector<Real>>>>
120  send_map;
121 
122  // We need to use the rank config here to ensure we are looping on the non-root processors
123  // too
124  for (const auto sample_i : make_range(rank_config.num_local_sims))
125  {
126  std::vector<Real> data = _sampler->getNextLocalRow();
127 
128  // Converting the local indexing to global sample indices
129  const unsigned int global_i = sample_i + _sampler->getLocalRowBegin();
130 
131  for (const auto var_i : index_range(_variable_names))
132  {
133  // Create a temporary storage for the coordinates in the latent space
134  std::vector<Real> local_vector;
135 
136  // Check if the current process has this global sample
137  if (_parallel_storage->hasGlobalSample(global_i, _variable_names[var_i]))
138  {
139  // Fetch the solution vector for the given sample index and variable
140  const auto & full_vector =
142 
143  // At the moment we only support simulations which have only one solution field
144  // per sample. This is typically a steady-state simulation.
145  if (full_vector.size() != 1)
146  mooseError("MappingReporter is only supported for simulations with one solution "
147  "field per run!");
148 
149  // We use the mapping object to generate the coordinates in the latent space
150  _mapping->map(_variable_names[var_i], global_i, local_vector);
151 
152  // If we are on the root processor of the sub-application, we simply insert the result
153  // into the reporter storage space. Othervise we will send it to the root process.
154  if (rank_config.is_first_local_rank)
155  (*_vector_real_values_parallel_storage[var_i])[sample_i] = local_vector;
156  else
157  send_map[rank_config.my_first_rank].emplace_back(
158  var_i, sample_i, std::move(local_vector));
159  }
160  }
161  }
162 
163  // This functor describes what we do when we receive the samples from other processes
164  auto receive_functor =
165  [this](processor_id_type /*pid*/,
166  const std::vector<std::tuple<unsigned int, unsigned int, std::vector<Real>>> & vectors)
167  {
168  // We unpack the tuples and insert the values into the reporter
169  for (const auto & [var_i, sample_i, vector] : vectors)
170  (*_vector_real_values_parallel_storage[var_i])[sample_i] = std::move(vector);
171  };
172 
173  // We send the results from the non-root processors to the root processors
174  Parallel::push_parallel_packed_range(_communicator, send_map, (void *)nullptr, receive_functor);
175 }
Sampler *const _sampler
We only need the sampler to check which coefficients would go to which processor in case a ParallelSo...
VariableMappingBase * _mapping
Link to the mapping object, we need this to be a pointer due to the fact that we can only fetch this ...
std::vector< Real > getNextLocalRow()
const std::vector< VariableName > & _variable_names
The variables we would like to map.
dof_id_type getLocalRowBegin() const
const Parallel::Communicator & _communicator
const ParallelSolutionStorage *const _parallel_storage
If we already have solution fields stored from previous runs, we can use their ParallelStorageObject ...
uint8_t processor_id_type
virtual void buildMapping(const VariableName &vname)=0
Abstract function for building mapping for a given variable.
bool hasGlobalSample(unsigned int global_sample_i, const VariableName &variable) const
Determine if we have the solution vector with a given global sample index for a given variable...
const LocalRankConfig & getRankConfig(bool batch_mode) const
virtual void map(const VariableName &vname, const DenseVector< Real > &full_order_vector, std::vector< Real > &reduced_order_vector) const =0
Map a full-order solution vector (in DenseVector format) for a given variable into a reduced-order ve...
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
const std::vector< DenseVector< Real > > & getGlobalSample(unsigned int global_sample_i, const VariableName &variable) const
Get the serialized solution field which is associated with a given global sample index and variable...
std::vector< std::vector< std::vector< Real > > * > _vector_real_values_parallel_storage
auto index_range(const T &sizable)

◆ mapVariableData()

void MappingReporter::mapVariableData ( )
protected

Map the available data in variables into the latent space.

Definition at line 178 of file MappingReporter.C.

Referenced by execute().

179 {
180  NonlinearSystemBase & nl = _fe_problem.getNonlinearSystemBase(/*nl_sys_num=*/0);
181 
182  for (unsigned int var_i = 0; var_i < _variable_names.size(); ++var_i)
183  {
184  // Getting the corresponding DoF indices for the variable.
186 
187  // We need to serialize the solution on the root process first.
188  DenseVector<Real> serialized_solution;
189  nl.solution().localize(serialized_solution.get_values(),
190  processor_id() == 0 ? nl.getVariableGlobalDoFs()
191  : std::vector<dof_id_type>());
192  // We map the solution into the latent space and save the solutions in one go
193  if (processor_id() == 0)
194  _mapping->map(_variable_names[var_i], serialized_solution, *_vector_real_values[var_i]);
195  }
196 }
VariableMappingBase * _mapping
Link to the mapping object, we need this to be a pointer due to the fact that we can only fetch this ...
NumericVector< Number > & solution()
const std::vector< VariableName > & _variable_names
The variables we would like to map.
const std::vector< dof_id_type > & getVariableGlobalDoFs()
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
virtual void map(const VariableName &vname, const DenseVector< Real > &full_order_vector, std::vector< Real > &reduced_order_vector) const =0
Map a full-order solution vector (in DenseVector format) for a given variable into a reduced-order ve...
FEProblemBase & _fe_problem
std::vector< std::vector< Real > * > _vector_real_values
void setVariableGlobalDoFs(const std::string &var_name)
processor_id_type processor_id() const
virtual void localize(std::vector< Number > &v_local) const =0

◆ validParams()

InputParameters MappingReporter::validParams ( )
static

Definition at line 21 of file MappingReporter.C.

22 {
26  params.addClassDescription(
27  "A reporter which can map full solution fields to a latent space for given variables.");
28  params.addRequiredParam<UserObjectName>("mapping", "Name of the mapping object.");
29  params.addRequiredParam<std::vector<VariableName>>(
30  "variables", "The names of the variables which need to be mapped to the latent space.");
31  params.addParam<std::string>("parallel_storage",
32  "The storage space where the snapshots are stored. These snapshots "
33  "are used to build the mapping. If this parameter is not specified, "
34  "the reporter will fetch the variable from the nonlinear system.");
35  params.addParam<SamplerName>(
36  "sampler",
37  "Sampler be able to identify how the samples are distributed among "
38  "the processes. Only needed if parallel storage is defined. It is important to have the "
39  "same sampler here as the one used to prepare the snapshots in the parallel storage.");
40  return params;
41 }
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()

Member Data Documentation

◆ _mapping

VariableMappingBase* MappingReporter::_mapping
protected

Link to the mapping object, we need this to be a pointer due to the fact that we can only fetch this in initialSetup.

Definition at line 50 of file MappingReporter.h.

Referenced by initialSetup(), mapParallelStorageData(), and mapVariableData().

◆ _mapping_name

const UserObjectName& MappingReporter::_mapping_name
protected

The name of the mapping object we would like to use.

Definition at line 48 of file MappingReporter.h.

Referenced by initialSetup(), and MappingReporter().

◆ _parallel_storage

const ParallelSolutionStorage* const MappingReporter::_parallel_storage
protected

If we already have solution fields stored from previous runs, we can use their ParallelStorageObject to obtain the corresponding coefficients.

Definition at line 41 of file MappingReporter.h.

Referenced by execute(), mapParallelStorageData(), and MappingReporter().

◆ _sampler

Sampler* const MappingReporter::_sampler
protected

We only need the sampler to check which coefficients would go to which processor in case a ParallelSolutionStorage is used.

Definition at line 45 of file MappingReporter.h.

Referenced by mapParallelStorageData(), and MappingReporter().

◆ _variable_names

const std::vector<VariableName>& MappingReporter::_variable_names
protected

The variables we would like to map.

Definition at line 53 of file MappingReporter.h.

Referenced by mapParallelStorageData(), MappingReporter(), and mapVariableData().

◆ _vector_real_values

std::vector<std::vector<Real> *> MappingReporter::_vector_real_values
protected

Definition at line 58 of file MappingReporter.h.

Referenced by MappingReporter(), and mapVariableData().

◆ _vector_real_values_parallel_storage

std::vector<std::vector<std::vector<Real> > *> MappingReporter::_vector_real_values_parallel_storage
protected

Links to the storage spaces (reporters) where we collect the coefficients

Definition at line 57 of file MappingReporter.h.

Referenced by mapParallelStorageData(), and MappingReporter().


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