Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
dumux-repositories
dumux
Commits
430fe0e6
Commit
430fe0e6
authored
3 years ago
by
Kilian Weishaupt
Browse files
Options
Downloads
Patches
Plain Diff
[staggered] Add local intersectionIndexMapper
parent
2f233d78
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2901
Feature/improve staggered gridgeometry
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dumux/discretization/facecentered/staggered/localintersectionindexmapper.hh
+133
-0
133 additions, 0 deletions
...on/facecentered/staggered/localintersectionindexmapper.hh
with
133 additions
and
0 deletions
dumux/discretization/facecentered/staggered/localintersectionindexmapper.hh
0 → 100644
+
133
−
0
View file @
430fe0e6
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \ingroup FaceCenteredStaggeredDiscretization
* \copydoc Dumux::FaceCenteredStaggeredLocalIntersectionIndexMapper
*/
#ifndef DUMUX_DISCRETIZATION_LOCAL_INTERSECTION_INDEX_MAPPER_HH
#define DUMUX_DISCRETIZATION_LOCAL_INTERSECTION_INDEX_MAPPER_HH
#include
<array>
#include
<numeric>
#include
<dune/common/float_cmp.hh>
#include
<dumux/common/indextraits.hh>
#include
<dumux/common/math.hh>
#include
<dumux/discretization/facecentered/staggered/normalaxis.hh>
#include
<dumux/discretization/facecentered/staggered/consistentlyorientedgrid.hh>
namespace
Dumux
{
namespace
Detail
{
template
<
class
GridView
,
bool
consistentlyOrientedGrid
>
class
FaceCenteredStaggeredLocalIntersectionIndexMapper
;
/*!
* \ingroup FaceCenteredStaggeredDiscretization
* \brief Provides a mapping of local intersecton indices (indexInInside)
* such that the local indices always follow the order of a reference element,
* regardless of how the element is oriented.
*/
template
<
class
GridView
>
class
FaceCenteredStaggeredLocalIntersectionIndexMapper
<
GridView
,
false
>
{
using
SmallLocalIndexType
=
typename
IndexTraits
<
GridView
>::
SmallLocalIndex
;
using
Element
=
typename
GridView
::
template
Codim
<
0
>
::
Entity
;
static
constexpr
auto
numElementFaces
=
GridView
::
Grid
::
dimension
*
2
;
public:
void
update
(
const
GridView
&
gv
,
const
Element
&
element
)
{
static
const
bool
makeConsistentlyOriented
=
getParam
<
bool
>
(
"Grid.MakeConsistentlyOriented"
,
true
);
if
(
!
makeConsistentlyOriented
)
{
std
::
iota
(
realToRefMap_
.
begin
(),
realToRefMap_
.
end
(),
0
);
refToRealMap_
=
realToRefMap_
;
return
;
}
for
(
const
auto
&
is
:
intersections
(
gv
,
element
))
{
const
auto
&
otherOuterNormal
=
is
.
centerUnitOuterNormal
();
const
auto
idx
=
normalAxis
(
otherOuterNormal
);
const
int
positveOrientation
=
!
std
::
signbit
(
otherOuterNormal
[
idx
]);
const
auto
refIdx
=
idx
*
2
+
positveOrientation
;
const
auto
realIdx
=
is
.
indexInInside
();
realToRefMap_
[
realIdx
]
=
refIdx
;
refToRealMap_
[
refIdx
]
=
realIdx
;
}
}
//! Return the intersection's actual local indexInElement given a local reference index.
SmallLocalIndexType
realToRefIdx
(
const
SmallLocalIndexType
localIsIdx
)
const
{
return
realToRefMap_
[
localIsIdx
];
}
//! Return the intersection's local reference indexInElement given an actual local index.
SmallLocalIndexType
refToRealIdx
(
const
SmallLocalIndexType
localIsIdx
)
const
{
return
refToRealMap_
[
localIsIdx
];
}
private
:
std
::
array
<
SmallLocalIndexType
,
numElementFaces
>
realToRefMap_
;
std
::
array
<
SmallLocalIndexType
,
numElementFaces
>
refToRealMap_
;
};
/*!
* \ingroup FaceCenteredStaggeredDiscretization
* \brief Provides a mapping of local intersecton indices (indexInInside)
* such that the local indices always follow the order of a reference element,
* regardless of how the element in oriented.
* \note This specialization is used for grids not supporting rotated elements.
* No mapping needs to be done here.
*/
template
<
class
GridView
>
class
FaceCenteredStaggeredLocalIntersectionIndexMapper
<
GridView
,
true
>
{
using
SmallLocalIndexType
=
typename
IndexTraits
<
GridView
>::
SmallLocalIndex
;
using
Element
=
typename
GridView
::
template
Codim
<
0
>
::
Entity
;
public:
//! Update the map for getting the corresponding local face indices in another element.
void
update
(
const
GridView
&
,
const
Element
&
)
{}
//! Return the intersection's actual local indexInElement given a local reference index.
SmallLocalIndexType
realToRefIdx
(
const
SmallLocalIndexType
localIsIdx
)
const
{
return
localIsIdx
;
}
//! Return the intersection's local reference indexInElement given an actual local index.
SmallLocalIndexType
refToRealIdx
(
const
SmallLocalIndexType
localIsIdx
)
const
{
return
localIsIdx
;
}
};
}
// end namespace Detail
/*!
* \ingroup FaceCenteredStaggeredDiscretization
* \brief Provides a mapping of local intersecton indices (indexInInside)
* such that the local indices always follow the order of a reference element,
* regardless of how the element is oriented. Does not do anything for grids
* not supporting rotated elements (such as Dune::YaspGrid).
*/
template
<
class
GridView
>
using
FaceCenteredStaggeredLocalIntersectionIndexMapper
=
Detail
::
FaceCenteredStaggeredLocalIntersectionIndexMapper
<
GridView
,
ConsistentlyOrientedGrid
<
typename
GridView
::
Grid
>
{}
>
;
}
// end namespace Dumux
#endif
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