ExaDG
Loading...
Searching...
No Matches
operator_base.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2021 by the ExaDG authors
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * ______________________________________________________________________
20 */
21
22#ifndef OPERATION_BASE_H
23#define OPERATION_BASE_H
24
25// deal.II
26#include <deal.II/base/subscriptor.h>
27#include <deal.II/dofs/dof_handler.h>
28#include <deal.II/lac/affine_constraints.h>
29#include <deal.II/lac/la_parallel_vector.h>
30#include <deal.II/lac/lapack_full_matrix.h>
31#ifdef DEAL_II_WITH_TRILINOS
32# include <deal.II/lac/trilinos_sparse_matrix.h>
33#endif
34#ifdef DEAL_II_WITH_PETSC
35# include <deal.II/lac/petsc_sparse_matrix.h>
36#endif
37#include <deal.II/matrix_free/matrix_free.h>
38
39// ExaDG
40#include <exadg/matrix_free/categorization.h>
41#include <exadg/matrix_free/integrators.h>
42
43#include <exadg/solvers_and_preconditioners/preconditioners/elementwise_preconditioners.h>
44#include <exadg/solvers_and_preconditioners/preconditioners/enum_types.h>
45#include <exadg/solvers_and_preconditioners/solvers/enum_types.h>
46#include <exadg/solvers_and_preconditioners/solvers/wrapper_elementwise_solvers.h>
47#include <exadg/solvers_and_preconditioners/utilities/invert_diagonal.h>
48
49#include <exadg/utilities/lazy_ptr.h>
50
51#include <exadg/operators/elementwise_operator.h>
52#include <exadg/operators/enum_types.h>
53#include <exadg/operators/integrator_flags.h>
54#include <exadg/operators/mapping_flags.h>
55#include <exadg/operators/operator_type.h>
56
57namespace ExaDG
58{
59struct OperatorBaseData
60{
61 OperatorBaseData()
62 : dof_index(0),
63 dof_index_inhomogeneous(dealii::numbers::invalid_unsigned_int),
64 quad_index(0),
65 use_matrix_based_vmult(false),
66 sparse_matrix_type(SparseMatrixType::Undefined),
67 operator_is_singular(false),
68 use_cell_based_loops(false),
69 implement_block_diagonal_preconditioner_matrix_free(false),
70 solver_block_diagonal(Elementwise::Solver::GMRES),
71 preconditioner_block_diagonal(Elementwise::Preconditioner::InverseMassMatrix),
72 solver_data_block_diagonal(SolverData(1000, 1.e-12, 1.e-2, 1000))
73 {
74 }
75
76 unsigned int dof_index;
77
78 // In addition to the "standard" dof_index above, we need a separate dof index to evaluate
79 // inhomogeneous boundary data correctly. This "inhomogeneous" dof index corresponds to an
80 // AffineConstraints object that only applies periodicity and hanging node constraints.
81 unsigned int dof_index_inhomogeneous;
82
83 unsigned int quad_index;
84
85 // this parameter can be used to use sparse matrices for the vmult() operation. The default
86 // case is to use a matrix-free implementation, i.e. use_matrix_based_vmult = false.
87 bool use_matrix_based_vmult;
88
89 SparseMatrixType sparse_matrix_type;
90
91 // Solution of linear systems of equations and preconditioning
92 bool operator_is_singular;
93
94 bool use_cell_based_loops;
95
96 // block Jacobi preconditioner
97 bool implement_block_diagonal_preconditioner_matrix_free;
98
99 // elementwise iterative solution of block Jacobi problems
100 Elementwise::Solver solver_block_diagonal;
101 Elementwise::Preconditioner preconditioner_block_diagonal;
102 SolverData solver_data_block_diagonal;
103};
104
105template<int dim, typename Number, int n_components = 1>
106class OperatorBase : public dealii::Subscriptor
107{
108public:
109 typedef OperatorBase<dim, Number, n_components> This;
110
111 typedef dealii::LinearAlgebra::distributed::Vector<Number> VectorType;
112 typedef std::pair<unsigned int, unsigned int> Range;
113 typedef CellIntegrator<dim, n_components, Number> IntegratorCell;
114 typedef FaceIntegrator<dim, n_components, Number> IntegratorFace;
115
116 static unsigned int const dimension = dim;
117 static unsigned int const vectorization_length = dealii::VectorizedArray<Number>::size();
118
119 typedef dealii::LAPACKFullMatrix<Number> LAPACKMatrix;
120
121 typedef dealii::FullMatrix<dealii::TrilinosScalar> FullMatrix_;
122
123 OperatorBase();
124
125 virtual ~OperatorBase()
126 {
127 if(data.sparse_matrix_type == SparseMatrixType::PETSc)
128 {
129#ifdef DEAL_II_WITH_PETSC
130 if(system_matrix_petsc.m() > 0)
131 {
132 PetscErrorCode ierr = VecDestroy(&petsc_vector_dst);
133 AssertThrow(ierr == 0, dealii::ExcPETScError(ierr));
134 ierr = VecDestroy(&petsc_vector_src);
135 AssertThrow(ierr == 0, dealii::ExcPETScError(ierr));
136 }
137#endif
138 }
139 }
140
141 /*
142 * Getters and setters.
143 */
144 void
145 set_time(double const time) const;
146
147 double
148 get_time() const;
149
150 unsigned int
151 get_level() const;
152
153 dealii::AffineConstraints<Number> const &
154 get_affine_constraints() const;
155
156 dealii::MatrixFree<dim, Number> const &
157 get_matrix_free() const;
158
159 unsigned int
160 get_dof_index() const;
161
162 unsigned int
163 get_quad_index() const;
164
165 /*
166 * Returns whether the operator is singular, e.g., the Laplace operator with pure Neumann boundary
167 * conditions is singular.
168 */
169 bool
170 operator_is_singular() const;
171
172 void
173 vmult(VectorType & dst, VectorType const & src) const;
174
175 void
176 vmult_add(VectorType & dst, VectorType const & src) const;
177
178 void
179 vmult_interface_down(VectorType & dst, VectorType const & src) const;
180
181 void
182 vmult_add_interface_up(VectorType & dst, VectorType const & src) const;
183
184 dealii::types::global_dof_index
185 m() const;
186
187 dealii::types::global_dof_index
188 n() const;
189
190 Number
191 el(unsigned int const, unsigned int const) const;
192
193 bool
194 is_empty_locally() const;
195
196 void
197 initialize_dof_vector(VectorType & vector) const;
198
199 /*
200 * For time-dependent problems, the function set_time() needs to be called prior to the present
201 * function.
202 */
203 virtual void
204 set_inhomogeneous_boundary_values(VectorType & solution) const;
205
206 void
207 set_constrained_dofs_to_zero(VectorType & vector) const;
208
209 void
210 calculate_inverse_diagonal(VectorType & diagonal) const;
211
212 /*
213 * Initialize block diagonal preconditioner: initialize everything related to block diagonal
214 * preconditioner.
215 */
216 void
217 initialize_block_diagonal_preconditioner(bool const initialize) const;
218
219 /*
220 * Update block diagonal preconditioner: Recompute block matrices in case of matrix-based
221 * implementation.
222 */
223 void
224 update_block_diagonal_preconditioner() const;
225
230 void
231 apply_inverse_block_diagonal(VectorType & dst, VectorType const & src) const;
232
233 /*
234 * Algebraic multigrid (AMG): sparse matrix (Trilinos) methods
235 */
236#ifdef DEAL_II_WITH_TRILINOS
237 void
238 init_system_matrix(dealii::TrilinosWrappers::SparseMatrix & system_matrix,
239 MPI_Comm const & mpi_comm) const;
240
241 void
242 calculate_system_matrix(dealii::TrilinosWrappers::SparseMatrix & system_matrix) const;
243#endif
244
245 /*
246 * Algebraic multigrid (AMG): sparse matrix (PETSc) methods
247 */
248#ifdef DEAL_II_WITH_PETSC
249 void
250 init_system_matrix(dealii::PETScWrappers::MPI::SparseMatrix & system_matrix,
251 MPI_Comm const & mpi_comm) const;
252
253 void
254 calculate_system_matrix(dealii::PETScWrappers::MPI::SparseMatrix & system_matrix) const;
255#endif
256
257 /*
258 * Provide near null space basis vectors used e.g. in AMG setup. ExaDG assumes a scalar Laplace
259 * operator as default, filling `constant_modes`, which can be overwritten in derived classes if
260 * necessary. `constant_modes_values` may alternatively be used to provide non-trivial modes.
261 */
262 virtual void
263 get_constant_modes(std::vector<std::vector<bool>> & constant_modes,
264 std::vector<std::vector<double>> & constant_modes_values) const;
265
266 /*
267 * Evaluate the homogeneous part of an operator. The homogeneous operator is the operator that is
268 * obtained for homogeneous boundary conditions. This operation is typically applied in linear
269 * iterative solvers (as well as multigrid preconditioners and smoothers). Operations of this type
270 * are called apply_...() and vmult_...() as required by deal.II interfaces.
271 */
272 void
273 apply(VectorType & dst, VectorType const & src) const;
274
275 /*
276 * See function apply() for a description.
277 */
278 void
279 apply_add(VectorType & dst, VectorType const & src) const;
280
281 void
282 assemble_matrix_if_necessary() const;
283
284 /*
285 * Matrix-based version of the apply function. This function is used if use_matrix_based_vmult =
286 * true.
287 */
288 void
289 apply_matrix_based(VectorType & dst, VectorType const & src) const;
290
291 /*
292 * See function apply_matrix_based() for a description.
293 */
294 void
295 apply_matrix_based_add(VectorType & dst, VectorType const & src) const;
296
297 /*
298 * evaluate inhomogeneous parts of operator related to inhomogeneous boundary face integrals.
299 * Operations of this type are called rhs_...() since these functions are called to calculate the
300 * vector forming the right-hand side vector of linear systems of equations. Functions of type
301 * rhs only make sense for linear operators (but they have e.g. no meaning for linearized
302 * operators of nonlinear problems). For this reason, these functions are currently defined
303 * 'virtual' to provide the opportunity to override and assert these functions in derived classes.
304 *
305 * For continuous Galerkin discretizations, this function calls internally the member function
306 * set_inhomogeneous_boundary_values(). Hence, prior to calling this function, one needs to call
307 * set_time() for a correct evaluation in case of time-dependent problems.
308 *
309 * This function sets the dst vector to zero, and afterwards calls rhs_add().
310 */
311 virtual void
312 rhs(VectorType & dst) const;
313
314 /*
315 * See function rhs() for a description.
316 */
317 virtual void
318 rhs_add(VectorType & dst) const;
319
320 /*
321 * Evaluate the operator including homogeneous and inhomogeneous contributions. The typical use
322 * case would be explicit time integration where a splitting into homogeneous and inhomogeneous
323 * contributions is not required. Functions of type evaluate only make sense for linear operators
324 * (but they have e.g. no meaning for linearized operators of nonlinear problems). For this
325 * reason, these functions are currently defined 'virtual' to provide the opportunity to override
326 * and assert these functions in derived classes.
327 *
328 * Unlike the function rhs(), this function does not internally call the function
329 * set_inhomogeneous_boundary_values() prior to evaluation. Hence, one needs to explicitly call
330 * the function set_inhomogeneous_boundary_values() in case of continuous Galerkin discretizations
331 * with inhomogeneous Dirichlet boundary conditions before calling the present function.
332 */
333 virtual void
334 evaluate(VectorType & dst, VectorType const & src) const;
335
336 /*
337 * See function evaluate() for a description.
338 */
339 virtual void
340 evaluate_add(VectorType & dst, VectorType const & src) const;
341
342 /*
343 * point Jacobi preconditioner (diagonal)
344 */
345 void
346 calculate_diagonal(VectorType & diagonal) const;
347
348 void
349 add_diagonal(VectorType & diagonal) const;
350
351 /*
352 * block Jacobi preconditioner (block-diagonal)
353 */
354 void
355 add_block_diagonal_matrices(std::vector<LAPACKMatrix> & matrices) const;
356
357 void
358 apply_inverse_block_diagonal_matrix_based(VectorType & dst, VectorType const & src) const;
359
360 // matrix-free implementation
361
362 // This function has to initialize everything related to the block diagonal preconditioner when
363 // using the matrix-free variant with elementwise iterative solvers and matrix-free operator
364 // evaluation.
365 void
366 initialize_block_diagonal_preconditioner_matrix_free(bool const initialize) const;
367
368 // updates block diagonal preconditioner when using the matrix-free variant with elementwise
369 // iterative solvers and matrix-free operator evaluation.
370 void
371 update_block_diagonal_preconditioner_matrix_free() const;
372
373 // initializes block diagonal preconditioner for matrix-based variant
374 void
375 initialize_block_diagonal_preconditioner_matrix_based(bool const initialize) const;
376
377 // updates block diagonal preconditioner for matrix-based variant
378 void
379 update_block_diagonal_preconditioner_matrix_based() const;
380
381 void
382 apply_add_block_diagonal_elementwise(unsigned int const cell,
383 dealii::VectorizedArray<Number> * const dst,
384 dealii::VectorizedArray<Number> const * const src,
385 unsigned int const problem_size) const;
386
387 /*
388 * additive Schwarz preconditioner (cellwise block-diagonal)
389 */
390 virtual void
391 compute_factorized_additive_schwarz_matrices() const;
392
393 void
394 apply_inverse_additive_schwarz_matrices(VectorType & dst, VectorType const & src) const;
395
396protected:
397 void
398 reinit(dealii::MatrixFree<dim, Number> const & matrix_free,
399 dealii::AffineConstraints<Number> const & constraints,
400 OperatorBaseData const & data);
401
402 void
403 reinit_cell(IntegratorCell & integrator, unsigned int const cell) const;
404
405 void
406 reinit_face(IntegratorFace & integrator_m,
407 IntegratorFace & integrator_p,
408 unsigned int const face) const;
409
410 void
411 reinit_boundary_face(IntegratorFace & integrator_m, unsigned int const face) const;
412
413 void
414 reinit_face_cell_based(IntegratorFace & integrator_m,
415 IntegratorFace & integrator_p,
416 unsigned int const cell,
417 unsigned int const face,
418 dealii::types::boundary_id const boundary_id) const;
419
420 /*
421 * These methods have to be overwritten by derived classes because these functions are
422 * operator-specific and define how the operator looks like.
423 */
424
425 // standard integration procedure with separate loops for cell and face integrals
426 virtual void
427 do_cell_integral(IntegratorCell & integrator) const;
428
429 virtual void
430 do_face_integral(IntegratorFace & integrator_m, IntegratorFace & integrator_p) const;
431
432 virtual void
433 do_boundary_integral(IntegratorFace & integrator,
434 OperatorType const & operator_type,
435 dealii::types::boundary_id const & boundary_id) const;
436
437 virtual void
438 do_boundary_integral_continuous(IntegratorFace & integrator,
439 dealii::types::boundary_id const & boundary_id) const;
440
441 // The computation of the diagonal and block-diagonal requires face integrals of type
442 // interior (int) and exterior (ext)
443 virtual void
444 do_face_int_integral(IntegratorFace & integrator_m, IntegratorFace & integrator_p) const;
445
446 virtual void
447 do_face_ext_integral(IntegratorFace & integrator_m, IntegratorFace & integrator_p) const;
448
449 // This function is currently only needed due to limitations of deal.II which do
450 // currently not allow to access neighboring data in case of cell-based face loops.
451 // Once this functionality is available, this function should be removed again.
452 // Since only special operators need to evaluate neighboring data, this function
453 // simply redirects to do_face_int_integral() if this function is not overwritten
454 // by a derived class (such as convective terms that require an additional
455 // evaluation of velocity fields for example).
456 virtual void
457 do_face_int_integral_cell_based(IntegratorFace & integrator_m,
458 IntegratorFace & integrator_p) const;
459
460 /*
461 * Matrix-free object.
462 */
464
465 /*
466 * Physical time (required for time-dependent problems).
467 */
468 mutable double time;
469
470 /*
471 * Constraint matrix.
472 */
474
475 mutable dealii::AffineConstraints<double> constraint_double;
476
477 /*
478 * Cell and face integrator flags.
479 */
480 IntegratorFlags integrator_flags;
481
482private:
483 /*
484 * Is the operator used as a multigrid level operator?
485 */
486 bool is_mg;
487
488protected:
489 /*
490 * Is the discretization based on discontinuous Galerkin method?
491 */
492 bool is_dg;
493
494 /*
495 * Block Jacobi preconditioner/smoother: matrix-free version with elementwise iterative solver
496 */
497 typedef Elementwise::OperatorBase<dim, Number, This> ELEMENTWISE_OPERATOR;
499 ELEMENTWISE_PRECONDITIONER;
500 typedef Elementwise::
501 IterativeSolver<dim, n_components, Number, ELEMENTWISE_OPERATOR, ELEMENTWISE_PRECONDITIONER>
502 ELEMENTWISE_SOLVER;
503
504 mutable std::shared_ptr<ELEMENTWISE_OPERATOR> elementwise_operator;
505 mutable std::shared_ptr<ELEMENTWISE_PRECONDITIONER> elementwise_preconditioner;
506 mutable std::shared_ptr<ELEMENTWISE_SOLVER> elementwise_solver;
507
508private:
509 virtual void
510 reinit_cell_derived(IntegratorCell & integrator, unsigned int const cell) const;
511
512 virtual void
513 reinit_face_derived(IntegratorFace & integrator_m,
514 IntegratorFace & integrator_p,
515 unsigned int const face) const;
516
517 virtual void
518 reinit_boundary_face_derived(IntegratorFace & integrator_m, unsigned int const face) const;
519
520 virtual void
521 reinit_face_cell_based_derived(IntegratorFace & integrator_m,
522 IntegratorFace & integrator_p,
523 unsigned int const cell,
524 unsigned int const face,
525 dealii::types::boundary_id const boundary_id) const;
526
527 /*
528 * Helper functions:
529 *
530 * The diagonal, block-diagonal, as well as the system matrix (assembled into a sparse matrix) are
531 * computed columnwise. This means that column i of the block-matrix is computed by evaluating the
532 * operator for a unit vector which takes a value of 1 in row i and is 0 for all other entries.
533 */
534 void
535 create_standard_basis(unsigned int j, IntegratorCell & integrator) const;
536
537 void
538 create_standard_basis(unsigned int j, IntegratorFace & integrator) const;
539
540 void
541 create_standard_basis(unsigned int j,
542 IntegratorFace & integrator_1,
543 IntegratorFace & integrator_2) const;
544
545 /*
546 * This function calculates cell integrals for the full (= homogeneous + inhomogeneous) part,
547 * where inhomogeneous part may occur for continuous Galerkin discretizations due to inhomogeneous
548 * Dirichlet BCs. A prerequisite to call this function is to set inhomogeneous Dirichlet degrees
549 * of freedom appropriately in the DoF-vector src. In case the DoF-vector src is zero apart from
550 * the inhomogeneous Dirichlet degrees of freedom, this function calculates only the inhomogeneous
551 * part of the operator, because the homogeneous operator is zero in this case. For DG
552 * discretizations, this function is equivalent to cell_loop().
553 */
554 void
555 cell_loop_full_operator(dealii::MatrixFree<dim, Number> const & matrix_free,
556 VectorType & dst,
557 VectorType const & src,
558 Range const & range) const;
559
560 /*
561 * This function loops over all cells and calculates cell integrals.
562 */
563 void
564 cell_loop(dealii::MatrixFree<dim, Number> const & matrix_free,
565 VectorType & dst,
566 VectorType const & src,
567 Range const & range) const;
568
569 /*
570 * This function loops over all interior faces and calculates face integrals.
571 */
572 void
573 face_loop(dealii::MatrixFree<dim, Number> const & matrix_free,
574 VectorType & dst,
575 VectorType const & src,
576 Range const & range) const;
577
578 /*
579 * The following functions loop over all boundary faces and calculate boundary face integrals.
580 * Depending on the operator type, we distinguish between boundary face integrals of type
581 * homogeneous, inhomogeneous, and full.
582 */
583
584 // homogeneous operator
585 void
586 boundary_face_loop_hom_operator(dealii::MatrixFree<dim, Number> const & matrix_free,
587 VectorType & dst,
588 VectorType const & src,
589 Range const & range) const;
590
591 // inhomogeneous operator
592 void
593 boundary_face_loop_inhom_operator(dealii::MatrixFree<dim, Number> const & matrix_free,
594 VectorType & dst,
595 VectorType const & src,
596 Range const & range) const;
597
598 // full operator
599 void
600 boundary_face_loop_full_operator(dealii::MatrixFree<dim, Number> const & matrix_free,
601 VectorType & dst,
602 VectorType const & src,
603 Range const & range) const;
604
605 /*
606 * inhomogeneous operator: For the inhomogeneous operator, we only have to calculate boundary face
607 * integrals. The matrix-free implementation, however, does not offer interfaces for boundary face
608 * integrals only. Hence we have to provide empty functions for cell and interior face integrals.
609 */
610 void
611 cell_loop_empty(dealii::MatrixFree<dim, Number> const & matrix_free,
612 VectorType & dst,
613 VectorType const & src,
614 Range const & range) const;
615
616 void
617 face_loop_empty(dealii::MatrixFree<dim, Number> const & matrix_free,
618 VectorType & dst,
619 VectorType const & src,
620 Range const & range) const;
621
622 /*
623 * Calculate diagonal.
624 */
625 void
626 cell_loop_diagonal(dealii::MatrixFree<dim, Number> const & matrix_free,
627 VectorType & dst,
628 VectorType const & src,
629 Range const & range) const;
630
631 void
632 face_loop_diagonal(dealii::MatrixFree<dim, Number> const & matrix_free,
633 VectorType & dst,
634 VectorType const & src,
635 Range const & range) const;
636
637 void
638 boundary_face_loop_diagonal(dealii::MatrixFree<dim, Number> const & matrix_free,
639 VectorType & dst,
640 VectorType const & src,
641 Range const & range) const;
642
643 void
644 cell_based_loop_diagonal(dealii::MatrixFree<dim, Number> const & matrix_free,
645 VectorType & dst,
646 VectorType const & src,
647 Range const & range) const;
648
649 /*
650 * Calculate (assemble) block diagonal.
651 */
652 void
653 cell_loop_block_diagonal(dealii::MatrixFree<dim, Number> const & matrix_free,
654 std::vector<LAPACKMatrix> & matrices,
655 std::vector<LAPACKMatrix> const & src,
656 Range const & range) const;
657
658 void
659 face_loop_block_diagonal(dealii::MatrixFree<dim, Number> const & matrix_free,
660 std::vector<LAPACKMatrix> & matrices,
661 std::vector<LAPACKMatrix> const & src,
662 Range const & range) const;
663
664 void
665 boundary_face_loop_block_diagonal(dealii::MatrixFree<dim, Number> const & matrix_free,
666 std::vector<LAPACKMatrix> & matrices,
667 std::vector<LAPACKMatrix> const & src,
668 Range const & range) const;
669
670 // cell-based variant for computation of both cell and face integrals
671 void
672 cell_based_loop_block_diagonal(dealii::MatrixFree<dim, Number> const & matrix_free,
673 std::vector<LAPACKMatrix> & matrices,
674 std::vector<LAPACKMatrix> const & src,
675 Range const & range) const;
676
677 /*
678 * Apply inverse block diagonal:
679 *
680 * we compute dst = B^{-1} * src
681 */
682 void
683 cell_loop_apply_inverse_block_diagonal_matrix_based(
684 dealii::MatrixFree<dim, Number> const & matrix_free,
685 VectorType & dst,
686 VectorType const & src,
687 Range const & range) const;
688
689 /*
690 * Set up sparse matrix internally for templated matrix type (Trilinos or
691 * PETSc matrices)
692 */
693 template<typename SparseMatrix>
694 void
695 internal_init_system_matrix(SparseMatrix & system_matrix,
696 dealii::DynamicSparsityPattern & dsp,
697 MPI_Comm const & mpi_comm) const;
698
699 template<typename SparseMatrix>
700 void
701 internal_calculate_system_matrix(SparseMatrix & system_matrix) const;
702
703 /*
704 * Calculate sparse matrix.
705 */
706 template<typename SparseMatrix>
707 void
708 cell_loop_calculate_system_matrix(dealii::MatrixFree<dim, Number> const & matrix_free,
709 SparseMatrix & dst,
710 SparseMatrix const & src,
711 Range const & range) const;
712
713 template<typename SparseMatrix>
714 void
715 face_loop_calculate_system_matrix(dealii::MatrixFree<dim, Number> const & matrix_free,
716 SparseMatrix & dst,
717 SparseMatrix const & src,
718 Range const & range) const;
719
720 template<typename SparseMatrix>
721 void
722 boundary_face_loop_calculate_system_matrix(dealii::MatrixFree<dim, Number> const & matrix_free,
723 SparseMatrix & dst,
724 SparseMatrix const & src,
725 Range const & range) const;
726
727 /*
728 * This function sets entries of the DoF-vector corresponding to constraint DoFs to one.
729 */
730 void
731 set_constrained_dofs_to_one(VectorType & vector) const;
732
733 /*
734 * Do we have to evaluate (boundary) face integrals for this operator? For example, operators
735 * such as the mass operator only involve cell integrals.
736 */
737 bool
738 evaluate_face_integrals() const;
739
740 /*
741 * Compute factorized additive Schwarz matrices.
742 */
743 template<typename SparseMatrix>
744 void
745 internal_compute_factorized_additive_schwarz_matrices() const;
746
747 /*
748 * Data structure containing all operator-specific data.
749 */
750 OperatorBaseData data;
751
752 /*
753 * Multigrid level: 0 <= level <= max_level. If the operator is not used as a multigrid
754 * level operator, this variable takes a value of dealii::numbers::invalid_unsigned_int.
755 */
756 unsigned int level;
757
758 /*
759 * Vector of matrices for block-diagonal preconditioners.
760 */
761 mutable std::vector<LAPACKMatrix> matrices;
762
763 /*
764 * Vector with weights for additive Schwarz preconditioner.
765 */
766 mutable VectorType weights;
767
768 unsigned int n_mpi_processes;
769
770 // sparse matrices for matrix-based vmult
771 mutable bool system_matrix_based_been_initialized;
772
773#ifdef DEAL_II_WITH_TRILINOS
774 mutable dealii::TrilinosWrappers::SparseMatrix system_matrix_trilinos;
775#endif
776
777#ifdef DEAL_II_WITH_PETSC
778 mutable dealii::PETScWrappers::MPI::SparseMatrix system_matrix_petsc;
779
780 // PETSc vector objects to avoid re-allocation in every vmult() operation
781 mutable Vec petsc_vector_src;
782 mutable Vec petsc_vector_dst;
783#endif
784};
785} // namespace ExaDG
786
787#endif
Definition elementwise_operator.h:33
Definition elementwise_preconditioners.h:41
void apply_inverse_block_diagonal(VectorType &dst, VectorType const &src) const
Definition operator_base.cpp:659
Definition lazy_ptr.h:29
Definition driver.cpp:33
Definition integrator_flags.h:30
Definition operator_base.h:60
Definition solver_data.h:34