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
ef51196f
Commit
ef51196f
authored
4 years ago
by
René Fritze
Committed by
René Fritze
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[intersection] simplify contains
this actually works with just function overloads
parent
83002ebd
No related branches found
No related tags found
1 merge request
!31
Sfinae and stuff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/xt/grid/intersection.hh
+9
-12
9 additions, 12 deletions
dune/xt/grid/intersection.hh
with
9 additions
and
12 deletions
dune/xt/grid/intersection.hh
+
9
−
12
View file @
ef51196f
...
@@ -85,10 +85,9 @@ double diameter(const Intersection<G, I>& intersection)
...
@@ -85,10 +85,9 @@ double diameter(const Intersection<G, I>& intersection)
* Returns true, if global_point and intersection coincide.
* Returns true, if global_point and intersection coincide.
*/
*/
template
<
class
G
,
class
I
,
class
D
>
template
<
class
G
,
class
I
,
class
D
>
typename
std
::
enable_if
<
G
::
dimension
==
1
,
bool
>::
type
bool
contains
(
const
Dune
::
Intersection
<
G
,
I
>&
intersection
,
contains
(
const
Dune
::
Intersection
<
G
,
I
>&
intersection
,
const
Dune
::
FieldVector
<
D
,
1
>&
global_point
,
const
Dune
::
FieldVector
<
D
,
1
>&
global_point
,
const
D
&
tolerance
=
Common
::
FloatCmp
::
DefaultEpsilon
<
D
>::
value
())
const
D
&
tolerance
=
Common
::
FloatCmp
::
DefaultEpsilon
<
D
>::
value
())
{
{
return
Common
::
FloatCmp
::
eq
(
intersection
.
geometry
().
center
(),
global_point
,
tolerance
);
return
Common
::
FloatCmp
::
eq
(
intersection
.
geometry
().
center
(),
global_point
,
tolerance
);
}
}
...
@@ -100,10 +99,9 @@ contains(const Dune::Intersection<G, I>& intersection,
...
@@ -100,10 +99,9 @@ contains(const Dune::Intersection<G, I>& intersection,
* Returns true if global_point lies on the line between the corners of intersection.
* Returns true if global_point lies on the line between the corners of intersection.
*/
*/
template
<
class
G
,
class
I
,
class
D
>
template
<
class
G
,
class
I
,
class
D
>
typename
std
::
enable_if
<
G
::
dimension
==
2
,
bool
>::
type
bool
contains
(
const
Dune
::
Intersection
<
G
,
I
>&
intersection
,
contains
(
const
Dune
::
Intersection
<
G
,
I
>&
intersection
,
const
Dune
::
FieldVector
<
D
,
2
>&
global_point
,
const
Dune
::
FieldVector
<
D
,
2
>&
global_point
,
const
D
&
tolerance
=
Common
::
FloatCmp
::
DefaultEpsilon
<
D
>::
value
())
const
D
&
tolerance
=
Common
::
FloatCmp
::
DefaultEpsilon
<
D
>::
value
())
{
{
const
auto
&
geometry
=
intersection
.
geometry
();
const
auto
&
geometry
=
intersection
.
geometry
();
// get the global coordinates of the intersections corners
// get the global coordinates of the intersections corners
...
@@ -139,10 +137,9 @@ contains(const Dune::Intersection<G, I>& intersection,
...
@@ -139,10 +137,9 @@ contains(const Dune::Intersection<G, I>& intersection,
* http://math.stackexchange.com/questions/684141/check-if-a-point-is-on-a-plane-minimize-the-use-of-multiplications-and-divisio
* http://math.stackexchange.com/questions/684141/check-if-a-point-is-on-a-plane-minimize-the-use-of-multiplications-and-divisio
*/
*/
template
<
class
G
,
class
I
,
class
D
>
template
<
class
G
,
class
I
,
class
D
>
typename
std
::
enable_if
<
G
::
dimension
==
3
,
bool
>::
type
bool
contains
(
const
Dune
::
Intersection
<
G
,
I
>&
intersection
,
contains
(
const
Dune
::
Intersection
<
G
,
I
>&
intersection
,
const
Dune
::
FieldVector
<
D
,
3
>&
global_point
,
const
Dune
::
FieldVector
<
D
,
3
>&
global_point
,
const
D
&
tolerance
=
Common
::
FloatCmp
::
DefaultEpsilon
<
D
>::
value
())
const
D
&
tolerance
=
Common
::
FloatCmp
::
DefaultEpsilon
<
D
>::
value
())
{
{
const
auto
&
geometry
=
intersection
.
geometry
();
const
auto
&
geometry
=
intersection
.
geometry
();
// get the global coordinates of the intersections corners, there should be at least 3 (ignore the fourth if there is
// get the global coordinates of the intersections corners, there should be at least 3 (ignore the fourth if there is
...
...
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