Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-istl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Core Modules
dune-istl
Commits
16b4b397
Commit
16b4b397
authored
7 years ago
by
Matthew Collins
Browse files
Options
Downloads
Patches
Plain Diff
problem with blockvector not changing values properly
parent
71d77978
No related branches found
No related tags found
1 merge request
!369
Feature/add python bindings
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bvector.hh
+12
-1
12 additions, 1 deletion
bvector.hh
with
12 additions
and
1 deletion
bvector.hh
+
12
−
1
View file @
16b4b397
...
...
@@ -10,6 +10,10 @@
#include
<dune/common/typeutilities.hh>
//this added otherwise insert class wasn't possible on line ~190
#include
<dune/python/common/typeregistry.hh>
#include
<dune/python/common/string.hh>
#include
<dune/python/common/vector.hh>
#include
<dune/python/istl/iterator.hh>
...
...
@@ -177,6 +181,7 @@ namespace Dune
// registserBlockVector
// --------------------
//the auto class is needed so that run.algorithm can properly work
template
<
class
BlockVector
>
inline
pybind11
::
class_
<
BlockVector
>
registerBlockVector
(
pybind11
::
handle
scope
,
const
char
*
clsName
=
"BlockVector"
)
{
...
...
@@ -188,6 +193,7 @@ namespace Dune
int
rows
=
BlockVector
::
block_type
::
dimension
;
std
::
string
vectorTypename
=
"Dune::BlockVector< Dune::FieldVector< double, "
+
std
::
to_string
(
rows
)
+
" > >"
;
auto
cls
=
Dune
::
Python
::
insertClass
<
BlockVector
>
(
scope
,
clsName
,
Dune
::
Python
::
GenerateTypeName
(
vectorTypename
),
Dune
::
Python
::
IncludeFiles
{
"dune/istl/bvector.hh"
,
"dune/python/istl/bvector.hh"
}).
first
;
//can't find insertClass not loaded yet?
registerBlockVector
(
cls
);
cls
.
def
(
pybind11
::
init
(
[]
()
{
return
new
BlockVector
();
}
)
);
...
...
@@ -210,14 +216,18 @@ namespace Dune
return
cls
;
}
//for the new bindings and arbitrary block size haven't
//for the new bindings and arbitrary block size haven't
//the generator acutally takes the scope into account which is why we do nothing with it here
//so when doing a dune.istl blockvector it doesn't actually define any of the rest ofthe bindings
template
<
class
BlockVector
,
class
...
options
>
void
registerBlockVector
(
pybind11
::
handle
scope
,
pybind11
::
class_
<
BlockVector
,
options
...
>
cls
)
{
typedef
typename
BlockVector
::
size_type
size_type
;
using
pybind11
::
operator
""
_a
;
registerBlockVector
(
cls
);
cls
.
def
(
pybind11
::
init
(
[]
()
{
return
new
BlockVector
();
}
)
);
cls
.
def
(
pybind11
::
init
(
[]
(
size_type
size
)
{
return
new
BlockVector
(
size
);
}
),
"size"
_a
);
...
...
@@ -227,6 +237,7 @@ namespace Dune
return
self
;
}
)
);
//cls.def( "__str__", [] ( const BlockVector &self ) { return to_string( self ); } );
cls
.
def
(
"assign"
,
[]
(
BlockVector
&
self
,
pybind11
::
buffer
buffer
)
{
detail
::
copy
(
buffer
,
self
);
},
"buffer"
_a
);
...
...
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