MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
schsolman.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/libraries/libmbmath/schsolman.h,v 1.44 2017/01/12 14:43:54 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  * Paolo Mantegazza <mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */
31 
32 /* Solutore Schur */
33 
34 /*
35  * Copyright 1999-2017 Giuseppe Quaranta <quaranta@aero.polimi.it>
36  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
37  */
38 
39 #ifndef SCHSOLMAN_H
40 #define SCHSOLMAN_H
41 
42 #include "myassert.h"
43 #include "mynewmem.h"
44 #include "except.h"
45 #include "solman.h"
46 #ifdef USE_MPI
47 #include "ac/mpi.h"
48 #endif /* USE_MPI */
49 #include "schurmh.h"
50 
51 /* look ahead */
53 
54 template <class T>
55 inline void
56 InitializeList(T* list, integer dim, T value)
57 {
58  for (int i = 0; i < dim; i++) {
59  list[i] = value;
60  }
61 }
62 
63 /* SchurMatrixHandler - Begin */
64 
65 const int G_TAG = 100;
66 const int S_TAG = 200;
67 
69 public:
70  class ErrGeneric : public MBDynErrBase {
71  public:
73  };
74 
75 
76 private:
77 
78  /* communicator per lo scambio di messaggi */
79 #ifdef USE_MPI
80  MPI::Intracomm SolvComm;
81 #endif /* USE_MPI */
83 
84  integer iPrbmSize; /* dimensioni totali del problema */
85  integer iPrbmBlocks; /* numero di problemi accoppiati, */
86  /* ciascuno di dimensione iPrbmSize */
87  integer iBlkSize; /* size di ciascun blocco */
88  integer* pLocDofs; /* lista dei dof locali */
89  integer* pIntDofs; /* lista dof interfaccia locale */
90  int iLocVecDim, iIntVecDim; /* dim. vettori dof locali e interfacce */
91  int* pRecvDim; /* vettore dim. interfacce locali; master */
92  int* pDispl; /* vettore disp. x comunicazioni; master */
93  integer* pDofsRecvdList; /* lista dof da ricevere sul master;
94  * i dof del processo i iniziano
95  * da pDofsRecvdList[pDispl[i]] */
96  integer* pSchurDofs; /* lista totale dof interfaccia; master */
97  int iSchurIntDim; /* dimensioni matrice di schur; master */
98 
99  integer* pGlbToLoc; /* vett. di trasf. indici Glob->loc */
100  integer* pSchGlbToLoc; /* vett. trasf. idx Glob->Schur; master */
101 
102  int* pBlockLenght; /* str. di servizio x datatype; master */
103 #ifdef USE_MPI
104  MPI::Aint* pTypeDsp; /* str. di servizio x datatype; master */
105  MPI::Datatype** ppNewTypes; /* datatype per la trasmissione dei vettori
106  * soluzione delle interfacce; master */
107 #endif /* USE_MPI */
108  doublereal* pBuffer; /* buffer di ricezione */
109 
111 
112 
113  SchurMatrixHandler* pMH; /* handler della matrice globale */
114  SchurVectorHandler* pRVH; /* handler del vettore residuo globale */
115  /* FIXME: do we need a SchurVectorHandler or is a MyVectorHandler enough? */
116  VectorHandler* pSolVH; /* handler del vettore soluzione globale */
117 
118  MatrixHandler* pSchMH; /*handler matrice delle interfacce */
119  VectorHandler* pSchVH; /* vettore delle interfacce */
120  VectorHandler* pSolSchVH; /* soluzione problema delle interfacce */
121  /* Vettori di lavoro x il Matrix Handler */
123  doublereal* pdCM; /* puntatore necessario per lo scambio delle schur locali */
127 
128 #ifdef USE_MPI
129  MPI::Request* pGSReq; /* Array di request Send */
130  MPI::Request* pGRReq; /* Array di request Receive */
131 #endif /* USE_MPI */
132 
133  SolutionManager* pLocalSM; /* Solutore sparso locale */
134  SolutionManager* pInterSM; /* Solutore sparso locale */
135 
136 
138 public:
139 
141  integer iBlocks,
142  integer* pLocalDofs,
143  int iDim1,
144  integer* pInterfDofs,
145  int iDim2,
146  SolutionManager* pLSM,
147  LinSol& ls);
148 
149  virtual ~SchurSolutionManager(void);
150 
151 #ifdef DEBUG
152  void IsValid(void) const;
153 #endif /* DEBUG */
154 
155  /* Inizializza il gestore delle matrici */
156  void MatrReset(void);
157 
158  /* Inizializzatore "speciale" */
159  void MatrInitialize(void);
160 
161  /* Risolve i blocchi chiamando il solutore */
162  void Solve(void);
163 
164  /* sposta il puntatore al vettore del residuo */
166 
167  /* sposta il puntatore al vettore del residuo */
169 
170  /* Rende disponibile l'handler per la matrice */
171  MatrixHandler* pMatHdl(void) const;
172 
173  /* Rende disponibile l'handler per il termine noto */
174  VectorHandler* pResHdl(void) const;
175 
176  /* Rende disponibile l'handler per la soluzione */
177  VectorHandler* pSolHdl(void) const;
178 
179  void StartExchIntRes(void);
181  void StartExchIntSol(void);
183 
184 private:
185  void AssSchur(void);
186 
187  void InitializeComm(void);
188 };
189 
190 #endif /* SCHSOLMAN_H */
191 
SchurVectorHandler * pRVH
Definition: schsolman.h:114
void MatrInitialize(void)
void ComplExchIntRes(doublereal &d, const NonlinearSolverTest *t)
integer * pSchurDofs
Definition: schsolman.h:96
#define MBDYN_EXCEPT_ARGS_PASSTHRU
Definition: except.h:55
integer * pIntDofs
Definition: schsolman.h:89
doublereal * pdCM
Definition: schsolman.h:123
SchurSolutionManager(integer iSize, integer iBlocks, integer *pLocalDofs, int iDim1, integer *pInterfDofs, int iDim2, SolutionManager *pLSM, LinSol &ls)
#define MBDYN_EXCEPT_ARGS_DECL
Definition: except.h:43
MatrixHandler * pBMH
Definition: schsolman.h:122
VectorHandler * pgVH
Definition: schsolman.h:125
void StartExchIntSol(void)
SolutionManager * pLocalSM
Definition: schsolman.h:133
Definition: linsol.h:39
integer * pGlbToLoc
Definition: schsolman.h:99
integer * pDofsRecvdList
Definition: schsolman.h:93
const int S_TAG
Definition: schsolman.h:66
VectorHandler * pResHdl(void) const
MatrixHandler * pSchMH
Definition: schsolman.h:118
integer iWorkSpaceSize
Definition: schsolman.h:110
VectorHandler * pSolVH
Definition: schsolman.h:116
SchurMatrixHandler * pMH
Definition: schsolman.h:113
VectorHandler * pSolSchVH
Definition: schsolman.h:120
const int G_TAG
Definition: schsolman.h:65
integer * pSchGlbToLoc
Definition: schsolman.h:100
ErrGeneric(MBDYN_EXCEPT_ARGS_DECL)
Definition: schsolman.h:72
doublereal * pBuffer
Definition: schsolman.h:108
MatrixHandler * pMatHdl(void) const
void StartExchIntRes(void)
VectorHandler * pSolHdl(void) const
doublereal * pdSetResVec(doublereal *pRes)
void ComplExchIntSol(doublereal &d, const NonlinearSolverTest *t)
doublereal * pdSetSolVec(doublereal *pSol)
void InitializeList(T *list, integer dim, T value)
Definition: schsolman.h:56
virtual ~SchurSolutionManager(void)
VectorHandler * prVH
Definition: schsolman.h:124
double doublereal
Definition: colamd.c:52
void InitializeComm(void)
long int integer
Definition: colamd.c:51
VectorHandler * pSolrVH
Definition: schsolman.h:126
integer * pLocDofs
Definition: schsolman.h:88
SolutionManager * pInterSM
Definition: schsolman.h:134
VectorHandler * pSchVH
Definition: schsolman.h:119