Namespace GooseFEM::Mesh::Quad4::Map#

namespace Map

Mesh mappings.

class FineLayer2Regular
#include <GooseFEM/MeshQuad4.h>

Map a FineLayer mesh to a Regular mesh.

The element size of the Regular corresponds to the smallest elements of the FineLayer mesh (along the middle layer).

Public Functions

inline FineLayer2Regular(const GooseFEM::Mesh::Quad4::FineLayer &mesh)

Constructors.

Parameters

mesh – The FineLayer mesh.

inline GooseFEM::Mesh::Quad4::Regular regularMesh() const

Obtain the Regular mesh.

Returns

mesh.

inline GooseFEM::Mesh::Quad4::FineLayer fineLayerMesh() const

Obtain the FineLayer mesh (copy of the mesh passed to the constructor).

Returns

mesh.

inline std::vector<std::vector<size_t>> map() const

Get element-mapping: elements of the Regular mesh per element of the FineLayer mesh.

The number of Regular elements varies between elements of the FineLayer mesh.

Returns

[nelem_finelayer, ?]

inline std::vector<std::vector<double>> mapFraction() const

To overlap fraction for each item in the mapping in map().

Returns

[nelem_finelayer, ?]

inline GooseFEM::Mesh::Quad4::Regular getRegularMesh() const

Obtain the Regular mesh.

Returns

mesh.

inline GooseFEM::Mesh::Quad4::FineLayer getFineLayerMesh() const

Obtain the FineLayer mesh (copy of the mesh passed to the constructor).

Returns

mesh.

inline std::vector<std::vector<size_t>> getMap() const

Get element-mapping: elements of the Regular mesh per element of the FineLayer mesh.

The number of Regular elements varies between elements of the FineLayer mesh.

Returns

[nelem_finelayer, ?]

inline std::vector<std::vector<double>> getMapFraction() const

To overlap fraction for each item in the mapping in getMap().

Returns

[nelem_finelayer, ?]

template<class T, size_t rank>
inline array_type::tensor<T, rank> mapToRegular(const array_type::tensor<T, rank> &data) const

Map element quantities to Regular.

The mapping is a bit simplistic: no interpolation is involved, the function just accounts the fraction of overlap between the FineLayer element and the Regular element. The mapping is such that::

 ret[e_regular, ...] <- arg[e_finelayer, ...]

Template Parameters
  • T – type of the data (e.g. double).

  • rank – rank of the data.

Parameters

data – data.

Returns

mapped data.

class RefineRegular
#include <GooseFEM/MeshQuad4.h>

Refine a Regular mesh: subdivide elements in several smaller elements.

Public Functions

inline RefineRegular(const GooseFEM::Mesh::Quad4::Regular &mesh, size_t nx, size_t ny)

Constructor.

Parameters
  • mesh – the coarse mesh.

  • nx – for each coarse element: number of fine elements in x-direction.

  • ny – for each coarse element: number of fine elements in y-direction.

inline size_t nx() const

For each coarse element: number of fine elements in x-direction.

Returns

unsigned int (same as used in constructor)

inline size_t ny() const

For each coarse element: number of fine elements in y-direction.

Returns

unsigned int (same as used in constructor)

inline GooseFEM::Mesh::Quad4::Regular coarseMesh() const

Obtain the coarse mesh (copy of the mesh passed to the constructor).

Returns

mesh

inline GooseFEM::Mesh::Quad4::Regular fineMesh() const

Obtain the fine mesh.

Returns

mesh

inline const array_type::tensor<size_t, 2> &map() const

Get element-mapping: elements of the fine mesh per element of the coarse mesh.

Returns

[nelem_coarse, nx() * ny()]

inline GooseFEM::Mesh::Quad4::Regular getCoarseMesh() const

Obtain the coarse mesh (copy of the mesh passed to the constructor).

Returns

mesh

inline GooseFEM::Mesh::Quad4::Regular getFineMesh() const

Obtain the fine mesh.

Returns

mesh

inline const array_type::tensor<size_t, 2> &getMap() const

Get element-mapping: elements of the fine mesh per element of the coarse mesh.

Returns

[nelem_coarse, nx() * ny()]

template<class T, size_t rank>
inline array_type::tensor<T, rank> meanToCoarse(const array_type::tensor<T, rank> &data) const

Compute the mean of the quantity define on the fine mesh when mapped on the coarse mesh.

Template Parameters
  • T – type of the data (e.g. double).

  • rank – rank of the data.

Parameters

data – the data [nelem_fine, …]

Returns

the average data of the coarse mesh [nelem_coarse, …]

template<class T, size_t rank, class S>
inline array_type::tensor<T, rank> averageToCoarse(const array_type::tensor<T, rank> &data, const array_type::tensor<S, rank> &weights) const

Compute the average of the quantity define on the fine mesh when mapped on the coarse mesh.

Template Parameters
  • T – type of the data (e.g. double).

  • rank – rank of the data.

  • S – type of the weights (e.g. double).

Parameters
  • data – the data [nelem_fine, …]

  • weights – the weights [nelem_fine, …]

Returns

the average data of the coarse mesh [nelem_coarse, …]

template<class T, size_t rank>
inline array_type::tensor<T, rank> mapToFine(const array_type::tensor<T, rank> &data) const

Map element quantities to the fine mesh.

The mapping is a bit simplistic: no interpolation is involved. The mapping is such that::

 ret[e_fine, ...] <- data[e_coarse, ...]

Template Parameters
  • T – type of the data (e.g. double).

  • rank – rank of the data.

Parameters

data – the data.

Returns

mapped data.