Skip to content

Commit

Permalink
Merge pull request #12888 from permcody/increase_test_coverage
Browse files Browse the repository at this point in the history
Increase test coverage
  • Loading branch information
rwcarlsen committed Feb 12, 2019
2 parents a07cb67 + c717d11 commit 2efbf7f
Show file tree
Hide file tree
Showing 35 changed files with 356 additions and 193 deletions.
15 changes: 0 additions & 15 deletions framework/doc/content/source/userobject/PerflogDumper.md

This file was deleted.

10 changes: 9 additions & 1 deletion framework/include/markers/QuadraturePointMarker.h
Expand Up @@ -19,7 +19,9 @@ class QuadraturePointMarker;
template <>
InputParameters validParams<QuadraturePointMarker>();

class QuadraturePointMarker : public Marker, public Coupleable, public MaterialPropertyInterface
class QuadraturePointMarker : public Marker,
public MooseVariableInterface<Real>,
public MaterialPropertyInterface
{
public:
QuadraturePointMarker(const InputParameters & parameters);
Expand All @@ -37,6 +39,9 @@ class QuadraturePointMarker : public Marker, public Coupleable, public MaterialP
*/
virtual MarkerValue computeQpMarker() = 0;

/// Holds the solution at current quadrature points
const VariableValue & _u;

/// The quadrature rule for the system
QBase *& _qrule;

Expand All @@ -45,6 +50,9 @@ class QuadraturePointMarker : public Marker, public Coupleable, public MaterialP

/// The current quadrature point
unsigned int _qp;

/// The behavior to use when "in-between" other states (what to do on the fringe)
MarkerValue _third_state;
};

#endif /* QUADRATUREPOINTMARKER_H */
3 changes: 0 additions & 3 deletions framework/include/markers/ValueRangeMarker.h
Expand Up @@ -29,11 +29,8 @@ class ValueRangeMarker : public QuadraturePointMarker
Real _upper_bound;
Real _buffer_size;

MarkerValue _third_state;
MarkerValue _inside;
MarkerValue _outside;

const VariableValue & _u;
};

#endif /* VALUERANGEMARKER_H */
3 changes: 0 additions & 3 deletions framework/include/markers/ValueThresholdMarker.h
Expand Up @@ -31,9 +31,6 @@ class ValueThresholdMarker : public QuadraturePointMarker
Real _refine;

bool _invert;
MarkerValue _third_state;

const VariableValue & _u;
};

#endif /* VALUETHRESHOLDMARKER_H */
31 changes: 0 additions & 31 deletions framework/include/userobject/PerflogDumper.h

This file was deleted.

