Hi Seyed,
If you're wanting the infinity norm of a deal.II vector, then there's already
a function
<https://www.dealii.org/8.4.1/doxygen/deal.II/classVector.html#a6e60ea952a6d3185b2f63f24e273329c>
for that. You can find the equivalent function for the specific MPI vector
class that you're using in its documentation.
Regards,
Jean-Paul
On Sunday, February 26, 2017 at 3:35:58 PM UTC+1, Seyed Ali Mohseni wrote:
>
> Thank you everyone. I understand your suggestions. From what I learned now
> in deal.II is, that each cell is owned by a specific processor which means
> I cannot access the information within a locally owned cell. That's why I
> have to loop over all cells and work with distributed data without using
> locally owned entities.
>
> Maybe I describe my aim more properly. I like to find the maximum value
> within a MPI vector such as our locally_relevant_solution in step-40.
> Hence, I have to loop over all cells and all nodes to find where the
> geometrical position and value of the displacement lies. How is this
> possible within a parallely distributed environment?
>
> My approach using local_dof_indices is somehow impossible. It only works
> for 1 core according to the below code:
>
> std::vector<double> displacement_norms, loaded_nodes, loaded_elements;
> double max_displacement;
> int max_loaded_node, max_loaded_element;
>
> typename DoFHandler<dim>::active_cell_iterator cell =
> dof_handler.begin_active(), endc = dof_handler.end();
> std::vector<unsigned int> local_dof_indices(fe.dofs_per_cell);
> unsigned int cell_number = 0;
>
> for (; cell != endc; ++cell, ++cell_number)
> {
> pcout << "CELL ID: " << cell_number << std::endl; // this works
> surprisingly.
>
> cell->get_dof_indices(local_dof_indices); // Output or accessing
> this won't work I assume.
>
> for (unsigned int i = 0, j = 1; i < fe.dofs_per_cell; i += 2, j += 2)
> {
> double displacement_x = locally_relevant_solution(local_dof_indices[i]);
> double displacement_y = locally_relevant_solution(local_dof_indices[j]);
>
> double displacement_norm = sqrt(displacement_x * displacement_x
> + displacement_y * displacement_y);
>
> loaded_nodes.push_back(cell->vertex_index(v));
> loaded_elements.push_back(cell_number);
> displacement_norms.push_back(displacement_norm);
> }
> }
>
> max_displacement = *max_element(displacement_norms.begin(),
> displacement_norms.end());
>
> double max_index = distance(displacement_norms.begin(), max_element(
> displacement_norms.begin(), displacement_norms.end()));
>
> // Node and element number of maximal displacements
> max_loaded_node = loaded_nodes[max_index];
> max_loaded_element = loaded_elements[max_index];
>
>
> Hopefully someone has an idea to help me out. Thank you :)
>
>
> Kind regards,
> S. A. Mohseni
>
>
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.