1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/struct/prismj.h,v 1.29 2017/01/12 14:46:43 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 /* Giunti prismatici */ 33 34 #ifndef PRISMJ_H 35 #define PRISMJ_H 36 37 #include "joint.h" 38 #include "drive.h" 39 40 /* PrismaticJoint - begin */ 41 42 class PrismaticJoint : virtual public Elem, public Joint { 43 private: 44 /* Giunto prismatico - vincola due corpi alla traslazione 45 * l'uno rispetto all'altro. Il sistema di riferimento del prisma e' dato 46 * rispetto a quelli dei nodi associati ai corpi. 47 * In particolare rispetto al nodo 1 la trasformazione dal sistema 48 * di riferimento del prisma al sistema globale e': R1*R1h, mentre per 49 * il nodo 2 la medesima trasformazion e': R2*R2h. 50 * Il vettore M esprie le reazioni vincolari di coppia. */ 51 const StructNode* pNode1; 52 const StructNode* pNode2; 53 Mat3x3 R1h; 54 Mat3x3 R2h; 55 Vec3 M; 56 57 public: 58 /* Costruttore non banale */ 59 PrismaticJoint(unsigned int uL, const DofOwner* pDO, 60 const StructNode* pN1, const StructNode* pN2, 61 const Mat3x3& R1hTmp, const Mat3x3& R2hTmp, flag fOut); 62 63 /* Distruttore */ 64 ~PrismaticJoint(void); 65 66 /* Contributo al file di restart */ 67 virtual std::ostream& Restart(std::ostream& out) const; 68 69 /* Tipo di Joint */ GetJointType(void)70 virtual Joint::Type GetJointType(void) const { 71 return Joint::PRISMATIC; 72 }; 73 iGetNumDof(void)74 virtual unsigned int iGetNumDof(void) const { 75 return 3; 76 }; 77 GetDofType(unsigned int i)78 DofOrder::Order GetDofType(unsigned int i) const { 79 ASSERT(i >= 0 && i < 5); 80 return DofOrder::ALGEBRAIC; 81 }; 82 83 DofOrder::Order GetEqType(unsigned int i) const; 84 WorkSpaceDim(integer * piNumRows,integer * piNumCols)85 void WorkSpaceDim(integer* piNumRows, integer* piNumCols) const { 86 *piNumRows = 9; 87 *piNumCols = 9; 88 }; 89 90 91 VariableSubMatrixHandler& AssJac(VariableSubMatrixHandler& WorkMat, 92 doublereal dCoef, 93 const VectorHandler& XCurr, 94 const VectorHandler& XPrimeCurr); 95 SubVectorHandler& AssRes(SubVectorHandler& WorkVec, 96 doublereal dCoef, 97 const VectorHandler& XCurr, 98 const VectorHandler& XPrimeCurr); 99 100 void OutputPrepare(OutputHandler &OH); 101 void Output(OutputHandler& OH) const; 102 103 void SetValue(DataManager *pDM, 104 VectorHandler& X, VectorHandler& XP, 105 SimulationEntity::Hints *ph = 0); 106 107 virtual Hint * 108 ParseHint(DataManager *pDM, const char *s) const; 109 110 /* funzioni usate nell'assemblaggio iniziale */ 111 iGetInitialNumDof(void)112 virtual unsigned int iGetInitialNumDof(void) const { 113 return 6; 114 }; InitialWorkSpaceDim(integer * piNumRows,integer * piNumCols)115 virtual void InitialWorkSpaceDim(integer* piNumRows, 116 integer* piNumCols) const { 117 *piNumRows = 18; 118 *piNumCols = 18; 119 }; 120 121 /* Contributo allo jacobiano durante l'assemblaggio iniziale */ 122 VariableSubMatrixHandler& InitialAssJac(VariableSubMatrixHandler& WorkMat, 123 const VectorHandler& XCurr); 124 125 /* Contributo al residuo durante l'assemblaggio iniziale */ 126 SubVectorHandler& InitialAssRes(SubVectorHandler& WorkVec, 127 const VectorHandler& XCurr); 128 129 #ifdef DEBUG sClassName(void)130 virtual const char* sClassName(void) const { 131 return "PrismaticJoint"; 132 }; 133 #endif 134 135 136 /* *******PER IL SOLUTORE PARALLELO******** */ 137 /* Fornisce il tipo e la label dei nodi che sono connessi all'elemento 138 utile per l'assemblaggio della matrice di connessione fra i dofs */ GetConnectedNodes(std::vector<const Node * > & connectedNodes)139 virtual void GetConnectedNodes(std::vector<const Node *>& connectedNodes) const { 140 connectedNodes.resize(2); 141 connectedNodes[0] = pNode1; 142 connectedNodes[1] = pNode2; 143 }; 144 /* ************************************************ */ 145 }; 146 147 /* PrismaticJoint - end */ 148 149 #endif 150