14 changes: 1 addition & 13 deletions framework/include/userobject/UserObject.h
Expand Up @@ -46,7 +46,7 @@ class UserObject : public MooseObject,
{
public:
UserObject(const InputParameters & params);
virtual ~UserObject();
virtual ~UserObject() = default;

/**
* Execute method.
Expand All @@ -64,18 +64,6 @@ class UserObject : public MooseObject,
*/
virtual void finalize() = 0;

/**
* Load user data object from a stream
* @param stream Stream to load from
*/
virtual void load(std::ifstream & stream);

/**
* Store user data object to a stream
* @param stream Stream to store to
*/
virtual void store(std::ofstream & stream);

/**
* Returns a reference to the subproblem that
* this postprocessor is tied to
Expand Down
21 changes: 10 additions & 11 deletions framework/src/markers/QuadraturePointMarker.C
Expand Up @@ -25,12 +25,7 @@ validParams<QuadraturePointMarker>()
"third_state",
third_state,
"The Marker state to apply to values falling in-between the coarsen and refine thresholds.");
params.addParam<Real>("coarsen",
"The threshold value for coarsening. Elements with variable "
"values beyond this will be marked for coarsening.");
params.addParam<Real>("refine",
"The threshold value for refinement. Elements with variable "
"values beyond this will be marked for refinement.");

params.addParam<bool>("invert",
false,
"If this is true then values _below_ 'refine' will be "
Expand All @@ -44,15 +39,19 @@ validParams<QuadraturePointMarker>()

QuadraturePointMarker::QuadraturePointMarker(const InputParameters & parameters)
: Marker(parameters),
Coupleable(this, false),
MooseVariableInterface<Real>(this,
false,
"variable",
Moose::VarKindType::VAR_ANY,
Moose::VarFieldType::VAR_FIELD_STANDARD),
MaterialPropertyInterface(this, blockIDs(), Moose::EMPTY_BOUNDARY_IDS),
_u(mooseVariable()->sln()),
_qrule(_assembly.qRule()),
_q_point(_assembly.qPoints()),
_qp(0)
_qp(0),
_third_state(getParam<MooseEnum>("third_state").getEnum<MarkerValue>())
{
const std::vector<MooseVariableFEBase *> & coupled_vars = getCoupledMooseVars();
for (const auto & var : coupled_vars)
addMooseVariableDependency(var);
addMooseVariableDependency(mooseVariable());
}

Marker::MarkerValue
Expand Down
19 changes: 3 additions & 16 deletions framework/src/markers/ValueRangeMarker.C
Expand Up @@ -17,25 +17,15 @@ template <>
InputParameters
validParams<ValueRangeMarker>()
{
InputParameters params = validParams<Marker>();
InputParameters params = validParams<QuadraturePointMarker>();

MooseEnum third_state("DONT_MARK=-1 COARSEN DO_NOTHING REFINE", "DONT_MARK");
params.addParam<MooseEnum>(
"third_state",
third_state,
"The Marker state to apply to values in the buffer zone (both ends of the range).");
params.addRequiredParam<Real>("lower_bound", "The lower bound value for the range.");
params.addRequiredParam<Real>("upper_bound", "The upper bound value for the range.");
params.addParam<Real>("buffer_size",
0.0,
"A buffer zone value added to both ends of the range "
"where a third_state marker can be returned.");
params.addParam<bool>("invert",
false,
"If this is true then values inside the range will be "
"coarsened, and values outside the range will be "
"refined.");
params.addRequiredCoupledVar("variable", "The variable whose values are used in this marker.");

params.addClassDescription("Mark elements for adaptivity based on the supplied upper and lower "
"bounds and the specified variable.");
return params;
Expand All @@ -46,11 +36,8 @@ ValueRangeMarker::ValueRangeMarker(const InputParameters & parameters)
_lower_bound(parameters.get<Real>("lower_bound")),
_upper_bound(parameters.get<Real>("upper_bound")),
_buffer_size(parameters.get<Real>("buffer_size")),
_third_state(getParam<MooseEnum>("third_state").getEnum<MarkerValue>()),
_inside(getParam<bool>("invert") ? COARSEN : REFINE),
_outside(getParam<bool>("invert") ? REFINE : COARSEN),

_u(coupledValue("variable"))
_outside(getParam<bool>("invert") ? REFINE : COARSEN)
{
if (_upper_bound < _lower_bound)
mooseError("Invalid bounds specified (upper_bound < lower_bound)");
Expand Down
21 changes: 2 additions & 19 deletions framework/src/markers/ValueThresholdMarker.C
Expand Up @@ -17,27 +17,14 @@ template <>
InputParameters
validParams<ValueThresholdMarker>()
{
InputParameters params = validParams<Marker>();
InputParameters params = validParams<QuadraturePointMarker>();

MooseEnum third_state("DONT_MARK=-1 COARSEN DO_NOTHING REFINE", "DONT_MARK");
params.addParam<MooseEnum>(
"third_state",
third_state,
"The Marker state to apply to values falling in-between the coarsen and refine thresholds.");
params.addParam<Real>("coarsen",
"The threshold value for coarsening. Elements with variable "
"values beyond this will be marked for coarsening.");
params.addParam<Real>("refine",
"The threshold value for refinement. Elements with variable "
"values beyond this will be marked for refinement.");
params.addParam<bool>("invert",
false,
"If this is true then values _below_ 'refine' will be "
"refined and _above_ 'coarsen' will be coarsened.");
params.addRequiredCoupledVar("variable",
"The values of this variable will be compared to "
"'refine' and 'coarsen' to see what should be done with "
"the element");
params.addClassDescription(
"The the refinement state based on a threshold value compared to the specified variable.");
return params;
Expand All @@ -49,11 +36,7 @@ ValueThresholdMarker::ValueThresholdMarker(const InputParameters & parameters)
_coarsen(parameters.get<Real>("coarsen")),
_refine_set(parameters.isParamValid("refine")),
_refine(parameters.get<Real>("refine")),

_invert(parameters.get<bool>("invert")),
_third_state(getParam<MooseEnum>("third_state").getEnum<MarkerValue>()),

_u(coupledValue("variable"))
_invert(parameters.get<bool>("invert"))
{
if (_refine_set && _coarsen_set)
{
Expand Down
5 changes: 2 additions & 3 deletions framework/src/meshgenerators/AllSideSetsByNormalsGenerator.C
Expand Up @@ -39,15 +39,14 @@ validParams<AllSideSetsByNormalsGenerator>()
AllSideSetsByNormalsGenerator::AllSideSetsByNormalsGenerator(const InputParameters & parameters)
: SideSetsGeneratorBase(parameters), _input(getMesh("input"))
{
if (typeid(_input).name() == typeid(DistributedMesh).name())
mooseError("AllSideSetsByNormalsGenerator only works with ReplicatedMesh.");
}

std::unique_ptr<MeshBase>
AllSideSetsByNormalsGenerator::generate()
{
std::unique_ptr<MeshBase> mesh = std::move(_input);
_mesh->errorIfDistributedMesh("AddAllSideSetsByNormals");

std::unique_ptr<MeshBase> mesh = std::move(_input);
setup(*mesh);

// Get the current list of boundaries so we can generate new ones that won't conflict
Expand Down
56 changes: 0 additions & 56 deletions framework/src/userobject/PerflogDumper.C

This file was deleted.

12 changes: 0 additions & 12 deletions framework/src/userobject/UserObject.C
Expand Up @@ -62,15 +62,3 @@ UserObject::UserObject(const InputParameters & parameters)
_duplicate_initial_execution(getParam<bool>("allow_duplicate_execution_on_initial"))
{
}

UserObject::~UserObject() {}

void
UserObject::load(std::ifstream & /*stream*/)
{
}

