File VectorPartitioned.h#
Methods to switch between storage types based on a mesh and DOFs that are partitioned in:
unknown DOFs
prescribed DOFs
- Copyright
Copyright 2017. Tom de Geus. All rights reserved.
- License: This project is released under the GNU Public License (GPLv3).
-
namespace GooseFEM
Toolbox to perform finite element computations.
-
class VectorPartitioned : public GooseFEM::Vector
- #include <GooseFEM/VectorPartitioned.h>
Class to switch between storage types, based on a mesh and DOFs that are partitioned in:
To this end some internal re-ordering of the DOFs has to be done, as follows:
which is relevant only if you interact using partitioned DOF-lists (“dofval_u” or “dofval_p”).iiu() -> arange(nnu()) iip() -> nnu() + arange(nnp())
The “dofval”, “nodevec”, and “elemvec” are all stored in the ‘normal’ order.
For reference:
Public Functions
-
VectorPartitioned() = default#
-
inline VectorPartitioned(const array_type::tensor<size_t, 2> &conn, const array_type::tensor<size_t, 2> &dofs, const array_type::tensor<size_t, 1> &iip)
Constructor.
-
inline size_t nnu() const
- Returns
Number of unknown DOFs.
-
inline size_t nnp() const
- Returns
Number of prescribed DOFs.
-
inline const array_type::tensor<size_t, 1> &iiu() const
- Returns
Unknown DOFs [nnu].
-
inline const array_type::tensor<size_t, 1> &iip() const
- Returns
Prescribed DOFs [nnp].
-
inline array_type::tensor<bool, 2> dofs_is_u() const
Per DOF (see Vector::dofs()) list if unknown (“u”).
- Returns
Boolean “nodevec”.
-
inline array_type::tensor<bool, 2> dofs_is_p() const
Per DOF (see Vector::dofs()) list if prescribed (“p”).
- Returns
Boolean “nodevec”.
-
inline array_type::tensor<double, 2> Copy_u(const array_type::tensor<double, 2> &nodevec_src, const array_type::tensor<double, 2> &nodevec_dest) const
Copy unknown DOFs from “nodevec” to another “nodvec”:
the other DOFs are taken fromnodevec_dest[vector.dofs_is_u()] = nodevec_src
nodevec_dest
:nodevec_dest[vector.dofs_is_p()] = nodevec_dest
-
inline void copy_u(const array_type::tensor<double, 2> &nodevec_src, array_type::tensor<double, 2> &nodevec_dest) const
Copy unknown DOFs from “nodevec” to another “nodvec”:
the other DOFs are taken fromnodevec_dest[vector.dofs_is_u()] = nodevec_src
nodevec_dest
:nodevec_dest[vector.dofs_is_p()] = nodevec_dest
-
inline array_type::tensor<double, 2> Copy_p(const array_type::tensor<double, 2> &nodevec_src, const array_type::tensor<double, 2> &nodevec_dest) const
Copy prescribed DOFs from “nodevec” to another “nodvec”:
the other DOFs are taken fromnodevec_dest[vector.dofs_is_p()] = nodevec_src
nodevec_dest
:nodevec_dest[vector.dofs_is_u()] = nodevec_dest
-
inline void copy_p(const array_type::tensor<double, 2> &nodevec_src, array_type::tensor<double, 2> &nodevec_dest) const
Copy prescribed DOFs from “nodevec” to another “nodvec”:
the other DOFs are taken fromnodevec_dest[vector.dofs_is_p()] = nodevec_src
nodevec_dest
:nodevec_dest[vector.dofs_is_u()] = nodevec_dest
-
inline array_type::tensor<double, 1> DofsFromParitioned(const array_type::tensor<double, 1> &dofval_u, const array_type::tensor<double, 1> &dofval_p) const
Combine unknown and prescribed “dofval” into a single “dofval” list.
-
inline void dofsFromParitioned(const array_type::tensor<double, 1> &dofval_u, const array_type::tensor<double, 1> &dofval_p, array_type::tensor<double, 1> &dofval) const
Combine unknown and prescribed “dofval” into a single “dofval” list.
-
inline array_type::tensor<double, 2> NodeFromPartitioned(const array_type::tensor<double, 1> &dofval_u, const array_type::tensor<double, 1> &dofval_p) const
Combine unknown and prescribed “dofval” into a single “dofval” list and directly convert to “nodeval” without a temporary (overwrite entries that occur more than once).
-
inline void nodeFromPartitioned(const array_type::tensor<double, 1> &dofval_u, const array_type::tensor<double, 1> &dofval_p, array_type::tensor<double, 2> &nodevec) const
Combine unknown and prescribed “dofval” into a single “dofval” list and directly convert to “nodeval” without a temporary (overwrite entries that occur more than once).
-
inline array_type::tensor<double, 3> ElementFromPartitioned(const array_type::tensor<double, 1> &dofval_u, const array_type::tensor<double, 1> &dofval_p) const
Combine unknown and prescribed “dofval” into a single “dofval” list and directly convert to “elemvec” without a temporary (overwrite entries that occur more than once).
-
inline void elementFromPartitioned(const array_type::tensor<double, 1> &dofval_u, const array_type::tensor<double, 1> &dofval_p, array_type::tensor<double, 3> &elemvec) const
Combine unknown and prescribed “dofval” into a single “dofval” list and directly convert to “elemvec” without a temporary (overwrite entries that occur more than once).
-
inline array_type::tensor<double, 1> AsDofs_u(const array_type::tensor<double, 1> &dofval) const
Extract the unknown “dofval”:
dofval[iiu()]
-
inline void asDofs_u(const array_type::tensor<double, 1> &dofval, array_type::tensor<double, 1> &dofval_u) const
Extract the unknown “dofval”:
dofval[iiu()]
-
inline array_type::tensor<double, 1> AsDofs_u(const array_type::tensor<double, 2> &nodevec) const
Convert “nodevec” to “dofval” (overwrite entries that occur more than once) and extract the unknown “dofval” without a temporary.
-
inline void asDofs_u(const array_type::tensor<double, 2> &nodevec, array_type::tensor<double, 1> &dofval_u) const
Convert “nodevec” to “dofval” (overwrite entries that occur more than once) and extract the unknown “dofval” without a temporary.
-
inline array_type::tensor<double, 1> AsDofs_u(const array_type::tensor<double, 3> &elemvec) const
Convert “elemvec” to “dofval” (overwrite entries that occur more than once) and extract the unknown “dofval” without a temporary.
-
inline void asDofs_u(const array_type::tensor<double, 3> &elemvec, array_type::tensor<double, 1> &dofval_u) const
Convert “elemvec” to “dofval” (overwrite entries that occur more than once) and extract the unknown “dofval” without a temporary.
-
inline array_type::tensor<double, 1> AsDofs_p(const array_type::tensor<double, 1> &dofval) const
Extract the prescribed “dofval”:
dofval[iip()]
-
inline void asDofs_p(const array_type::tensor<double, 1> &dofval, array_type::tensor<double, 1> &dofval_p) const
Extract the prescribed “dofval”:
dofval[iip()]
-
inline array_type::tensor<double, 1> AsDofs_p(const array_type::tensor<double, 2> &nodevec) const
Convert “nodevec” to “dofval” (overwrite entries that occur more than once) and extract the prescribed “dofval” without a temporary.
-
inline void asDofs_p(const array_type::tensor<double, 2> &nodevec, array_type::tensor<double, 1> &dofval_p) const
Convert “nodevec” to “dofval” (overwrite entries that occur more than once) and extract the prescribed “dofval” without a temporary.
-
inline array_type::tensor<double, 1> AsDofs_p(const array_type::tensor<double, 3> &elemvec) const
Convert “elemvec” to “dofval” (overwrite entries that occur more than once) and extract the prescribed “dofval” without a temporary.
-
inline void asDofs_p(const array_type::tensor<double, 3> &elemvec, array_type::tensor<double, 1> &dofval_p) const
Convert “elemvec” to “dofval” (overwrite entries that occur more than once) and extract the prescribed “dofval” without a temporary.
Protected Attributes
-
array_type::tensor<size_t, 1> m_iiu#
See iiu()
-
array_type::tensor<size_t, 1> m_iip#
See iip()
-
array_type::tensor<size_t, 2> m_part#
Renumbered DOFs per node, such that.
making is much simpler to slice.iiu = arange(nnu) iip = nnu + arange(nnp)
-
VectorPartitioned() = default#
-
class VectorPartitioned : public GooseFEM::Vector