MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
fem_operator_matrix.cpp
Go to the documentation of this file.
1
/*
2
* MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3
* Copyright (C) 2013-2020 Manav Bhatia and MAST authors
4
*
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
9
*
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
*/
19
20
//#include "numerics/fem_operator_matrix.h"
21
//
22
//int main_fem_operator (int argc, char* const argv[])
23
//{
24
// DenseRealVector vec1, vec2, shp;
25
// DenseRealMatrix mat1, mat2, bmat1, bmat2, tmp;
26
//
27
// vec1.resize(12); shp.resize(4);
28
//
29
// for (unsigned int i=0; i<shp.size(); i++)
30
// shp(i) = i+1;
31
//
32
// for (unsigned int i=0; i<vec1.size(); i++)
33
// vec1(i) = i+100;
34
//
35
// shp.print(libMesh::out);
36
// vec1.print(libMesh::out);
37
// mat1.print(libMesh::out);
38
//
39
// MAST::FEMOperatorMatrix b1, b2;
40
// b1.reinit(3, shp); b2.reinit(3, shp);
41
// bmat1.resize(3, shp.size()*3); bmat2.resize(3, shp.size()*3);
42
// for (unsigned int i=0; i<3; i++)
43
// for (unsigned int j=0; j<shp.size(); j++) {
44
// bmat1(i, i*shp.size()+j) = shp(j);
45
// bmat2(i, i*shp.size()+j) = shp(j);
46
// }
47
//
48
//
49
// vec2.resize(3);
50
// b1.vector_mult(vec2, vec1);
51
// libMesh::out << "FEMOperator: " << std::endl; vec2.print(libMesh::out);
52
// bmat1.vector_mult(vec2, vec1);
53
// libMesh::out << "Matrix: " << std::endl; vec2.print(libMesh::out);
54
//
55
// vec1.resize(3);
56
// for (unsigned int i=0; i<vec1.size(); i++)
57
// vec1(i) = 100+i;
58
// vec2.resize(12);
59
// b1.vector_mult_transpose(vec2, vec1);
60
// libMesh::out << "FEMOperator: " << std::endl; vec2.print(libMesh::out);
61
// bmat1.vector_mult_transpose(vec2, vec1);
62
// libMesh::out << "Matrix: " << std::endl; vec2.print(libMesh::out);
63
//
64
//
65
// mat1.resize(5,3);
66
// mat2.resize(5, 12);
67
// for (unsigned int i=0; i<5; i++)
68
// for (unsigned int j=0; j<3; j++)
69
// mat1(i,j) = (i+1)*(j+1);
70
// libMesh::out << "multiply matrix" << std::endl; mat1.print();
71
// b1.left_multiply(mat2, mat1);
72
// libMesh::out << "FEMOperator: " << std::endl; mat2.print();
73
// tmp = bmat1;
74
// tmp.left_multiply(mat1);
75
// libMesh::out << "Matrix: " << std::endl; tmp.print();
76
//
77
//
78
// mat1.resize(5,12);
79
// mat2.resize(5, 3);
80
// for (unsigned int i=0; i<5; i++)
81
// for (unsigned int j=0; j<12; j++)
82
// mat1(i,j) = (i+1)*(j+1);
83
// libMesh::out << "multiply matrix" << std::endl; mat1.print();
84
// b1.left_multiply_transpose(mat2, mat1);
85
// libMesh::out << "FEMOperator: " << std::endl; mat2.print();
86
// bmat1.get_transpose(tmp);
87
// tmp.left_multiply(mat1);
88
// libMesh::out << "Matrix: " << std::endl; tmp.print();
89
//
90
//
91
// mat1.resize(12,5);
92
// mat2.resize(3, 5);
93
// for (unsigned int i=0; i<12; i++)
94
// for (unsigned int j=0; j<5; j++)
95
// mat1(i,j) = (i+1)*(j+1);
96
// libMesh::out << "multiply matrix" << std::endl; mat1.print();
97
// b1.right_multiply(mat2, mat1);
98
// libMesh::out << "FEMOperator: " << std::endl; mat2.print();
99
// tmp = bmat1;
100
// tmp.right_multiply(mat1);
101
// libMesh::out << "Matrix: " << std::endl; tmp.print();
102
//
103
//
104
// mat1.resize(3, 5);
105
// mat2.resize(12, 5);
106
// for (unsigned int i=0; i<3; i++)
107
// for (unsigned int j=0; j<5; j++)
108
// mat1(i,j) = (i+1)*(j+1);
109
// libMesh::out << "multiply matrix" << std::endl; mat1.print();
110
// b1.right_multiply_transpose(mat2, mat1);
111
// libMesh::out << "FEMOperator: " << std::endl; mat2.print();
112
// bmat1.get_transpose(tmp);
113
// tmp.right_multiply(mat1);
114
// libMesh::out << "Matrix: " << std::endl; tmp.print();
115
//
116
//
117
// mat2.resize(12, 12);
118
// b1.right_multiply_transpose(mat2, b1);
119
// libMesh::out << "FEMOperator: " << std::endl; mat2.print();
120
// bmat1.get_transpose(tmp);
121
// tmp.right_multiply(bmat1);
122
// libMesh::out << "Matrix: " << std::endl; tmp.print();
123
//
124
// return 0;
125
//}
126
//
127
//
tests
old
numerics
fem_operator_matrix.cpp
Generated on Fri Jul 24 2020 16:05:45 for MAST by
1.8.13