Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GenericIO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael Buehlmann
GenericIO
Commits
e3e7d6ab
Commit
e3e7d6ab
authored
4 years ago
by
Michael Buehlmann
Browse files
Options
Downloads
Patches
Plain Diff
update to pybind11 2.6.1
parent
1fb1423c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
new_python/CMakeLists.txt
+1
-1
1 addition, 1 deletion
new_python/CMakeLists.txt
new_python/genericio.cpp
+10
-11
10 additions, 11 deletions
new_python/genericio.cpp
with
11 additions
and
12 deletions
new_python/CMakeLists.txt
+
1
−
1
View file @
e3e7d6ab
...
...
@@ -5,7 +5,7 @@ include(FetchContent)
FetchContent_Declare
(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v2.
5
GIT_TAG v2.
6.1
)
FetchContent_GetProperties
(
pybind11
)
...
...
This diff is collapsed.
Click to expand it.
new_python/genericio.cpp
+
10
−
11
View file @
e3e7d6ab
...
...
@@ -84,21 +84,21 @@ public:
);
if
(
varp
!=
variables
.
end
())
{
// extra space
size_t
readsize
=
num_elem
+
requestedExtraSpace
()
/
(
*
varp
).
ElementSize
;
py
::
s
size_t
readsize
=
num_elem
+
requestedExtraSpace
()
/
(
*
varp
).
ElementSize
;
if
((
*
varp
).
IsFloat
&&
(
*
varp
).
ElementSize
==
4
)
{
result
[
var_name
]
=
py
::
array_t
<
float
>
(
size_t
(
readsize
)
)
;
result
[
var_name
]
=
py
::
array_t
<
float
>
(
readsize
);
addVariable
(
*
varp
,
result
[
var_name
].
mutable_data
(),
gio
::
GenericIO
::
VarHasExtraSpace
);
}
else
if
((
*
varp
).
IsFloat
&&
(
*
varp
).
ElementSize
==
8
)
{
result
[
var_name
]
=
py
::
array_t
<
double
>
(
size_t
(
readsize
)
)
;
result
[
var_name
]
=
py
::
array_t
<
double
>
(
readsize
);
addVariable
(
*
varp
,
result
[
var_name
].
mutable_data
(),
gio
::
GenericIO
::
VarHasExtraSpace
);
}
else
if
(
!
(
*
varp
).
IsFloat
&&
(
*
varp
).
ElementSize
==
4
)
{
result
[
var_name
]
=
py
::
array_t
<
int32_t
>
(
size_t
(
readsize
)
)
;
result
[
var_name
]
=
py
::
array_t
<
int32_t
>
(
readsize
);
addVariable
(
*
varp
,
result
[
var_name
].
mutable_data
(),
gio
::
GenericIO
::
VarHasExtraSpace
);
}
else
if
(
!
(
*
varp
).
IsFloat
&&
(
*
varp
).
ElementSize
==
8
)
{
result
[
var_name
]
=
py
::
array_t
<
int64_t
>
(
size_t
(
readsize
)
)
;
result
[
var_name
]
=
py
::
array_t
<
int64_t
>
(
readsize
);
addVariable
(
*
varp
,
result
[
var_name
].
mutable_data
(),
gio
::
GenericIO
::
VarHasExtraSpace
);
}
else
if
(
!
(
*
varp
).
IsFloat
&&
(
*
varp
).
ElementSize
==
2
)
{
result
[
var_name
]
=
py
::
array_t
<
uint16_t
>
(
size_t
(
readsize
)
)
;
result
[
var_name
]
=
py
::
array_t
<
uint16_t
>
(
readsize
);
addVariable
(
*
varp
,
result
[
var_name
].
mutable_data
(),
gio
::
GenericIO
::
VarHasExtraSpace
);
}
}
...
...
@@ -197,8 +197,10 @@ PYBIND11_MODULE(pygio, m) {
m
.
def
(
"_init_mpi"
,
[](){
int
initialized
;
MPI_Initialized
(
&
initialized
);
if
(
!
initialized
)
MPI_Init
(
nullptr
,
nullptr
);
if
(
!
initialized
)
{
int
level_provided
;
MPI_Init_thread
(
nullptr
,
nullptr
,
MPI_THREAD_SINGLE
,
&
level_provided
);
}
});
#endif
...
...
@@ -214,7 +216,6 @@ PYBIND11_MODULE(pygio, m) {
.
value
(
"MismatchDisallowed"
,
PyGenericIO
::
MismatchBehavior
::
MismatchDisallowed
)
.
value
(
"MismatchRedistribute"
,
PyGenericIO
::
MismatchBehavior
::
MismatchRedistribute
);
pyGenericIO
.
def
(
py
::
init
<
std
::
string
,
PyGenericIO
::
FileIO
,
PyGenericIO
::
MismatchBehavior
>
(),
py
::
arg
(
"filename"
),
py
::
arg
(
"method"
)
=
PyGenericIO
::
FileIO
::
FileIOPOSIX
,
py
::
arg
(
"redistribute"
)
=
PyGenericIO
::
MismatchBehavior
::
MismatchRedistribute
)
.
def
(
"inspect"
,
&
PyGenericIO
::
inspect
,
"Print variable infos and size of GenericIO file"
)
.
def
(
"get_variables"
,
&
PyGenericIO
::
get_variables
,
"Get a list of VariableInformations defined in the GenericIO file"
)
...
...
@@ -224,8 +225,6 @@ PYBIND11_MODULE(pygio, m) {
.
def
(
"read_phys_scale"
,
&
PyGenericIO
::
read_phys_scale
)
.
def
(
"read"
,
&
PyGenericIO
::
read
,
py
::
arg
(
"variables"
)
=
nullptr
);
py
::
class_
<
gio
::
GenericIO
::
VariableInfo
>
(
pyGenericIO
,
"VariableInfo"
)
.
def_readonly
(
"name"
,
&
gio
::
GenericIO
::
VariableInfo
::
Name
)
.
def_readonly
(
"size"
,
&
gio
::
GenericIO
::
VariableInfo
::
Size
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment