20 #ifndef __mast__fem_operator_matrix__ 21 #define __mast__fem_operator_matrix__ 54 void print(std::ostream& o);
62 void reinit(
unsigned int n_interpolated_vars,
63 unsigned int n_discrete_vars,
64 unsigned int n_discrete_dofs_per_var);
74 unsigned int discrete_var,
83 void reinit(
unsigned int n_interpolated_vars,
103 template <
typename T>
110 template <
typename T>
117 template <
typename T>
124 template <
typename T>
131 template <
typename T>
168 unsigned int index = 0;
172 index = j*_n_interpolated_vars+i;
178 o << std::setw(15) << 0.;
197 for ( ; it!=end; it++)
211 unsigned int n_discrete_vars,
212 unsigned int n_discrete_dofs_per_var) {
229 unsigned int discrete_var,
266 for (
unsigned int i=0; i<n_vars; i++)
276 template <
typename T>
283 libmesh_assert_equal_to(v.size(),
n());
286 unsigned int index = 0;
290 index = j*_n_interpolated_vars+i;
299 template <
typename T>
305 libmesh_assert_equal_to(res.size(),
n());
308 res.setZero(res.size());
309 unsigned int index = 0;
313 index = j*_n_interpolated_vars+i;
316 res(j*_n_dofs_per_var+k) +=
323 template <
typename T>
330 libmesh_assert_equal_to(r.cols(), m.cols());
331 libmesh_assert_equal_to(m.rows(),
n());
334 unsigned int index = 0;
338 index = j*_n_interpolated_vars+i;
340 for (
unsigned int l=0; l<m.cols(); l++)
351 template <
typename T>
357 libmesh_assert_equal_to(r.rows(),
n());
358 libmesh_assert_equal_to(r.cols(), m.cols());
361 r.setZero(r.rows(), r.cols());
362 unsigned int index = 0;
366 index = j*_n_interpolated_vars+i;
368 for (
unsigned int l=0; l<m.cols(); l++)
370 r(j*_n_dofs_per_var+k,l) +=
378 template <
typename T>
384 libmesh_assert_equal_to(r.rows(),
n());
385 libmesh_assert_equal_to(r.cols(), m.
n());
389 unsigned int index_i, index_j = 0;
394 index_i = i*_n_interpolated_vars+k;
400 for (
unsigned int i_n1=0; i_n1<n1.size(); i_n1++)
401 for (
unsigned int i_n2=0; i_n2<n2.size(); i_n2++)
411 template <
typename T>
417 libmesh_assert_equal_to(r.rows(), m.rows());
418 libmesh_assert_equal_to(r.cols(),
n());
421 r.setZero(r.rows(), r.cols());
422 unsigned int index = 0;
426 index = j*_n_interpolated_vars+i;
428 for (
unsigned int l=0; l<m.rows(); l++)
430 r(l,j*_n_dofs_per_var+k) +=
438 template <
typename T>
444 libmesh_assert_equal_to(r.rows(), m.rows());
446 libmesh_assert_equal_to(m.cols(),
n());
449 unsigned int index = 0;
453 index = j*_n_interpolated_vars+i;
455 for (
unsigned int l=0; l<m.rows(); l++)
466 #endif // __mast__fem_operator_matrix__ void vector_mult_transpose(T &res, const T &v) const
res = v^T * [this]
void reinit(unsigned int n_interpolated_vars, unsigned int n_discrete_vars, unsigned int n_discrete_dofs_per_var)
this initializes the operator for number of rows and variables, assuming that all variables has the s...
void set_shape_function(unsigned int interpolated_var, unsigned int discrete_var, const RealVectorX &shape_func)
sets the shape function values for the block corresponding to interpolated_var and discrete_var...
void right_multiply(T &r, const T &m) const
[R] = [this] * [M]
void clear()
clears the data structures
std::vector< RealVectorX * > _var_shape_functions
stores the shape function values that defines the coupling of i_th interpolated var and j_th discrete...
unsigned int _n_discrete_vars
number of discrete variables in the system
unsigned int _n_dofs_per_var
number of dofs for each variable
void print(std::ostream &o)
void vector_mult(T &res, const T &v) const
res = [this] * v
void left_multiply_transpose(T &r, const T &m) const
[R] = [M] * [this]^T
Matrix< Real, Dynamic, 1 > RealVectorX
void right_multiply_transpose(T &r, const T &m) const
[R] = [this]^T * [M]
void left_multiply(T &r, const T &m) const
[R] = [M] * [this]
unsigned int _n_interpolated_vars
number of rows of the operator
virtual ~FEMOperatorMatrix()