Nektar++
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Nektar::SpatialDomains::XmapFactory< StdExp, dim > Class Template Reference

A simple factory for Xmap objects that is based on the element type, the basis and quadrature selection. More...

#include <XmapFactory.hpp>

Classes

struct  KeyEqual
 
struct  KeyHash
 Hash for key_t. More...
 

Public Member Functions

 XmapFactory ()=default
 
StdRegions::StdExpansionSharedPtr CreateInstance (const key_t &basis)
 Returns (and creates, if necessary) a standard expansion corresponding to.
 

Private Types

using key_t = std::array< LibUtilities::BasisKey, dim >
 Key for the Xmap: an array of dimension dim which contains the basis keys for each coordinate direction.
 

Private Member Functions

template<int d, typename std::enable_if< d==1, int >::type = 0>
std::shared_ptr< StdExp > CreateStdExp (const key_t &args)
 
template<int d, typename std::enable_if< d==2, int >::type = 0>
std::shared_ptr< StdExp > CreateStdExp (const key_t &args)
 
template<int d, typename std::enable_if< d==3, int >::type = 0>
std::shared_ptr< StdExp > CreateStdExp (const key_t &args)
 

Private Attributes

std::unordered_map< key_t, StdRegions::StdExpansionSharedPtr, KeyHash, KeyEqualm_xmaps
 Storage for created xmap objects.
 

Detailed Description

template<class StdExp, int dim>
class Nektar::SpatialDomains::XmapFactory< StdExp, dim >

A simple factory for Xmap objects that is based on the element type, the basis and quadrature selection.

Definition at line 50 of file XmapFactory.hpp.

Member Typedef Documentation

◆ key_t

template<class StdExp , int dim>
using Nektar::SpatialDomains::XmapFactory< StdExp, dim >::key_t = std::array<LibUtilities::BasisKey, dim>
private

Key for the Xmap: an array of dimension dim which contains the basis keys for each coordinate direction.

Definition at line 54 of file XmapFactory.hpp.

Constructor & Destructor Documentation

◆ XmapFactory()

template<class StdExp , int dim>
Nektar::SpatialDomains::XmapFactory< StdExp, dim >::XmapFactory ( )
default

Member Function Documentation

◆ CreateInstance()

template<class StdExp , int dim>
StdRegions::StdExpansionSharedPtr Nektar::SpatialDomains::XmapFactory< StdExp, dim >::CreateInstance ( const key_t basis)
inline

Returns (and creates, if necessary) a standard expansion corresponding to.

Template Parameters
StdExpand the supplied basis.

Definition at line 118 of file XmapFactory.hpp.

119 {
120 auto it = m_xmaps.find(basis);
121
122 if (it != m_xmaps.end())
123 {
124 return it->second;
125 }
126
127 std::shared_ptr<StdExp> xmap = CreateStdExp<dim>(basis);
128 m_xmaps[basis] = xmap;
129
130 return xmap;
131 }
std::unordered_map< key_t, StdRegions::StdExpansionSharedPtr, KeyHash, KeyEqual > m_xmaps
Storage for created xmap objects.

References Nektar::SpatialDomains::XmapFactory< StdExp, dim >::m_xmaps.

◆ CreateStdExp() [1/3]

template<class StdExp , int dim>
template<int d, typename std::enable_if< d==1, int >::type = 0>
std::shared_ptr< StdExp > Nektar::SpatialDomains::XmapFactory< StdExp, dim >::CreateStdExp ( const key_t args)
inlineprivate

Definition at line 94 of file XmapFactory.hpp.

95 {
96 return std::make_shared<StdExp>(args[0]);
97 }

◆ CreateStdExp() [2/3]

template<class StdExp , int dim>
template<int d, typename std::enable_if< d==2, int >::type = 0>
std::shared_ptr< StdExp > Nektar::SpatialDomains::XmapFactory< StdExp, dim >::CreateStdExp ( const key_t args)
inlineprivate

Definition at line 100 of file XmapFactory.hpp.

101 {
102 return std::make_shared<StdExp>(args[0], args[1]);
103 }

◆ CreateStdExp() [3/3]

template<class StdExp , int dim>
template<int d, typename std::enable_if< d==3, int >::type = 0>
std::shared_ptr< StdExp > Nektar::SpatialDomains::XmapFactory< StdExp, dim >::CreateStdExp ( const key_t args)
inlineprivate

Definition at line 106 of file XmapFactory.hpp.

107 {
108 return std::make_shared<StdExp>(args[0], args[1], args[2]);
109 }

Member Data Documentation

◆ m_xmaps

template<class StdExp , int dim>
std::unordered_map<key_t, StdRegions::StdExpansionSharedPtr, KeyHash, KeyEqual> Nektar::SpatialDomains::XmapFactory< StdExp, dim >::m_xmaps
private

Storage for created xmap objects.

Definition at line 137 of file XmapFactory.hpp.

Referenced by Nektar::SpatialDomains::XmapFactory< StdExp, dim >::CreateInstance().