Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
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
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
Core Modules
dune-common
Commits
87d9b800
Commit
87d9b800
authored
5 years ago
by
Ansgar Burchardt
Browse files
Options
Downloads
Patches
Plain Diff
FieldMatrix should be trivially copyable and standard layout type
Closes:
#169
parent
14fc1f32
No related branches found
No related tags found
1 merge request
!688
make `FieldMatrix` and `FieldVector` trivially copyable types
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/common/fmatrix.hh
+13
-8
13 additions, 8 deletions
dune/common/fmatrix.hh
dune/common/test/fmatrixtest.cc
+9
-0
9 additions, 0 deletions
dune/common/test/fmatrixtest.cc
with
22 additions
and
8 deletions
dune/common/fmatrix.hh
+
13
−
8
View file @
87d9b800
...
...
@@ -87,7 +87,7 @@ namespace Dune
//===== constructors
/** \brief Default constructor
*/
FieldMatrix
()
{}
FieldMatrix
()
=
default
;
/** \brief Constructor initializing the matrix from a list of vector
*/
...
...
@@ -107,16 +107,21 @@ namespace Dune
using
Base
::
operator
=
;
// Specialisation: FieldMatrix assignment (compile-time bounds checking)
template
<
typename
T
,
int
rows
,
int
cols
>
FieldMatrix
&
operator
=
(
FieldMatrix
<
T
,
rows
,
cols
>
const
&
rhs
)
//! copy assignment operator
FieldMatrix
&
operator
=
(
const
FieldMatrix
&
)
=
default
;
//! copy assignment from FieldMatrix over a different field
template
<
typename
T
>
FieldMatrix
&
operator
=
(
const
FieldMatrix
<
T
,
ROWS
,
COLS
>&
x
)
{
static_assert
(
rows
==
ROWS
,
"Size mismatch in matrix assignment (rows)"
);
static_assert
(
cols
==
COLS
,
"Size mismatch in matrix assignment (columns)"
);
_data
=
rhs
.
_data
;
_data
=
x
.
_data
;
return
*
this
;
}
//! no copy assignment from FieldMatrix of different size
template
<
typename
T
,
int
rows
,
int
cols
>
FieldMatrix
&
operator
=
(
FieldMatrix
<
T
,
rows
,
cols
>
const
&
)
=
delete
;
//! Multiplies M from the left to this matrix, this matrix is not modified
template
<
int
l
>
FieldMatrix
<
K
,
l
,
cols
>
leftmultiplyany
(
const
FieldMatrix
<
K
,
l
,
rows
>&
M
)
const
...
...
@@ -226,7 +231,7 @@ namespace Dune
//===== constructors
/** \brief Default constructor
*/
FieldMatrix
()
{}
FieldMatrix
()
=
default
;
/** \brief Constructor initializing the matrix from a list of vector
*/
...
...
This diff is collapsed.
Click to expand it.
dune/common/test/fmatrixtest.cc
+
9
−
0
View file @
87d9b800
...
...
@@ -733,6 +733,15 @@ void test_interface()
typedef
CheckMatrixInterface
::
UseFieldVector
<
K2
,
rows
,
cols
>
Traits
;
typedef
Dune
::
FieldMatrix
<
K
,
rows
,
cols
>
FMatrix
;
static_assert
(
!
std
::
is_trivially_copyable
<
K
>::
value
||
std
::
is_trivially_copyable
<
FMatrix
>::
value
,
"FieldMatrix<T, ...> must be trivally copyable type when T is trivial type"
);
static_assert
(
std
::
is_standard_layout
<
FMatrix
>::
value
,
"FieldMatrix<...> must be a standard layout type"
);
FMatrix
m
(
1
);
checkMatrixInterface
<
FMatrix
>
(
m
);
checkMatrixInterface
<
FMatrix
,
Traits
>
(
m
);
...
...
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