Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90376232
py_group_manager.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 1, 02:22
Size
4 KB
Mime Type
text/x-c
Expires
Sun, Nov 3, 02:22 (2 d)
Engine
blob
Format
Raw Data
Handle
17265712
Attached To
rAKA akantu
py_group_manager.cc
View Options
/* -------------------------------------------------------------------------- */
#include "py_aka_array.hh"
/* -------------------------------------------------------------------------- */
#include <element_group.hh>
#include <node_group.hh>
/* -------------------------------------------------------------------------- */
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
/* -------------------------------------------------------------------------- */
namespace
py
=
pybind11
;
/* -------------------------------------------------------------------------- */
namespace
akantu
{
/* -------------------------------------------------------------------------- */
void
register_group_manager
(
py
::
module
&
mod
)
{
/* ------------------------------------------------------------------------ */
py
::
class_
<
NodeGroup
>
(
mod
,
"NodeGroup"
)
.
def
(
"getNodes"
,
[](
NodeGroup
&
self
)
->
decltype
(
auto
)
{
return
self
.
getNodes
();
},
py
::
return_value_policy
::
reference
)
.
def
(
"getName"
,
&
NodeGroup
::
getName
);
/* ------------------------------------------------------------------------ */
py
::
class_
<
ElementGroup
>
(
mod
,
"ElementGroup"
)
.
def
(
"getNodeGroup"
,
[](
ElementGroup
&
self
)
->
decltype
(
auto
)
{
return
self
.
getNodeGroup
();
},
py
::
return_value_policy
::
reference
)
.
def
(
"getName"
,
&
ElementGroup
::
getName
)
.
def
(
"getElements"
,
[](
ElementGroup
&
self
)
->
decltype
(
auto
)
{
return
self
.
getElements
();
},
py
::
return_value_policy
::
reference
)
.
def
(
"getNodeGroup"
,
[](
ElementGroup
&
self
)
->
decltype
(
auto
)
{
return
self
.
getNodeGroup
();
},
py
::
return_value_policy
::
reference
);
/* ------------------------------------------------------------------------ */
py
::
class_
<
GroupManager
>
(
mod
,
"GroupManager"
)
.
def
(
"getElementGroup"
,
[](
GroupManager
&
self
,
const
std
::
string
&
name
)
->
decltype
(
auto
)
{
return
self
.
getElementGroup
(
name
);
},
py
::
return_value_policy
::
reference
)
.
def
(
"iterateElementGroups"
,
[](
GroupManager
&
self
)
->
decltype
(
auto
)
{
std
::
vector
<
std
::
reference_wrapper
<
ElementGroup
>>
groups
;
for
(
auto
&
group
:
self
.
iterateElementGroups
())
{
groups
.
emplace_back
(
group
);
}
return
groups
;
})
.
def
(
"iterateNodeGroups"
,
[](
GroupManager
&
self
)
->
decltype
(
auto
)
{
std
::
vector
<
std
::
reference_wrapper
<
NodeGroup
>>
groups
;
for
(
auto
&
group
:
self
.
iterateNodeGroups
())
{
groups
.
emplace_back
(
group
);
}
return
groups
;
})
.
def
(
"createNodeGroup"
,
&
GroupManager
::
createNodeGroup
,
py
::
return_value_policy
::
reference
)
.
def
(
"createElementGroup"
,
py
::
overload_cast
<
const
std
::
string
&
,
UInt
,
bool
>
(
&
GroupManager
::
createElementGroup
),
py
::
return_value_policy
::
reference
)
.
def
(
"createGroupsFromMeshDataUInt"
,
&
GroupManager
::
createGroupsFromMeshData
<
UInt
>
)
.
def
(
"createElementGroupFromNodeGroup"
,
&
GroupManager
::
createElementGroupFromNodeGroup
,
py
::
arg
(
"name"
),
py
::
arg
(
"node_group"
),
py
::
arg
(
"dimension"
)
=
_all_dimensions
)
.
def
(
"getNodeGroup"
,
[](
GroupManager
&
self
,
const
std
::
string
&
name
)
->
decltype
(
auto
)
{
return
self
.
getNodeGroup
(
name
);
},
py
::
return_value_policy
::
reference
)
.
def
(
"nodeGroups"
,
[](
GroupManager
&
self
)
{
std
::
vector
<
NodeGroup
*>
groups
;
for
(
auto
&
g
:
self
.
iterateNodeGroups
())
{
groups
.
push_back
(
&
g
);
}
return
groups
;
},
py
::
return_value_policy
::
reference
)
.
def
(
"elementGroups"
,
[](
GroupManager
&
self
)
{
std
::
vector
<
ElementGroup
*>
groups
;
for
(
auto
&
g
:
self
.
iterateElementGroups
())
{
groups
.
push_back
(
&
g
);
}
return
groups
;
},
py
::
return_value_policy
::
reference
)
.
def
(
"createBoundaryGroupFromGeometry"
,
&
GroupManager
::
createBoundaryGroupFromGeometry
);
}
}
// namespace akantu
Event Timeline
Log In to Comment