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
fa1119c1
Commit
fa1119c1
authored
12 years ago
by
René Fritze
Browse files
Options
Downloads
Patches
Plain Diff
[grid] introduces range adapters for views/intersection
parent
11fec873
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/grid/ranges.hh
+86
-0
86 additions, 0 deletions
dune/stuff/grid/ranges.hh
with
86 additions
and
0 deletions
dune/stuff/grid/ranges.hh
0 → 100644
+
86
−
0
View file @
fa1119c1
#ifndef DUNE_STUFF_RANGES_RANGES_HH
#define DUNE_STUFF_RANGES_RANGES_HH
namespace
Dune
{
namespace
Stuff
{
namespace
Grid
{
//! adapter enabling view usage in range-based for
template
<
class
GridViewType
,
int
codim
=
0
>
class
ViewRange
{
const
GridViewType
&
view_
;
public:
ViewRange
(
const
GridViewType
&
view
)
:
view_
(
view
)
{
}
typename
GridViewType
::
template
Codim
<
codim
>
::
Iterator
begin
()
const
{
return
view_
.
template
begin
<
codim
>();
}
typename
GridViewType
::
template
Codim
<
codim
>
::
Iterator
end
()
const
{
return
view_
.
template
end
<
codim
>();
}
};
//! adapter enabling intersectionniterator usage in range-based for
template
<
class
GridViewType
>
class
IntersectionRange
{
typedef
typename
GridViewType
::
template
Codim
<
0
>
::
Entity
EntityType
;
const
GridViewType
&
view_
;
const
EntityType
&
entity_
;
public:
IntersectionRange
(
const
GridViewType
&
view
,
const
EntityType
&
entity
)
:
view_
(
view
)
,
entity_
(
entity
)
{
}
typename
GridViewType
::
IntersectionIterator
begin
()
const
{
return
view_
.
ibegin
(
entity_
);
}
typename
GridViewType
::
IntersectionIterator
end
()
const
{
return
view_
.
iend
(
entity_
);
}
};
}
// namespace Grid
}
// namespace Stud
}
// namespace Dune
#endif // DUNE_STUFF_RANGES_RANGES_HH
/** Copyright (c) 2012, Felix Albrecht, Rene Milk
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those
* of the authors and should not be interpreted as representing official policies,
* either expressed or implied, of the FreeBSD Project.
**/
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