Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Aland, Sebastian
amdis
Commits
ac1878f9
Commit
ac1878f9
authored
Mar 19, 2015
by
Praetorius, Simon
Browse files
problems with swap() solved
parent
a84300ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/operations/functors.hpp
View file @
ac1878f9
...
@@ -70,6 +70,46 @@ namespace AMDiS
...
@@ -70,6 +70,46 @@ namespace AMDiS
private:
private:
T
val
;
T
val
;
};
};
template
<
typename
T
,
typename
S
>
struct
add_constant
:
FunctorBase
{
typedef
T
result_type
;
S
value
;
add_constant
(
S
value
)
:
value
(
value
)
{}
result_type
&
operator
()(
T
&
v
)
{
return
(
v
+=
value
);
}
};
template
<
typename
T
,
typename
S
>
struct
minus_constant
:
FunctorBase
{
typedef
T
result_type
;
S
value
;
minus_constant
(
S
value
)
:
value
(
value
)
{}
result_type
&
operator
()(
T
&
v
)
{
return
(
v
-=
value
);
}
};
template
<
typename
T
,
typename
S
>
struct
mult_constant
:
FunctorBase
{
typedef
T
result_type
;
S
value
;
mult_constant
(
S
value
)
:
value
(
value
)
{}
result_type
&
operator
()(
T
&
v
)
{
return
(
v
*=
value
);
}
};
template
<
typename
T
,
typename
S
>
struct
div_constant
:
FunctorBase
{
typedef
T
result_type
;
S
value
;
div_constant
(
S
value
)
:
value
(
value
)
{}
result_type
&
operator
()(
T
&
v
)
{
return
(
v
/=
value
);
}
};
/// functor for operator+=
/// functor for operator+=
template
<
typename
T
>
template
<
typename
T
>
...
@@ -100,6 +140,7 @@ namespace AMDiS
...
@@ -100,6 +140,7 @@ namespace AMDiS
static
result_type
&
apply
(
T
&
v
,
T
const
&
v0
)
{
return
(
v
*=
v0
);
}
static
result_type
&
apply
(
T
&
v
,
T
const
&
v0
)
{
return
(
v
*=
v0
);
}
result_type
&
operator
()(
T
&
v
,
T
const
&
v0
)
{
return
apply
(
v
,
v0
);
}
result_type
&
operator
()(
T
&
v
,
T
const
&
v0
)
{
return
apply
(
v
,
v0
);
}
};
};
/// abs(v) == |v|
/// abs(v) == |v|
template
<
typename
T
>
template
<
typename
T
>
...
...
AMDiS/src/parallel/MeshManipulation.cc
View file @
ac1878f9
...
@@ -366,6 +366,7 @@ namespace AMDiS { namespace Parallel {
...
@@ -366,6 +366,7 @@ namespace AMDiS { namespace Parallel {
Element
*
child0
=
boundEl
.
el
->
getFirstChild
();
Element
*
child0
=
boundEl
.
el
->
getFirstChild
();
Element
*
child1
=
boundEl
.
el
->
getSecondChild
();
Element
*
child1
=
boundEl
.
el
->
getSecondChild
();
if
(
boundEl
.
reverseMode
)
{
if
(
boundEl
.
reverseMode
)
{
using
std
::
swap
;
swap
(
s0
,
s1
);
swap
(
s0
,
s1
);
swap
(
child0
,
child1
);
swap
(
child0
,
child1
);
}
}
...
@@ -478,6 +479,7 @@ namespace AMDiS { namespace Parallel {
...
@@ -478,6 +479,7 @@ namespace AMDiS { namespace Parallel {
Element
*
child0
=
el
->
getFirstChild
();
Element
*
child0
=
el
->
getFirstChild
();
Element
*
child1
=
el
->
getSecondChild
();
Element
*
child1
=
el
->
getSecondChild
();
if
(
rMode
)
{
if
(
rMode
)
{
using
std
::
swap
;
swap
(
s0
,
s1
);
swap
(
s0
,
s1
);
swap
(
child0
,
child1
);
swap
(
child0
,
child1
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment