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
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Timo Koch
dune-common
Commits
157c684f
Commit
157c684f
authored
12 years ago
by
Christoph Gersbacher
Browse files
Options
Downloads
Patches
Plain Diff
Interface check for DiagonalMatrix + minor fixes.
[[Imported from SVN: r7103]]
parent
f17471bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/common/diagonalmatrix.hh
+9
-1
9 additions, 1 deletion
dune/common/diagonalmatrix.hh
dune/common/test/diagonalmatrixtest.cc
+41
-0
41 additions, 0 deletions
dune/common/test/diagonalmatrixtest.cc
with
50 additions
and
1 deletion
dune/common/diagonalmatrix.hh
+
9
−
1
View file @
157c684f
...
...
@@ -50,7 +50,8 @@ namespace Dune {
//===== type definitions and constants
//! export the type representing the field
typedef
K
field_type
;
typedef
K
value_type
;
typedef
value_type
field_type
;
//! export the type representing the components
typedef
K
block_type
;
...
...
@@ -67,8 +68,10 @@ namespace Dune {
//! Each row is implemented by a field vector
typedef
DiagonalRowVector
<
K
,
n
>
row_type
;
typedef
row_type
reference
;
typedef
row_type
row_reference
;
typedef
DiagonalRowVectorConst
<
K
,
n
>
const_row_type
;
typedef
const_row_type
const_reference
;
typedef
const_row_type
const_row_reference
;
//! export size
enum
{
...
...
@@ -78,7 +81,12 @@ namespace Dune {
cols
=
n
};
//==== size
size_type
size
()
const
{
return
rows
;
}
//===== constructors
...
...
This diff is collapsed.
Click to expand it.
dune/common/test/diagonalmatrixtest.cc
+
41
−
0
View file @
157c684f
...
...
@@ -10,9 +10,36 @@
#include
<dune/common/fvector.hh>
#include
<dune/common/exceptions.hh>
#include
"checkmatrixinterface.hh"
using
namespace
Dune
;
namespace
CheckMatrixInterface
{
namespace
Capabilities
{
template
<
class
K
,
int
n
>
struct
hasStaticSizes
<
Dune
::
DiagonalMatrix
<
K
,
n
>
>
{
static
const
bool
v
=
true
;
static
const
int
rows
=
n
;
static
const
int
cols
=
n
;
};
template
<
class
K
,
int
n
>
struct
isRegular
<
Dune
::
DiagonalMatrix
<
K
,
n
>
>
{
static
const
bool
v
=
true
;
};
}
// namespace Capabilities
}
// namespace CheckMatrixInterface
template
<
class
K
,
int
n
>
void
test_matrix
()
{
...
...
@@ -50,12 +77,26 @@ void test_matrix()
DUNE_UNUSED
FieldMatrix
<
K
,
n
,
n
>
AFM
=
FieldMatrix
<
K
,
n
,
n
>
(
A
);
}
template
<
class
K
,
int
n
>
void
test_interface
()
{
typedef
CheckMatrixInterface
::
UseFieldVector
<
K
,
n
,
n
>
Traits
;
typedef
Dune
::
DiagonalMatrix
<
K
,
n
>
DiagonalMatrix
;
const
DiagonalMatrix
A
(
1
);
checkMatrixInterface
<
DiagonalMatrix
>
(
A
);
checkMatrixInterface
<
DiagonalMatrix
,
Traits
>
(
A
);
}
int
main
()
{
try
{
test_matrix
<
float
,
1
>
();
test_interface
<
float
,
1
>
();
test_matrix
<
double
,
1
>
();
test_interface
<
double
,
1
>
();
test_matrix
<
double
,
5
>
();
test_interface
<
double
,
5
>
();
}
catch
(
Dune
::
Exception
&
e
)
{
...
...
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