Skip to content

Commit

Permalink
fix neighbor material coverage idaholab#9482
Browse files Browse the repository at this point in the history
  • Loading branch information
YaqiWang committed Jul 13, 2017
1 parent e312dc4 commit 114841a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
6 changes: 3 additions & 3 deletions framework/include/materials/MaterialPropertyInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,13 @@ class MaterialPropertyInterface
/// The set of material properties (as given by their IDs) that _this_ object depends on
std::set<unsigned int> _material_property_dependencies;

/// Check and throw an error if the execution has progerssed past the construction stage
void checkExecutionStage();

private:
/// An initialization routine needed for dual constructors
void initializeMaterialPropertyInterface(const InputParameters & parameters);

/// Check and throw an error if the execution has progerssed past the construction stage
void checkExecutionStage();

/// Empty sets for referencing when ids is not included
const std::set<SubdomainID> _empty_block_ids;

Expand Down
21 changes: 21 additions & 0 deletions framework/include/materials/TwoMaterialPropertyInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,17 @@ class TwoMaterialPropertyInterface : public MaterialPropertyInterface
* This class has two constructors:
* (1) not restricted to boundaries or blocks
* (2) restricted to only blocks
* (3) restricted to only boundaries
* (4) restricted to both blocks and boundaries
*/
TwoMaterialPropertyInterface(const MooseObject * moose_object);
TwoMaterialPropertyInterface(const MooseObject * moose_object,
const std::set<SubdomainID> & block_ids);
TwoMaterialPropertyInterface(const MooseObject * moose_object,
const std::set<BoundaryID> & boundary_ids);
TwoMaterialPropertyInterface(const MooseObject * moose_object,
const std::set<SubdomainID> & block_ids,
const std::set<BoundaryID> & boundary_ids);
///@}

/**
Expand Down Expand Up @@ -71,7 +78,13 @@ TwoMaterialPropertyInterface::getNeighborMaterialProperty(const std::string & na
if (default_property)
return *default_property;
else
{
checkExecutionStage();
checkMaterialProperty(prop_name);
markMatPropRequested(prop_name);
_material_property_dependencies.insert(_neighbor_material_data->getPropertyId(prop_name));
return _neighbor_material_data->getProperty<T>(prop_name);
}
}

template <typename T>
Expand All @@ -86,7 +99,11 @@ TwoMaterialPropertyInterface::getNeighborMaterialPropertyOld(const std::string &
if (default_property)
return *default_property;
else
{
markMatPropRequested(prop_name);
_material_property_dependencies.insert(_neighbor_material_data->getPropertyId(prop_name));
return _neighbor_material_data->getPropertyOld<T>(prop_name);
}
}

template <typename T>
Expand All @@ -101,7 +118,11 @@ TwoMaterialPropertyInterface::getNeighborMaterialPropertyOlder(const std::string
if (default_property)
return *default_property;
else
{
markMatPropRequested(prop_name);
_material_property_dependencies.insert(_neighbor_material_data->getPropertyId(prop_name));
return _neighbor_material_data->getPropertyOlder<T>(prop_name);
}
}

#endif // TWOMATERIALPROPERTYINTERFACE_H
2 changes: 1 addition & 1 deletion framework/src/dgkernels/DGKernel.C
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ DGKernel::DGKernel(const InputParameters & parameters)
FunctionInterface(this),
UserObjectInterface(this),
NeighborCoupleableMooseVariableDependencyIntermediateInterface(this, false, false),
TwoMaterialPropertyInterface(this),
TwoMaterialPropertyInterface(this, blockIDs(), boundaryIDs()),
Restartable(parameters, "DGKernels"),
ZeroInterface(parameters),
MeshChangedInterface(parameters),
Expand Down
18 changes: 18 additions & 0 deletions framework/src/materials/TwoMaterialPropertyInterface.C
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,21 @@ TwoMaterialPropertyInterface::TwoMaterialPropertyInterface(const MooseObject * m
_mi_params.get<THREAD_ID>("_tid")))
{
}

TwoMaterialPropertyInterface::TwoMaterialPropertyInterface(
const MooseObject * moose_object, const std::set<BoundaryID> & boundary_ids)
: MaterialPropertyInterface(moose_object, boundary_ids),
_neighbor_material_data(_mi_feproblem.getMaterialData(Moose::NEIGHBOR_MATERIAL_DATA,
_mi_params.get<THREAD_ID>("_tid")))
{
}

TwoMaterialPropertyInterface::TwoMaterialPropertyInterface(
const MooseObject * moose_object,
const std::set<SubdomainID> & block_ids,
const std::set<BoundaryID> & boundary_ids)
: MaterialPropertyInterface(moose_object, block_ids, boundary_ids),
_neighbor_material_data(_mi_feproblem.getMaterialData(Moose::NEIGHBOR_MATERIAL_DATA,
_mi_params.get<THREAD_ID>("_tid")))
{
}

0 comments on commit 114841a

Please sign in to comment.