TrilinosWrappers::SparseMatrix newton_matrix;
TrilinosWrappers::MPI::Vector solution;
+ TrilinosWrappers::MPI::Vector active_set_vector;
TrilinosWrappers::MPI::Vector newton_rhs;
TrilinosWrappers::MPI::Vector newton_rhs_uncondensed;
TrilinosWrappers::MPI::Vector diag_mass_matrix_vector;
{
TimerOutput::Scope t(computing_timer, "Setup: vectors");
solution.reinit(locally_relevant_dofs, mpi_communicator);
+ active_set_vector.reinit(locally_relevant_dofs, MPI_COMM_WORLD);
newton_rhs.reinit(locally_owned_dofs, mpi_communicator);
newton_rhs_uncondensed.reinit(locally_owned_dofs, mpi_communicator);
diag_mass_matrix_vector.reinit(locally_owned_dofs, mpi_communicator);
all_constraints.close();
all_constraints.merge(constraints_dirichlet_and_hanging_nodes);
+ // We misuse distributed_solution for updating active_set_vector.
+ // We can do that because distributed_solution has a compatible underlying
+ // IndexSet and we don't need the vector anymore.
+ distributed_solution = 0.;
+ for (const auto index : active_set)
+ distributed_solution[index] = 1.;
+ active_set_vector = distributed_solution;
+
pcout << " Size of active set: "
<< Utilities::MPI::sum((active_set & locally_owned_dofs).n_elements(),
mpi_communicator)
std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
- typename DoFHandler<dim>::active_cell_iterator cell =
- dof_handler.begin_active(),
- endc = dof_handler.end();
-
const FEValuesExtractors::Vector displacement(0);
- for (; cell != endc; ++cell)
+ for (const auto &cell : dof_handler.active_cell_iterators())
if (cell->is_locally_owned())
{
fe_values.reinit(cell);
fraction_of_plastic_q_points_per_cell = 0;
- typename DoFHandler<dim>::active_cell_iterator cell =
- dof_handler.begin_active(),
- endc = dof_handler.end();
- unsigned int cell_number = 0;
+ auto cell = dof_handler.begin_active();
+ const auto endc = dof_handler.end();
+ unsigned int cell_number = 0;
for (; cell != endc; ++cell, ++cell_number)
if (cell->is_locally_owned())
{
std::vector<std::string>(dim, "contact_force"),
DataOut<dim>::type_dof_data,
data_component_interpretation);
- data_out.add_data_vector(active_set,
+ data_out.add_data_vector(active_set_vector,
std::vector<std::string>(dim, "active_set"),
DataOut<dim>::type_dof_data,
data_component_interpretation);
* Vector<T>, BlockVector<T>, or one of the PETSc or Trilinos
* vector wrapper classes. It represents a global vector of DoF values
* associated with the DoFHandler object with which this FEValues object was
- * last initialized. Alternatively, if the vector argument is of type
- * IndexSet, then the function is represented as one that is either zero or
- * one, depending on whether a DoF index is in the set or not.
+ * last initialized.
*
* @dealiiRequiresUpdateFlags{update_values}
*/
* Vector<T>, BlockVector<T>, or one of the PETSc or Trilinos
* vector wrapper classes. It represents a global vector of DoF values
* associated with the DoFHandler object with which this FEValues object was
- * last initialized. Alternatively, if the vector argument is of type
- * IndexSet, then the function is represented as one that is either zero or
- * one, depending on whether a DoF index is in the set or not.
+ * last initialized.
*
* @dealiiRequiresUpdateFlags{update_gradients}
*/
* Vector<T>, BlockVector<T>, or one of the PETSc or Trilinos
* vector wrapper classes. It represents a global vector of DoF values
* associated with the DoFHandler object with which this FEValues object was
- * last initialized. Alternatively, if the vector argument is of type
- * IndexSet, then the function is represented as one that is either zero or
- * one, depending on whether a DoF index is in the set or not.
+ * last initialized.
*
* @dealiiRequiresUpdateFlags{update_hessians}
*/
* Vector<T>, BlockVector<T>, or one of the PETSc or Trilinos
* vector wrapper classes. It represents a global vector of DoF values
* associated with the DoFHandler object with which this FEValues object was
- * last initialized. Alternatively, if the vector argument is of type
- * IndexSet, then the function is represented as one that is either zero or
- * one, depending on whether a DoF index is in the set or not.
+ * last initialized.
*
* @dealiiRequiresUpdateFlags{update_hessians}
*/
* Vector<T>, BlockVector<T>, or one of the PETSc or Trilinos
* vector wrapper classes. It represents a global vector of DoF values
* associated with the DoFHandler object with which this FEValues object was
- * last initialized. Alternatively, if the vector argument is of type
- * IndexSet, then the function is represented as one that is either zero or
- * one, depending on whether a DoF index is in the set or not.
+ * last initialized.
*
* @dealiiRequiresUpdateFlags{update_3rd_derivatives}
*/
#endif
}
-
-
-// instantiations for VEC=IndexSet
-
-for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : DIMENSIONS)
- {
-#if deal_II_dimension <= deal_II_space_dimension
- template void
- FEValuesViews::Scalar<deal_II_dimension, deal_II_space_dimension>::
- get_function_values<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<ProductType<IndexSet::value_type, double>::type> &) const;
- template void
- FEValuesViews::Scalar<deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<
- ProductType<IndexSet::value_type,
- dealii::Tensor<1, deal_II_space_dimension>>::type> &)
- const;
- template void
- FEValuesViews::Scalar<deal_II_dimension, deal_II_space_dimension>::
- get_function_hessians<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<
- ProductType<IndexSet::value_type,
- dealii::Tensor<2, deal_II_space_dimension>>::type> &)
- const;
- template void
- FEValuesViews::Scalar<deal_II_dimension, deal_II_space_dimension>::
- get_function_laplacians<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<ProductType<IndexSet::value_type, double>::type> &) const;
- template void
- FEValuesViews::Scalar<deal_II_dimension, deal_II_space_dimension>::
- get_function_third_derivatives<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<
- ProductType<IndexSet::value_type,
- dealii::Tensor<3, deal_II_space_dimension>>::type> &)
- const;
-
- template void
- FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
- get_function_values<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<
- ProductType<IndexSet::value_type,
- dealii::Tensor<1, deal_II_space_dimension>>::type> &)
- const;
- template void
- FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<
- ProductType<IndexSet::value_type,
- dealii::Tensor<2, deal_II_space_dimension>>::type> &)
- const;
- template void
- FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
- get_function_symmetric_gradients<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<ProductType<
- IndexSet::value_type,
- dealii::SymmetricTensor<2, deal_II_space_dimension>>::type> &) const;
- template void
- FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
- get_function_curls<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<ProductType<IndexSet::value_type, curl_type>::type> &)
- const;
- template void
- FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
- get_function_divergences<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<ProductType<IndexSet::value_type, divergence_type>::type> &)
- const;
- template void
- FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
- get_function_hessians<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<
- ProductType<IndexSet::value_type,
- dealii::Tensor<3, deal_II_space_dimension>>::type> &)
- const;
- template void
- FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
- get_function_laplacians<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<
- ProductType<IndexSet::value_type,
- dealii::Tensor<1, deal_II_space_dimension>>::type> &)
- const;
- template void
- FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
- get_function_third_derivatives<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<
- ProductType<IndexSet::value_type,
- dealii::Tensor<4, deal_II_space_dimension>>::type> &)
- const;
-
- template void FEValuesViews::SymmetricTensor<2,
- deal_II_dimension,
- deal_II_space_dimension>::
- get_function_values<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<ProductType<
- IndexSet::value_type,
- dealii::SymmetricTensor<2, deal_II_space_dimension>>::type> &) const;
- template void FEValuesViews::
- SymmetricTensor<2, deal_II_dimension, deal_II_space_dimension>::
- get_function_divergences<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<
- ProductType<IndexSet::value_type,
- dealii::Tensor<1, deal_II_space_dimension>>::type> &)
- const;
-
- template void
- FEValuesViews::Tensor<2, deal_II_dimension, deal_II_space_dimension>::
- get_function_values<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<
- ProductType<IndexSet::value_type,
- dealii::Tensor<2, deal_II_space_dimension>>::type> &)
- const;
- template void
- FEValuesViews::Tensor<2, deal_II_dimension, deal_II_space_dimension>::
- get_function_divergences<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<
- ProductType<IndexSet::value_type,
- dealii::Tensor<1, deal_II_space_dimension>>::type> &)
- const;
- template void
- FEValuesViews::Tensor<2, deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<dealii::IndexSet>(
- const dealii::IndexSet &,
- std::vector<
- ProductType<IndexSet::value_type,
- dealii::Tensor<3, deal_II_space_dimension>>::type> &)
- const;
-#endif
- }
-
-
-
-// Instantiations of functions in FEValuesBase and IndexSet=IndexSet
-
-for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : DIMENSIONS)
- {
-#if deal_II_dimension <= deal_II_space_dimension
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_values<IndexSet>(const IndexSet &,
- std::vector<IndexSet::value_type> &) const;
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_values<IndexSet>(
- const IndexSet &,
- const ArrayView<const types::global_dof_index> &,
- std::vector<IndexSet::value_type> &) const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_values<IndexSet>(const IndexSet &,
- std::vector<Vector<IndexSet::value_type>> &)
- const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_values<IndexSet>(
- const IndexSet &,
- const ArrayView<const types::global_dof_index> &,
- std::vector<Vector<IndexSet::value_type>> &) const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_values<IndexSet>(
- const IndexSet &,
- const ArrayView<const types::global_dof_index> &,
- ArrayView<std::vector<IndexSet::value_type>>,
- bool) const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<IndexSet>(
- const IndexSet &,
- std::vector<
- dealii::Tensor<1, deal_II_space_dimension, IndexSet::value_type>> &)
- const;
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<IndexSet>(
- const IndexSet &,
- const ArrayView<const types::global_dof_index> &,
- std::vector<
- dealii::Tensor<1, deal_II_space_dimension, IndexSet::value_type>> &)
- const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<IndexSet>(
- const IndexSet &,
- std::vector<std::vector<
- dealii::Tensor<1, deal_II_space_dimension, IndexSet::value_type>>> &)
- const;
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_gradients<IndexSet>(
- const IndexSet &,
- const ArrayView<const types::global_dof_index> &,
- ArrayView<std::vector<
- dealii::Tensor<1, deal_II_space_dimension, IndexSet::value_type>>>,
- bool) const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_hessians<IndexSet>(
- const IndexSet &,
- std::vector<
- dealii::Tensor<2, deal_II_space_dimension, IndexSet::value_type>> &)
- const;
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_hessians<IndexSet>(
- const IndexSet &,
- const ArrayView<const types::global_dof_index> &,
- std::vector<
- dealii::Tensor<2, deal_II_space_dimension, IndexSet::value_type>> &)
- const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_hessians<IndexSet>(
- const IndexSet &,
- std::vector<std::vector<
- dealii::Tensor<2, deal_II_space_dimension, IndexSet::value_type>>> &,
- bool) const;
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_hessians<IndexSet>(
- const IndexSet &,
- const ArrayView<const types::global_dof_index> &,
- ArrayView<std::vector<
- dealii::Tensor<2, deal_II_space_dimension, IndexSet::value_type>>>,
- bool) const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_laplacians<IndexSet>(const IndexSet &,
- std::vector<IndexSet::value_type> &)
- const;
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_laplacians<IndexSet>(
- const IndexSet &,
- const ArrayView<const types::global_dof_index> &,
- std::vector<IndexSet::value_type> &) const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_laplacians<IndexSet>(
- const IndexSet &, std::vector<Vector<IndexSet::value_type>> &) const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_laplacians<IndexSet>(
- const IndexSet &,
- const ArrayView<const types::global_dof_index> &,
- std::vector<Vector<IndexSet::value_type>> &) const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_laplacians<IndexSet>(
- const IndexSet &,
- const ArrayView<const types::global_dof_index> &,
- std::vector<std::vector<IndexSet::value_type>> &,
- bool) const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_third_derivatives<IndexSet>(
- const IndexSet &,
- std::vector<
- dealii::Tensor<3, deal_II_space_dimension, IndexSet::value_type>> &)
- const;
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_third_derivatives<IndexSet>(
- const IndexSet &,
- const ArrayView<const types::global_dof_index> &,
- std::vector<
- dealii::Tensor<3, deal_II_space_dimension, IndexSet::value_type>> &)
- const;
-
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_third_derivatives<IndexSet>(
- const IndexSet &,
- std::vector<std::vector<
- dealii::Tensor<3, deal_II_space_dimension, IndexSet::value_type>>> &,
- bool) const;
- template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_third_derivatives<IndexSet>(
- const IndexSet &,
- const ArrayView<const types::global_dof_index> &,
- ArrayView<std::vector<
- dealii::Tensor<3, deal_II_space_dimension, IndexSet::value_type>>>,
- bool) const;
-#endif
- }
-for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS)
- {
- template void DataOut_DoFData<DH<deal_II_dimension, deal_II_dimension>,
- deal_II_dimension,
- deal_II_dimension>::
- add_data_vector_internal<IndexSet>(
- const DH<deal_II_dimension, deal_II_dimension> *,
- const IndexSet &,
- const std::vector<std::string> &,
- const DataVectorType,
- const std::vector<
- DataComponentInterpretation::DataComponentInterpretation> &,
- const bool);
-
- template void DataOut_DoFData<DH<deal_II_dimension, deal_II_dimension>,
- deal_II_dimension,
- deal_II_dimension>::
- add_data_vector<IndexSet>(
- const DH<deal_II_dimension, deal_II_dimension> &,
- const IndexSet &,
- const DataPostprocessor<
- DH<deal_II_dimension, deal_II_dimension>::space_dimension> &);
-
-
-
- // stuff needed for face data
-
- template void DataOut_DoFData<DH<deal_II_dimension, deal_II_dimension>,
- deal_II_dimension - 1,
- deal_II_dimension>::
- add_data_vector_internal<IndexSet>(
- const DH<deal_II_dimension, deal_II_dimension> *,
- const IndexSet &,
- const std::vector<std::string> &,
- const DataVectorType,
- const std::vector<
- DataComponentInterpretation::DataComponentInterpretation> &,
- const bool);
-
- template void DataOut_DoFData<DH<deal_II_dimension, deal_II_dimension>,
- deal_II_dimension - 1,
- deal_II_dimension>::
- add_data_vector<IndexSet>(
- const DH<deal_II_dimension, deal_II_dimension> &,
- const IndexSet &,
- const DataPostprocessor<
- DH<deal_II_dimension, deal_II_dimension>::space_dimension> &);
-
- // things for DataOutRotation
-
-#if deal_II_dimension < 3
- template void DataOut_DoFData<DH<deal_II_dimension, deal_II_dimension>,
- deal_II_dimension + 1,
- deal_II_dimension + 1>::
- add_data_vector_internal<IndexSet>(
- const DH<deal_II_dimension, deal_II_dimension> *,
- const IndexSet &,
- const std::vector<std::string> &,
- const DataVectorType,
- const std::vector<
- DataComponentInterpretation::DataComponentInterpretation> &,
- const bool);
-
- template void DataOut_DoFData<DH<deal_II_dimension, deal_II_dimension>,
- deal_II_dimension + 1,
- deal_II_dimension + 1>::
- add_data_vector<IndexSet>(
- const DH<deal_II_dimension, deal_II_dimension> &,
- const IndexSet &,
- const DataPostprocessor<
- DH<deal_II_dimension, deal_II_dimension>::space_dimension> &);
-#endif
- }
-
-
-
for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS)
{
template class DataOut_DoFData<DH<deal_II_dimension>, deal_II_dimension>;