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
971606fa
Commit
971606fa
authored
Apr 30, 2015
by
GILLES Sebastien
Browse files
#531
Introduce new method to get the list of unknowns to consider within a given numbering subset.
parent
5ee01bc8
Changes
8
Hide whitespace changes
Inline
Side-by-side
Data/Lua/demo_input_hyperelasticity.lua
View file @
971606fa
...
...
@@ -16,7 +16,7 @@ transient = {
-- Maximum time, if set to zero run a case.
-- Expected format: VALUE
-- Constraint: v >= 0.
timeMax
=
1
.
timeMax
=
40
.
}
-- NumberingSubset1
...
...
HappyHeart.xcodeproj/xcshareddata/xcschemes/Hyperelasticity_CG_half_sum - mpi.xcscheme
View file @
971606fa
...
...
@@ -44,7 +44,7 @@
selectedLauncherIdentifier =
"Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle =
"0"
useCustomWorkingDirectory =
"NO"
buildConfiguration =
"
Debug
"
buildConfiguration =
"
Release
"
ignoresPersistentStateOnLaunch =
"NO"
debugDocumentVersioning =
"YES"
allowLocationSimulation =
"YES"
>
...
...
Sources/FiniteElement/FiniteElement/LocalFEltSpace.cpp
View file @
971606fa
...
...
@@ -44,6 +44,17 @@ namespace HappyHeart
{
return
current_finite_elt_ptr
->
GetUnknownAndNumberingSubset
()
==
unknown_and_numbering_subset
;
})
==
finite_elt_list_
.
cend
());
const
auto
&
unknown
=
unknown_and_numbering_subset
.
GetUnknown
();
assert
(
"LocalFEltSpace are supposed to be defined within a FEltSpace, in which an unknown might be present "
"only once (can't be associated to two different numbering subsets at this level)."
&&
std
::
find_if
(
finite_elt_list_
.
cbegin
(),
finite_elt_list_
.
cend
(),
[
&
unknown
](
const
auto
&
current_finite_elt_ptr
)
{
return
current_finite_elt_ptr
->
GetUnknownAndNumberingSubset
().
GetUnknown
()
==
unknown
;
})
==
finite_elt_list_
.
cend
());
#endif // NDEBUG
...
...
Sources/FiniteElement/FiniteElement/LocalFEltSpace.hpp
View file @
971606fa
...
...
@@ -86,6 +86,9 @@ namespace HappyHeart
//! Non-constant access to the FiniteElt matching the given \a unknown_ptr.
FiniteElt
&
GetNonCstFiniteElt
(
const
UnknownAndNumberingSubset
&
unknown_and_numbering_subset
);
//! Access to the FiniteElt matching the given \a unknown_ptr.
const
FiniteElt
&
GetFiniteElt
(
const
Unknown
&
unknown
)
const
;
//! Access to all FiniteElts.
const
FiniteElt
::
vector_unique_ptr
&
GetFiniteEltList
()
const
;
...
...
@@ -113,8 +116,7 @@ namespace HappyHeart
* possibly several of them...). Mutable trick should be use here.
*/
template
<
MpiScale
MpiScaleT
>
std
::
vector
<
PetscInt
>
ComputeLocal2Global
(
const
UnknownAndNumberingSubset
::
vector_const_shared_ptr
&
list
,
const
NumberingSubset
&
numbering_subset
)
const
;
std
::
vector
<
PetscInt
>
ComputeLocal2Global
(
const
Unknown
::
vector_const_shared_ptr
&
list
)
const
;
private:
...
...
Sources/FiniteElement/FiniteElement/LocalFEltSpace.hxx
View file @
971606fa
...
...
@@ -44,6 +44,20 @@ namespace HappyHeart
}
inline
const
FiniteElt
&
LocalFEltSpace
::
GetFiniteElt
(
const
Unknown
&
unknown
)
const
{
auto
it
=
std
::
find_if
(
finite_elt_list_
.
cbegin
(),
finite_elt_list_
.
cend
(),
[
&
unknown
](
const
auto
&
finite_elt_ptr
)
{
assert
(
!
(
!
finite_elt_ptr
));
return
finite_elt_ptr
->
GetUnknownAndNumberingSubset
().
GetUnknown
()
==
unknown
;
});
assert
(
it
!=
finite_elt_list_
.
cend
());
return
*
(
*
it
);
}
inline
FiniteElt
&
LocalFEltSpace
::
GetNonCstFiniteElt
(
const
UnknownAndNumberingSubset
&
unknown_and_numbering_subset
)
{
return
const_cast
<
FiniteElt
&>
(
GetFiniteElt
(
unknown_and_numbering_subset
));
...
...
@@ -65,8 +79,7 @@ namespace HappyHeart
template
<
MpiScale
MpiScaleT
>
std
::
vector
<
PetscInt
>
LocalFEltSpace
::
ComputeLocal2Global
(
const
UnknownAndNumberingSubset
::
vector_const_shared_ptr
&
list
,
const
NumberingSubset
&
numbering_subset
)
const
::
ComputeLocal2Global
(
const
Unknown
::
vector_const_shared_ptr
&
list
)
const
{
std
::
vector
<
PetscInt
>
ret
;
...
...
@@ -75,9 +88,6 @@ namespace HappyHeart
assert
(
!
(
!
item_ptr
));
const
auto
&
item
=
*
item_ptr
;
if
(
item
.
GetNumberingSubset
()
!=
numbering_subset
)
continue
;
const
auto
&
felt
=
GetFiniteElt
(
item
);
const
auto
&
felt_loc2glob
=
felt
.
GetLocal2Global
<
MpiScaleT
>
();
...
...
Sources/FiniteElement/Operators/Crtp/UnknownAndNumberingSubsetList.hpp
View file @
971606fa
...
...
@@ -57,9 +57,14 @@ namespace HappyHeart
///@}
//! Return the list of Unkowns and their associated numbering subset.
const
UnknownAndNumberingSubset
::
vector_const_shared_ptr
&
GetUnknownAndNumberingSubsetList
()
const
;
/*!
* \brief Returns the list of Unknowns that match \a numbering_subset.
*/
Unknown
::
vector_const_shared_ptr
GetUnknownList
(
const
NumberingSubset
&
numbering_subset
)
const
;
protected:
...
...
@@ -73,6 +78,8 @@ namespace HappyHeart
*/
const
Unknown
&
GetUnknown
(
std
::
size_t
index
=
0
)
const
;
private:
//! Unknown/numbering subset list.
...
...
Sources/FiniteElement/Operators/Crtp/UnknownAndNumberingSubsetList.hxx
View file @
971606fa
...
...
@@ -51,6 +51,27 @@ namespace HappyHeart
}
template
<
class
DerivedT
>
Unknown
::
vector_const_shared_ptr
UnknownAndNumberingSubsetList
<
DerivedT
>
::
GetUnknownList
(
const
NumberingSubset
&
numbering_subset
)
const
{
const
auto
&
list
=
GetUnknownAndNumberingSubsetList
();
Unknown
::
vector_const_shared_ptr
ret
;
for
(
const
auto
&
item_ptr
:
list
)
{
assert
(
!
(
!
item_ptr
));
const
auto
&
item
=
*
item_ptr
;
if
(
item
.
GetNumberingSubset
()
==
numbering_subset
)
ret
.
push_back
(
item
.
GetUnknownPtr
());
}
return
ret
;
}
}
//namespace Crtp
...
...
Sources/FiniteElement/Operators/GlobalVariationalOperator/Private/Impl/Recursivity.hxx
View file @
971606fa
...
...
@@ -77,9 +77,9 @@ namespace HappyHeart
template
<
class
LocalVariationalOperatorT
>
void
Recursivity
<
LinearAlgebraTupleT
,
I
,
TupleSizeT
>
::
InjectInGlobalLinearAlgebraImpl
(
const
LocalFEltSpace
&
local_felt_space
,
LocalVariationalOperatorT
&
local_variational_operator
,
const
GlobalMatrixWithCoefficient
&
global_matrix_with_coefficient
,
const
double
previous_coefficient
)
LocalVariationalOperatorT
&
local_variational_operator
,
const
GlobalMatrixWithCoefficient
&
global_matrix_with_coefficient
,
const
double
previous_coefficient
)
{
auto
&
global_matrix
=
global_matrix_with_coefficient
.
first
;
...
...
@@ -100,14 +100,12 @@ namespace HappyHeart
if
(
!
Utilities
::
AreEqual
(
factor
,
1.
))
local_matrix
*=
factor
;
const
auto
&
unknown_and_numbering_subset_list
=
local_variational_operator
.
GetUnknownAndNumberingSubsetList
();
decltype
(
auto
)
row_unknown_list
=
local_variational_operator
.
GetUnknownList
(
row_numbering_subset
);
decltype
(
auto
)
row_local_2_global
=
local_felt_space
.
ComputeLocal2Global
<
MpiScale
::
program_wise
>
(
unknown_and_numbering_subset_list
,
row_numbering_subset
);
local_felt_space
.
ComputeLocal2Global
<
MpiScale
::
program_wise
>
(
row_unknown_list
);
assert
(
static_cast
<
int
>
(
row_local_2_global
.
size
())
==
local_matrix
.
GetM
());
...
...
@@ -123,9 +121,10 @@ namespace HappyHeart
}
else
{
decltype
(
auto
)
col_unknown_list
=
local_variational_operator
.
GetUnknownList
(
col_numbering_subset
);
decltype
(
auto
)
col_local_2_global
=
local_felt_space
.
ComputeLocal2Global
<
MpiScale
::
program_wise
>
(
unknown_and_numbering_subset_list
,
col_numbering_subset
);
local_felt_space
.
ComputeLocal2Global
<
MpiScale
::
program_wise
>
(
col_unknown_list
);
assert
(
static_cast
<
int
>
(
col_local_2_global
.
size
())
==
local_matrix
.
GetN
());
...
...
@@ -223,9 +222,9 @@ namespace HappyHeart
template
<
class
LocalVariationalOperatorT
>
void
Recursivity
<
LinearAlgebraTupleT
,
I
,
TupleSizeT
>
::
InjectInGlobalLinearAlgebraImpl
(
const
LocalFEltSpace
&
local_felt_space
,
LocalVariationalOperatorT
&
local_variational_operator
,
const
GlobalVectorWithCoefficient
&
global_vector_with_coefficient
,
const
double
previous_coefficient
)
LocalVariationalOperatorT
&
local_variational_operator
,
const
GlobalVectorWithCoefficient
&
global_vector_with_coefficient
,
const
double
previous_coefficient
)
{
auto
&
global_vector
=
global_vector_with_coefficient
.
first
;
...
...
@@ -245,12 +244,10 @@ namespace HappyHeart
const
auto
&
numbering_subset
=
global_vector
.
GetNumberingSubset
();
const
auto
&
unknown_and_numbering_subset_list
=
local_variational_operator
.
GetUnknownAndNumberingSubsetList
();
decltype
(
auto
)
unknown_list
=
local_variational_operator
.
GetUnknownList
(
numbering_subset
);
decltype
(
auto
)
local_2_global
=
local_felt_space
.
ComputeLocal2Global
<
MpiScale
::
program_wise
>
(
unknown_and_numbering_subset_list
,
numbering_subset
);
local_felt_space
.
ComputeLocal2Global
<
MpiScale
::
program_wise
>
(
unknown_list
);
assert
(
static_cast
<
int
>
(
local_2_global
.
size
())
==
local_vector
.
GetSize
());
...
...
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