Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-alugrid
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
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-alugrid
Commits
3e008fb6
Commit
3e008fb6
authored
5 years ago
by
alkaemper
Browse files
Options
Downloads
Patches
Plain Diff
make IntegerType a template parameter
parent
b197dc50
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/alugrid/3d/indexsets.hh
+17
-9
17 additions, 9 deletions
dune/alugrid/3d/indexsets.hh
with
17 additions
and
9 deletions
dune/alugrid/3d/indexsets.hh
+
17
−
9
View file @
3e008fb6
...
@@ -173,15 +173,23 @@ namespace Dune
...
@@ -173,15 +173,23 @@ namespace Dune
}
}
};
};
template
<
class
MacroKeyImp
>
// Class to provide global Ids for all entities in the
// grid. Global Ids depend on the macro Element that
// the current element descends from, the codimension
// and the level - this is usually created by the method
// createId
//
// The template parameter IntegerType allows to switch between
// more elements in the grid and a smaller size of the global Ids
template
<
class
MacroKeyImp
,
class
IntegerType
=
int
>
class
ALUGridId
class
ALUGridId
{
{
MacroKeyImp
key_
;
MacroKeyImp
key_
;
i
nt
nChild_
;
I
nt
egerType
nChild_
;
i
nt
64_t
codimLevel_
;
I
nt
egerType
codimLevel_
;
// this means that only up to INT64_MAX/4 entities are allowed
// this means that only up to INT64_MAX/4 entities are allowed
static
constexpr
i
nt
64_t
codimOffset
=
INT64_MAX
/
4
;
static
constexpr
I
nt
egerType
codimOffset
=
std
::
numeric_limits
<
IntegerType
>::
max
()
/
4
;
public:
public:
ALUGridId
()
:
key_
()
ALUGridId
()
:
key_
()
...
@@ -189,7 +197,7 @@ namespace Dune
...
@@ -189,7 +197,7 @@ namespace Dune
,
codimLevel_
(
-
1
)
,
codimLevel_
(
-
1
)
{}
{}
explicit
ALUGridId
(
const
MacroKeyImp
&
key
,
const
i
nt
nChild
,
const
i
nt
64_t
codim
,
const
i
nt
64_t
level
)
explicit
ALUGridId
(
const
MacroKeyImp
&
key
,
const
I
nt
egerType
nChild
,
const
I
nt
egerType
codim
,
const
I
nt
egerType
level
)
:
key_
(
key
)
,
nChild_
(
nChild
)
:
key_
(
key
)
,
nChild_
(
nChild
)
,
codimLevel_
(
codim
*
codimOffset
+
level
)
,
codimLevel_
(
codim
*
codimOffset
+
level
)
{}
{}
...
@@ -241,9 +249,9 @@ namespace Dune
...
@@ -241,9 +249,9 @@ namespace Dune
}
}
const
MacroKeyImp
&
getKey
()
const
{
return
key_
;
}
const
MacroKeyImp
&
getKey
()
const
{
return
key_
;
}
i
nt
nChild
()
const
{
return
nChild_
;
}
I
nt
egerType
nChild
()
const
{
return
nChild_
;
}
i
nt
64_t
codim
()
const
{
return
codimLevel_
/
codimOffset
;
}
I
nt
egerType
codim
()
const
{
return
codimLevel_
/
codimOffset
;
}
i
nt
64_t
level
()
const
{
return
codimLevel_
%
codimOffset
;
}
I
nt
egerType
level
()
const
{
return
codimLevel_
%
codimOffset
;
}
bool
isValid
()
const
bool
isValid
()
const
{
{
...
@@ -452,7 +460,7 @@ namespace Dune {
...
@@ -452,7 +460,7 @@ namespace Dune {
enum
{
childOffSet
=
(
dim
==
2
)
?
4
:
((
cd
==
1
)
&&
(
elType
==
hexa
))
?
16
:
8
};
enum
{
childOffSet
=
(
dim
==
2
)
?
4
:
((
cd
==
1
)
&&
(
elType
==
hexa
))
?
16
:
8
};
alugrid_assert
(
nChild
<
childOffSet
);
alugrid_assert
(
nChild
<
childOffSet
);
const
int
newChild
=
((
creatorId
.
codim
()
+
1
)
*
creatorId
.
nChild
()
*
childOffSet
)
+
nChild
;
const
IdType
::
IntegerType
newChild
=
((
creatorId
.
codim
()
+
1
)
*
creatorId
.
nChild
()
*
childOffSet
)
+
nChild
;
IdType
newId
(
creatorId
.
getKey
()
,
newChild
,
cd
,
creatorId
.
level
()
+
1
);
IdType
newId
(
creatorId
.
getKey
()
,
newChild
,
cd
,
creatorId
.
level
()
+
1
);
alugrid_assert
(
newId
!=
creatorId
);
alugrid_assert
(
newId
!=
creatorId
);
...
...
This diff is collapsed.
Click to expand it.
Tobias Leibner
@l_tobi01
mentioned in commit
28bb328e
·
3 years ago
mentioned in commit
28bb328e
mentioned in commit 28bb328ef3db317927e9d568c7fe3fc39a4d549a
Toggle commit list
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