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
0b717dcc
Commit
0b717dcc
authored
19 years ago
by
Christian Engwer
Browse files
Options
Downloads
Patches
Plain Diff
specilization for FieldVector<K,1>
[[Imported from SVN: r3648]]
parent
0716cac6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
common/exprtmpl.hh
+18
-0
18 additions, 0 deletions
common/exprtmpl.hh
common/exprtmpl/exprexpr.inc
+24
-0
24 additions, 0 deletions
common/exprtmpl/exprexpr.inc
common/exprtmpl/scalar.inc
+16
-7
16 additions, 7 deletions
common/exprtmpl/scalar.inc
with
58 additions
and
7 deletions
common/exprtmpl.hh
+
18
−
0
View file @
0b717dcc
...
...
@@ -35,11 +35,15 @@ struct Indent
}
void
operator
++
()
{
#ifdef DUNE_VVERBOSE
i
+=
3
;
#endif
};
void
operator
--
()
{
#ifdef DUNE_VVERBOSE
i
-=
3
;
#endif
};
};
...
...
@@ -47,7 +51,9 @@ extern Indent INDENT;
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
s
,
const
Indent
&
i
)
{
#ifdef DUNE_VVERBOSE
for
(
int
n
=
0
;
n
<
i
.
i
;
n
++
)
s
<<
" "
;
#endif
return
s
;
}
...
...
@@ -174,6 +180,18 @@ namespace Dune {
enum
{
value
=
true
};
};
template
<
class
K
>
struct
isEndOfExpressionRecusion
<
FieldVector
<
K
,
1
>
>
{
enum
{
value
=
true
};
};
template
<
class
K
>
struct
isEndOfExpressionRecusion
<
std
::
complex
<
K
>
>
{
enum
{
value
=
true
};
};
template
<
>
struct
isEndOfExpressionRecusion
<
int
>
{
...
...
This diff is collapsed.
Click to expand it.
common/exprtmpl/exprexpr.inc
+
24
−
0
View file @
0b717dcc
...
...
@@ -47,6 +47,14 @@ operator OP (const Expression<A> & a, const Vector<B> & b)
return
Expression
<
ExpressionOpExpression
<
A
,
ConstRef
<
B
>
>
>
(
ex
);
}
// Expression op FieldVector<K,1>
template
<
class
A
,
class
K
>
K
operator
OP
(
const
Expression
<
A
>
&
a
,
const
Expression
<
ConstRef
<
FieldVector
<
K
,
1
>
>
>&
b
)
{
return
a
OP
b
[
0
];
}
// Vector op Expression
template
<
class
A
,
class
B
>
Expression
<
ExpressionOpExpression
<
ConstRef
<
A
>
,
B
>
>
...
...
@@ -57,6 +65,14 @@ operator OP (const Vector<A> & a, const Expression<B> & b)
return
Expression
<
ExpressionOpExpression
<
ConstRef
<
A
>
,
B
>
>
(
ex
);
}
// FieldVector<K,1> op Expression
template
<
class
K
,
class
B
>
K
operator
OP
(
const
Expression
<
ConstRef
<
FieldVector
<
K
,
1
>
>
>
&
a
,
const
Expression
<
B
>
&
b
)
{
return
a
[
0
]
OP
b
;
}
// Vector op Vector
template
<
class
V
>
Expression
<
ExpressionOpExpression
<
ConstRef
<
V
>
,
ConstRef
<
V
>
>
>
...
...
@@ -68,6 +84,14 @@ operator OP (const Vector<V> & a, const Vector<V> & b)
return
Expression
<
ExpressionOpExpression
<
ConstRef
<
V
>
,
ConstRef
<
V
>
>
>
(
ex
);
}
// FieldVector<K,1> op FieldVector<K,1>
template
<
class
K
>
K
operator
OP
(
const
Expression
<
ConstRef
<
FieldVector
<
K
,
1
>
>
>
&
a
,
const
Expression
<
ConstRef
<
FieldVector
<
K
,
1
>
>
>
&
b
)
{
return
a
[
0
]
OP
b
[
0
];
}
// TypeTraits
template
<
class
A
,
class
B
>
struct
BlockExpression
<
ExpressionOpExpression
<
A
,
B
>
>
...
...
This diff is collapsed.
Click to expand it.
common/exprtmpl/scalar.inc
+
16
−
7
View file @
0b717dcc
...
...
@@ -26,6 +26,14 @@ private:
const
field_type
lambda
;
};
// Scalar op FieldVector<K,1>
template
<
class
K
>
K
operator
OP
(
const
Expression
<
ConstRef
<
FieldVector
<
K
,
1
>
>
>
&
a
,
const
K
&
lambda
)
{
return
a
[
0
]
OP
lambda
;
}
// Vector op Scalar
template
<
class
A
>
Expression
<
ExpressionOpScalar
<
ConstRef
<
A
>
>
>
...
...
@@ -108,6 +116,14 @@ private:
const
field_type
lambda
;
};
// Scalar op FieldVector<K,1>
template
<
class
K
>
K
operator
OP
(
const
K
&
lambda
,
const
Expression
<
ConstRef
<
FieldVector
<
K
,
1
>
>
>
&
a
)
{
return
lambda
OP
a
[
0
];
}
// Scalar op Vector
template
<
class
A
>
Expression
<
ScalarOpExpression
<
ConstRef
<
A
>
>
>
...
...
@@ -128,13 +144,6 @@ operator OP (const typename FieldType<A>::type & lambda, const Expression<A> & a
}
// TypeTraits
/*
template<class K, int N>
struct BlockExpression< ExprTmpl::ScalarOpExpression< ExprTmpl::ConstRef< FieldVector<K,N> > > >
{
typedef K type;
};
*/
template
<
class
Ex
>
struct
BlockExpression
<
ExprTmpl
::
ScalarOpExpression
<
Ex
>
>
{
...
...
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