#include <base/config.h>
#include <base/subscriptor.h>
#include <base/smartpointer.h>
+#include <numerics/data_out.h>
#include <lac/sparse_matrix.h>
#include <lac/vector.h>
#include <multigrid/mg_base.h>
transfer->copy_from_mg(*mg_dof_handler,
dst,
multigrid->solution);
+
+ /*
+ DataOut<dim> data_out;
+ data_out.attach_dof_handler (*mg_dof_handler);
+ VECTOR2 tmp;
+ tmp.reinit(dst);
+ tmp = dst;
+ transfer->constraints->distribute(tmp);
+ data_out.add_data_vector (tmp, "mg");
+ data_out.build_patches ();
+
+ std::ostringstream filename;
+ filename << "mg.gpl";
+
+ std::ofstream output (filename.str().c_str());
+ data_out.write_gnuplot (output);
+ */
}
edge_down->vmult(level, t[level-1], solution[level]);
transfer->restrict_and_add (l, t[l-1], t[l]);
- if(debug>2)
+ if(debug>3)
deallog << "restrict t[" << l-1 << "] " << t[l-1].l2_norm() << std::endl;
defect[l-1] -= t[l-1];
- if(debug>2)
+ if(debug>3)
deallog << "defect d[" << l-1 << "] " << defect[l-1].l2_norm() << std::endl;
}
}
if (debug>2)
- deallog << "V-cycle Defect norm hier " << defect[level].l2_norm()
+ deallog << "V-cycle Defect norm " << defect[level].l2_norm()
<< std::endl;
if (debug>1)
for (unsigned int i=0; i<fe.dofs_per_cell; ++i)
{
const unsigned int component
- = fe.system_to_component_index(i).first;
- if (mg_selected[component] &&
+ = fe.system_to_component_index(i).first;
+ deallog << "comp " << component << std::endl;
+ if (selected[component] &&
!interface_dofs[level][level_dof_indices[i]])
{
const unsigned int level_start
= mg_component_start[level][mg_target_component[component]];
+ const unsigned int global_start
+ = component_start[target_component[component]];
copy_to_and_from_indices[level].insert(
- std::make_pair(global_dof_indices[i]
- - component_start[target_component[selected_component]],
+ std::make_pair(global_dof_indices[i] - global_start
+ /*- component_start[target_component[selected_component]]*/,
level_dof_indices[i]-level_start));
+ deallog << "global " << global_dof_indices[i]
+ - component_start[target_component[selected_component]] <<
+ " lokal " << level_dof_indices[i]-level_start << std::endl;
+ deallog << "index global " << global_dof_indices[i] <<
+ " index lokal " << level_dof_indices[i] << std::endl;
+ deallog << "offset global "
+ << component_start[target_component[selected_component]] <<
+ " offset lokal " << level_start << std::endl;
}
}
}
for (unsigned int level=mg_dof_handler.get_tria().n_levels();level != 0;)
{
--level;
- VECTOR& dst_level = dst[level];
+// VECTOR& dst_level = dst[level];
typedef std::map<unsigned int, unsigned int>::const_iterator IT;
for (IT i= copy_indices[level].begin();
i != copy_indices[level].end();++i)
- dst_level(i->second) = src(i->first);
+ dst[level](i->second) = src(i->first);
// For non-DG: degrees of
// freedom in the refinement
//----------------------------------------------------------------------//
+template<typename number>
+MGTransferSelect<number>::MGTransferSelect ()
+{}
+
+
+template<typename number>
+MGTransferSelect<number>::MGTransferSelect (const ConstraintMatrix &c)
+ :
+ constraints(&c)
+{}
+
template <typename number>
MGTransferSelect<number>::~MGTransferSelect ()
{}
Assert ((to_level >= 1) && (to_level<=prolongation_matrices.size()),
ExcIndexRange (to_level, 1, prolongation_matrices.size()+1));
- prolongation_matrices[to_level-1]->block(mg_selected_component,
- mg_selected_component)
+ prolongation_matrices[to_level-1]->block(mg_target_component[mg_selected_component],
+ mg_target_component[mg_selected_component])
.vmult (dst, src);
}
Assert ((from_level >= 1) && (from_level<=prolongation_matrices.size()),
ExcIndexRange (from_level, 1, prolongation_matrices.size()+1));
- prolongation_matrices[from_level-1]->block(mg_selected_component,
- mg_selected_component)
+ prolongation_matrices[from_level-1]->block(mg_target_component[mg_selected_component],
+ mg_target_component[mg_selected_component])
.Tvmult_add (dst, src);
}