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
8f6e2469
Commit
8f6e2469
authored
12 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[function.checkerboard] fixed possible overflow
parent
7a59ea07
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/function/checkerboard.hh
+7
-1
7 additions, 1 deletion
dune/stuff/function/checkerboard.hh
with
7 additions
and
1 deletion
dune/stuff/function/checkerboard.hh
+
7
−
1
View file @
8f6e2469
...
@@ -132,13 +132,19 @@ public:
...
@@ -132,13 +132,19 @@ public:
return
0
;
return
0
;
}
}
/**
* \todo put this stuff in an expression, that is expanded at compile time (dimension dependent)
*/
virtual
void
evaluate
(
const
DomainType
&
x
,
RangeType
&
ret
)
const
virtual
void
evaluate
(
const
DomainType
&
x
,
RangeType
&
ret
)
const
{
{
// decide on the subdomain the point x belongs to
// decide on the subdomain the point x belongs to
std
::
vector
<
size_t
>
whichPartition
;
std
::
vector
<
size_t
>
whichPartition
;
for
(
int
d
=
0
;
d
<
dimDomain
;
++
d
)
{
for
(
int
d
=
0
;
d
<
dimDomain
;
++
d
)
{
// for points that are on upperRight_[d], this selects one partition too much
// so we need to cap this
whichPartition
.
push_back
(
whichPartition
.
push_back
(
std
::
floor
(
numElements_
[
d
]
*
((
x
[
d
]
-
lowerLeft_
[
d
])
/
(
upperRight_
[
d
]
-
lowerLeft_
[
d
]))));
std
::
min
(
size_t
(
std
::
floor
(
numElements_
[
d
]
*
((
x
[
d
]
-
lowerLeft_
[
d
])
/
(
upperRight_
[
d
]
-
lowerLeft_
[
d
])))),
numElements_
[
d
]
-
1
));
}
}
size_t
subdomain
=
0
;
size_t
subdomain
=
0
;
if
(
dimDomain
==
1
)
if
(
dimDomain
==
1
)
...
...
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