MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
schurdataman.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/schurdataman.h,v 1.44 2017/01/12 14:46:10 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 /* Schur Data Manager */
33 
34 /*
35  * Copyright 1999-2017 Giuseppe Quaranta <quaranta@aero.polimi.it>
36  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
37  */
38 
39  /* E' una classe derivata da Data Manager che suddivide
40  * i dati in blocchi e li assegna ai vari processi.
41  */
42 
43 #ifndef SCHURDATAMAN_H
44 #define SCHURDATAMAN_H
45 
46 #include <assert.h>
47 #include <mynewmem.h>
48 
49 
50 #include <dataman.h>
51 #include <mbpar.h>
52 
53 #ifdef USE_MPI
54 #include "ac/mpi.h"
55 #endif /* USE_MPI */
56 class Solver;
57 
58 class SchurDataManager : public DataManager {
59 public:
60  class ErrGeneric : public MBDynErrBase {
61  public:
63  };
64 
65 private:
66  int iTotVertices; /* # totale dei vertici: nodi = elementi */
67  Elem** ppMyElems; /* Lista elementi assegnati a questo processo */
69 
70  int iNumLocElems; /* # di elementi assegnati a questo processo */
73 
74  Node** ppMyNodes; /* Lista dei nodi assegnati a questo processo */
75  int iNumLocNodes; /* # di nodi assegnati a questo processo */
82  int iNumMyInt;
84  unsigned int* pLabelsList; /* str. di serv. per CreatePartition */
85  enum {
86  WEIGHT_NONE = 0x00U,
87  WEIGHT_VERTICES = 0x01U,
88  WEIGHT_COMM = 0x02U,
89  WEIGHT_EDGES = 0x04U
90  };
91  unsigned wgtflag;
92  int* pParAmgProcs;
93 
99 
100 #if defined(USE_CHACO)
102 #elif defined(USE_METIS)
103  PARTITIONER_DEFAULT = PARTITIONER_METIS,
104 #else /* ! USE_CHACO && ! USE_METIS */
105  PARTITIONER_DEFAULT = PARTITIONER_MANUAL,
106 #endif /* ! USE_CHACO && ! USE_METIS */
107 
109  } Partitioner;
110 
111 protected:
112 #ifdef USE_MPI
113  MPI::Intracomm DataComm;
114  MPI::Intracomm* pIndVelComm;
115 #endif /* USE_MPI */
117 
121 
122 private:
123 
124  /* compatta il vettore delle adiacenze */
125  void Pack(int* pList, int dim);
126 
127  /* Inizializza le varie liste che vengono utilizzate
128  * in CreatePartition */
129  void InitList(int* list, int dim, int value);
130  void InitList(float* list, int dim, int value);
131 
132  Node** SearchNode(Node** ppFirst, int dim, unsigned int& label);
133 
134  void OutputPartition(void);
135 
136 public:
137  /* Costruttore Inizializza i dati */
139  unsigned OF,
140  Solver* pS,
141  doublereal dInitialTime,
142  const char* sOutputFileName,
143  const char* sInputFileName,
144  bool bAbortAfterInput);
145 
146  /* Distruttore libera la memoria */
147  ~SchurDataManager(void);
148 
149  /* Crea la partizione o la legge dal file fornito */
150  void CreatePartition(void);
151 
152  /* Assembla il residuo */
153  void AssRes(VectorHandler& ResHdl, doublereal dCoef)
155 
156  /* Assembla lo jacobiano */
157  void AssJac(MatrixHandler& JacHdl, doublereal dCoef);
158 
159  /* Funzioni di aggiornamento dati durante la simulazione */
160  void DerivativesUpdate(void) const;
162  VectorHandler& XPrev, VectorHandler& XPPrev) const;
163  void AfterPredict(void) const;
164  void Update(void) const;
165  void AfterConvergence(void) const;
166 
167  /* stampa i risultati */
168  void Output(bool force = false) const;
169 
170  enum DofType { TOTAL = 1, LOCAL = 2, INTERNAL = 3, MYINTERNAL = 4 };
171 
172  integer HowManyDofs(DofType who) const;
173  integer* GetDofsList(DofType who) const;
174 
175  Dof* pGetDofsList(void) const;
176 };
177 
178 #endif /* SCHURDATAMAN_H */
179 
integer * GetDofsList(DofType who) const
integer * pLocalIntDofs
Definition: schurdataman.h:78
enum SchurDataManager::PartitionLibrary Partitioner
unsigned wgtflag
Definition: schurdataman.h:91
Definition: node.h:67
void DerivativesUpdate(void) const
void Update(void) const
#define MBDYN_EXCEPT_ARGS_PASSTHRU
Definition: except.h:55
Elem ** ppExpCntElems
Definition: schurdataman.h:119
void BeforePredict(VectorHandler &X, VectorHandler &XP, VectorHandler &XPrev, VectorHandler &XPPrev) const
#define MBDYN_EXCEPT_ARGS_DECL
Definition: except.h:43
Node ** SearchNode(Node **ppFirst, int dim, unsigned int &label)
Elem ** ppMyIntElems
Definition: schurdataman.h:71
VecIter< Elem * > MyElemIter
Definition: schurdataman.h:68
void AssRes(VectorHandler &ResHdl, doublereal dCoef)
Definition: schurdataman.cc:93
void AfterPredict(void) const
Node ** ppExpCntNodes
Definition: schurdataman.h:118
void AssJac(MatrixHandler &JacHdl, doublereal dCoef)
Definition: schurdataman.cc:99
void Output(bool force=false) const
unsigned int * pLabelsList
Definition: schurdataman.h:84
integer * pMyIntDofs
Definition: schurdataman.h:83
Node ** ppIntNodes
Definition: schurdataman.h:80
void OutputPartition(void)
Definition: solver.h:78
Dof * pGetDofsList(void) const
Definition: elem.h:75
integer HowManyDofs(DofType who) const
SchurDataManager(MBDynParser &HP, unsigned OF, Solver *pS, doublereal dInitialTime, const char *sOutputFileName, const char *sInputFileName, bool bAbortAfterInput)
Definition: schurdataman.cc:70
void Pack(int *pList, int dim)
integer * pLocalDofs
Definition: schurdataman.h:76
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
void AfterConvergence(void) const
Definition: dofown.h:59
ErrGeneric(MBDYN_EXCEPT_ARGS_DECL)
Definition: schurdataman.h:62
void CreatePartition(void)
void InitList(int *list, int dim, int value)