Skip to content

Commit

Permalink
[PL] Rewrite PV::createNeumann/DirichletBcs.
Browse files Browse the repository at this point in the history
Now searching for the component_id directly.
  • Loading branch information
endJunction committed Jun 6, 2016
1 parent 9fd539f commit db11cdb
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions ProcessLib/ProcessVariable.h
Expand Up @@ -67,15 +67,25 @@ class ProcessVariable
const int variable_id,
const int component_id)
{
for (auto& bc_config : _dirichlet_bc_configs)
auto const bc_config = std::find_if(
_dirichlet_bc_configs.cbegin(),
_dirichlet_bc_configs.cend(),
[&component_id](
std::pair<std::unique_ptr<UniformDirichletBoundaryCondition>,
int> const& bc) {
return bc.second == component_id;
});

if (bc_config == _dirichlet_bc_configs.cend())
{
if (bc_config.second != component_id)
continue;
DirichletBc<GlobalIndexType> bc;
bc_config.first->initialize(searcher, dof_table, variable_id,
component_id, bc);
output_bcs++ = bc;
// No boundary condition for any of the components.
return;
}

DirichletBc<GlobalIndexType> bc;
bc_config->first->initialize(searcher, dof_table, variable_id,
component_id, bc);
output_bcs++ = bc;
}

template <typename GlobalSetup, typename OutputIterator>
Expand All @@ -86,18 +96,27 @@ class ProcessVariable
const int variable_id,
const int component_id)
{
for (auto& bc_config : _neumann_bc_configs)
auto const bc_config = std::find_if(
_neumann_bc_configs.cbegin(),
_neumann_bc_configs.cend(),
[&component_id](
std::pair<std::unique_ptr<NeumannBcConfig>, int> const& bc) {
return bc.second == component_id;
});

if (bc_config == _neumann_bc_configs.cend())
{
if (bc_config.second != component_id)
continue;
bc_config.first->initialize(searcher);
bcs++ = std::unique_ptr<NeumannBc<GlobalSetup>>{
new NeumannBc<GlobalSetup>(*bc_config.first,
integration_order,
dof_table,
variable_id,
component_id)};
// No boundary condition for any of the components.
return;
}

bc_config->first->initialize(searcher);
bcs++ = std::unique_ptr<NeumannBc<GlobalSetup>>{
new NeumannBc<GlobalSetup>(*bc_config->first,
integration_order,
dof_table,
variable_id,
component_id)};
}

double getInitialConditionValue(std::size_t const node_id,
Expand Down

0 comments on commit db11cdb

Please sign in to comment.