Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-matrix-vector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Model registry
Operate
Environments
Monitor
Incidents
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
agnumpde
dune-matrix-vector
Commits
22a8e39e
Commit
22a8e39e
authored
8 years ago
by
Elias Pipping
Browse files
Options
Downloads
Patches
Plain Diff
Incorporate crossProduct from Arithmetic
parent
069c7903
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/matrix-vector/CMakeLists.txt
+1
-0
1 addition, 0 deletions
dune/matrix-vector/CMakeLists.txt
dune/matrix-vector/crossproduct.hh
+41
-0
41 additions, 0 deletions
dune/matrix-vector/crossproduct.hh
with
42 additions
and
0 deletions
dune/matrix-vector/CMakeLists.txt
+
1
−
0
View file @
22a8e39e
...
...
@@ -3,6 +3,7 @@ install(FILES
addtodiagonal.hh
axpy.hh
componentwisematrixmap.hh
crossproduct.hh
genericvectortools.hh
ldlt.hh
matrixtraits.hh
...
...
This diff is collapsed.
Click to expand it.
dune/matrix-vector/crossproduct.hh
0 → 100644
+
41
−
0
View file @
22a8e39e
#ifndef DUNE_MATRIX_VECTOR_CROSSPRODUCT_HH
#define DUNE_MATRIX_VECTOR_CROSSPRODUCT_HH
#include
<dune/common/fvector.hh>
namespace
Dune
{
namespace
MatrixVector
{
//! Helper class for computing the cross product
template
<
class
T
,
int
n
>
struct
CrossProductHelper
{
static
Dune
::
FieldVector
<
T
,
n
>
crossProduct
(
const
Dune
::
FieldVector
<
T
,
n
>&
a
,
const
Dune
::
FieldVector
<
T
,
n
>&
b
)
{
DUNE_UNUSED_PARAMETER
(
a
);
DUNE_UNUSED_PARAMETER
(
b
);
DUNE_THROW
(
Dune
::
Exception
,
"You can only call crossProduct with dim==3"
);
}
};
//! Specialisation for n=3
template
<
class
T
>
struct
CrossProductHelper
<
T
,
3
>
{
static
Dune
::
FieldVector
<
T
,
3
>
crossProduct
(
const
Dune
::
FieldVector
<
T
,
3
>&
a
,
const
Dune
::
FieldVector
<
T
,
3
>&
b
)
{
Dune
::
FieldVector
<
T
,
3
>
r
;
r
[
0
]
=
a
[
1
]
*
b
[
2
]
-
a
[
2
]
*
b
[
1
];
r
[
1
]
=
a
[
2
]
*
b
[
0
]
-
a
[
0
]
*
b
[
2
];
r
[
2
]
=
a
[
0
]
*
b
[
1
]
-
a
[
1
]
*
b
[
0
];
return
r
;
}
};
//! Compute the cross product of two vectors. Only works for n==3
template
<
class
T
,
int
n
>
Dune
::
FieldVector
<
T
,
n
>
crossProduct
(
const
Dune
::
FieldVector
<
T
,
n
>&
a
,
const
Dune
::
FieldVector
<
T
,
n
>&
b
)
{
return
CrossProductHelper
<
T
,
n
>::
crossProduct
(
a
,
b
);
}
}
}
#endif
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