Class GooseFEM::VectorPartitioned#

class VectorPartitioned : public GooseFEM::Vector#

Class to switch between storage types, based on a mesh and DOFs that are partitioned in:

  • unknown DOFs (iiu()), indicated with “u”.

  • prescribed DOFs (iip()), indicated with “p”.

To this end some internal re-ordering of the DOFs has to be done, as follows:

 iiu() -> arange(nnu())
 iip() -> nnu() + arange(nnp())
which is relevant only if you interact using partitioned DOF-lists (“dofval_u” or “dofval_p”).

The “dofval”, “nodevec”, and “elemvec” are all stored in the ‘normal’ order.

For reference:

  • “dofval”: DOF values [ndof].

  • ”dofval_u”: unknown DOF values, == dofval[iiu()], [nnu].

  • ”dofval_p”: prescribed DOF values, == dofval[iip()], [nnp].

  • ”nodevec”: nodal vectors [nnode, ndim].

  • ”elemvec”: nodal vectors stored per element [nelem, nne, ndim].

Public Functions

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.

Parameters
  • conn – connectivity [nelem, nne].

  • dofs – DOFs per node [nnode, ndim].

  • iip – prescribed DOFs [nnp].

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”:

 nodevec_dest[vector.dofs_is_u()] = nodevec_src
the other DOFs are taken from nodevec_dest:
 nodevec_dest[vector.dofs_is_p()] = nodevec_dest

Parameters
Returns

nodevec output [nnode, ndim]

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”:

 nodevec_dest[vector.dofs_is_u()] = nodevec_src
the other DOFs are taken from nodevec_dest:
 nodevec_dest[vector.dofs_is_p()] = nodevec_dest

Parameters
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”:

 nodevec_dest[vector.dofs_is_p()] = nodevec_src
the other DOFs are taken from nodevec_dest:
 nodevec_dest[vector.dofs_is_u()] = nodevec_dest

Parameters
Returns

nodevec output [nnode, ndim]

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”:

 nodevec_dest[vector.dofs_is_p()] = nodevec_src
the other DOFs are taken from nodevec_dest:
 nodevec_dest[vector.dofs_is_u()] = nodevec_dest

Parameters
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.

Parameters
  • dofval_u – input [nnu]

  • dofval_p – input [nnp]

Returns

dofval output [ndof]

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.

Parameters
  • dofval_u – input [nnu]

  • dofval_p – input [nnp]

  • dofval – output [ndof]

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).

Parameters
  • dofval_u – input [nnu]

  • dofval_p – input [nnp]

Returns

nodevec output [nnode, ndim]

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).

Parameters
  • dofval_u – input [nnu]

  • dofval_p – input [nnp]

  • nodevec – output [nnode, ndim]

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).

Parameters
  • dofval_u – input [nnu]

  • dofval_p – input [nnp]

Returns

elemvec output [nelem, nne, ndim]

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).

Parameters
inline array_type::tensor<double, 1> AsDofs_u(const array_type::tensor<double, 1> &dofval) const#

Extract the unknown “dofval”:

 dofval[iiu()]

Parameters

dofval – input [ndof]

Returns

dofval_u input [nnu]

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()]

Parameters
  • dofval – input [ndof]

  • dofval_u – input [nnu]

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.

Parameters

nodevec – input [nnode, ndim]

Returns

dofval_u input [nnu]

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.

Parameters
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.

Parameters

elemvec – input [nelem, nne, ndim]

Returns

dofval_u input [nnu]

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.

Parameters
inline array_type::tensor<double, 1> AsDofs_p(const array_type::tensor<double, 1> &dofval) const#

Extract the prescribed “dofval”:

 dofval[iip()]

Parameters

dofval – input [ndof]

Returns

dofval_p input [nnp]

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()]

Parameters
  • dofval – input [ndof]

  • dofval_p – input [nnp]

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.

Parameters

nodevec – input [nnode, ndim]

Returns

dofval_p input [nnp]

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.

Parameters
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.

Parameters

elemvec – input [nelem, nne, ndim]

Returns

dofval_p input [nnp]

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.

Parameters