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
8292a44e
Commit
8292a44e
authored
4 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[P|grid.provider] refactor visualize
parent
30b4c3a9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!20
Update bindings
Pipeline
#62845
failed
4 years ago
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/dune/xt/grid/gridprovider.hh
+37
-17
37 additions, 17 deletions
python/dune/xt/grid/gridprovider.hh
with
37 additions
and
17 deletions
python/dune/xt/grid/gridprovider.hh
+
37
−
17
View file @
8292a44e
...
@@ -21,7 +21,9 @@
...
@@ -21,7 +21,9 @@
#include
<dune/xt/common/numeric_cast.hh>
#include
<dune/xt/common/numeric_cast.hh>
#include
<dune/xt/grid/entity.hh>
#include
<dune/xt/grid/entity.hh>
#include
<dune/xt/grid/exceptions.hh>
#include
<dune/xt/grid/exceptions.hh>
#include
<dune/xt/grid/gridprovider/dgf.hh>
#include
<dune/xt/grid/gridprovider/provider.hh>
#include
<dune/xt/grid/gridprovider/provider.hh>
#include
<dune/xt/functions/generic/grid-function.hh>
#include
<python/dune/xt/common/configuration.hh>
#include
<python/dune/xt/common/configuration.hh>
#include
<python/dune/xt/common/fvector.hh>
#include
<python/dune/xt/common/fvector.hh>
...
@@ -51,24 +53,42 @@ public:
...
@@ -51,24 +53,42 @@ public:
const
std
::
string
class_name
=
class_id
+
"_"
+
grid_id
;
const
std
::
string
class_name
=
class_id
+
"_"
+
grid_id
;
const
auto
ClassName
=
XT
::
Common
::
to_camel_case
(
class_name
);
const
auto
ClassName
=
XT
::
Common
::
to_camel_case
(
class_name
);
bound_type
c
(
m
,
ClassName
.
c_str
(),
(
XT
::
Common
::
to_camel_case
(
class_id
)
+
" ("
+
grid_id
+
" variant)"
).
c_str
());
bound_type
c
(
m
,
ClassName
.
c_str
(),
(
XT
::
Common
::
to_camel_case
(
class_id
)
+
" ("
+
grid_id
+
" variant)"
).
c_str
());
c
.
def_property_readonly
(
"dimension"
,
[
dim
](
type
&
)
{
return
dim
;});
c
.
def_property_readonly
(
"dimension"
,
[
dim
](
type
&
)
{
return
dim
;
});
c
.
def_property_readonly
(
"max_level"
,
&
type
::
max_level
);
c
.
def_property_readonly
(
"max_level"
,
&
type
::
max_level
);
c
.
def
(
"size"
,
[
dim
](
type
&
self
,
const
int
codim
){
c
.
def
(
DUNE_THROW_IF
(
codim
<
0
||
codim
>
dim
,
"size"
,
Exceptions
::
wrong_codimension
,
[
dim
](
type
&
self
,
const
int
codim
)
{
"dim = "
<<
dim
<<
"
\n
codim = "
<<
codim
);
DUNE_THROW_IF
(
auto
grid_view
=
self
.
leaf_view
();
codim
<
0
||
codim
>
dim
,
Exceptions
::
wrong_codimension
,
"dim = "
<<
dim
<<
"
\n
codim = "
<<
codim
);
MultipleCodimMultipleGeomTypeMapper
<
decltype
(
grid_view
)
>
mapper
(
grid_view
,
[
codim
](
GeometryType
gt
,
int
dimgrid
)
{
auto
grid_view
=
self
.
leaf_view
();
return
dimgrid
-
Common
::
numeric_cast
<
int
>
(
gt
.
dim
())
==
codim
;
MultipleCodimMultipleGeomTypeMapper
<
decltype
(
grid_view
)
>
mapper
(
});
grid_view
,
return
mapper
.
size
();
[
codim
](
GeometryType
gt
,
int
dimgrid
)
{
return
dimgrid
-
Common
::
numeric_cast
<
int
>
(
gt
.
dim
())
==
codim
;
});
},
"codim"
_a
);
return
mapper
.
size
();
c
.
def
(
"visualize"
,
[](
type
&
self
,
const
std
::
string
&
filename
,
const
Common
::
Configuration
&
boundary_info_cfg
){
},
self
.
visualize
(
filename
,
boundary_info_cfg
);
"codim"
_a
);
},
c
.
def
(
"filename"
_a
,
"visualize"
,
"boundary_info_cfg"
_a
=
Common
::
Configuration
());
[](
type
&
self
,
const
std
::
string
&
filename
,
const
std
::
string
&
layer
)
{
c
.
def
(
"global_refine"
,
[](
type
&
self
,
const
int
count
){
self
.
global_refine
(
count
);},
"count"
_a
=
1
);
DUNE_THROW_IF
(
layer
!=
"leaf"
,
NotImplemented
,
"Visualization of level views not implemented yet!"
);
auto
grid_view
=
self
.
leaf_view
();
using
GV
=
decltype
(
grid_view
);
const
MultipleCodimMultipleGeomTypeMapper
<
GV
>
mapper
(
grid_view
,
[](
GeometryType
gt
,
int
dimgrid
)
{
return
dimgrid
==
Common
::
numeric_cast
<
int
>
(
gt
.
dim
());
});
double
element_index
=
0
;
Functions
::
GenericGridFunction
<
extract_entity_t
<
GV
>>
element_index_function
(
/*order=*/
[](
const
auto
&
)
{
return
0
;
},
/*post_bind=*/
[
&
mapper
,
&
element_index
](
const
auto
&
element
)
{
element_index
=
mapper
.
index
(
element
);
},
/*evaluate=*/
[
&
element_index
](
const
auto
&
,
const
auto
&
)
{
return
element_index
;
},
/*param_type=*/
{},
/*name=*/
"Element index"
);
element_index_function
.
visualize
(
grid_view
,
filename
,
/*subsampling=*/
false
);
},
"filename"
_a
,
"layer"
_a
=
"leaf"
);
c
.
def
(
"global_refine"
,
[](
type
&
self
,
const
int
count
)
{
self
.
global_refine
(
count
);
},
"count"
_a
=
1
);
c
.
def
(
"refine_steps_for_half"
,
[](
type
&
/*self*/
)
{
return
DGFGridInfo
<
G
>::
refineStepsForHalf
();
});
return
c
;
return
c
;
}
// ... bind(...)
}
// ... bind(...)
};
// class GridProvider
};
// class GridProvider
...
...
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