MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
subtest.cc
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/libraries/libmbmath/subtest.cc,v 1.6 2017/01/12 14:43:54 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 #include "mbconfig.h"
33 
34 #include "submat.h"
35 #include "spmapmh.h"
36 
37 int
38 main(void)
39 {
40  FullMatrixHandler FMH(4);
41  SpMapMatrixHandler SMH(4);
42 
43  FullSubMatrixHandler FSMH(2, 2);
44  FSMH.ResizeReset(2, 2);
45 
46  FSMH.PutRowIndex(1, 3);
47  FSMH.PutRowIndex(2, 4);
48 
49  FSMH.PutColIndex(1, 1);
50  FSMH.PutColIndex(2, 2);
51 
52  FSMH(1, 1) = 11.;
53  FSMH(1, 2) = 12.;
54  FSMH(2, 1) = 21.;
55  FSMH(2, 2) = 22.;
56 
57  std::cout << "FSMH: " << std::endl << FSMH << std::endl;
58 
59  FMH.Reset();
60  FSMH.AddTo(FMH);
61 
62  std::cout << "FMH = FSMH: " << std::endl << FMH << std::endl;
63 
64  FMH.Reset();
65  FSMH.SubFrom(FMH);
66 
67  std::cout << "FMH = -FSMH: " << std::endl << FMH << std::endl;
68 
69  FMH.Reset();
70  FSMH.AddToT(FMH);
71 
72  std::cout << "FMH = FSMH^T: " << std::endl << FMH << std::endl;
73 
74  FMH.Reset();
75  FSMH.SubFromT(FMH);
76 
77  std::cout << "FMH = -FSMH^T: " << std::endl << FMH << std::endl;
78 
79  SMH.Reset();
80  FSMH.AddTo(SMH);
81 
82  std::cout << "SMH = FSMH: " << std::endl << SMH << std::endl;
83 
84  SMH.Reset();
85  FSMH.SubFrom(SMH);
86 
87  std::cout << "SMH = -FSMH: " << std::endl << SMH << std::endl;
88 
89  SMH.Reset();
90  FSMH.AddToT(SMH);
91 
92  std::cout << "SMH = FSMH^T: " << std::endl << SMH << std::endl;
93 
94  SMH.Reset();
95  FSMH.SubFromT(SMH);
96 
97  std::cout << "SMH = -FSMH^T: " << std::endl << SMH << std::endl;
98 
99  return 0;
100 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
MatrixHandler & SubFromT(MatrixHandler &MH) const
Definition: submat.cc:748
MatrixHandler & AddTo(MatrixHandler &MH) const
Definition: submat.cc:604
void Reset(void)
Definition: spmapmh.cc:161
MatrixHandler & AddToT(MatrixHandler &MH) const
Definition: submat.cc:632
MatrixHandler & SubFrom(MatrixHandler &MH) const
Definition: submat.cc:720
int main(void)
Definition: subtest.cc:38
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
void Reset(void)
Definition: fullmh.cc:44