Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90872105
py_dumpable.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
Tue, Nov 5, 13:12
Size
4 KB
Mime Type
text/x-c
Expires
Thu, Nov 7, 13:12 (2 d)
Engine
blob
Format
Raw Data
Handle
20342942
Attached To
rAKA akantu
py_dumpable.cc
View Options
/* -------------------------------------------------------------------------- */
#include "py_aka_array.hh"
/* -------------------------------------------------------------------------- */
#include <dumper_iohelper_paraview.hh>
#include <mesh.hh>
/* -------------------------------------------------------------------------- */
#include <dumpable_inline_impl.hh>
/* -------------------------------------------------------------------------- */
#include <pybind11/pybind11.h>
/* -------------------------------------------------------------------------- */
namespace
py
=
pybind11
;
/* -------------------------------------------------------------------------- */
namespace
akantu
{
std
::
vector
<
detail
::
ArrayProxy
<
Real
>>
tmp_array
;
void
register_dumpable
(
py
::
module
&
mod
)
{
/* ------------------------------------------------------------------------ */
py
::
class_
<
Dumpable
>
(
mod
,
"Dumpable"
)
.
def
(
"registerDumperParaview"
,
&
Dumpable
::
registerDumper
<
DumperParaview
>
,
py
::
arg
(
"dumper_name"
),
py
::
arg
(
"file_name"
),
py
::
arg
(
"is_default"
)
=
false
)
.
def
(
"addDumpMeshToDumper"
,
&
Dumpable
::
addDumpMeshToDumper
,
py
::
arg
(
"dumper_name"
),
py
::
arg
(
"mesh"
),
py
::
arg
(
"dimension"
),
py
::
arg
(
"ghost_type"
)
=
_not_ghost
,
py
::
arg
(
"element_kind"
)
=
_ek_regular
)
.
def
(
"addDumpMesh"
,
&
Dumpable
::
addDumpMesh
,
py
::
arg
(
"mesh"
),
py
::
arg
(
"dimension"
),
py
::
arg
(
"ghost_type"
)
=
_not_ghost
,
py
::
arg
(
"element_kind"
)
=
_ek_regular
)
.
def
(
"addDumpField"
,
&
Dumpable
::
addDumpField
,
py
::
arg
(
"field_id"
))
.
def
(
"addDumpFieldToDumper"
,
&
Dumpable
::
addDumpFieldToDumper
,
py
::
arg
(
"dumper_name"
),
py
::
arg
(
"field_id"
))
.
def
(
"addDumpFieldExternal"
,
[](
Dumpable
&
_this
,
const
std
::
string
&
field_id
,
std
::
shared_ptr
<
dumpers
::
Field
>
field
)
{
return
_this
.
addDumpFieldExternal
(
field_id
,
field
);
},
py
::
arg
(
"field_id"
),
py
::
arg
(
"field"
))
.
def
(
"addDumpFieldExternal"
,
[](
Dumpable
&
_this
,
const
std
::
string
&
field_id
,
Array
<
Real
>
&
field
)
{
auto
&
tmp
=
dynamic_cast
<
detail
::
ArrayProxy
<
Real
>
&>
(
field
);
tmp_array
.
push_back
(
tmp
);
return
_this
.
addDumpFieldExternal
(
field_id
,
tmp_array
.
back
());
},
py
::
arg
(
"field_id"
),
py
::
arg
(
"field"
))
.
def
(
"addDumpFieldExternalToDumper"
,
[](
Dumpable
&
_this
,
const
std
::
string
&
dumper_name
,
const
std
::
string
&
field_id
,
std
::
shared_ptr
<
dumpers
::
Field
>
field
)
{
return
_this
.
addDumpFieldExternalToDumper
(
dumper_name
,
field_id
,
field
);
},
py
::
arg
(
"dumper_name"
),
py
::
arg
(
"field_id"
),
py
::
arg
(
"field"
))
.
def
(
"dump"
,
py
::
overload_cast
<>
(
&
Dumpable
::
dump
))
.
def
(
"dump"
,
py
::
overload_cast
<
Real
,
UInt
>
(
&
Dumpable
::
dump
),
py
::
arg
(
"time"
),
py
::
arg
(
"step"
))
.
def
(
"dump"
,
py
::
overload_cast
<
UInt
>
(
&
Dumpable
::
dump
),
py
::
arg
(
"step"
))
.
def
(
"dump"
,
py
::
overload_cast
<
const
std
::
string
&
,
UInt
>
(
&
Dumpable
::
dump
),
py
::
arg
(
"dumper_name"
),
py
::
arg
(
"step"
))
.
def
(
"dump"
,
py
::
overload_cast
<
const
std
::
string
&
,
Real
,
UInt
>
(
&
Dumpable
::
dump
),
py
::
arg
(
"dumper_name"
),
py
::
arg
(
"time"
),
py
::
arg
(
"step"
))
.
def
(
"dump"
,
py
::
overload_cast
<
const
std
::
string
&>
(
&
Dumpable
::
dump
),
py
::
arg
(
"dumper_name"
));
}
/* -------------------------------------------------------------------------- */
PYBIND11_MODULE
(
dumper_module
,
mod
)
{
mod
.
attr
(
"__name__"
)
=
"py11_akantu.dumper"
;
/* ------------------------------------------------------------------------ */
py
::
class_
<
dumpers
::
Field
,
std
::
shared_ptr
<
dumpers
::
Field
>>
(
mod
,
"Field"
);
/* ------------------------------------------------------------------------ */
py
::
class_
<
dumpers
::
ElementalField
<
UInt
>
,
dumpers
::
Field
,
std
::
shared_ptr
<
dumpers
::
ElementalField
<
UInt
>>>
(
mod
,
"ElementalFieldUInt"
,
py
::
multiple_inheritance
())
.
def
(
py
::
init
<
dumpers
::
ElementalField
<
UInt
>::
field_type
&
,
UInt
,
GhostType
,
ElementKind
>
(),
py
::
arg
(
"field"
),
py
::
arg
(
"spatial_dimension"
)
=
_all_dimensions
,
py
::
arg
(
"ghost_type"
)
=
_not_ghost
,
py
::
arg
(
"element_kind"
)
=
_ek_not_defined
);
}
}
// namespace akantu
Event Timeline
Log In to Comment