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
821a0630
Commit
821a0630
authored
11 years ago
by
René Fritze
Browse files
Options
Downloads
Patches
Plain Diff
[common] new geometry corner range, lp point range
parent
ee165ace
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/stuff/common/ranges.hh
+107
-5
107 additions, 5 deletions
dune/stuff/common/ranges.hh
with
107 additions
and
5 deletions
dune/stuff/common/ranges.hh
+
107
−
5
View file @
821a0630
...
...
@@ -12,6 +12,7 @@
#include
<dune/grid/common/gridview.hh>
#include
<dune/stuff/common/reenable_warnings.hh>
#include
<boost/serialization/static_warning.hpp>
#include
<boost/iterator/iterator_facade.hpp>
#endif
#if HAVE_DUNE_FEM
...
...
@@ -20,6 +21,7 @@
#include
<dune/fem/function/common/discretefunction.hh>
#include
<dune/stuff/common/reenable_warnings.hh>
#include
<dune/fem/gridpart/common/gridpart.hh>
#include
<dune/fem/space/lagrange/lagrangepoints.hh>
#endif
#include
<dune/stuff/common/math.hh>
#include
<dune/stuff/fem/namespace.hh>
...
...
@@ -128,15 +130,98 @@ intersectionRange(const Dune::GridView<GridViewTraits>& gridview,
typename
Dune
::
GridView
<
GridViewTraits
>::
template
Codim
<
0
>
::
Entity
>
(
gridview
,
entity
);
}
//! custom const iterator for \ref FixedMap
template
<
class
GeometryType
>
class
ConstCornerIterator
:
public
boost
::
iterator_facade
<
ConstCornerIterator
<
GeometryType
>
,
const
typename
GeometryType
::
GlobalCoordinate
,
boost
::
forward_traversal_tag
>
{
typedef
ConstCornerIterator
<
GeometryType
>
ThisType
;
typedef
typename
GeometryType
::
GlobalCoordinate
CornerType
;
public:
ConstCornerIterator
()
:
index_
(
-
1
)
,
geometry_
(
nullptr
)
{
}
explicit
ConstCornerIterator
(
const
GeometryType
*
const
geometry
,
int
i
=
0
)
:
index_
(
i
)
,
geometry_
(
geometry
)
{
}
private
:
friend
class
boost
::
iterator_core_access
;
void
increment
()
{
index_
++
;
}
bool
equal
(
ThisType
const
&
other
)
const
{
return
this
->
geometry_
&&
(
index_
==
other
.
index_
)
&&
(
this
->
geometry_
==
other
.
geometry_
);
}
const
CornerType
&
dereference
()
const
{
return
geometry_
->
corner
(
index_
);
}
int
index_
;
const
GeometryType
*
const
geometry_
;
};
template
<
class
GeometryType
>
class
CornerRange
{
typedef
ConstCornerIterator
<
GeometryType
>
IteratorType
;
public:
CornerRange
(
const
GeometryType
&
geometry
)
:
geometry_
(
geometry
)
{
}
IteratorType
begin
()
const
{
return
IteratorType
(
geometry_
,
0
);
}
IteratorType
end
()
const
{
return
IteratorType
(
geometry_
,
geometry_
->
corners
());
}
private
:
const
GeometryType
&
geometry_
;
};
template
<
int
mydim
,
int
cdim
,
class
GridImp
,
template
<
int
,
int
,
class
>
class
GeometryImp
>
CornerRange
<
Dune
::
Geometry
<
mydim
,
cdim
,
GridImp
,
GeometryImp
>>
cornerRange
(
const
Dune
::
Geometry
<
mydim
,
cdim
,
GridImp
,
GeometryImp
>&
geometry
)
{
return
CornerRange
<
Dune
::
Geometry
<
mydim
,
cdim
,
GridImp
,
GeometryImp
>>
(
geometry
);
}
template
<
int
mydim
,
int
cdim
,
class
GridImp
,
template
<
int
,
int
,
class
>
class
EntityImp
>
auto
cornerRange
(
const
Dune
::
Entity
<
mydim
,
cdim
,
GridImp
,
EntityImp
>&
entity
)
->
ConstCornerIterator
<
decltype
(
entity
.
geometry
())
>
{
return
CornerRange
<
decltype
(
entity
.
geometry
())
>
(
entity
.
geometry
());
}
#endif //#if HAVE_DUNE_GRID
#if HAVE_DUNE_FEM
//! Range adapter for lagrange points from lagrange spaces
template
<
class
DiscreteFunctionspaceType
,
int
faceCodim
>
template
<
class
GridPartType
,
int
order
,
int
faceCodim
>
class
LagrangePointSetRange
{
typedef
typename
DiscreteFunctionspaceType
::
LagrangePointSetType
LagrangePointSetType
;
typedef
Dune
::
Fem
::
LagrangePointSet
<
GridPartType
,
order
>
LagrangePointSetType
;
typedef
typename
LagrangePointSetType
::
template
Codim
<
faceCodim
>
::
SubEntityIteratorType
SubEntityIteratorType
;
const
LagrangePointSetType
&
lp_set_
;
const
unsigned
int
subEntity_
;
...
...
@@ -144,13 +229,19 @@ class LagrangePointSetRange
public:
/** the template isn't lazyness here, the underlying set is templated on it too
*/
template
<
class
EntityType
>
template
<
class
DiscreteFunctionspaceType
,
class
EntityType
>
LagrangePointSetRange
(
const
DiscreteFunctionspaceType
&
space
,
const
EntityType
&
entity
,
const
unsigned
int
subEntity
)
:
lp_set_
(
space
.
lagrangePointSet
(
entity
))
,
subEntity_
(
subEntity
)
{
}
LagrangePointSetRange
(
const
LagrangePointSetType
&
lp_set
,
const
unsigned
int
subEntity
)
:
lp_set_
(
lp_set
)
,
subEntity_
(
subEntity
)
{
}
SubEntityIteratorType
begin
()
const
{
return
lp_set_
.
template
beginSubEntity
<
faceCodim
>(
subEntity_
);
...
...
@@ -162,10 +253,21 @@ public:
};
template
<
int
codim
,
class
DiscreteFunctionspaceType
,
class
EntityType
>
LagrangePointSetRange
<
DiscreteFunctionspaceType
,
codim
>
LagrangePointSetRange
<
typename
DiscreteFunctionspaceType
::
GridPartType
,
DiscreteFunctionspaceType
::
polynomialOrder
,
codim
>
lagrangePointSetRange
(
const
DiscreteFunctionspaceType
&
space
,
const
EntityType
&
entity
,
const
int
subEntity
)
{
return
LagrangePointSetRange
<
DiscreteFunctionspaceType
,
codim
>
(
space
,
entity
,
subEntity
);
return
LagrangePointSetRange
<
typename
DiscreteFunctionspaceType
::
GridPartType
,
DiscreteFunctionspaceType
::
polynomialOrder
,
codim
>
(
space
,
entity
,
subEntity
);
}
template
<
class
LgPointSetType
,
int
codim
=
1
>
LagrangePointSetRange
<
typename
LgPointSetType
::
GridPartType
,
LgPointSetType
::
polynomialOrder
,
codim
>
lagrangePointSetRange
(
const
LgPointSetType
&
lpset
,
const
int
subEntity
)
{
return
LagrangePointSetRange
<
typename
LgPointSetType
::
GridPartType
,
LgPointSetType
::
polynomialOrder
,
codim
>
(
lpset
,
subEntity
);
}
template
<
class
GridPartTraits
>
...
...
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