Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91646531
py_aka_parser.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
Wed, Nov 13, 01:30
Size
2 KB
Mime Type
text/x-c
Expires
Fri, Nov 15, 01:30 (2 d)
Engine
blob
Format
Raw Data
Handle
22292333
Attached To
rAKA akantu
py_aka_parser.cc
View Options
/* -------------------------------------------------------------------------- */
#include "aka_common.hh"
#include "parameter_registry.hh"
#include "parsable.hh"
#include "parser.hh"
#include <map>
#include <pybind11/operators.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
/* -------------------------------------------------------------------------- */
namespace
py
=
pybind11
;
/* -------------------------------------------------------------------------- */
namespace
akantu
{
std
::
map
<
void
*
,
std
::
map
<
std
::
string
,
void
*>>
map_params
;
__attribute__
((
visibility
(
"default"
)))
void
register_parser
(
py
::
module
&
mod
)
{
py
::
class_
<
ParameterRegistry
>
(
mod
,
"ParameterRegistry"
,
py
::
multiple_inheritance
())
.
def
(
"registerParamReal"
,
[](
ParameterRegistry
&
self
,
const
std
::
string
&
name
,
UInt
type
,
const
std
::
string
&
description
)
{
Real
*
p
=
new
Real
;
map_params
[
&
self
][
name
]
=
p
;
self
.
registerParam
<
Real
>
(
name
,
*
p
,
ParameterAccessType
(
type
),
description
);
})
.
def
(
"registerParamReal"
,
[](
ParameterRegistry
&
self
,
const
Real
&
_default
,
const
std
::
string
&
name
,
UInt
type
,
const
std
::
string
&
description
)
{
Real
*
p
=
new
Real
;
map_params
[
&
self
][
name
]
=
p
;
self
.
registerParam
<
Real
>
(
name
,
*
p
,
_default
,
ParameterAccessType
(
type
),
description
);
})
.
def
(
"getReal"
,
[](
ParameterRegistry
&
self
,
const
std
::
string
&
name
)
{
return
Real
(
self
.
get
(
name
));
});
py
::
class_
<
Parsable
,
ParameterRegistry
>
(
mod
,
"Parsable"
,
py
::
multiple_inheritance
())
.
def
(
py
::
init
<
const
ParserType
&
,
const
ID
&>
());
mod
.
def
(
"parseInput"
,
[](
const
std
::
string
&
input_file
)
{
getStaticParser
().
parse
(
input_file
);
},
"Parse an Akantu input file"
);
}
}
// namespace akantu
Event Timeline
Log In to Comment