MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
privdrive.cc
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/privdrive.cc,v 1.23 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 /* Drive che usa i gradi di liberta' */
33 
34 #include "mbconfig.h" /* This goes first in every *.c,*.cc file */
35 
36 #include "privdrive.h"
37 #include "elem.h"
38 #include "node.h"
39 
40 
42  const DriveCaller* pDC,
43  const SimulationEntity *p, unsigned int i, const std::string& s)
44 : DriveCaller(pDH), DriveOwner(pDC), pSE(p), iIndex(i), sIndexName(s)
45 {
46  NO_OP;
47 };
48 
50 {
51  NO_OP;
52 }
53 
54 /* Copia */
57 {
58  DriveCaller* pDC = NULL;
59 
64  pSE, iIndex, sIndexName));
65 
66  return pDC;
67 }
68 
69 
70 /* Restart */
71 std::ostream&
72 PrivDriveCaller::Restart(std::ostream& out) const
73 {
74  const Elem *pElem = dynamic_cast<const Elem *>(pSE);
75  const Node *pNode = dynamic_cast<const Node *>(pSE);
76 
77  if (pElem != 0) {
78  out << " element, "
79  << pElem->GetLabel() << ", "
80  << psReadElemsElems[pElem->GetElemType()] << ", ";
81 
82  } else if (pNode != 0) {
83  out << " node, "
84  << pNode->GetLabel() << ", "
85  << psReadNodesNodes[pNode->GetNodeType()] << ", ";
86 
87  } else {
89  }
90 
91  if (!sIndexName.empty()) {
92  out << "string, " << sIndexName;
93 
94  } else if (pElem->iGetNumPrivData() > 1) {
95  out << "index, " << iIndex;
96  }
97 
98  out << ", ";
99 
100  return DriveOwner::pGetDriveCaller()->Restart(out);
101 }
102 
103 unsigned int
105  return iIndex;
106 }
107 
108 const SimulationEntity *
110  return pSE;
111 }
112 
113 
const SimulationEntity * iGetSE(void) const
Definition: privdrive.cc:109
const char * psReadNodesNodes[]
Definition: enums.cc:398
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
Definition: node.h:67
const SimulationEntity * pSE
Definition: privdrive.h:51
#define NO_OP
Definition: myassert.h:74
virtual Elem::Type GetElemType(void) const =0
virtual std::ostream & Restart(std::ostream &out) const =0
PrivDriveCaller(const DriveHandler *pDH, const DriveCaller *pDC, const SimulationEntity *p, unsigned int i, const std::string &s)
Definition: privdrive.cc:41
DriveHandler * pDrvHdl
Definition: drive.h:444
virtual std::ostream & Restart(std::ostream &out) const
Definition: privdrive.cc:72
virtual DriveCaller * pCopy(void) const
Definition: privdrive.cc:56
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
DriveCaller * pGetDriveCaller(void) const
Definition: drive.cc:658
virtual unsigned int iGetNumPrivData(void) const
Definition: simentity.cc:136
Definition: elem.h:75
virtual Node::Type GetNodeType(void) const =0
std::string sIndexName
Definition: privdrive.h:53
const char * psReadElemsElems[]
Definition: enums.cc:79
unsigned int iGetIndex(void) const
Definition: privdrive.cc:104
unsigned int GetLabel(void) const
Definition: withlab.cc:62
unsigned int iIndex
Definition: privdrive.h:52
virtual ~PrivDriveCaller(void)
Definition: privdrive.cc:49