12#ifndef GOOSEFEM_VECTORPARTITIONEDTYINGS_H
13#define GOOSEFEM_VECTORPARTITIONEDTYINGS_H
19#include <Eigen/Sparse>
42 Eigen::SparseMatrix<double> m_Cdu;
43 Eigen::SparseMatrix<double> m_Cdp;
44 Eigen::SparseMatrix<double> m_Cdi;
45 Eigen::SparseMatrix<double> m_Cud;
46 Eigen::SparseMatrix<double> m_Cpd;
47 Eigen::SparseMatrix<double> m_Cid;
58 Eigen::VectorXd Eigen_asDofs_d(
const T& nodevec)
const
62 Eigen::VectorXd dofval_d(m_nnd, 1);
64#pragma omp parallel for
65 for (
size_t m = 0; m <
m_nnode; ++m) {
66 for (
size_t i = 0; i <
m_ndim; ++i) {
67 if (
m_dofs(m, i) >= m_nni) {
68 dofval_d(
m_dofs(m, i) - m_nni) = nodevec(m, i);
90 template <
class E,
class M>
97 m_nnu =
static_cast<size_t>(m_Cdu.cols());
98 m_nnp =
static_cast<size_t>(m_Cdp.cols());
99 m_nnd =
static_cast<size_t>(m_Cdp.rows());
100 m_nni = m_nnu + m_nnp;
101 m_iiu = xt::arange<size_t>(m_nnu);
102 m_iip = xt::arange<size_t>(m_nnu, m_nnu + m_nnp);
103 m_iii = xt::arange<size_t>(m_nni);
104 m_iid = xt::arange<size_t>(m_nni, m_nni + m_nnd);
105 m_Cud = m_Cdu.transpose();
106 m_Cpd = m_Cdp.transpose();
107 m_Cid = m_Cdi.transpose();
188 void copy_p(
const T& dofval_src, T& dofval_dest)
const
195#pragma omp parallel for
196 for (
size_t i = m_nnu; i < m_nni; ++i) {
197 dofval_dest(i) = dofval_src(i);
223 template <
class T,
class R>
224 void asDofs_i(
const T& nodevec, R& dofval_i,
bool apply_tyings =
true)
const
231#pragma omp parallel for
232 for (
size_t m = 0; m <
m_nnode; ++m) {
233 for (
size_t i = 0; i <
m_ndim; ++i) {
234 if (
m_dofs(m, i) < m_nni) {
235 dofval_i(
m_dofs(m, i)) = nodevec(m, i);
244 Eigen::VectorXd Dofval_d = this->Eigen_asDofs_d(nodevec);
245 Eigen::VectorXd Dofval_i = m_Cid * Dofval_d;
247#pragma omp parallel for
248 for (
size_t i = 0; i < m_nni; ++i) {
249 dofval_i(i) += Dofval_i(i);
Methods to switch between storage types based on a mesh.
Class to switch between storage types.
void asDofs_i(const T &nodevec, R &dofval_i, bool apply_tyings=true) const
Same as InterpQuad_vector(), but writing to preallocated return.
array_type::tensor< double, 1 > AsDofs_i(const T &nodevec) const
Convert to "dofval" (overwrite entries that occur more than once).
const array_type::tensor< size_t, 1 > & iip() const
Independent prescribed DOFs (list of DOF numbers).
const array_type::tensor< size_t, 1 > & iii() const
Independent DOFs (list of DOF numbers).
const array_type::tensor< size_t, 1 > & iid() const
Dependent DOFs (list of DOF numbers).
const array_type::tensor< size_t, 1 > & iiu() const
Independent unknown DOFs (list of DOF numbers).
void copy_p(const T &dofval_src, T &dofval_dest) const
Copy (part of) "dofval" to another "dofval": dofval_dest[iip()] = dofval_src[iip()].
VectorPartitionedTyings(const E &conn, const E &dofs, const M &Cdu, const M &Cdp, const M &Cdi)
Constructor.
Class to switch between storage types.
array_type::tensor< size_t, 2 > m_dofs
See dofs()
const array_type::tensor< size_t, 2 > & conn() const
const array_type::tensor< size_t, 2 > & dofs() const
#define GOOSEFEM_ASSERT(expr)
All assertions are implementation as::
xt::xtensor< T, N > tensor
Fixed (static) rank array.
Toolbox to perform finite element computations.