@@ -457,7 +457,7 @@ void piDoMUS<dim, spacedim, LAC>::setup_dofs (const bool &first_run)
457457 *dof_handler,
458458 constraints,
459459 interface.get_matrix_coupling (i));
460- matrices[i]-> reinit ( *matrix_sparsities[i]);
460+ initializer (* matrices[i], *matrix_sparsities[i]);
461461 }
462462
463463 if (first_run)
@@ -680,6 +680,7 @@ void piDoMUS<dim, spacedim, LAC>::assemble_matrices (const double t,
680680
681681/* ------------------------ MESH AND GRID ------------------------ */
682682
683+ #ifdef DEAL_II_WITH_TRILINOS
683684template <int dim, int spacedim, typename LAC>
684685void piDoMUS<dim, spacedim, LAC>::
685686refine_and_transfer_solutions (LATrilinos::VectorType &y,
@@ -732,6 +733,56 @@ refine_and_transfer_solutions(LATrilinos::VectorType &y,
732733 locally_relevant_y_expl = y_expl;
733734
734735}
736+ #endif // DEAL_II_WITH_TRILINOS
737+
738+ #ifdef DEAL_II_WITH_PETSC
739+ template <int dim, int spacedim, typename LAC>
740+ void piDoMUS<dim, spacedim, LAC>::
741+ refine_and_transfer_solutions (LAPETSc::VectorType &y,
742+ LAPETSc::VectorType &y_dot,
743+ LAPETSc::VectorType &y_expl,
744+ LAPETSc::VectorType &distributed_y,
745+ LAPETSc::VectorType &distributed_y_dot,
746+ LAPETSc::VectorType &distributed_y_expl,
747+ bool adaptive_refinement)
748+ {
749+ distributed_y = y;
750+ distributed_y_dot = y_dot;
751+ distributed_y_expl = y_expl;
752+
753+ parallel::distributed::SolutionTransfer<dim, LAPETSc::VectorType, DoFHandler<dim,spacedim> > sol_tr (*dof_handler);
754+
755+ std::vector<const LAPETSc::VectorType *> old_sols (3 );
756+ old_sols[0 ] = &distributed_y;
757+ old_sols[1 ] = &distributed_y_dot;
758+ old_sols[2 ] = &distributed_y_expl;
759+
760+ triangulation->prepare_coarsening_and_refinement ();
761+ sol_tr.prepare_for_coarsening_and_refinement (old_sols);
762+
763+ if (adaptive_refinement)
764+ triangulation->execute_coarsening_and_refinement ();
765+ else
766+ triangulation->refine_global (1 );
767+
768+ setup_dofs (false );
769+
770+ LAPETSc::VectorType new_sol (y);
771+ LAPETSc::VectorType new_sol_dot (y_dot);
772+ LAPETSc::VectorType new_sol_expl (y_expl);
773+
774+ std::vector<LAPETSc::VectorType *> new_sols (3 );
775+ new_sols[0 ] = &new_sol;
776+ new_sols[1 ] = &new_sol_dot;
777+ new_sols[2 ] = &new_sol_expl;
778+
779+ sol_tr.interpolate (new_sols);
780+
781+ y = new_sol;
782+ y_dot = new_sol_dot;
783+ y_expl = new_sol_expl;
784+ }
785+ #endif // DEAL_II_WITH_PETSC
735786
736787template <int dim, int spacedim, typename LAC>
737788void piDoMUS<dim, spacedim, LAC>::
@@ -1208,11 +1259,18 @@ piDoMUS<dim, spacedim, LAC>::set_constrained_dofs_to_zero(typename LAC::VectorTy
12081259 }
12091260}
12101261
1262+ #ifdef DEAL_II_WITH_TRILINOS
12111263template class piDoMUS <2 , 2 , LATrilinos>;
12121264template class piDoMUS <2 , 3 , LATrilinos>;
12131265template class piDoMUS <3 , 3 , LATrilinos>;
1266+ #endif // DEAL_II_WITH_TRILINOS
12141267
12151268template class piDoMUS <2 , 2 , LADealII>;
12161269template class piDoMUS <2 , 3 , LADealII>;
12171270template class piDoMUS <3 , 3 , LADealII>;
12181271
1272+ #ifdef DEAL_II_WITH_PETSC
1273+ template class piDoMUS <2 , 2 , LAPETSc>;
1274+ template class piDoMUS <2 , 3 , LAPETSc>;
1275+ template class piDoMUS <3 , 3 , LAPETSc>;
1276+ #endif // DEAL_II_WITH_PETSC
0 commit comments