Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Chaofan Chen
ogs
Commits
7ea621d4
Commit
7ea621d4
authored
2 years ago
by
Christoph Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
[T] Don't require constexpr/templates
parent
ce516fe8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/MeshLib/ElementUtils.h
+24
-29
24 additions, 29 deletions
Tests/MeshLib/ElementUtils.h
with
24 additions
and
29 deletions
Tests/MeshLib/ElementUtils.h
+
24
−
29
View file @
7ea621d4
...
...
@@ -21,20 +21,16 @@ namespace ElementUtils
//
// Here, faces of a d dimensional element are always considered d-1 dimensional.
// This differs from other places in OGS.
template
<
typename
MeshElementType
>
std
::
size_t
getNumberOfFaces
(
MeshElementType
const
&
e
)
inline
std
::
size_t
getNumberOfFaces
(
MeshLib
::
Element
const
&
e
)
{
if
constexpr
(
MeshElementType
::
d
imension
==
3
)
switch
(
e
.
getD
imension
()
)
{
return
e
.
getNumberOfFaces
();
}
if
constexpr
(
MeshElementType
::
dimension
==
2
)
{
return
e
.
getNumberOfEdges
();
}
if
constexpr
(
MeshElementType
::
dimension
==
1
)
{
return
2
;
case
3
:
return
e
.
getNumberOfFaces
();
case
2
:
return
e
.
getNumberOfEdges
();
case
1
:
return
2
;
}
return
0
;
...
...
@@ -44,26 +40,25 @@ std::size_t getNumberOfFaces(MeshElementType const& e)
//
// Here, faces of a d dimensional element are always considered d-1 dimensional.
// This differs from other places in OGS.
template
<
typename
MeshElementType
>
std
::
unique_ptr
<
MeshLib
::
Element
const
>
getFace
(
MeshElementType
const
&
bulk_element
,
unsigned
face_id
)
inline
std
::
unique_ptr
<
MeshLib
::
Element
const
>
getFace
(
MeshLib
::
Element
const
&
bulk_element
,
unsigned
face_id
)
{
auto
const
expr
dim
=
MeshElementType
::
d
imension
;
auto
const
dim
=
bulk_element
.
getD
imension
()
;
if
constexpr
(
dim
==
3
)
{
return
std
::
unique_ptr
<
MeshLib
::
Element
const
>
{
bulk_element
.
getFace
(
face_id
)};
}
if
constexpr
(
dim
==
2
)
{
return
std
::
unique_ptr
<
MeshLib
::
Element
const
>
{
bulk_element
.
getEdge
(
face_id
)};
}
if
constexpr
(
dim
==
1
)
switch
(
dim
)
{
auto
*
node
=
const_cast
<
MeshLib
::
Node
*>
(
bulk_element
.
getNode
(
face_id
));
return
std
::
make_unique
<
MeshLib
::
Point
>
(
std
::
array
{
node
});
case
3
:
return
std
::
unique_ptr
<
MeshLib
::
Element
const
>
{
bulk_element
.
getFace
(
face_id
)};
case
2
:
return
std
::
unique_ptr
<
MeshLib
::
Element
const
>
{
bulk_element
.
getEdge
(
face_id
)};
case
1
:
{
auto
*
node
=
const_cast
<
MeshLib
::
Node
*>
(
bulk_element
.
getNode
(
face_id
));
return
std
::
make_unique
<
MeshLib
::
Point
>
(
std
::
array
{
node
});
}
}
OGS_FATAL
(
"Unsupported element dimension: "
+
std
::
to_string
(
dim
));
...
...
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