Skip to content

Commit

Permalink
break header dependency in material property interface idaholab#17586
Browse files Browse the repository at this point in the history
  • Loading branch information
YaqiWang authored and aeslaughter committed Jun 2, 2021
1 parent f6530c2 commit bedf923
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 8 deletions.
26 changes: 18 additions & 8 deletions framework/include/materials/MaterialPropertyInterface.h
Expand Up @@ -11,16 +11,16 @@

// MOOSE includes
#include "MaterialProperty.h"
#include "FEProblemBase.h"
#include "MooseTypes.h"
#include "MaterialData.h"
#include "MathUtils.h"
#include "MooseObjectName.h"
#include "InputParameters.h"

// Forward declarations
class InputParameters;
class MaterialPropertyInterface;
class MooseObject;
class FEProblemBase;

template <>
InputParameters validParams<MaterialPropertyInterface>();
Expand Down Expand Up @@ -345,6 +345,16 @@ class MaterialPropertyInterface
std::set<unsigned int> _material_property_dependencies;

private:
/*
* A proxy method for _mi_feproblem.getMaxQps()
*/
unsigned int getMaxQps() const;

/*
* A proxy method for _mi_feproblem.addConsumedPropertyName()
*/
void addConsumedPropertyName(const MooseObjectName & obj_name, const std::string & prop_name);

/// BoundaryRestricted flag
const bool _mi_boundary_restricted;

Expand Down Expand Up @@ -476,7 +486,7 @@ MaterialPropertyInterface::getMaterialPropertyByName(const MaterialPropertyName
_material_property_dependencies.insert(_material_data->getPropertyId(name));

// Update consumed properties in MaterialPropertyDebugOutput
_mi_feproblem.addConsumedPropertyName(_mi_moose_object_name, name);
addConsumedPropertyName(_mi_moose_object_name, name);

return _material_data->getProperty<T>(name);
}
Expand All @@ -497,7 +507,7 @@ MaterialPropertyInterface::getADMaterialPropertyByName(const MaterialPropertyNam
_material_property_dependencies.insert(_material_data->getPropertyId(name));

// Update consumed properties in MaterialPropertyDebugOutput
_mi_feproblem.addConsumedPropertyName(_mi_moose_object_name, name);
addConsumedPropertyName(_mi_moose_object_name, name);

return _material_data->getADProperty<T>(name);
}
Expand Down Expand Up @@ -552,10 +562,10 @@ MaterialPropertyInterface::getBlockMaterialProperty(const MaterialPropertyName &
_material_property_dependencies.insert(_material_data->getPropertyId(name));

// Update consumed properties in MaterialPropertyDebugOutput
_mi_feproblem.addConsumedPropertyName(_mi_moose_object_name, name);
addConsumedPropertyName(_mi_moose_object_name, name);

return std::pair<const MaterialProperty<T> *, std::set<SubdomainID>>(
&_material_data->getProperty<T>(name), _mi_feproblem.getMaterialPropertyBlocks(name));
&_material_data->getProperty<T>(name), getMaterialPropertyBlocks(name));
}

template <typename T>
Expand Down Expand Up @@ -595,7 +605,7 @@ MaterialPropertyInterface::getGenericZeroMaterialPropertyByName(const std::strin

// resize to accomodate maximum number of qpoints
// (in multiapp scenarios getMaxQps can return different values in each app; we need the max)
unsigned int nqp = _mi_feproblem.getMaxQps();
unsigned int nqp = getMaxQps();
if (nqp > zero.size())
zero.resize(nqp);

Expand All @@ -615,7 +625,7 @@ MaterialPropertyInterface::getGenericZeroMaterialProperty()

// resize to accomodate maximum number of qpoints
// (in multiapp scenarios getMaxQps can return different values in each app; we need the max)
unsigned int nqp = _mi_feproblem.getMaxQps();
unsigned int nqp = getMaxQps();
if (nqp > zero.size())
zero.resize(nqp);

Expand Down
2 changes: 2 additions & 0 deletions framework/src/fvkernels/FVFluxKernel.C
Expand Up @@ -13,7 +13,9 @@
#include "SystemBase.h"
#include "MooseMesh.h"
#include "ADUtils.h"

#include "libmesh/elem.h"
#include "libmesh/system.h"

InputParameters
FVFluxKernel::validParams()
Expand Down
14 changes: 14 additions & 0 deletions framework/src/materials/MaterialPropertyInterface.C
Expand Up @@ -11,6 +11,7 @@
#include "MaterialPropertyInterface.h"
#include "MooseApp.h"
#include "MaterialBase.h"
#include "FEProblemBase.h"

defineLegacyParams(MaterialPropertyInterface);

Expand Down Expand Up @@ -205,6 +206,19 @@ MaterialPropertyInterface::getMaterialPropertyBoundaryNames(const std::string &
return _mi_feproblem.getMaterialPropertyBoundaryNames(name);
}

unsigned int
MaterialPropertyInterface::getMaxQps() const
{
return _mi_feproblem.getMaxQps();
}

void
MaterialPropertyInterface::addConsumedPropertyName(const MooseObjectName & obj_name,
const std::string & prop_name)
{
return _mi_feproblem.addConsumedPropertyName(obj_name, prop_name);
}

void
MaterialPropertyInterface::checkMaterialProperty(const std::string & name)
{
Expand Down
1 change: 1 addition & 0 deletions framework/src/materials/TwoMaterialPropertyInterface.C
Expand Up @@ -10,6 +10,7 @@
#include "TwoMaterialPropertyInterface.h"
#include "MaterialData.h"
#include "InputParameters.h"
#include "FEProblemBase.h"

defineLegacyParams(TwoMaterialPropertyInterface);

Expand Down

0 comments on commit bedf923

Please sign in to comment.