Hello everyone,
This question is regarding DynamicSparsityPattern and SparsityPattern.
I am trying, as a small exercise to parallelize step files and observe the
output. In the step-2 file. I am not able to use the copy_from() function
when I run it in parallel. Could anyone please suggest a workaround to
view the svg file for each processor or point out any mistake that I might
have made?
Following is the distribute_dofs function.
* The gnuplots get printed out properly but it is for the Dynamic Matrix:
void distribute_dofs (parallel::distributed::Triangulation<dim> &
triangulation,
DoFHandler<dim> &dof_handler, MPI_Comm
mpi_communicator)
{
static const FE_Q<dim> finite_element(1);
IndexSet locally_owned_dofs = dof_handler.locally_owned_dofs();
IndexSet locally_relevant_dofs;
ConstraintMatrix constraints;
dof_handler.distribute_dofs (finite_element);
locally_owned_dofs = dof_handler.locally_owned_dofs ();
DoFTools::extract_locally_relevant_dofs (dof_handler,
locally_relevant_dofs);
/*constraints.clear ();
constraints.reinit (locally_relevant_dofs);
constraints.close ();*/
DynamicSparsityPattern dsp (locally_relevant_dofs);
DoFTools::make_sparsity_pattern (dof_handler, dsp,
constraints, false);
SparsityTools::distribute_sparsity_pattern (dsp,
dof_handler.
n_locally_owned_dofs_per_processor(),
mpi_communicator,
locally_relevant_dofs);
std::ofstream out ("sparsity_pattern_1_" + Utilities::int_to_string
(triangulation.locally_owned_subdomain(), 4));
dsp.print_gnuplot(out);
/* SparsityPattern sparsity_pattern;
sparsity_pattern.copy_from (dsp);
std::ofstream out ("sparsity_pattern_1_" + Utilities::int_to_string
(triangulation.locally_owned_subdomain(), 4) + ".svg");
sparsity_pattern.print_svg (out);*/
}
The following is the error obtained after I uncomment the sparsity pattern
block:
An error occurred in line <341> of file </home/dulcet/deal.ii-candi/tmp/
unpack/deal.II-v8.4.2/source/lac/dynamic_sparsity_pattern.cc> in function
bool dealii::DynamicSparsityPattern::exists(dealii::
DynamicSparsityPattern::size_type, dealii::DynamicSparsityPattern::size_type
) const
The violated condition was:
rowset.size()==0 || rowset.is_element(i)
The name and call sequence of the exception was:
ExcInternalError()
Additional Information:
This exception -- which is used in many places in the library -- usually
indicates that some condition which the author of the code thought must be
satisfied at a certain point in an algorithm, is not fulfilled. An example
would be that the first part of an algo
rithm sorts elements of an array in ascending order, and a second part of
the algorithm later encounters an an element that is not larger than the
previous one.
There is usually not very much you can do if you encounter such an
exception since it indicates an error in deal.II, not in your own program.
Try to come up with the smallest possible program that still demonstrates
the error and contact the deal.II mailing list
s with it to obtain help.
Stacktrace:
-----------
#0 /home/dulcet/deal.ii-candi/deal.II-v8.4.2/lib/libdeal_II.g.so.8.4.2:
dealii::DynamicSparsityPattern::exists(unsigned int, unsigned int) const
#1 /home/dulcet/deal.ii-candi/deal.II-v8.4.2/lib/libdeal_II.g.so.8.4.2:
void
dealii::SparsityPattern::copy_from<dealii::DynamicSparsityPattern>(dealii::DynamicSparsityPattern
const&)
#2 ./step-2:
distribute_dofs(dealii::parallel::distributed::Triangulation<2, 2>&,
dealii::DoFHandler<2, 2>&, ompi_communicator_t*)
#3 ./step-2: main
Thanks in advance.
Regards,
Kartik Jujare
--
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.