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
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
Yuhao Liu
ogs
Commits
df2b56d9
Commit
df2b56d9
authored
4 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[PL] Use constexpr if replacing enable_if.
parent
38a65fec
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
ProcessLib/LocalAssemblerTraits.h
+95
-131
95 additions, 131 deletions
ProcessLib/LocalAssemblerTraits.h
with
95 additions
and
131 deletions
ProcessLib/LocalAssemblerTraits.h
+
95
−
131
View file @
df2b56d9
...
@@ -64,152 +64,116 @@ public:
...
@@ -64,152 +64,116 @@ public:
//! per node.
//! per node.
using
LaplaceMatrix
=
Matrix
<
Dim
*
NodalDOF
,
Dim
*
NodalDOF
>
;
using
LaplaceMatrix
=
Matrix
<
Dim
*
NodalDOF
,
Dim
*
NodalDOF
>
;
//! Get a block \c Dim x \c Dim whose upper left corner is at \c top and \c
//! Get a block \c Dim x \c Dim whose upper left corner is at \c top and \c left.
//! left.
template
<
typename
Mat
>
template
<
typename
Mat
>
static
static
auto
blockDimDim
(
Mat
const
&
mat
,
unsigned
top
,
unsigned
left
,
typename
std
::
enable_if
<
NodalDOF
!=
0
,
unsigned
nrows
,
unsigned
ncols
)
decltype
(
std
::
declval
<
const
Mat
>
().
template
block
<
Dim
,
Dim
>(
0u
,
0u
))
>::
type
blockDimDim
(
Mat
const
&
mat
,
unsigned
top
,
unsigned
left
,
unsigned
nrows
,
unsigned
ncols
)
{
assert
(
nrows
==
Dim
&&
ncols
==
Dim
);
(
void
)
nrows
;
(
void
)
ncols
;
return
mat
.
template
block
<
Dim
,
Dim
>(
top
,
left
);
}
//! Get a block \c Dim x \c Dim whose upper left corner is at \c top and \c left.
template
<
typename
Mat
>
static
typename
std
::
enable_if
<
NodalDOF
==
0
,
decltype
(
std
::
declval
<
const
Mat
>
().
block
(
0u
,
0u
,
0u
,
0u
))
>::
type
blockDimDim
(
Mat
const
&
mat
,
unsigned
top
,
unsigned
left
,
unsigned
nrows
,
unsigned
ncols
)
{
assert
(
nrows
==
ncols
);
return
mat
.
block
(
top
,
left
,
nrows
,
ncols
);
}
//! Get a block \c Dim x \c Dim whose upper left corner is at \c top and \c left.
template
<
typename
Mat
>
static
typename
std
::
enable_if
<
NodalDOF
!=
0
,
decltype
(
std
::
declval
<
Mat
>
().
template
block
<
Dim
,
Dim
>(
0u
,
0u
))
>::
type
blockDimDim
(
Mat
&
mat
,
unsigned
top
,
unsigned
left
,
unsigned
nrows
,
unsigned
ncols
)
{
{
assert
(
nrows
==
Dim
&&
ncols
==
Dim
);
if
constexpr
(
NodalDOF
!=
0
)
(
void
)
nrows
;
(
void
)
ncols
;
{
return
mat
.
template
block
<
Dim
,
Dim
>(
top
,
left
);
assert
(
nrows
==
Dim
&&
ncols
==
Dim
);
}
(
void
)
nrows
;
//! Get a block \c Dim x \c Dim whose upper left corner is at \c top and \c left.
(
void
)
ncols
;
template
<
typename
Mat
>
return
mat
.
template
block
<
Dim
,
Dim
>(
top
,
left
);
static
}
typename
std
::
enable_if
<
NodalDOF
==
0
,
else
decltype
(
std
::
declval
<
Mat
>
().
block
(
0u
,
0u
,
0u
,
0u
))
{
>::
type
assert
(
nrows
==
ncols
);
blockDimDim
(
Mat
&
mat
,
return
mat
.
block
(
top
,
left
,
nrows
,
ncols
);
unsigned
top
,
unsigned
left
,
unsigned
nrows
,
unsigned
ncols
)
}
{
assert
(
nrows
==
ncols
);
return
mat
.
block
(
top
,
left
,
nrows
,
ncols
);
}
}
//! Get a block \c NNodes x \c NNodes whose upper left corner is at \c top and \c left.
//! Get a block \c Dim x \c Dim whose upper left corner is at \c top and \c
template
<
typename
Mat
>
//! left.
static
template
<
typename
Mat
>
typename
std
::
enable_if
<
NodalDOF
!=
0
,
static
auto
blockDimDim
(
Mat
&
mat
,
unsigned
top
,
unsigned
left
,
decltype
(
std
::
declval
<
const
Mat
>
().
template
block
<
NNodes
,
NNodes
>(
0u
,
0u
))
unsigned
nrows
,
unsigned
ncols
)
>::
type
blockShpShp
(
Mat
const
&
mat
,
unsigned
top
,
unsigned
left
,
unsigned
nrows
,
unsigned
ncols
)
{
assert
(
nrows
==
NNodes
&&
ncols
==
NNodes
);
(
void
)
nrows
;
(
void
)
ncols
;
return
mat
.
template
block
<
NNodes
,
NNodes
>(
top
,
left
);
}
//! Get a block \c NNodes x \c NNodes whose upper left corner is at \c top and \c left.
template
<
typename
Mat
>
static
typename
std
::
enable_if
<
NodalDOF
==
0
,
decltype
(
std
::
declval
<
const
Mat
>
().
block
(
0u
,
0u
,
0u
,
0u
))
>::
type
blockShpShp
(
Mat
const
&
mat
,
unsigned
top
,
unsigned
left
,
unsigned
nrows
,
unsigned
ncols
)
{
{
assert
(
nrows
==
ncols
);
if
constexpr
(
NodalDOF
!=
0
)
return
mat
.
block
(
top
,
left
,
nrows
,
ncols
);
{
}
assert
(
nrows
==
Dim
&&
ncols
==
Dim
);
//! Get a block \c NNodes x \c NNodes whose upper left corner is at \c top and \c left.
(
void
)
nrows
;
template
<
typename
Mat
>
(
void
)
ncols
;
static
return
mat
.
template
block
<
Dim
,
Dim
>(
top
,
left
);
typename
std
::
enable_if
<
NodalDOF
!=
0
,
}
decltype
(
std
::
declval
<
Mat
>
().
template
block
<
NNodes
,
NNodes
>(
0u
,
0u
))
else
>::
type
{
blockShpShp
(
Mat
&
mat
,
assert
(
nrows
==
ncols
);
unsigned
top
,
unsigned
left
,
unsigned
nrows
,
unsigned
ncols
)
return
mat
.
block
(
top
,
left
,
nrows
,
ncols
);
{
}
assert
(
nrows
==
NNodes
&&
ncols
==
NNodes
);
(
void
)
nrows
;
(
void
)
ncols
;
return
mat
.
template
block
<
NNodes
,
NNodes
>(
top
,
left
);
}
//! Get a block \c NNodes x \c NNodes whose upper left corner is at \c top and \c left.
template
<
typename
Mat
>
static
typename
std
::
enable_if
<
NodalDOF
==
0
,
decltype
(
std
::
declval
<
Mat
>
().
block
(
0u
,
0u
,
0u
,
0u
))
>::
type
blockShpShp
(
Mat
&
mat
,
unsigned
top
,
unsigned
left
,
unsigned
nrows
,
unsigned
ncols
)
{
assert
(
nrows
==
ncols
);
return
mat
.
block
(
top
,
left
,
nrows
,
ncols
);
}
}
//! Get a block \c NNodes x 1 starting at the \c top'th row.
//! Get a block \c NNodes x \c NNodes whose upper left corner is at \c top
template
<
typename
Vec
>
//! and \c left.
static
template
<
typename
Mat
>
typename
std
::
enable_if
<
NodalDOF
!=
0
,
static
auto
blockShpShp
(
Mat
const
&
mat
,
unsigned
top
,
unsigned
left
,
decltype
(
std
::
declval
<
const
Vec
>
().
template
block
<
NNodes
,
1
>(
0u
,
0u
))
unsigned
nrows
,
unsigned
ncols
)
>::
type
blockShp
(
Vec
const
&
vec
,
unsigned
top
,
unsigned
nrows
)
{
{
assert
(
nrows
==
NNodes
);
if
constexpr
(
NodalDOF
!=
0
)
(
void
)
nrows
;
{
return
vec
.
template
block
<
NNodes
,
1
>(
top
,
0
);
assert
(
nrows
==
NNodes
&&
ncols
==
NNodes
);
(
void
)
nrows
;
(
void
)
ncols
;
return
mat
.
template
block
<
NNodes
,
NNodes
>(
top
,
left
);
}
else
{
assert
(
nrows
==
ncols
);
return
mat
.
block
(
top
,
left
,
nrows
,
ncols
);
}
}
}
//! Get a block \c NNodes x 1 starting at the \c top'th row.
template
<
typename
Vec
>
//! Get a block \c NNodes x \c NNodes whose upper left corner is at \c top
static
//! and \c left.
typename
std
::
enable_if
<
NodalDOF
==
0
,
template
<
typename
Mat
>
decltype
(
std
::
declval
<
const
Vec
>
().
block
(
0u
,
0u
,
0u
,
0u
))
static
auto
blockShpShp
(
Mat
&
mat
,
unsigned
top
,
unsigned
left
,
>::
type
unsigned
nrows
,
unsigned
ncols
)
blockShp
(
Vec
const
&
vec
,
unsigned
top
,
unsigned
nrows
)
{
{
return
vec
.
block
(
top
,
0
,
nrows
,
1
);
if
constexpr
(
NodalDOF
!=
0
)
{
assert
(
nrows
==
NNodes
&&
ncols
==
NNodes
);
(
void
)
nrows
;
(
void
)
ncols
;
return
mat
.
template
block
<
NNodes
,
NNodes
>(
top
,
left
);
}
else
{
assert
(
nrows
==
ncols
);
return
mat
.
block
(
top
,
left
,
nrows
,
ncols
);
}
}
}
//! Get a block \c NNodes x 1 starting at the \c top'th row.
//! Get a block \c NNodes x 1 starting at the \c top'th row.
template
<
typename
Vec
>
template
<
typename
Vec
>
static
static
auto
blockShp
(
Vec
const
&
vec
,
unsigned
top
,
unsigned
nrows
)
typename
std
::
enable_if
<
NodalDOF
!=
0
,
decltype
(
std
::
declval
<
Vec
>
().
template
block
<
NNodes
,
1
>(
0u
,
0u
))
>::
type
blockShp
(
Vec
&
vec
,
unsigned
top
,
unsigned
nrows
)
{
{
assert
(
nrows
==
NNodes
);
if
constexpr
(
NodalDOF
!=
0
)
(
void
)
nrows
;
{
return
vec
.
template
block
<
NNodes
,
1
>(
top
,
0
);
assert
(
nrows
==
NNodes
);
(
void
)
nrows
;
return
vec
.
template
block
<
NNodes
,
1
>(
top
,
0
);
}
else
{
return
vec
.
block
(
top
,
0
,
nrows
,
1
);
}
}
}
//! Get a block \c NNodes x 1 starting at the \c top'th row.
//! Get a block \c NNodes x 1 starting at the \c top'th row.
template
<
typename
Vec
>
template
<
typename
Vec
>
static
static
auto
blockShp
(
Vec
&
vec
,
unsigned
top
,
unsigned
nrows
)
typename
std
::
enable_if
<
NodalDOF
==
0
,
decltype
(
std
::
declval
<
Vec
>
().
block
(
0u
,
0u
,
0u
,
0u
))
>::
type
blockShp
(
Vec
&
vec
,
unsigned
top
,
unsigned
nrows
)
{
{
return
vec
.
block
(
top
,
0
,
nrows
,
1
);
if
constexpr
(
NodalDOF
!=
0
)
{
assert
(
nrows
==
NNodes
);
(
void
)
nrows
;
return
vec
.
template
block
<
NNodes
,
1
>(
top
,
0
);
}
else
{
return
vec
.
block
(
top
,
0
,
nrows
,
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