PetscSolverFeti.h 3.06 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ==  http://www.amdis-fem.org                                              ==
// ==                                                                        ==
// ============================================================================
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.



/** \file PetscSolverFeti.h */

#include "parallel/PetscSolver.h"
24
#include "parallel/ParallelTypes.h"
25
26
27
28
29
30
31
32
33
34

#ifndef AMDIS_PETSC_SOLVER_FETI_H
#define AMDIS_PETSC_SOLVER_FETI_H

namespace AMDiS {

  using namespace std;


#ifdef HAVE_PETSC_DEV
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

  struct PetscSchurPrimalData {
    Mat *mat_primal_b, *mat_b_primal, *mat_primal_primal;

    Vec tmp_vec_b;

    Vec tmp_vec_primal;

    KSP *ksp_b;
  };



  struct PetscFetiData {
    Mat *mat_primal_b, *mat_b_primal, *mat_primal_primal;

    Mat *mat_lagrange;

    Vec tmp_vec_b;

    Vec tmp_vec_primal;

    Vec tmp_vec_lagrange;

    KSP *ksp_b;

    KSP *ksp_schur_primal;
  };



66
67
68
69
70
71
72
73
74
75
  class PetscSolverFeti : public PetscSolver
  {
  public:
    PetscSolverFeti() 
      : PetscSolver()
    {}

    void fillPetscMatrix(Matrix<DOFMatrix*> *mat, SystemVector *vec);

    void solvePetscMatrix(SystemVector &vec, AdaptInfo *adaptInfo);
76
77
78
79
80
81
82
83
84

    Flag getBoundaryDofRequirement()
    {
      return 
	MeshDistributor::BOUNDARY_SUBOBJ_SORTED |
	MeshDistributor::BOUNDARY_FILL_INFO_SEND_DOFS |
	MeshDistributor::BOUNDARY_FILL_INFO_RECV_DOFS;
    }
  protected:
85
    void updateDofData();
86

87
88
89
90
91
92
93
94
95
    void createPrimals();

    void createDuals();

    void createLagrange();

    void createIndexB();

    void createMatLagrange(int nComponents);
96

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112


    void createSchurPrimalKsp(int nComponents);

    void destroySchurPrimalKsp();


    void createFetiKsp();

    void destroyFetiKsp();


    void recoverSolution(Vec &vec_sol_b,
			 Vec &vec_sol_primal,
			 SystemVector &vec);

113
  protected:
114
    DofIndexSet primals;
115
116

    DofMapping globalPrimalIndex;
117
118
119
120
121

    int nRankPrimals;

    int nOverallPrimals;

122
123
    int rStartPrimals;

124
125
126
127
128
129
130
131
132
133
134
    DofIndexSet duals;
    
    DofMapping globalDualIndex;

    DofIndexToPartitions boundaryDofRanks;

    DofMapping dofFirstLagrange;

    int nRankLagrange;

    int nOverallLagrange;
135
136

    int rStartLagrange;
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
    
    DofMapping globalIndexB;

    int nRankB;

    int nOverallB;
    
    int rStartB;    

    Mat mat_b_b;

    Mat mat_primal_primal;

    Mat mat_b_primal, mat_primal_b;

    Mat mat_lagrange;

154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
    Vec f_b, f_primal;

    KSP ksp_b;




    KSP ksp_schur_primal;

    Mat mat_schur_primal;

    PetscSchurPrimalData petscSchurPrimalData;



    KSP ksp_feti;

    Mat mat_feti;
172

173
    PetscFetiData petscFetiData;
174
175
176
177
178
179
  };
#endif

}

#endif