void
UserObject::store(std::ofstream & /*stream*/)
{
}
2 changes: 1 addition & 1 deletion test/src/markers/QPointMarker.C
Expand Up @@ -17,7 +17,7 @@ template <>
InputParameters
validParams<QPointMarker>()
{
InputParameters params = validParams<Marker>();
InputParameters params = validParams<QuadraturePointMarker>();
return params;
}

Expand Down
2 changes: 1 addition & 1 deletion test/tests/markers/q_point_marker/q_point_marker.i
Expand Up @@ -51,11 +51,11 @@
[./Markers]
[./marker]
type = QPointMarker
variable = u
[../]
[../]
[]

[Outputs]
exodus = true
[]

Binary file not shown.
Binary file not shown.
@@ -0,0 +1,17 @@
[MeshGenerators]
[read]
type = FileMeshGenerator
file = reactor.e
[]
[block_1]
type = AllSideSetsByNormalsGenerator
input = read
[]
[]

[Mesh]
type = MeshGeneratorMesh
[]

# This input file is intended to be run with the "--mesh-only" option so
# no other sections are required
Binary file not shown.
17 changes: 17 additions & 0 deletions test/tests/meshgenerators/add_all_side_sets_generators/simple.i
@@ -0,0 +1,17 @@
[MeshGenerators]
[read]
type = FileMeshGenerator
file = twoblocks.e
[]
[block_1]
type = AllSideSetsByNormalsGenerator
input = read
[]
[]

[Mesh]
type = MeshGeneratorMesh
[]

# This input file is intended to be run with the "--mesh-only" option so
# no other sections are required

0 comments on commit 2efbf7f

Please sign in to comment.