Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MoReFEM
CoreLibrary
MoReFEM
Commits
10979afd
Commit
10979afd
authored
Apr 29, 2015
by
GILLES Sebastien
Browse files
#531
Fewer scale of local matrices; result remains the same.
parent
4bac08c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Sources/FiniteElement/Operators/GlobalVariationalOperator/Private/Impl/Recursivity.hpp
View file @
10979afd
...
...
@@ -38,7 +38,7 @@ namespace HappyHeart
static
void
InjectInGlobalMatrix531
(
const
LinearAlgebraTupleT
&
linear_algebra_tuple
,
const
LocalFEltSpace
&
local_felt_space
,
LocalVariationalOperatorT
&
local_variational_operator
);
};
...
...
@@ -61,6 +61,29 @@ namespace HappyHeart
template
<
class
LinearAlgebraTupleT
,
std
::
size_t
I
>
struct
ZeroSpecialCase
{
static
double
FetchPreviousCoefficient
(
const
LinearAlgebraTupleT
&
linear_algebra_tuple
);
};
template
<
class
LinearAlgebraTupleT
>
struct
ZeroSpecialCase
<
LinearAlgebraTupleT
,
0
>
{
static
double
FetchPreviousCoefficient
(
const
LinearAlgebraTupleT
&
linear_algebra_tuple
);
};
}
//namespace Impl
...
...
Sources/FiniteElement/Operators/GlobalVariationalOperator/Private/Impl/Recursivity.hxx
View file @
10979afd
...
...
@@ -34,7 +34,7 @@ namespace HappyHeart
Recursivity
<
LinearAlgebraTupleT
,
I
+
1
,
TupleSizeT
>::
Assembly531
(
linear_algebra_tuple
);
}
template
<
class
LinearAlgebraTupleT
,
std
::
size_t
I
,
std
::
size_t
TupleSizeT
>
template
<
class
LocalVariationalOperatorT
>
...
...
@@ -54,8 +54,19 @@ namespace HappyHeart
const
double
coefficient
=
std
::
get
<
I
>
(
linear_algebra_tuple
).
second
;
if
(
!
Utilities
::
AreEqual
(
coefficient
,
1.
))
local_matrix
*=
coefficient
;
const
double
previous_coefficient
=
ZeroSpecialCase
<
LinearAlgebraTupleT
,
I
>::
FetchPreviousCoefficient
(
linear_algebra_tuple
);
assert
(
!
Utilities
::
IsZero
(
previous_coefficient
));
// Trick here: local matrix was multiplied by a coefficient in previous iteration; we here both apply
// the new one and cancel the previous one.
const
auto
factor
=
coefficient
/
previous_coefficient
;
if
(
!
Utilities
::
AreEqual
(
factor
,
1.
))
local_matrix
*=
factor
;
const
auto
&
row_numbering_subset
=
global_matrix
.
GetRowNumberingSubset
();
const
auto
&
col_numbering_subset
=
global_matrix
.
GetColNumberingSubset
();
...
...
@@ -96,11 +107,6 @@ namespace HappyHeart
}
if
(
!
Utilities
::
AreEqual
(
coefficient
,
1.
))
// \todo #531 Be clever and get rid of it (use value from previous iteration in the first product).
local_matrix
*=
1.
/
coefficient
;
Recursivity
<
LinearAlgebraTupleT
,
I
+
1
,
TupleSizeT
>::
InjectInGlobalMatrix531
(
linear_algebra_tuple
,
local_felt_space
,
local_variational_operator
);
...
...
@@ -130,6 +136,25 @@ namespace HappyHeart
}
template
<
class
LinearAlgebraTupleT
>
double
ZeroSpecialCase
<
LinearAlgebraTupleT
,
0
>
::
FetchPreviousCoefficient
(
const
LinearAlgebraTupleT
&
linear_algebra_tuple
)
{
static_cast
<
void
>
(
linear_algebra_tuple
);
return
1.
;
}
template
<
class
LinearAlgebraTupleT
,
std
::
size_t
I
>
double
ZeroSpecialCase
<
LinearAlgebraTupleT
,
I
>
::
FetchPreviousCoefficient
(
const
LinearAlgebraTupleT
&
linear_algebra_tuple
)
{
return
std
::
get
<
I
-
1
>
(
linear_algebra_tuple
).
second
;
}
}
//namespace Impl
...
...
Write
Preview
Markdown
is supported
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