File Allocate.h#

Common allocation methods.

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.

Functions

template<class T, class R>
inline void asTensor(const T &arg, R &ret)#

“Broadcast” a scalar stored in an array (e.g.

[r, s]) to the same scalar of all tensor components of a tensor of certain rank (e.g. for rank 2: [r, s, i, j]).

Parameters
  • arg – An array with scalars.

  • ret – Corresponding array with tensors.

template<class T, class S>
inline auto AsTensor(const T &arg, const S &shape)#

“Broadcast” a scalar stored in an array (e.g.

[r, s]) to the same scalar of all tensor components of a tensor of certain rank (e.g. for rank 2: [r, s, i, j]).

Parameters
  • arg – An array with scalars.

  • shape – The shape of the added tensor dimensions (e.g.: [i, j]).

Returns

Corresponding array with tensors.

template<class T, class I, size_t L>
inline auto AsTensor(const T &arg, const I (&shape)[L])#

“Broadcast” a scalar stored in an array (e.g.

[r, s]) to the same scalar of all tensor components of a tensor of certain rank (e.g. for rank 2: [r, s, i, j]).

Parameters
  • arg – An array with scalars.

  • shape – The shape of the added tensor dimensions (e.g.: [i, j]).

Returns

Corresponding array with tensors.

template<size_t rank, class T>
inline auto AsTensor(const T &arg, size_t n)#

“Broadcast” a scalar stored in an array (e.g.

[r, s]) to the same scalar of all tensor components of a tensor of certain rank (e.g. for rank 2: [r, s, n, n]).

Template Parameters

rank – Number of tensor dimensions (number of dimensions to add to the input).

Parameters
  • arg – An array with scalars.

  • n – The shape along each of the added dimensions.

Returns

Corresponding array with tensors.

template<class T>
inline auto AsTensor(size_t rank, const T &arg, size_t n)#

“Broadcast” a scalar stored in an array (e.g.

[r, s]) to the same scalar of all tensor components of a tensor of certain rank (e.g. for rank 2: [r, s, n, n]).

Parameters
  • rank – Number of tensor dimensions (number of dimensions to add to the input).

  • arg – An array with scalars.

  • n – The shape along each of the added dimensions.

Returns

Corresponding array with tensors.

template<class T>
inline T as3d(const T &arg)#

Zero-pad columns to a matrix until is that shape [m, 3].

Parameters

arg – A “nodevec” (arg.shape(1) <= 3).

Returns

Corresponding “nodevec” in 3-d (ret.shape(1) == 3)