Skip to content

Commit

Permalink
Removed unused initialization flag from BlockRestrictable
Browse files Browse the repository at this point in the history
  • Loading branch information
aeslaughter committed Oct 25, 2017
1 parent 0c19e9c commit a39ae5f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 30 deletions.
2 changes: 0 additions & 2 deletions framework/include/base/BlockRestrictable.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ class BlockRestrictable
/// Vector the block names supplied by the user via the input file
std::vector<SubdomainName> _blocks;

bool _initialized;

/// Flag for allowing dual restriction
const bool _blk_dual_restrictable;

Expand Down
31 changes: 3 additions & 28 deletions framework/src/base/BlockRestrictable.C
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ validParams<BlockRestrictable>()

// Standard constructor
BlockRestrictable::BlockRestrictable(const InputParameters & parameters)
: _initialized(false),
_blk_dual_restrictable(parameters.get<bool>("_dual_restrictable")),
: _blk_dual_restrictable(parameters.get<bool>("_dual_restrictable")),
_blk_feproblem(parameters.isParamValid("_fe_problem_base")
? parameters.get<FEProblemBase *>("_fe_problem_base")
: NULL),
Expand All @@ -60,8 +59,7 @@ BlockRestrictable::BlockRestrictable(const InputParameters & parameters)
// Dual restricted constructor
BlockRestrictable::BlockRestrictable(const InputParameters & parameters,
const std::set<BoundaryID> & boundary_ids)
: _initialized(false),
_blk_dual_restrictable(parameters.get<bool>("_dual_restrictable")),
: _blk_dual_restrictable(parameters.get<bool>("_dual_restrictable")),
_blk_feproblem(parameters.isParamValid("_fe_problem_base")
? parameters.get<FEProblemBase *>("_fe_problem_base")
: NULL),
Expand All @@ -76,8 +74,6 @@ BlockRestrictable::BlockRestrictable(const InputParameters & parameters,
void
BlockRestrictable::initializeBlockRestrictable(const InputParameters & parameters)
{
mooseAssert(!_initialized, "BlockRestrictable already initialized");

// If the mesh pointer is not defined, but FEProblemBase is, get it from there
if (_blk_feproblem != NULL && _blk_mesh == NULL)
_blk_mesh = &_blk_feproblem->mesh();
Expand All @@ -91,11 +87,6 @@ BlockRestrictable::initializeBlockRestrictable(const InputParameters & parameter
if (_blk_feproblem != NULL)
_blk_material_data = _blk_feproblem->getMaterialData(Moose::BLOCK_MATERIAL_DATA, _blk_tid);

/**
* The _initialized value needs to be set early so that calls to helper functions during
* initialization may succeed.
*/
_initialized = true;

// The 'block' input is defined
if (parameters.isParamValid("block"))
Expand Down Expand Up @@ -176,32 +167,24 @@ BlockRestrictable::initializeBlockRestrictable(const InputParameters & parameter
bool
BlockRestrictable::blockRestricted() const
{
mooseAssert(_initialized, "BlockRestrictable not initialized");

return _blk_ids.find(Moose::ANY_BLOCK_ID) == _blk_ids.end();
}

const std::vector<SubdomainName> &
BlockRestrictable::blocks() const
{
mooseAssert(_initialized, "BlockRestrictable not initialized");

return _blocks;
}

const std::set<SubdomainID> &
BlockRestrictable::blockIDs() const
{
mooseAssert(_initialized, "BlockRestrictable not initialized");

return _blk_ids;
}

unsigned int
BlockRestrictable::numBlocks() const
{
mooseAssert(_initialized, "BlockRestrictable not initialized");

return (unsigned int)_blk_ids.size();
}

Expand All @@ -224,8 +207,6 @@ BlockRestrictable::hasBlocks(const std::vector<SubdomainName> & names) const
bool
BlockRestrictable::hasBlocks(const SubdomainID & id) const
{
mooseAssert(_initialized, "BlockRestrictable not initialized");

if (_blk_ids.empty() || _blk_ids.find(Moose::ANY_BLOCK_ID) != _blk_ids.end())
return true;
else
Expand All @@ -242,8 +223,6 @@ BlockRestrictable::hasBlocks(const std::vector<SubdomainID> & ids) const
bool
BlockRestrictable::hasBlocks(const std::set<SubdomainID> & ids) const
{
mooseAssert(_initialized, "BlockRestrictable not initialized");

if (_blk_ids.empty() || _blk_ids.find(Moose::ANY_BLOCK_ID) != _blk_ids.end())
return true;
else
Expand All @@ -253,8 +232,6 @@ BlockRestrictable::hasBlocks(const std::set<SubdomainID> & ids) const
bool
BlockRestrictable::isBlockSubset(const std::set<SubdomainID> & ids) const
{
mooseAssert(_initialized, "BlockRestrictable not initialized");

// An empty input is assumed to be ANY_BLOCK_ID
if (ids.empty() || ids.find(Moose::ANY_BLOCK_ID) != ids.end())
return true;
Expand Down Expand Up @@ -307,8 +284,6 @@ BlockRestrictable::variableSubdomainIDs(const InputParameters & parameters) cons
const std::set<SubdomainID> &
BlockRestrictable::meshBlockIDs() const
{
mooseAssert(_initialized, "BlockRestrictable not initialized");

return _blk_mesh->meshSubdomains();
}

Expand Down Expand Up @@ -373,7 +348,7 @@ BlockRestrictable::getBlockCoordSystem()
void
BlockRestrictable::checkVariable(const MooseVariable & variable) const
{
if (_initialized && !isBlockSubset(variable.activeSubdomains()))
if (!isBlockSubset(variable.activeSubdomains()))
{
std::string var_ids = Moose::stringify(variable.activeSubdomains());
std::string obj_ids = Moose::stringify(blockRestricted() ? blockIDs() : meshBlockIDs());
Expand Down

0 comments on commit a39ae5f

Please sign in to comment.