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
d0952ab0
Commit
d0952ab0
authored
6 years ago
by
Tobias Leibner
Browse files
Options
Downloads
Patches
Plain Diff
[walker] do not dereference PerThreadValue on all elements
parent
cf70396c
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
.gitsuper
+2
-2
2 additions, 2 deletions
.gitsuper
dune/xt/grid/walker.hh
+91
-35
91 additions, 35 deletions
dune/xt/grid/walker.hh
with
93 additions
and
37 deletions
.gitsuper
+
2
−
2
View file @
d0952ab0
...
@@ -17,7 +17,7 @@ status = 1a3bcab04b011a5d6e44f9983cae6ff89fa695e8 bin (heads/master)
...
@@ -17,7 +17,7 @@ status = 1a3bcab04b011a5d6e44f9983cae6ff89fa695e8 bin (heads/master)
+30e7ad34db59be19bbf67bb72fc52eba50a5245d dune-xt-common (heads/dailywork_tleibner)
+30e7ad34db59be19bbf67bb72fc52eba50a5245d dune-xt-common (heads/dailywork_tleibner)
+3e3f3bf06e21cbbf3c0a559891b44c6f5d987d0f dune-xt-data (heads/master)
+3e3f3bf06e21cbbf3c0a559891b44c6f5d987d0f dune-xt-data (heads/master)
+f05aa7470ead4150ca7a91894cd2ad77dfcedc46 dune-xt-functions (heads/new-master)
+f05aa7470ead4150ca7a91894cd2ad77dfcedc46 dune-xt-functions (heads/new-master)
+
4276ffe6f0f1f28217eb6f8f064f5b86d7b89862
dune-xt-grid (heads/new-master)
+
cf70396c9755a34d8cea36a220ce800d44360967
dune-xt-grid (heads/new-master)
+f6904b69f9a3ee5d45ee824d3b244e59cfed7ff4 dune-xt-la (heads/master)
+f6904b69f9a3ee5d45ee824d3b244e59cfed7ff4 dune-xt-la (heads/master)
09d0378f616b94d68bcdd9fc6114813181849ec0 scripts (heads/master)
09d0378f616b94d68bcdd9fc6114813181849ec0 scripts (heads/master)
commit = 5f5841ee7a2dff290b98845c46262151752189c1
commit = 5f5841ee7a2dff290b98845c46262151752189c1
...
@@ -110,7 +110,7 @@ commit = f05aa7470ead4150ca7a91894cd2ad77dfcedc46
...
@@ -110,7 +110,7 @@ commit = f05aa7470ead4150ca7a91894cd2ad77dfcedc46
[submodule.dune-xt-grid]
[submodule.dune-xt-grid]
remote = git@github.com:dune-community/dune-xt-grid.git
remote = git@github.com:dune-community/dune-xt-grid.git
status = 2424627f0ad5de7e4aaa5e7f48bc2a02414d95a1 .vcsetup (heads/master)
status = 2424627f0ad5de7e4aaa5e7f48bc2a02414d95a1 .vcsetup (heads/master)
commit =
4276ffe6f0f1f28217eb6f8f064f5b86d7b89862
commit =
cf70396c9755a34d8cea36a220ce800d44360967
[submodule.dune-xt-la]
[submodule.dune-xt-la]
remote = git@github.com:dune-community/dune-xt-la.git
remote = git@github.com:dune-community/dune-xt-la.git
...
...
This diff is collapsed.
Click to expand it.
dune/xt/grid/walker.hh
+
91
−
35
View file @
d0952ab0
...
@@ -229,6 +229,18 @@ private:
...
@@ -229,6 +229,18 @@ private:
thread_storage
=
Common
::
PerThreadValue
<
std
::
list
<
WrapperType
>>
(
storage
);
thread_storage
=
Common
::
PerThreadValue
<
std
::
list
<
WrapperType
>>
(
storage
);
}
}
void
reinitialize_thread_storage
()
{
element_functor_wrappers_
=
Common
::
PerThreadValue
<
std
::
list
<
internal
::
ElementFunctorWrapper
<
GridViewType
>>>
(
stored_element_functor_wrappers_
);
intersection_functor_wrappers_
=
Common
::
PerThreadValue
<
std
::
list
<
internal
::
IntersectionFunctorWrapper
<
GridViewType
>>>
(
stored_intersection_functor_wrappers_
);
element_and_intersection_functor_wrappers_
=
Common
::
PerThreadValue
<
std
::
list
<
internal
::
ElementAndIntersectionFunctorWrapper
<
GridViewType
>>>
(
stored_element_and_intersection_functor_wrappers_
);
}
public
:
public
:
explicit
Walker
(
GridViewType
grd_vw
)
explicit
Walker
(
GridViewType
grd_vw
)
:
grid_view_
(
grd_vw
)
:
grid_view_
(
grd_vw
)
...
@@ -241,14 +253,7 @@ public:
...
@@ -241,14 +253,7 @@ public:
,
stored_intersection_functor_wrappers_
(
other
.
stored_intersection_functor_wrappers_
)
,
stored_intersection_functor_wrappers_
(
other
.
stored_intersection_functor_wrappers_
)
,
stored_element_and_intersection_functor_wrappers_
(
other
.
stored_element_and_intersection_functor_wrappers_
)
,
stored_element_and_intersection_functor_wrappers_
(
other
.
stored_element_and_intersection_functor_wrappers_
)
{
{
element_functor_wrappers_
=
Common
::
PerThreadValue
<
std
::
list
<
internal
::
ElementFunctorWrapper
<
GridViewType
>>>
(
reinitialize_thread_storage
();
stored_element_functor_wrappers_
);
intersection_functor_wrappers_
=
Common
::
PerThreadValue
<
std
::
list
<
internal
::
IntersectionFunctorWrapper
<
GridViewType
>>>
(
stored_intersection_functor_wrappers_
);
element_and_intersection_functor_wrappers_
=
Common
::
PerThreadValue
<
std
::
list
<
internal
::
ElementAndIntersectionFunctorWrapper
<
GridViewType
>>>
(
stored_element_and_intersection_functor_wrappers_
);
}
}
Walker
(
ThisType
&&
source
)
=
default
;
Walker
(
ThisType
&&
source
)
=
default
;
...
@@ -492,24 +497,44 @@ public:
...
@@ -492,24 +497,44 @@ public:
virtual
void
prepare
()
override
virtual
void
prepare
()
override
{
{
auto
prep
=
[](
auto
&
functor_list
)
{
auto
prep
=
[](
auto
&
wrapper_list
)
{
for
(
auto
&&
pt_wrapper
:
functor_list
)
{
for
(
auto
&&
wrapper
:
wrapper_list
)
for
(
auto
&&
wrapper
:
pt_wrapper
)
wrapper
.
functor
().
prepare
();
wrapper
.
functor
().
prepare
();
}
};
};
prep
(
element_functor_wrappers_
);
prep
(
stored_element_functor_wrappers_
);
prep
(
intersection_functor_wrappers_
);
prep
(
stored_intersection_functor_wrappers_
);
prep
(
element_and_intersection_functor_wrappers_
);
prep
(
stored_element_and_intersection_functor_wrappers_
);
// prepare is called in a single thread, so make sure all functors in the thread are also prepared
reinitialize_thread_storage
();
}
// ... prepare()
}
// ... prepare()
// prepare calling thread
void
prepare_thread
()
{
auto
prep
=
[](
auto
&
wrapper_list
)
{
for
(
auto
&&
wrapper
:
wrapper_list
)
wrapper
.
functor
().
prepare
();
};
prep
(
*
element_functor_wrappers_
);
prep
(
*
intersection_functor_wrappers_
);
prep
(
*
element_and_intersection_functor_wrappers_
);
}
virtual
void
apply_local
(
const
ElementType
&
element
)
override
virtual
void
apply_local
(
const
ElementType
&
element
)
override
{
{
for
(
auto
&&
wrapper
:
*
element_functor_wrappers_
)
{
apply_local
(
element
,
*
element_functor_wrappers_
,
*
element_and_intersection_functor_wrappers_
);
}
// ... apply_local(...)
void
apply_local
(
const
ElementType
&
element
,
std
::
list
<
internal
::
ElementFunctorWrapper
<
GridViewType
>>&
element_functor_wrappers
,
std
::
list
<
internal
::
ElementAndIntersectionFunctorWrapper
<
GridViewType
>>&
element_and_intersection_functor_wrappers
)
{
for
(
auto
&&
wrapper
:
element_functor_wrappers
)
{
if
(
wrapper
.
filter
().
contains
(
grid_view_
,
element
))
if
(
wrapper
.
filter
().
contains
(
grid_view_
,
element
))
wrapper
.
functor
().
apply_local
(
element
);
wrapper
.
functor
().
apply_local
(
element
);
}
}
for
(
auto
&&
wrapper
:
*
element_and_intersection_functor_wrappers
_
)
{
for
(
auto
&&
wrapper
:
element_and_intersection_functor_wrappers
)
{
if
(
wrapper
.
element_filter
().
contains
(
grid_view_
,
element
))
if
(
wrapper
.
element_filter
().
contains
(
grid_view_
,
element
))
wrapper
.
functor
().
apply_local
(
element
);
wrapper
.
functor
().
apply_local
(
element
);
}
}
...
@@ -519,21 +544,36 @@ public:
...
@@ -519,21 +544,36 @@ public:
const
ElementType
&
inside_element
,
const
ElementType
&
inside_element
,
const
ElementType
&
outside_element
)
override
const
ElementType
&
outside_element
)
override
{
{
for
(
auto
&&
wrapper
:
*
intersection_functor_wrappers_
)
{
apply_local
(
intersection
,
inside_element
,
outside_element
,
*
intersection_functor_wrappers_
,
*
element_and_intersection_functor_wrappers_
);
}
// ... apply_local(...)
virtual
void
apply_local
(
const
IntersectionType
&
intersection
,
const
ElementType
&
inside_element
,
const
ElementType
&
outside_element
,
std
::
list
<
internal
::
IntersectionFunctorWrapper
<
GridViewType
>>&
intersection_functor_wrappers
,
std
::
list
<
internal
::
ElementAndIntersectionFunctorWrapper
<
GridViewType
>>&
element_and_intersection_functor_wrappers
)
{
for
(
auto
&&
wrapper
:
intersection_functor_wrappers
)
{
if
(
wrapper
.
filter
().
contains
(
grid_view_
,
intersection
))
if
(
wrapper
.
filter
().
contains
(
grid_view_
,
intersection
))
wrapper
.
functor
().
apply_local
(
intersection
,
inside_element
,
outside_element
);
wrapper
.
functor
().
apply_local
(
intersection
,
inside_element
,
outside_element
);
}
}
for
(
auto
&&
wrapper
:
*
element_and_intersection_functor_wrappers
_
)
{
for
(
auto
&&
wrapper
:
element_and_intersection_functor_wrappers
)
{
if
(
wrapper
.
intersection_filter
().
contains
(
grid_view_
,
intersection
))
if
(
wrapper
.
intersection_filter
().
contains
(
grid_view_
,
intersection
))
wrapper
.
functor
().
apply_local
(
intersection
,
inside_element
,
outside_element
);
wrapper
.
functor
().
apply_local
(
intersection
,
inside_element
,
outside_element
);
}
}
}
// ... apply_local(...)
}
// ... apply_local(...)
// finalize all threads
virtual
void
finalize
()
override
virtual
void
finalize
()
override
{
{
auto
fin
=
[](
auto
&
list
)
{
auto
fin
=
[](
auto
&
per_thread_value
)
{
for
(
auto
&&
p
t
:
list
)
{
for
(
auto
&&
lis
t
:
per_thread_value
)
{
for
(
auto
&&
wrapper
:
p
t
)
for
(
auto
&&
wrapper
:
lis
t
)
wrapper
.
functor
().
finalize
();
wrapper
.
functor
().
finalize
();
}
}
};
};
...
@@ -542,6 +582,18 @@ public:
...
@@ -542,6 +582,18 @@ public:
fin
(
intersection_functor_wrappers_
);
fin
(
intersection_functor_wrappers_
);
}
// ... finalize()
}
// ... finalize()
// finalize calling thread
void
finalize_thread
()
{
auto
fin
=
[](
auto
&
wrapper_list
)
{
for
(
auto
&&
wrapper
:
wrapper_list
)
wrapper
.
functor
().
finalize
();
};
fin
(
*
element_functor_wrappers_
);
fin
(
*
intersection_functor_wrappers_
);
fin
(
*
element_and_intersection_functor_wrappers_
);
}
/**
/**
* \}
* \}
*/
*/
...
@@ -581,14 +633,7 @@ public:
...
@@ -581,14 +633,7 @@ public:
stored_element_functor_wrappers_
.
clear
();
stored_element_functor_wrappers_
.
clear
();
stored_intersection_functor_wrappers_
.
clear
();
stored_intersection_functor_wrappers_
.
clear
();
stored_element_and_intersection_functor_wrappers_
.
clear
();
stored_element_and_intersection_functor_wrappers_
.
clear
();
element_functor_wrappers_
=
Common
::
PerThreadValue
<
std
::
list
<
internal
::
ElementFunctorWrapper
<
GridViewType
>>>
(
reinitialize_thread_storage
();
stored_element_functor_wrappers_
);
intersection_functor_wrappers_
=
Common
::
PerThreadValue
<
std
::
list
<
internal
::
IntersectionFunctorWrapper
<
GridViewType
>>>
(
stored_intersection_functor_wrappers_
);
element_and_intersection_functor_wrappers_
=
Common
::
PerThreadValue
<
std
::
list
<
internal
::
ElementAndIntersectionFunctorWrapper
<
GridViewType
>>>
(
stored_element_and_intersection_functor_wrappers_
);
}
}
BaseType
*
copy
()
override
BaseType
*
copy
()
override
...
@@ -679,6 +724,9 @@ private:
...
@@ -679,6 +724,9 @@ private:
template
<
class
ElementRange
>
template
<
class
ElementRange
>
void
walk_range
(
const
ElementRange
&
element_range
)
void
walk_range
(
const
ElementRange
&
element_range
)
{
{
auto
&
element_functor_wrappers
=
*
element_functor_wrappers_
;
auto
&
intersection_functor_wrappers
=
*
intersection_functor_wrappers_
;
auto
&
element_and_intersection_functor_wrappers
=
*
element_and_intersection_functor_wrappers_
;
#ifdef __INTEL_COMPILER
#ifdef __INTEL_COMPILER
const
auto
it_end
=
element_range
.
end
();
const
auto
it_end
=
element_range
.
end
();
for
(
auto
it
=
element_range
.
begin
();
it
!=
it_end
;
++
it
)
{
for
(
auto
it
=
element_range
.
begin
();
it
!=
it_end
;
++
it
)
{
...
@@ -687,10 +735,10 @@ private:
...
@@ -687,10 +735,10 @@ private:
for
(
const
ElementType
&
element
:
element_range
)
{
for
(
const
ElementType
&
element
:
element_range
)
{
#endif
#endif
// apply element functors
// apply element functors
apply_local
(
element
);
apply_local
(
element
,
element_functor_wrappers
,
element_and_intersection_functor_wrappers
);
// only walk the intersections, if there are codim1 functors present
// only walk the intersections, if there are codim1 functors present
if
((
intersection_functor_wrappers
_
->
size
()
+
element_and_intersection_functor_wrappers
_
->
size
())
>
0
)
{
if
((
intersection_functor_wrappers
.
size
()
+
element_and_intersection_functor_wrappers
.
size
())
>
0
)
{
// Do not use intersections(...) here, since that does not work for a SubdomainGridPart which is based on
// Do not use intersections(...) here, since that does not work for a SubdomainGridPart which is based on
// alugrid and then wrapped as a grid view (see also https://github.com/dune-community/dune-xt-grid/issues/26)
// alugrid and then wrapped as a grid view (see also https://github.com/dune-community/dune-xt-grid/issues/26)
const
auto
intersection_it_end
=
grid_view_
.
iend
(
element
);
const
auto
intersection_it_end
=
grid_view_
.
iend
(
element
);
...
@@ -699,9 +747,17 @@ private:
...
@@ -699,9 +747,17 @@ private:
const
auto
&
intersection
=
*
intersection_it
;
const
auto
&
intersection
=
*
intersection_it
;
if
(
intersection
.
neighbor
())
{
if
(
intersection
.
neighbor
())
{
const
auto
neighbor
=
intersection
.
outside
();
const
auto
neighbor
=
intersection
.
outside
();
apply_local
(
intersection
,
element
,
neighbor
);
apply_local
(
intersection
,
element
,
neighbor
,
intersection_functor_wrappers
,
element_and_intersection_functor_wrappers
);
}
else
}
else
apply_local
(
intersection
,
element
,
element
);
apply_local
(
intersection
,
element
,
element
,
intersection_functor_wrappers
,
element_and_intersection_functor_wrappers
);
}
// walk the intersections
}
// walk the intersections
}
// only walk the intersections, if there are codim1 functors present
}
// only walk the intersections, if there are codim1 functors present
}
// .. walk elements
}
// .. walk elements
...
...
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