MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
j2p.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/j2p.h,v 1.30 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 #ifndef J2P_H
33 #define J2P_H
34 
35 #include "node.h"
36 #include "elem.h"
37 
38 /* Elem2Param - begin */
39 
40 class Elem2Param : public ParameterNode {
41 protected:
42  const Elem* pElem;
43  unsigned int iNum;
44 
45 public:
46  Elem2Param(unsigned int uL, const DofOwner* pDO, flag fOut);
47  virtual ~Elem2Param(void);
48 
49  virtual void Bind(const Elem* pEl, unsigned int i);
50 
51  /* Contributo del nodo al file di restart */
52  virtual std::ostream& Restart(std::ostream& out) const;
53  std::ostream& RestartBind(std::ostream& out) const;
54 
55  /* Restituisce il valore del dof iDof;
56  * se differenziale, iOrder puo' essere = 1 per la derivata */
57  virtual inline const doublereal&
58  dGetDofValue(int iDof, int iOrder = 0) const;
59 
60  /* virtual void SetX(const doublereal& d); */
61  virtual inline const doublereal& dGetX(void) const;
62 
63  /* Setta il valore del dof iDof a dValue;
64  * se differenziale, iOrder puo' essere = 1 per la derivata */
65  virtual void SetDofValue(const doublereal& dValue,
66  unsigned int iDof,
67  unsigned int iOrder = 0);
68 
69  virtual void SetValue(DataManager *pDM,
71  SimulationEntity::Hints *ph = 0);
72 };
73 
74 
75 /* Restituisce il valore del dof iDof;
76  * se differenziale, iOrder puo' essere = 1 per la derivata */
77 inline const doublereal&
78 Elem2Param::dGetDofValue(int iDof, int iOrder) const
79 {
80  ASSERT(iDof == 1);
81  ASSERT(iOrder == 0);
82  return dGetX();
83 }
84 
85 /* Restituisce il valore del dof */
86 inline const doublereal&
87 Elem2Param::dGetX(void) const
88 {
89  /* element could be undefined (yet) */
90  if (pElem != 0) {
92  }
93  return dX;
94 }
95 
96 /* Elem2Param - end */
97 
98 
99 /* StrainGageParam - begin */
100 
101 class StrainGageParam : public Elem2Param {
102 protected:
105 
106 public:
107  StrainGageParam(unsigned int uL, const DofOwner* pDO,
108  doublereal dy, doublereal dz, flag fOut);
109  virtual ~StrainGageParam(void);
110 
111  virtual void Bind(const Elem* pEl, unsigned int i);
112 
113  /* Contributo del nodo al file di restart */
114  virtual std::ostream& Restart(std::ostream& out) const;
115 
116  /* Restituisce il valore del dof iDof;
117  * se differenziale, iOrder puo' essere = 1 per la derivata */
118  virtual inline const doublereal&
119  dGetDofValue(int iDof, int iOrder = 0) const;
120 
121  /* virtual void SetX(const doublereal& d); */
122  virtual inline const doublereal& dGetX(void) const;
123 };
124 
125 
126 /* Restituisce il valore del dof iDof;
127  * se differenziale, iOrder puo' essere = 1 per la derivata */
128 inline const doublereal&
129 StrainGageParam::dGetDofValue(int iDof, int iOrder) const
130 {
131  ASSERT(iDof == 1);
132  ASSERT(iOrder == 0);
133  return dGetX();
134 }
135 
136 
137 /* Restituisce il valore del dof iDof;
138  * se differenziale, iOrder puo' essere = 1 per la derivata */
139 inline const doublereal&
141 {
142  unsigned int i = iNum - 1;
143 
144  dX = pElem->dGetPrivData(i + 1)
145  + dZ*pElem->dGetPrivData(i + 5)
146  - dY*pElem->dGetPrivData(i + 6);
147 
148  return dX;
149 }
150 
151 /* StrainGageParam - end */
152 
153 #endif /* J2P_H */
154 
std::ostream & RestartBind(std::ostream &out) const
Definition: j2p.cc:95
virtual const doublereal & dGetDofValue(int iDof, int iOrder=0) const
Definition: j2p.h:78
long int flag
Definition: mbdyn.h:43
StrainGageParam(unsigned int uL, const DofOwner *pDO, doublereal dy, doublereal dz, flag fOut)
Definition: j2p.cc:134
virtual std::ostream & Restart(std::ostream &out) const
Definition: j2p.cc:87
std::vector< Hint * > Hints
Definition: simentity.h:89
virtual ~Elem2Param(void)
Definition: j2p.cc:46
virtual std::ostream & Restart(std::ostream &out) const
Definition: j2p.cc:180
virtual const doublereal & dGetX(void) const
Definition: j2p.h:87
doublereal dX
Definition: node.h:405
virtual void Bind(const Elem *pEl, unsigned int i)
Definition: j2p.cc:147
virtual const doublereal & dGetDofValue(int iDof, int iOrder=0) const
Definition: j2p.h:129
virtual void SetDofValue(const doublereal &dValue, unsigned int iDof, unsigned int iOrder=0)
Definition: j2p.cc:108
virtual void Bind(const Elem *pEl, unsigned int i)
Definition: j2p.cc:53
const Elem * pElem
Definition: j2p.h:42
unsigned int iNum
Definition: j2p.h:43
#define ASSERT(expression)
Definition: colamd.c:977
virtual ~StrainGageParam(void)
Definition: j2p.cc:141
doublereal dY
Definition: j2p.h:103
virtual doublereal dGetPrivData(unsigned int i) const
Definition: simentity.cc:149
virtual const doublereal & dGetX(void) const
Definition: j2p.h:140
Elem2Param(unsigned int uL, const DofOwner *pDO, flag fOut)
Definition: j2p.cc:40
Definition: j2p.h:40
Definition: elem.h:75
virtual void SetValue(DataManager *pDM, VectorHandler &, VectorHandler &, SimulationEntity::Hints *ph=0)
Definition: j2p.cc:116
doublereal dZ
Definition: j2p.h:104
double doublereal
Definition: colamd.c:52