MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
playground.cc
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/utils/playground.cc,v 1.17 2017/01/12 15:10:28 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  *
10  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
11  * via La Masa, 34 - 20156 Milano, Italy
12  * http://www.aero.polimi.it
13  *
14  * Changing this copyright notice is forbidden.
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation (version 2 of the License).
19  *
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29  */
30 
31 #include "mbconfig.h" /* This goes first in every *.c,*.cc file */
32 
33 #include <cstdlib>
34 #include <cstring>
35 #include <iostream>
36 
37 #include "matvec3.h"
38 #include "matvec6.h"
39 #include "matvecexp.h"
40 #include "Rot.hh"
41 
42 int
43 main(int argn, const char* const argv[])
44 {
45  static doublereal d[9];
46  while (true) {
47  std::cin >> d[0];
48  if (std::cin) {
49  std::cin >> d[1] >> d[2];
50 
51 #if 0
52  Mat3x3 Gamma_m1 = RotManip::DRot_I(Vec3(d));
53  Mat3x3 Gamma = Gamma_m1.Inv();
54  doublereal dDet = Gamma.dDet();
55  std::cout << "Gamma=" << Gamma << " det(Gamma)=" << dDet << std::endl;
56 #endif
57 
58 #if 0
60  Vec3 Theta(RotManip::VecRot(R));
61  Mat3x3 Rcheck(RotManip::Rot(Theta));
62  std::cout << "R={" << R << "}" << std::endl
63  << " V={" << Theta << "}" << std::endl
64  << " R={" << Rcheck << "}" << std::endl
65  << " I={" << R.MulMT(Rcheck) << "}"
66  << std::endl;
67 #endif
68 
69  std::cin >> d[3] >> d[4] >> d[5] >> d[6] >> d[7] >> d[8];
70  Mat3x3 M(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8]);
71  doublereal b[3];
72  std::cin >> b[0] >> b[1] >> b[2];
73  Vec3 x = M.LDLSolve(Vec3(b[0], b[1], b[2]));
74  std::cout << x << std::endl;
75  } else {
76  break;
77  }
78  }
79 
80  return EXIT_SUCCESS;
81 }
82 
Definition: matvec3.h:98
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
Mat3x3 Inv(const doublereal &ddet) const
Definition: matvec3.cc:133
doublereal dDet(void) const
Definition: matvec3.cc:122
Mat3x3 Rot(const Vec3 &phi)
Definition: Rot.cc:62
Vec3 LDLSolve(const Vec3 &v) const
Definition: matvec3.cc:199
Mat3x3 MulMT(const Mat3x3 &m) const
Definition: matvec3.cc:444
int main(int argn, const char *const argv[])
Definition: playground.cc:43
double doublereal
Definition: colamd.c:52
Mat3x3 DRot_I(const Vec3 &phi)
Definition: Rot.cc:111
Mat3x3 R