Nektar++
Public Member Functions | Static Public Member Functions | List of all members
pybind11::detail::type_caster< VarCoeffEntry > Struct Reference

#include <VarCoeffEntry.hpp>

Public Member Functions

 PYBIND11_TYPE_CASTER (VarCoeffEntry, const_name("VarCoeffEntry"))
 
bool load (handle src, bool)
 

Static Public Member Functions

static handle cast (VarCoeffEntry const &src, return_value_policy, handle)
 

Detailed Description

Definition at line 53 of file VarCoeffEntry.hpp.

Member Function Documentation

◆ cast()

static handle pybind11::detail::type_caster< VarCoeffEntry >::cast ( VarCoeffEntry const &  src,
return_value_policy  ,
handle   
)
inlinestatic

Definition at line 83 of file VarCoeffEntry.hpp.

84 {
85 // Create a Python capsule to hold a pointer that contains a lightweight
86 // copy of src. That way we guarantee Python will still have access to
87 // the memory allocated inside arr even if arr is deallocated in C++.
88 py::capsule c(new VarCoeffEntry(src), [](void *ptr) {
89 VarCoeffEntry *tmp = (VarCoeffEntry *)ptr;
90 delete tmp;
91 });
92
93 array_t<NekDouble> array({src.GetValue().size()}, {},
94 src.GetValue().data(), c);
95
96 return array.release();
97 }
Representation of a variable coefficient.
Definition: StdRegions.hpp:265

References Nektar::StdRegions::VarCoeffEntry::GetValue().

◆ load()

bool pybind11::detail::type_caster< VarCoeffEntry >::load ( handle  src,
bool   
)
inline

Definition at line 58 of file VarCoeffEntry.hpp.

59 {
60 if (!array_t<NekDouble>::check_(src))
61 {
62 return false;
63 }
64
65 auto arr =
66 array_t<NekDouble, array::c_style | array::forcecast>::ensure(src);
67 if (!arr)
68 {
69 return false;
70 }
71
72 if (arr.ndim() != 1)
73 {
74 return false;
75 }
76
77 Array<OneD, NekDouble> nekArray = py::cast<Array<OneD, NekDouble>>(src);
78 value = VarCoeffEntry(nekArray);
79
80 return true;
81 }

◆ PYBIND11_TYPE_CASTER()

pybind11::detail::type_caster< VarCoeffEntry >::PYBIND11_TYPE_CASTER ( VarCoeffEntry  ,
const_name("VarCoeffEntry")   
)