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
ac7139f9
Commit
ac7139f9
authored
14 years ago
by
Christian Engwer
Browse files
Options
Downloads
Patches
Plain Diff
* update FieldVector such that the vector test passes also for complex
valued data [[Imported from SVN: r6177]]
parent
021ae546
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/common/fvector.hh
+62
-43
62 additions, 43 deletions
dune/common/fvector.hh
with
62 additions
and
43 deletions
dune/common/fvector.hh
+
62
−
43
View file @
ac7139f9
...
...
@@ -142,7 +142,6 @@ namespace Dune {
};
typedef
typename
Base
::
size_type
size_type
;
typedef
typename
Base
::
value_type
value_type
;
//===== construction
...
...
@@ -150,7 +149,7 @@ namespace Dune {
FieldVector
()
{}
/** \brief Constructor with a given scalar */
FieldVector
(
const
K
&
k
)
{
(
*
this
)[
0
]
=
k
;
}
FieldVector
(
const
K
&
k
)
:
_data
(
k
)
{
}
using
Base
::
operator
=
;
...
...
@@ -170,69 +169,45 @@ namespace Dune {
//===== conversion operator
/** \brief Conversion operator */
operator
K
()
{
return
(
*
this
)[
0
]
;
}
operator
K
()
{
return
_data
;
}
/** \brief Const conversion operator */
operator
K
()
const
{
return
(
*
this
)[
0
]
;
}
operator
K
()
const
{
return
_data
;
}
};
//! Binary vector addition
template
<
class
K
>
inline
FieldVector
<
K
,
1
>
operator
+
(
const
FieldVector
<
K
,
1
>&
a
,
const
FieldVector
<
K
,
1
>&
b
)
{
return
a
[
0
]
+
b
[
0
];
}
//! Binary vector subtraction
template
<
class
K
>
inline
FieldVector
<
K
,
1
>
operator
-
(
const
FieldVector
<
K
,
1
>&
a
,
const
FieldVector
<
K
,
1
>&
b
)
{
return
a
[
0
]
-
b
[
0
];
}
/* ----- FV / FV ----- */
/* not necessary as these operations are already covered via the cast operator */
//! Binary compare, when using FieldVector<K,1> like K
template
<
class
K
>
inline
bool
operator
>
(
const
FieldVector
<
K
,
1
>&
a
,
const
FieldVector
<
K
,
1
>&
b
)
{
return
a
[
0
]
>
b
[
0
];
}
/* ----- FV / scalar ----- */
//! Binary compare, when using FieldVector<K,1> like K
template
<
class
K
>
inline
bool
operator
>=
(
const
FieldVector
<
K
,
1
>&
a
,
const
FieldVector
<
K
,
1
>&
b
)
{
return
a
[
0
]
>=
b
[
0
];
}
//! Binary compare, when using FieldVector<K,1> like K
//! Binary addition, when using FieldVector<K,1> like K
template
<
class
K
>
inline
bool
operator
<
(
const
FieldVector
<
K
,
1
>&
a
,
const
FieldVector
<
K
,
1
>&
b
)
inline
FieldVector
<
K
,
1
>
operator
+
(
const
FieldVector
<
K
,
1
>&
a
,
const
K
b
)
{
return
a
[
0
]
<
b
[
0
]
;
return
a
[
0
]
+
b
;
}
//! Binary
compare
, when using FieldVector<K,1> like K
//! Binary
subtraction
, when using FieldVector<K,1> like K
template
<
class
K
>
inline
bool
operator
<=
(
const
FieldVector
<
K
,
1
>&
a
,
const
FieldVector
<
K
,
1
>&
b
)
inline
FieldVector
<
K
,
1
>
operator
-
(
const
FieldVector
<
K
,
1
>&
a
,
const
K
b
)
{
return
a
[
0
]
<=
b
[
0
]
;
return
a
[
0
]
-
b
;
}
//! Binary
addi
tion, when using FieldVector<K,1> like K
//! Binary
multiplica
tion, when using FieldVector<K,1> like K
template
<
class
K
>
inline
FieldVector
<
K
,
1
>
operator
+
(
const
FieldVector
<
K
,
1
>&
a
,
const
K
b
)
inline
FieldVector
<
K
,
1
>
operator
*
(
const
FieldVector
<
K
,
1
>&
a
,
const
K
b
)
{
return
a
[
0
]
+
b
;
return
a
[
0
]
*
b
;
}
//! Binary
subtract
ion, when using FieldVector<K,1> like K
//! Binary
divis
ion, when using FieldVector<K,1> like K
template
<
class
K
>
inline
FieldVector
<
K
,
1
>
operator
-
(
const
FieldVector
<
K
,
1
>&
a
,
const
K
b
)
inline
FieldVector
<
K
,
1
>
operator
/
(
const
FieldVector
<
K
,
1
>&
a
,
const
K
b
)
{
return
a
[
0
]
-
b
;
return
a
[
0
]
/
b
;
}
//! Binary compare, when using FieldVector<K,1> like K
template
<
class
K
>
inline
bool
operator
>
(
const
FieldVector
<
K
,
1
>&
a
,
const
K
b
)
...
...
@@ -261,6 +236,22 @@ namespace Dune {
return
a
[
0
]
<=
b
;
}
//! Binary compare, when using FieldVector<K,1> like K
template
<
class
K
>
inline
bool
operator
==
(
const
FieldVector
<
K
,
1
>&
a
,
const
K
b
)
{
return
a
[
0
]
==
b
;
}
//! Binary compare, when using FieldVector<K,1> like K
template
<
class
K
>
inline
bool
operator
!=
(
const
FieldVector
<
K
,
1
>&
a
,
const
K
b
)
{
return
a
[
0
]
!=
b
;
}
/* ----- scalar / FV ------ */
//! Binary addition, when using FieldVector<K,1> like K
template
<
class
K
>
inline
FieldVector
<
K
,
1
>
operator
+
(
const
K
a
,
const
FieldVector
<
K
,
1
>&
b
)
...
...
@@ -275,6 +266,20 @@ namespace Dune {
return
a
-
b
[
0
];
}
//! Binary multiplication, when using FieldVector<K,1> like K
template
<
class
K
>
inline
FieldVector
<
K
,
1
>
operator
*
(
const
K
a
,
const
FieldVector
<
K
,
1
>&
b
)
{
return
a
*
b
[
0
];
}
//! Binary division, when using FieldVector<K,1> like K
template
<
class
K
>
inline
FieldVector
<
K
,
1
>
operator
/
(
const
K
a
,
const
FieldVector
<
K
,
1
>&
b
)
{
return
a
/
b
[
0
];
}
//! Binary compare, when using FieldVector<K,1> like K
template
<
class
K
>
inline
bool
operator
>
(
const
K
a
,
const
FieldVector
<
K
,
1
>&
b
)
...
...
@@ -302,6 +307,20 @@ namespace Dune {
{
return
a
<=
b
[
0
];
}
//! Binary compare, when using FieldVector<K,1> like K
template
<
class
K
>
inline
bool
operator
==
(
const
K
a
,
const
FieldVector
<
K
,
1
>&
b
)
{
return
a
==
b
[
0
];
}
//! Binary compare, when using FieldVector<K,1> like K
template
<
class
K
>
inline
bool
operator
!=
(
const
K
a
,
const
FieldVector
<
K
,
1
>&
b
)
{
return
a
!=
b
[
0
];
}
#endif
/** @} end documentation */
...
...
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