Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ag-ohlberger
dune-community
dune-xt
Commits
93f1835c
Commit
93f1835c
authored
8 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[vector] add first draft of pickling for vectors
parent
b4ac2df5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/xt/la/container/vector-interface.pbh
+13
-0
13 additions, 0 deletions
dune/xt/la/container/vector-interface.pbh
with
13 additions
and
0 deletions
dune/xt/la/container/vector-interface.pbh
+
13
−
0
View file @
93f1835c
...
...
@@ -157,6 +157,19 @@ typename std::enable_if<is_vector<C>::value, pybind11::class_<C>>::type bind_Vec
c.def("sup_norm", &C::sup_norm);
c.def("standard_deviation", [](const C& self) { return self.standard_deviation(); });
c.def("__getstate__", [](const C& self) { return py::make_tuple(std::vector<S>(self)); });
c.def("__setstate__", [](C& self, py::tuple t) {
if (t.size() != 1)
throw std::runtime_error("Invalid state!");
auto data = t[0].cast<std::vector<S>>();
/* Invoke the in-place constructor. Note that this is needed even
when the object just has a trivial default constructor */
new (&self) C(data.size());
/* Assign any additional state */
for (size_t ii = 0; ii < self.size(); ++ii)
self[ii] = data[ii];
});
addbind_ContainerInterface(c);
return c;
...
...
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