Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MoReFEM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
47
Issues
47
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MoReFEM
CoreLibrary
MoReFEM
Commits
07a9fac8
Commit
07a9fac8
authored
Jun 24, 2020
by
GILLES Sebastien
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1534
Writing the new MatrixTestOperation test (in progress).
parent
802309ed
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
122 additions
and
20 deletions
+122
-20
Sources/Test/ThirdParty/PETSc/MatrixOperations/Model.cpp
Sources/Test/ThirdParty/PETSc/MatrixOperations/Model.cpp
+9
-5
Sources/Test/ThirdParty/PETSc/MatrixOperations/Model.hpp
Sources/Test/ThirdParty/PETSc/MatrixOperations/Model.hpp
+30
-1
Sources/Test/ThirdParty/PETSc/MatrixOperations/Model.hxx
Sources/Test/ThirdParty/PETSc/MatrixOperations/Model.hxx
+24
-0
Sources/Test/ThirdParty/PETSc/MatrixOperations/main.cpp
Sources/Test/ThirdParty/PETSc/MatrixOperations/main.cpp
+39
-14
Sources/Test/Tools/Fixture/Model.hpp
Sources/Test/Tools/Fixture/Model.hpp
+8
-0
Sources/Test/Tools/Fixture/Model.hxx
Sources/Test/Tools/Fixture/Model.hxx
+12
-0
No files found.
Sources/Test/ThirdParty/PETSc/MatrixOperations/Model.cpp
View file @
07a9fac8
...
...
@@ -31,8 +31,8 @@ namespace MoReFEM::TestNS::PetscNS::MatrixOperationsNS
void
Model
::
SupplInitialize
()
{
decltype
(
auto
)
god_of_dof_manager
=
GodOfDofManager
::
GetInstance
(
__FILE__
,
__LINE__
);
decltype
(
auto
)
god_of_dof
=
god_of_dof_manager
.
GetGodOfDof
(
1
);
decltype
(
auto
)
numbering_subset
=
god_of_dof
.
GetNumberingSubset
(
1
);
decltype
(
auto
)
god_of_dof
=
god_of_dof_manager
.
GetGodOfDof
(
sole
);
decltype
(
auto
)
numbering_subset
=
god_of_dof
.
GetNumberingSubset
(
sole
);
decltype
(
auto
)
mpi
=
god_of_dof
.
GetMpi
();
vector_init_1_
=
std
::
make_unique
<
GlobalVector
>
(
numbering_subset
);
...
...
@@ -47,7 +47,13 @@ namespace MoReFEM::TestNS::PetscNS::MatrixOperationsNS
AllocateGlobalVector
(
god_of_dof
,
vector_init_2
);
AllocateGlobalVector
(
god_of_dof
,
vector_init_3
);
matrix_init_1_
=
std
::
make_unique
<
GlobalMatrix
>
(
numbering_subset
,
numbering_subset
);
for
(
auto
i
=
0ul
;
i
<
Utilities
::
ArraySize
<
decltype
(
initialized_matrix_list_
)
>::
GetValue
();
++
i
)
{
initialized_matrix_list_
[
i
]
=
std
::
make_unique
<
GlobalMatrix
>
(
numbering_subset
,
numbering_subset
);
AllocateGlobalMatrix
(
god_of_dof
,
*
initialized_matrix_list_
[
i
]);
}
matrix_init_2_
=
std
::
make_unique
<
GlobalMatrix
>
(
numbering_subset
,
numbering_subset
);
matrix_init_3_
=
std
::
make_unique
<
GlobalMatrix
>
(
numbering_subset
,
numbering_subset
);
...
...
@@ -59,7 +65,6 @@ namespace MoReFEM::TestNS::PetscNS::MatrixOperationsNS
matrix_9_
=
std
::
make_unique
<
GlobalMatrix
>
(
numbering_subset
,
numbering_subset
);
matrix_10_
=
std
::
make_unique
<
GlobalMatrix
>
(
numbering_subset
,
numbering_subset
);
auto
&
matrix_init_1
=
*
matrix_init_1_
;
auto
&
matrix_init_2
=
*
matrix_init_2_
;
auto
&
matrix_init_3
=
*
matrix_init_3_
;
...
...
@@ -73,7 +78,6 @@ namespace MoReFEM::TestNS::PetscNS::MatrixOperationsNS
auto
&
matrix_10
=
*
matrix_10_
;
// only three matrices allocated, all the others are set to PETSC_NULL
AllocateGlobalMatrix
(
god_of_dof
,
matrix_init_1
);
AllocateGlobalMatrix
(
god_of_dof
,
matrix_init_2
);
AllocateGlobalMatrix
(
god_of_dof
,
matrix_init_3
);
...
...
Sources/Test/ThirdParty/PETSc/MatrixOperations/Model.hpp
View file @
07a9fac8
...
...
@@ -14,6 +14,8 @@
# include <memory>
# include <vector>
# include "Utilities/Containers/Array.hpp"
# include "Core/InputData/Instances/Result.hpp"
# include "Model/Model.hpp"
...
...
@@ -120,6 +122,32 @@ namespace MoReFEM
*/
void
SupplFinalize
();
/*!
* \brief Constant access to a matrix that was fully initialized (i.e. with layout also defined, not just the constructor called).
*
* \tparam I Index of the requested matrix (some tests require several so several are stored). There are static check for the consistency of this
* index.
*
* \return Constant accessor to an initialized matrix.
*/
template
<
std
::
size_t
I
>
const
GlobalMatrix
&
GetInitializedMatrix
()
const
noexcept
;
/*!
* \brief Non-constant access to a matrix that was fully initialized (i.e. with layout also defined, not just the constructor called).
*
* \tparam I Index of the requested matrix (some tests require several so several are stored). There are static check for the consistency of this
* index.
*
* \return Non-constant accessor to an initialized matrix.
*/
template
<
std
::
size_t
I
>
GlobalMatrix
&
GetNonCstInitializedMatrix
()
noexcept
;
//! Get the \a NumberingSubset used in the tests.
const
NumberingSubset
&
GetNumberingSubset
()
const
noexcept
;
private:
...
...
@@ -154,7 +182,8 @@ namespace MoReFEM
///@{
//! Matrix used in the test.
GlobalMatrix
::
unique_ptr
matrix_init_1_
=
nullptr
;
GlobalMatrix
::
array_unique_ptr
<
2
>
initialized_matrix_list_
=
Utilities
::
NullptrArray
<
GlobalMatrix
::
unique_ptr
,
2
>
();
//! Matrix used in the test.
GlobalMatrix
::
unique_ptr
matrix_init_2_
=
nullptr
;
...
...
Sources/Test/ThirdParty/PETSc/MatrixOperations/Model.hxx
View file @
07a9fac8
...
...
@@ -35,6 +35,30 @@ namespace MoReFEM
{
}
template
<
std
::
size_t
I
>
inline
const
GlobalMatrix
&
Model
::
GetInitializedMatrix
()
const
noexcept
{
static_assert
(
I
<
Utilities
::
ArraySize
<
decltype
(
initialized_matrix_list_
)
>::
GetValue
());
assert
(
!
(
!
initialized_matrix_list_
[
I
]));
return
*
initialized_matrix_list_
[
I
];
}
template
<
std
::
size_t
I
>
inline
GlobalMatrix
&
Model
::
GetNonCstInitializedMatrix
()
noexcept
{
return
const_cast
<
GlobalMatrix
&>
(
GetInitializedMatrix
<
I
>
());
}
inline
const
NumberingSubset
&
Model
::
GetNumberingSubset
()
const
noexcept
{
decltype
(
auto
)
god_of_dof_manager
=
GodOfDofManager
::
GetInstance
(
__FILE__
,
__LINE__
);
decltype
(
auto
)
god_of_dof
=
god_of_dof_manager
.
GetGodOfDof
(
sole
);
return
god_of_dof
.
GetNumberingSubset
(
sole
);
}
}
// namespace TestNS::PetscNS::MatrixOperationsNS
...
...
Sources/Test/ThirdParty/PETSc/MatrixOperations/main.cpp
View file @
07a9fac8
...
...
@@ -49,6 +49,7 @@ namespace // anonymous
>
;
}
// namespace anonymous
...
...
@@ -56,29 +57,53 @@ PRAGMA_DIAGNOSTIC(push)
#include "Utilities/Warnings/Internal/IgnoreWarning/disabled-macro-expansion.hpp"
BOOST_FIXTURE_TEST_CASE
(
cre
ation
,
fixture_type
)
BOOST_FIXTURE_TEST_CASE
(
model_initializ
ation
,
fixture_type
)
{
decltype
(
auto
)
model
=
GetModel
();
static_cast
<
void
>
(
model
);
}
/**
{
BOOST_FIXTURE_TEST_CASE
(
create_transpose
,
fixture_type
)
{
decltype
(
auto
)
model
=
GetModel
();
decltype
(
auto
)
numbering_subset
=
model
.
GetNumberingSubset
();
GlobalMatrix
non_allocated_matrix
(
numbering_subset
,
numbering_subset
);
Wrappers
::
Petsc
::
MatCreateTranspose
(
model
.
GetInitializedMatrix
<
0
>
(),
non_allocated_matrix
,
__FILE__
,
__LINE__
);
}
BOOST_FIXTURE_TEST_CASE
(
axpy
,
fixture_type
)
{
decltype
(
auto
)
model
=
GetNonCstModel
();
// First all wrappers that do not use a DoReuseMatrix policy
Wrappers::Petsc::MatCreateTranspose(matrix_init_1,
matrix_4,
__FILE__, __LINE__);
Wrappers
::
Petsc
::
AXPY
<
NonZeroPattern
::
same
>
(
1.
,
model
.
GetInitializedMatrix
<
0
>
(),
model
.
GetNonCstInitializedMatrix
<
1
>
(),
__FILE__
,
__LINE__
);
}
//BOOST_FIXTURE_TEST_CASE(mat_shift, fixture_type)
//{
// decltype(auto) model = GetModel();
//
// Wrappers::Petsc::MatShift(1.,
// model.GetInitializedMatrix<0>(),
// __FILE__, __LINE__);
//}
/*
{
Wrappers::Petsc::AXPY<NonZeroPattern::same>(1.,
matrix_init_1,
matrix_init_2,
__FILE__, __LINE__);
Wrappers::Petsc::MatShift(1.,
matrix_init_1,
__FILE__, __LINE__);
Wrappers::Petsc::MatMult(matrix_init_1,
vector_init_1,
...
...
Sources/Test/Tools/Fixture/Model.hpp
View file @
07a9fac8
...
...
@@ -107,6 +107,14 @@ namespace MoReFEM
*/
static
const
ModelT
&
GetModel
();
/*!
* \brief Static method which yields the model considered for the tests.
*
* \return Non constant reference to the \a Model.
*/
static
ModelT
&
GetNonCstModel
();
/*!
* \brief Static method which yields the \a MoReFEMData considered for the tests.
*
...
...
Sources/Test/Tools/Fixture/Model.hxx
View file @
07a9fac8
...
...
@@ -83,6 +83,18 @@ namespace MoReFEM
}
template
<
class
ModelT
,
class
LuaFileT
,
call_run_method_at_first_call
CallRunMethodT
>
ModelT
&
Model
<
ModelT
,
LuaFileT
,
CallRunMethodT
>::
GetNonCstModel
()
{
return
const_cast
<
ModelT
&>
(
GetModel
());
}
template
<
class
ModelT
,
...
...
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