Skip to content

Commit

Permalink
Merge pull request #302 from masterleinad/improve_readability_active_…
Browse files Browse the repository at this point in the history
…fe_index_equal_to

Be explicit about the second argument of ActiveFEIndexEqualTo
  • Loading branch information
Rombur authored Jul 22, 2024
2 parents 593d0bc + cb73e0d commit e6cea1d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
7 changes: 4 additions & 3 deletions source/MaterialProperty.templates.hh
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,10 @@ void MaterialProperty<dim, p_order, MaterialStates, MemorySpaceType>::
// entire domain. This is not a problem since that state is unchanged and does
// not need to be updated.
unsigned int cell_i = 0;
for (auto const &cell : dealii::filter_iterators(
dof_handler.active_cell_iterators(),
dealii::IteratorFilters::ActiveFEIndexEqualTo(0, true)))
for (auto const &cell :
dealii::filter_iterators(dof_handler.active_cell_iterators(),
dealii::IteratorFilters::ActiveFEIndexEqualTo(
0, /* locally owned */ true)))
{
typename dealii::Triangulation<dim>::active_cell_iterator cell_tria(cell);
auto mp_dof_index = get_dof_index(cell_tria);
Expand Down
18 changes: 9 additions & 9 deletions source/MechanicalOperator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ void MechanicalOperator<dim, p_order, MaterialStates, MemorySpaceType>::

// Loop over the locally owned cells that are not FE_Nothing and assemble the
// sparse matrix and the right-hand-side
for (auto const &cell :
_dof_handler->active_cell_iterators() |
dealii::IteratorFilters::ActiveFEIndexEqualTo(0, true))
for (auto const &cell : _dof_handler->active_cell_iterators() |
dealii::IteratorFilters::ActiveFEIndexEqualTo(
0, /* locally owned */ true))
{
displacement_hp_fe_values.reinit(cell);
auto const &fe_values = displacement_hp_fe_values.get_present_fe_values();
Expand Down Expand Up @@ -232,9 +232,9 @@ void MechanicalOperator<dim, p_order, MaterialStates, MemorySpaceType>::
std::vector<dealii::types::global_dof_index> temperature_local_dof_indices(
_thermal_dof_handler->get_fe_collection().max_dofs_per_cell());
double const initial_temperature = _reference_temperatures.back();
for (auto const &cell :
_dof_handler->active_cell_iterators() |
dealii::IteratorFilters::ActiveFEIndexEqualTo(0, true))
for (auto const &cell : _dof_handler->active_cell_iterators() |
dealii::IteratorFilters::ActiveFEIndexEqualTo(
0, /* locally owned */ true))
{
cell_rhs = 0.;

Expand Down Expand Up @@ -296,9 +296,9 @@ void MechanicalOperator<dim, p_order, MaterialStates, MemorySpaceType>::
// Add gravitational body force
if (body_forces.size())
{
for (auto const &cell :
_dof_handler->active_cell_iterators() |
dealii::IteratorFilters::ActiveFEIndexEqualTo(0, true))
for (auto const &cell : _dof_handler->active_cell_iterators() |
dealii::IteratorFilters::ActiveFEIndexEqualTo(
0, /* locally owned */ true))
{
cell_rhs = 0.;

Expand Down
6 changes: 3 additions & 3 deletions source/MechanicalPhysics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ void MechanicalPhysics<dim, p_order, MaterialStates, MemorySpaceType>::
std::vector<dealii::SymmetricTensor<2, dim>> strain_tensor(n_q_points);
const dealii::FEValuesExtractors::Vector displacement_extr(0);
unsigned int cell_id = 0;
for (auto const &cell :
_dof_handler.active_cell_iterators() |
dealii::IteratorFilters::ActiveFEIndexEqualTo(0, true))
for (auto const &cell : _dof_handler.active_cell_iterators() |
dealii::IteratorFilters::ActiveFEIndexEqualTo(
0, /* locally owned */ true))
{
// Formulation based on the combined isotropic-kinematic hardening model for
// J2 plasticity in Chapter 3 of R. Borja, Plasticity: Modeling and
Expand Down
6 changes: 3 additions & 3 deletions source/PostProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ dealii::Vector<double> PostProcessor<dim>::get_stress_norm(
unsigned int const n_quad_pts =
stress_tensor.size() > 0 ? stress_tensor[0].size() : 0;
unsigned int cell_id = 0;
for (auto const &cell :
_mechanical_dof_handler->active_cell_iterators() |
dealii::IteratorFilters::ActiveFEIndexEqualTo(0, true))
for (auto const &cell : _mechanical_dof_handler->active_cell_iterators() |
dealii::IteratorFilters::ActiveFEIndexEqualTo(
0, /* locally owned */ true))
{
dealii::SymmetricTensor<2, dim> accumulated_stress;
for (unsigned int q = 0; q < n_quad_pts; ++q)
Expand Down
7 changes: 4 additions & 3 deletions source/experimental_data_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ get_dof_to_support_mapping(dealii::DoFHandler<dim> const &dof_handler)
fe.n_dofs_per_cell());
auto locally_owned_dofs = dof_handler.locally_owned_dofs();

for (auto const &cell : dealii::filter_iterators(
dof_handler.active_cell_iterators(),
dealii::IteratorFilters::ActiveFEIndexEqualTo(0, true)))
for (auto const &cell :
dealii::filter_iterators(dof_handler.active_cell_iterators(),
dealii::IteratorFilters::ActiveFEIndexEqualTo(
0, /* locally owned */ true)))
{
fe_values.reinit(cell);
cell->get_dof_indices(local_dof_indices);
Expand Down

0 comments on commit e6cea1d

Please sign in to comment.