MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
bulk.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/bulk.h,v 1.27 2017/01/12 14:46:09 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 /* Bulk elements */
33 
34 #ifndef BULK_H
35 #define BULK_H
36 
37 #include "elem.h"
38 #include "node.h"
39 #include "drive.h"
40 
41 
42 /* Tipi di bulk */
43 class BulkType {
44  public:
45  enum Type {
46  UNKNOWN = -1,
49 
51  };
52 };
53 
54 extern const char* psBulkNames[];
55 
56 
57 /* Bulk - begin */
58 
59 class Bulk : virtual public Elem {
60  public:
61  Bulk(unsigned int uLabel, flag fOutput)
62  : Elem(uLabel, fOutput) {
63  NO_OP;
64  };
65 
66  virtual ~Bulk(void) {
67  NO_OP;
68  };
69 
70  virtual Elem::Type GetElemType(void) const {
71  return Elem::BULK;
72  };
73 };
74 
75 /* Bulk - end */
76 
77 
78 /* BulkSpringSupport - begin */
79 
81 : virtual public Elem, public Bulk, public DriveOwner {
82  protected:
84 
85  public:
86  BulkSpringSupport(unsigned int uLabel, const DriveCaller* pDC,
87  const ScalarDof& sd, flag fOutput)
88  : Elem(uLabel, fOutput), Bulk(uLabel, fOutput),
89  DriveOwner(pDC), SD(sd) {
90  NO_OP;
91  };
92 
93  virtual ~BulkSpringSupport(void) {
94  NO_OP;
95  };
96 
97  /* Scrive il contributo dell'elemento al file di restart */
98  virtual std::ostream& Restart(std::ostream& out) const {
99  return out;
100  };
101 
102 
103  /* Dimensioni del workspace */
104  virtual void WorkSpaceDim(integer* piNumRows, integer* piNumCols) const {
105  *piNumRows = 1;
106  *piNumCols = 1;
107  };
108 
109  /* assemblaggio jacobiano */
110  virtual VariableSubMatrixHandler&
112  doublereal dCoef,
113  const VectorHandler& /* XCurr */ ,
114  const VectorHandler& /* XPrimeCurr */ ) {
115 
116  FullSubMatrixHandler& WM = WorkMat.SetFull();
117  WM.ResizeReset(1, 1);
118 
119  integer iRowIndex = SD.pNode->iGetFirstRowIndex()+1;
120  integer iColIndex = SD.pNode->iGetFirstColIndex()+1;
121  WM.PutRowIndex(1, iRowIndex);
122  WM.PutColIndex(1, iColIndex);
123 
124  doublereal d = dGet();
125  if (SD.iOrder == 0) {
126  d *= dCoef;
127  }
128  WM.PutCoef(1, 1, d);
129 
130  return WorkMat;
131  };
132 
133  /* assemblaggio residuo */
135  doublereal /* dCoef */ ,
136  const VectorHandler& /* XCurr */ ,
137  const VectorHandler& /* XPrimeCurr */ ) {
138  WorkVec.Resize(1);
139  WorkVec.Reset();
140 
141  integer iRowIndex = SD.pNode->iGetFirstRowIndex()+1;
142  doublereal dVal = SD.pNode->dGetDofValue(1, SD.iOrder);
143  WorkVec.PutItem(1, iRowIndex, -dGet()*dVal);
144 
145  return WorkVec;
146  };
147 
148  /* *******PER IL SOLUTORE PARALLELO******** */
149  /* Fornisce il tipo e la label dei nodi che sono connessi all'elemento
150  utile per l'assemblaggio della matrice di connessione fra i dofs */
151  virtual void GetConnectedNodes(std::vector<const Node *>& connectedNodes) const {
152  connectedNodes.resize(1);
153  connectedNodes[0] = SD.pNode;
154  };
155  /* ************************************************ */
156 };
157 
158 /* BulkSpringSupport - end */
159 
160 class DataManager;
161 class MBDynParser;
162 
163 extern Elem* ReadBulk(DataManager* pDM, MBDynParser& HP, unsigned int uLabel);
164 
165 #endif
ScalarNode * pNode
Definition: node.h:708
virtual void Reset(void)=0
virtual const doublereal & dGetDofValue(int iDof, int iOrder=0) const =0
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &, const VectorHandler &)
Definition: bulk.h:111
long int flag
Definition: mbdyn.h:43
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
flag fOutput
Definition: output.h:658
int iOrder
Definition: node.h:710
virtual Elem::Type GetElemType(void) const
Definition: bulk.h:70
Elem * ReadBulk(DataManager *pDM, MBDynParser &HP, unsigned int uLabel)
Definition: bulk.cc:39
doublereal dGet(void) const
Definition: drive.cc:671
void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:672
const char * psBulkNames[]
Definition: enums.cc:342
Definition: bulk.h:59
Definition: bulk.h:43
#define NO_OP
Definition: myassert.h:74
virtual void PutItem(integer iSubRow, integer iRow, const doublereal &dCoef)
Definition: submat.h:1445
virtual ~BulkSpringSupport(void)
Definition: bulk.h:93
Type
Definition: bulk.h:45
DataManager * pDM
Definition: mbpar.h:252
virtual ~Bulk(void)
Definition: bulk.h:66
virtual integer iGetFirstRowIndex(void) const
Definition: node.cc:82
unsigned int uLabel
Definition: withlab.h:44
ScalarDof SD
Definition: bulk.h:83
Bulk(unsigned int uLabel, flag fOutput)
Definition: bulk.h:61
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
Definition: elem.h:75
Type
Definition: elem.h:91
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
virtual std::ostream & Restart(std::ostream &out) const
Definition: bulk.h:98
virtual void WorkSpaceDim(integer *piNumRows, integer *piNumCols) const
Definition: bulk.h:104
virtual SubVectorHandler & AssRes(SubVectorHandler &WorkVec, doublereal, const VectorHandler &, const VectorHandler &)
Definition: bulk.h:134
virtual void GetConnectedNodes(std::vector< const Node * > &connectedNodes) const
Definition: bulk.h:151
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
BulkSpringSupport(unsigned int uLabel, const DriveCaller *pDC, const ScalarDof &sd, flag fOutput)
Definition: bulk.h:86
virtual void Resize(integer iNewSize)=0
virtual integer iGetFirstColIndex(void) const
Definition: node.cc:88