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
65776003
Commit
65776003
authored
5 years ago
by
alkaemper
Browse files
Options
Downloads
Patches
Plain Diff
a working new id set implementation
parent
e5442786
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/alugrid/3d/indexsets.cc
+6
-6
6 additions, 6 deletions
dune/alugrid/3d/indexsets.cc
dune/alugrid/3d/indexsets.hh
+34
-20
34 additions, 20 deletions
dune/alugrid/3d/indexsets.hh
with
40 additions
and
26 deletions
dune/alugrid/3d/indexsets.cc
+
6
−
6
View file @
65776003
...
@@ -230,7 +230,7 @@ buildMacroVertexId(const VertexType & item )
...
@@ -230,7 +230,7 @@ buildMacroVertexId(const VertexType & item )
int
vx
[
4
]
=
{
item
.
ident
(),
-
1
,
-
1
,
-
1
};
int
vx
[
4
]
=
{
item
.
ident
(),
-
1
,
-
1
,
-
1
};
enum
{
codim
=
3
};
enum
{
codim
=
3
};
MacroKeyType
key
(
vx
[
0
],
vx
[
1
],
vx
[
2
],
vx
[
3
]);
MacroKeyType
key
(
vx
[
0
],
vx
[
1
],
vx
[
2
],
vx
[
3
]);
return
MacroIdType
(
key
,
1
,
codim
,
startOffSet_
);
return
MacroIdType
(
key
,
0
,
codim
,
startOffSet_
);
}
}
template
<
int
dim
,
int
dimworld
,
ALU3dGridElementType
elType
,
class
Comm
>
template
<
int
dim
,
int
dimworld
,
ALU3dGridElementType
elType
,
class
Comm
>
...
@@ -248,7 +248,7 @@ buildMacroEdgeId(const HEdgeType & item )
...
@@ -248,7 +248,7 @@ buildMacroEdgeId(const HEdgeType & item )
enum
{
codim
=
2
};
enum
{
codim
=
2
};
MacroKeyType
key
(
vx
[
0
],
vx
[
1
],
vx
[
2
],
vx
[
3
]);
MacroKeyType
key
(
vx
[
0
],
vx
[
1
],
vx
[
2
],
vx
[
3
]);
return
MacroIdType
(
key
,
1
,
codim
,
startOffSet_
);
return
MacroIdType
(
key
,
0
,
codim
,
startOffSet_
);
}
}
template
<
int
dim
,
int
dimworld
,
ALU3dGridElementType
elType
,
class
Comm
>
template
<
int
dim
,
int
dimworld
,
ALU3dGridElementType
elType
,
class
Comm
>
...
@@ -266,7 +266,7 @@ buildMacroFaceId(const HFaceType & item )
...
@@ -266,7 +266,7 @@ buildMacroFaceId(const HFaceType & item )
enum
{
codim
=
1
};
enum
{
codim
=
1
};
MacroKeyType
key
(
vx
[
0
],
vx
[
1
],
vx
[
2
],
vx
[
3
]);
MacroKeyType
key
(
vx
[
0
],
vx
[
1
],
vx
[
2
],
vx
[
3
]);
return
MacroIdType
(
key
,
1
,
codim
,
startOffSet_
);
return
MacroIdType
(
key
,
0
,
codim
,
startOffSet_
);
}
}
template
<
int
dim
,
int
dimworld
,
ALU3dGridElementType
elType
,
class
Comm
>
template
<
int
dim
,
int
dimworld
,
ALU3dGridElementType
elType
,
class
Comm
>
...
@@ -283,7 +283,7 @@ buildMacroElementId(const HElementType & item )
...
@@ -283,7 +283,7 @@ buildMacroElementId(const HElementType & item )
}
}
enum
{
codim
=
0
};
enum
{
codim
=
0
};
MacroKeyType
key
(
vx
[
0
],
vx
[
1
],
vx
[
2
],
vx
[
3
]);
MacroKeyType
key
(
vx
[
0
],
vx
[
1
],
vx
[
2
],
vx
[
3
]);
return
MacroIdType
(
key
,
1
,
codim
,
startOffSet_
);
return
MacroIdType
(
key
,
0
,
codim
,
startOffSet_
);
}
}
// build ids for all children of this element
// build ids for all children of this element
...
@@ -440,8 +440,8 @@ ALU3dGridGlobalIdSet< dim, dimworld, elType, Comm > ::
...
@@ -440,8 +440,8 @@ ALU3dGridGlobalIdSet< dim, dimworld, elType, Comm > ::
buildVertexIds
(
const
VertexType
&
vertex
,
const
IdType
&
fatherId
)
buildVertexIds
(
const
VertexType
&
vertex
,
const
IdType
&
fatherId
)
{
{
enum
{
codim
=
3
};
enum
{
codim
=
3
};
// inner vertex number is
1
// inner vertex number is
0
ids_
[
codim
][
vertex
.
getIndex
()]
=
createId
<
codim
>
(
vertex
,
fatherId
,
1
);
ids_
[
codim
][
vertex
.
getIndex
()]
=
createId
<
codim
>
(
vertex
,
fatherId
,
0
);
alugrid_assert
(
ids_
[
codim
][
vertex
.
getIndex
()].
isValid
()
);
alugrid_assert
(
ids_
[
codim
][
vertex
.
getIndex
()].
isValid
()
);
}
}
...
...
This diff is collapsed.
Click to expand it.
dune/alugrid/3d/indexsets.hh
+
34
−
20
View file @
65776003
...
@@ -191,33 +191,35 @@ namespace Dune
...
@@ -191,33 +191,35 @@ namespace Dune
MacroKeyImp
key_
;
MacroKeyImp
key_
;
IntegerType
nChild_
;
IntegerType
nChild_
;
int
codimLevel_
;
signed
char
codim_
;
signed
char
level_
;
// this means that only up to 100 levels are allowed
static
constexpr
int
codimOffset
=
100
;
public:
public:
ALUGridId
()
:
key_
()
ALUGridId
()
:
key_
()
,
nChild_
(
-
1
)
,
nChild_
(
-
1
)
,
codimLevel_
(
-
1
)
,
codim_
(
-
1
)
,
level_
(
-
1
)
{}
{}
explicit
ALUGridId
(
const
MacroKeyImp
&
key
,
const
IntegerType
nChild
,
const
int
codim
,
const
int
level
)
explicit
ALUGridId
(
const
MacroKeyImp
&
key
,
const
IntegerType
nChild
,
const
int
codim
,
const
int
level
)
:
key_
(
key
)
,
nChild_
(
nChild
)
:
key_
(
key
)
,
nChild_
(
nChild
)
,
codimLevel_
(
codim
*
codimOffset
+
level
)
,
codim_
(
codim
)
,
level_
(
level
)
{}
{}
ALUGridId
(
const
ALUGridId
&
org
)
ALUGridId
(
const
ALUGridId
&
org
)
:
key_
(
org
.
key_
)
:
key_
(
org
.
key_
)
,
nChild_
(
org
.
nChild_
)
,
nChild_
(
org
.
nChild_
)
,
codimLevel_
(
org
.
codimLevel_
)
,
codim_
(
org
.
codim_
)
,
level_
(
org
.
level_
)
{}
{}
ALUGridId
&
operator
=
(
const
ALUGridId
&
org
)
ALUGridId
&
operator
=
(
const
ALUGridId
&
org
)
{
{
key_
=
org
.
key_
;
key_
=
org
.
key_
;
nChild_
=
org
.
nChild_
;
nChild_
=
org
.
nChild_
;
codimLevel_
=
org
.
codimLevel_
;
codim_
=
org
.
codim_
;
level_
=
org
.
level_
;
return
*
this
;
return
*
this
;
}
}
...
@@ -255,30 +257,32 @@ namespace Dune
...
@@ -255,30 +257,32 @@ namespace Dune
const
MacroKeyImp
&
getKey
()
const
{
return
key_
;
}
const
MacroKeyImp
&
getKey
()
const
{
return
key_
;
}
IntegerType
nChild
()
const
{
return
nChild_
;
}
IntegerType
nChild
()
const
{
return
nChild_
;
}
int
codim
()
const
{
return
codimLevel_
/
codimOffset
;
}
int
codim
()
const
{
return
int
(
codim_
)
;
}
int
level
()
const
{
return
codimLevel_
%
codimOffset
;
}
int
level
()
const
{
return
int
(
level_
)
;
}
bool
isValid
()
const
bool
isValid
()
const
{
{
return
(
(
nChild_
>=
0
)
&&
(
codim
L
evel_
>=
0
)
);
return
(
(
nChild_
>=
0
)
&&
(
codim
_
>=
0
)
&&
(
l
evel_
>=
0
)
);
}
}
void
reset
()
void
reset
()
{
{
nChild_
=
-
1
;
nChild_
=
-
1
;
codimLevel_
=
-
1
;
codim_
=
-
1
;
level_
=
-
1
;
}
}
void
print
(
std
::
ostream
&
out
)
const
void
print
(
std
::
ostream
&
out
)
const
{
{
out
<<
"AluGridID: ("
<<
getKey
()
<<
","
<<
nChild_
<<
","
<<
codim
L
evel_
<<
")"
;
out
<<
"AluGridID: ("
<<
getKey
()
<<
","
<<
nChild_
<<
","
<<
int
(
codim
_
)
<<
","
<<
int
(
l
evel_
)
<<
")"
;
}
}
inline
friend
std
::
size_t
hash_value
(
const
ALUGridId
&
arg
)
inline
friend
std
::
size_t
hash_value
(
const
ALUGridId
&
arg
)
{
{
std
::
size_t
seed
=
hash
<
MacroKeyImp
>
()(
arg
.
getKey
());
std
::
size_t
seed
=
hash
<
MacroKeyImp
>
()(
arg
.
getKey
());
hash_combine
(
seed
,
arg
.
nChild_
);
hash_combine
(
seed
,
arg
.
nChild_
);
hash_combine
(
seed
,
arg
.
codimLevel_
);
hash_combine
(
seed
,
arg
.
codim_
);
hash_combine
(
seed
,
arg
.
level_
);
return
seed
;
return
seed
;
}
}
...
@@ -292,7 +296,9 @@ namespace Dune
...
@@ -292,7 +296,9 @@ namespace Dune
{
{
if
(
nChild_
==
org
.
nChild_
)
if
(
nChild_
==
org
.
nChild_
)
{
{
return
codimLevel_
<
org
.
codimLevel_
;
if
(
codim_
==
org
.
codim_
)
return
level_
<
org
.
level_
;
return
codim_
<
org
.
codim_
;
}
}
else
else
return
nChild_
<
org
.
nChild_
;
return
nChild_
<
org
.
nChild_
;
...
@@ -305,7 +311,7 @@ namespace Dune
...
@@ -305,7 +311,7 @@ namespace Dune
bool
equals
(
const
ALUGridId
&
org
)
const
bool
equals
(
const
ALUGridId
&
org
)
const
{
{
return
(
(
getKey
()
==
org
.
getKey
()
)
&&
(
nChild_
==
org
.
nChild_
)
return
(
(
getKey
()
==
org
.
getKey
()
)
&&
(
nChild_
==
org
.
nChild_
)
&&
(
codim
Level
_
==
org
.
codim
L
evel_
)
);
&&
(
codim_
==
org
.
codim
_
)
&&
(
level_
==
org
.
l
evel_
)
);
}
}
};
};
...
@@ -480,17 +486,21 @@ namespace Dune {
...
@@ -480,17 +486,21 @@ namespace Dune {
const
IntType
nElements
=
std
::
pow
(
8
,
level
);
const
IntType
nElements
=
std
::
pow
(
8
,
level
);
const
std
::
array
<
IntType
,
4
>
nEntities
({
nElements
,
3
*
nElements
,
3
*
nElements
,
nElements
});
const
std
::
array
<
IntType
,
4
>
nEntities
({
nElements
,
3
*
nElements
,
3
*
nElements
,
nElements
});
const
std
::
array
<
std
::
array
<
int
,
4
>
,
3
>
offset
=
{
AT
({
8
,
12
,
6
,
1
}),
AT
({
-
1
,
4
,
4
,
1
}),
AT
({
-
1
,
-
1
,
2
,
1
})};
const
std
::
array
<
std
::
array
<
int
,
4
>
,
4
>
offset
=
{
AT
({
8
,
12
,
6
,
1
}),
AT
({
-
1
,
4
,
4
,
1
}),
AT
({
-
1
,
-
1
,
2
,
1
})
,
AT
({
-
1
,
-
1
,
-
1
,
1
})
};
const
int
childOffSet
=
offset
[
creatorCodim
][
cd
];
const
int
childOffSet
=
offset
[
creatorCodim
][
cd
];
alugrid_assert
(
nChild
<
childOffSet
);
alugrid_assert
(
nChild
<
childOffSet
);
typename
IdType
::
IntegerType
newChild
=
creatorNumber
*
childOffSet
+
nChild
;
alugrid_assert
(
childOffSet
>
0
);
alugrid_assert
(
creatorNumber
<
nEntities
[
creatorCodim
]
);
typename
IdType
::
IntegerType
newChild
=
creatorNumber
*
childOffSet
+
nChild
;
for
(
int
i
=
cd
;
i
>
creatorCodim
;
i
--
)
for
(
int
i
=
cd
;
i
>
creatorCodim
;
i
--
)
{
{
alugrid_assert
(
offset
[
i
][
cd
]
>
0
);
newChild
+=
nEntities
[
i
]
*
offset
[
i
][
cd
];
newChild
+=
nEntities
[
i
]
*
offset
[
i
][
cd
];
}
}
IdType
newId
(
creatorId
.
getKey
()
,
newChild
,
cd
,
creatorId
.
level
()
+
1
);
IdType
newId
(
creatorId
.
getKey
()
,
newChild
,
cd
,
level
+
1
);
alugrid_assert
(
newId
.
isValid
()
);
alugrid_assert
(
newId
!=
creatorId
);
alugrid_assert
(
newId
!=
creatorId
);
return
newId
;
return
newId
;
}
}
...
@@ -499,7 +509,7 @@ namespace Dune {
...
@@ -499,7 +509,7 @@ namespace Dune {
const
IntType
nElements
=
std
::
pow
(
8
,
level
);
const
IntType
nElements
=
std
::
pow
(
8
,
level
);
const
std
::
array
<
IntType
,
4
>
nEntities
({
nElements
,
2
*
nElements
,
(
3
*
nElements
)
/
4
,
nElements
/
2
});
const
std
::
array
<
IntType
,
4
>
nEntities
({
nElements
,
2
*
nElements
,
(
3
*
nElements
)
/
4
,
nElements
/
2
});
const
std
::
array
<
std
::
array
<
int
,
4
>
,
3
>
offset
=
{
AT
({
4
,
12
,
1
,
0
}),
AT
({
-
1
,
4
,
3
,
0
}),
AT
({
-
1
,
-
1
,
2
,
1
})};
const
std
::
array
<
std
::
array
<
int
,
4
>
,
4
>
offset
=
{
AT
({
8
,
8
,
1
,
0
}),
AT
({
-
1
,
4
,
3
,
0
}),
AT
({
-
1
,
-
1
,
2
,
1
})
,
AT
({
-
1
,
-
1
,
-
1
,
1
})
};
const
int
childOffSet
=
offset
[
creatorCodim
][
cd
];
const
int
childOffSet
=
offset
[
creatorCodim
][
cd
];
alugrid_assert
(
nChild
<
childOffSet
);
alugrid_assert
(
nChild
<
childOffSet
);
...
@@ -508,6 +518,10 @@ namespace Dune {
...
@@ -508,6 +518,10 @@ namespace Dune {
{
{
newChild
+=
nEntities
[
i
]
*
offset
[
i
][
cd
];
newChild
+=
nEntities
[
i
]
*
offset
[
i
][
cd
];
}
}
IdType
newId
(
creatorId
.
getKey
()
,
newChild
,
cd
,
level
+
1
);
alugrid_assert
(
newId
.
isValid
()
);
alugrid_assert
(
newId
!=
creatorId
);
return
newId
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Tobias Leibner
@l_tobi01
mentioned in commit
ff30ef93
·
3 years ago
mentioned in commit
ff30ef93
mentioned in commit ff30ef93c0fbc099eece46f5a386c307df8ab6e7
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