Commit ee5f91f9 authored by webmanue's avatar webmanue
Browse files

Merge branch '98-update-reference-platform-to-ubuntu-jammy' into 'master'

Resolve "Update reference platform to Ubuntu Jammy"

Closes #98

See merge request mechanics-and-materials/ae108!87
parents 0b3a29ac b294a3c9
Pipeline #137226 passed with stages
in 7 minutes and 47 seconds
......@@ -80,7 +80,7 @@ check-license-header:
image: $CI_REGISTRY_IMAGE/dev-real:$CI_COMMIT_REF_SLUG
script:
- >
! grep \
grep \
--recursive \
--exclude-dir='.git' \
--exclude='*.json' \
......
......@@ -56,9 +56,9 @@ The project uses [CMake](https://cmake.org) as its build system generator. The f
- [Google Test](https://github.com/google/googletest): version 1.8.1
- [HDF5](https://www.hdfgroup.org/solutions/hdf5/): version 1.10
- [MPI](https://cmake.org/cmake/help/latest/module/FindMPI.html): version 3.1
- [PETSc](https://www.mcs.anl.gov/petsc/): version 3.12
- [Range-v3](https://github.com/ericniebler/range-v3): version 0.10
- [SLEPc](https://slepc.upv.es/): version 3.12
- [PETSc](https://www.mcs.anl.gov/petsc/): version 3.15
- [Range-v3](https://github.com/ericniebler/range-v3): version 0.11
- [SLEPc](https://slepc.upv.es/): version 3.15
Of course, these libraries are covered by their own license terms. Since PETSc and SLEPc do not provide a CMake configuration file, these libraries are found using the provided find modules in ```cmake/modules/```, which in turn are based on ```pkg-config```.
......
......@@ -66,7 +66,7 @@ public:
/**
* @param args Are used to construct the plugins.
*/
template <class... Args> explicit Assembler(Args &&... args);
template <class... Args> explicit Assembler(Args &&...args);
using ElementView = typename cpppetsc::LocalElementView<mesh_type>;
......@@ -82,7 +82,7 @@ public:
* constructor.
*/
template <class... Args>
void emplaceElement(ElementView view, Args &&... constructorArguments);
void emplaceElement(ElementView view, Args &&...constructorArguments);
/**
* @brief Returns a range of iterators pointing to a struct with two methods:
......@@ -191,13 +191,13 @@ namespace assembly {
template <class Element, class Plugins, class Policy>
template <class... Args>
Assembler<Element, Plugins, Policy>::Assembler(Args &&... args)
Assembler<Element, Plugins, Policy>::Assembler(Args &&...args)
: PluginBase(std::forward<Args>(args)...) {}
template <class Element, class Plugins, class Policy>
template <class... Args>
void Assembler<Element, Plugins, Policy>::emplaceElement(
ElementView view, Args &&... constructorArguments) {
ElementView view, Args &&...constructorArguments) {
_elements.emplace_back(std::move(view),
std::forward<Args>(constructorArguments)...);
}
......@@ -220,7 +220,7 @@ public:
* @param args Are used to construct in-place the element instance.
*/
template <class... Args>
explicit AnnotatedElement(ElementView view, Args &&... args)
explicit AnnotatedElement(ElementView view, Args &&...args)
: _meshView(std::move(view)), _instance(std::forward<Args>(args)...) {}
const ElementView &meshView() const { return _meshView; }
......
......@@ -38,7 +38,7 @@ class AssemblerGroup : public DerivePluginsUniquely<
typename ConcatenatePlugins<typename PluginTypeTrait<
SingleElementAssemblers>::type...>::type> {
public:
template <class... Args> explicit AssemblerGroup(Args &&... args);
template <class... Args> explicit AssemblerGroup(Args &&...args);
/**
* @brief Get the Nth member assembler.
......@@ -158,7 +158,7 @@ namespace assembly {
template <class... SingleElementAssemblers>
template <class... Args>
AssemblerGroup<SingleElementAssemblers...>::AssemblerGroup(Args &&... args)
AssemblerGroup<SingleElementAssemblers...>::AssemblerGroup(Args &&...args)
: _assemblers(std::forward<Args>(args)...) {}
} // namespace assembly
......
......@@ -21,7 +21,7 @@
#include <utility>
#define DEFINE_ASSEMBLER_METHOD_BASE(PluginName, methodName, cvQualifiers) \
template <class... Args> void methodName(Args &&... args) cvQualifiers { \
template <class... Args> void methodName(Args &&...args) cvQualifiers { \
if constexpr (!::ae108::assembly::IsGroupTypeTrait< \
typename PluginName::assembler_type>::value) { \
execute(std::forward<Args>(args)...); \
......@@ -33,7 +33,7 @@
} \
}; \
std::apply( \
[&](auto &... as) { (..., std::invoke(conditionalCall, as)); }, \
[&](auto &...as) { (..., std::invoke(conditionalCall, as)); }, \
this->assembler().assemblers()); \
} \
}
......
......@@ -20,9 +20,9 @@ find_dependency(Boost 1.67 COMPONENTS program_options REQUIRED)
find_dependency(Eigen3 3.3 CONFIG REQUIRED)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
find_dependency(AE108_PETSc MODULE 3.12)
find_dependency(AE108_PETSc MODULE 3.15)
find_dependency(range-v3 0.10.0 CONFIG REQUIRED)
find_dependency(range-v3 0.11.0 CONFIG REQUIRED)
foreach(AE108_LIBRARY elements cpppetsc cppslepc assembly solve cmdline)
include("${CMAKE_CURRENT_LIST_DIR}/ae108-${AE108_LIBRARY}-export.cmake")
......
......@@ -47,4 +47,4 @@ endif()
find_package_handle_standard_args(AE108_GTest
REQUIRED_VARS GTest_FOUND
)
\ No newline at end of file
)
......@@ -14,8 +14,8 @@
# limitations under the License.
include(FindPkgConfig)
pkg_check_modules(SLEPc SLEPc IMPORTED_TARGET)
find_package(AE108_PETSc 1.12 MODULE)
pkg_check_modules(SLEPc slepc IMPORTED_TARGET)
find_package(AE108_PETSc 3.15 MODULE)
find_package_handle_standard_args(AE108_SLEPc
REQUIRED_VARS SLEPc_FOUND AE108_PETSc_FOUND
......@@ -28,4 +28,4 @@ if(AE108_SLEPc_FOUND AND NOT TARGET ae108::external::slepc)
INTERFACE PkgConfig::SLEPc
INTERFACE ae108::external::petsc
)
endif()
\ No newline at end of file
endif()
......@@ -75,8 +75,8 @@ target_include_directories(${PROJECT_NAME}-cpppetsc PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
find_package(AE108_PETSc 3.12 MODULE REQUIRED)
find_package(range-v3 0.10.0 CONFIG REQUIRED)
find_package(AE108_PETSc 3.15 MODULE REQUIRED)
find_package(range-v3 0.11.0 CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME}-cpppetsc
PUBLIC ${PROJECT_NAME}::external::petsc
PUBLIC range-v3::range-v3
......
......@@ -37,10 +37,6 @@ template <> PetscErrorCode callDestructor(Vec *const ptr) noexcept {
return VecDestroy(ptr);
}
template <> PetscErrorCode callDestructor(VecScatter *const ptr) noexcept {
return VecScatterDestroy(ptr);
}
template <> PetscErrorCode callDestructor(PetscSF *const ptr) noexcept {
return PetscSFDestroy(ptr);
}
......
......@@ -313,6 +313,9 @@ Mesh<Policy> Mesh<Policy>::fromConnectivity(const size_type dimension,
// calculate the strata
Policy::handleError(DMPlexStratify(mesh._mesh.get()));
// set unknown cell type
Policy::handleError(DMCreateLabel(mesh._mesh.get(), "celltype"));
distributeMesh(&mesh);
mesh.setSection(mesh.createSection(dofPerVertex, dofPerElement));
......
......@@ -33,21 +33,22 @@ public:
/**
* @brief Constructs the contained value with the given arguments.
*/
template <class... Args> explicit constexpr TaggedEntity(Args &&... args);
template <class... Args> explicit constexpr TaggedEntity(Args &&...args);
/**
* @brief Calls operator() of the contained value.
*/
template <class... Args>
auto operator()(Args &&... args)
auto operator()(Args &&...args)
-> decltype(std::declval<value_type>()(std::forward<Args>(args)...));
/**
* @brief Calls operator() of the contained value.
*/
template <class... Args>
constexpr auto operator()(Args &&... args) const -> decltype(
std::declval<const value_type>()(std::forward<Args>(args)...));
constexpr auto operator()(Args &&...args) const
-> decltype(std::declval<const value_type>()(
std::forward<Args>(args)...));
/**
* @brief Returns a const reference to the contained value.
......@@ -100,12 +101,12 @@ namespace cpppetsc {
template <class Entity, class Tag>
template <class... Args>
constexpr TaggedEntity<Entity, Tag>::TaggedEntity(Args &&... args)
constexpr TaggedEntity<Entity, Tag>::TaggedEntity(Args &&...args)
: _value(std::forward<Args>(args)...) {}
template <class Entity, class Tag>
template <class... Args>
auto TaggedEntity<Entity, Tag>::operator()(Args &&... args)
auto TaggedEntity<Entity, Tag>::operator()(Args &&...args)
-> decltype(std::declval<typename TaggedEntity<Entity, Tag>::value_type>()(
std::forward<Args>(args)...)) {
return _value(std::forward<Args>(args)...);
......@@ -113,10 +114,10 @@ auto TaggedEntity<Entity, Tag>::operator()(Args &&... args)
template <class Entity, class Tag>
template <class... Args>
constexpr auto TaggedEntity<Entity, Tag>::operator()(Args &&... args) const
-> decltype(
std::declval<const typename TaggedEntity<Entity, Tag>::value_type>()(
std::forward<Args>(args)...)) {
constexpr auto TaggedEntity<Entity, Tag>::operator()(Args &&...args) const
-> decltype(std::declval<
const typename TaggedEntity<Entity, Tag>::value_type>()(
std::forward<Args>(args)...)) {
return _value(std::forward<Args>(args)...);
}
......
......@@ -16,6 +16,7 @@
#include "ae108/cpppetsc/ParallelComputePolicy.h"
#include "ae108/cpppetsc/SequentialComputePolicy.h"
#include "ae108/cpppetsc/Vector.h"
#include "ae108/cpppetsc/createTransformInput.h"
#include "ae108/cpppetsc/multiply.h"
#include "ae108/cpppetsc/nestMatrices.h"
#include "ae108/cppptest/Matchers.h"
......@@ -100,7 +101,6 @@ TYPED_TEST(nestMatrices_Test, throws_if_inconsistent_rows) {
TYPED_TEST(nestMatrices_Test, result_has_correct_first_column) {
using matrix_type = typename TestFixture::matrix_type;
using vector_type = typename TestFixture::vector_type;
auto u = matrix_type::fromList({
{1.},
......@@ -120,8 +120,9 @@ TYPED_TEST(nestMatrices_Test, result_has_correct_first_column) {
{&w, &x},
});
const auto entry = multiply(
nested, distributed<vector_type>(vector_type::fromList({1., 0.})));
auto in = createTransformInput(nested);
in.unwrap().replace()(0) = 1.;
const auto entry = multiply(nested, in);
EXPECT_THAT(entry.unwrap(), ScalarEqIfLocal(0, 1.));
EXPECT_THAT(entry.unwrap(), ScalarEqIfLocal(1, 3.));
......@@ -129,7 +130,6 @@ TYPED_TEST(nestMatrices_Test, result_has_correct_first_column) {
TYPED_TEST(nestMatrices_Test, result_has_correct_second_column) {
using matrix_type = typename TestFixture::matrix_type;
using vector_type = typename TestFixture::vector_type;
auto u = matrix_type::fromList({
{1.},
......@@ -149,8 +149,9 @@ TYPED_TEST(nestMatrices_Test, result_has_correct_second_column) {
{&w, &x},
});
const auto entry = multiply(
nested, distributed<vector_type>(vector_type::fromList({1., 0.})));
auto in = createTransformInput(nested);
in.unwrap().replace()(1) = 1.;
const auto entry = multiply(nested, in);
EXPECT_THAT(entry.unwrap(), ScalarEqIfLocal(2, 1.));
EXPECT_THAT(entry.unwrap(), ScalarEqIfLocal(4, 3.));
......
......@@ -29,7 +29,7 @@ target_compile_features(${PROJECT_NAME}-cppslepc
PUBLIC cxx_std_17
)
find_package(AE108_SLEPc 1.12 MODULE REQUIRED)
find_package(AE108_SLEPc 3.15 MODULE REQUIRED)
target_link_libraries(${PROJECT_NAME}-cppslepc
PUBLIC ${PROJECT_NAME}::external::slepc
PUBLIC ${PROJECT_NAME}::cpppetsc
......
......@@ -75,6 +75,7 @@ computeGeneralizedEigenvalues(
} // namespace cppslepc
} // namespace ae108
#include <range/v3/range/conversion.hpp>
#include <range/v3/view/iota.hpp>
#include <range/v3/view/transform.hpp>
#include <slepceps.h>
......@@ -118,9 +119,8 @@ solve(const LinearEigenvalueProblemSolver<Policy> &solver) {
#ifdef AE108_PETSC_COMPLEX
eigenvalue.first
#else
std::complex<typename solver_type::real_type> {
eigenvalue.first, eigenvalue.second
}
std::complex<typename solver_type::real_type>{eigenvalue.first,
eigenvalue.second}
#endif
;
}) |
......
......@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
ARG BASE_IMAGE=ubuntu:focal
ARG BASE_IMAGE=ubuntu:jammy
FROM $BASE_IMAGE
ARG PETSC_SCALAR_TYPE=real
......@@ -33,20 +33,21 @@ RUN apt-get update && \
libxrender1 \
ninja-build \
python3 python3-pip \
python3-h5py \
python3-scipy \
gdb
RUN pip3 install \
mypy==0.790 \
mypy==0.931 \
black==22.3.0 \
pylint==2.6.0 \
pylint==2.12.2 \
sympy==1.7.1 \
vtk==9.1.0 \
gcovr==5.0
gcovr==5.0 \
h5py==3.6.0
RUN pip3 install vtk --extra-index-url https://gitlab.kitware.com/api/v4/projects/13/packages/pypi/simple
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" \
apt-get install -y \
libpetsc-${PETSC_SCALAR_TYPE}-dev \
libslepc-${PETSC_SCALAR_TYPE}3.12-dev
libslepc-${PETSC_SCALAR_TYPE}3.15-dev
\ No newline at end of file
......@@ -679,7 +679,7 @@ struct IntegrateTrait<Quadrature<Type_, Dimension_, Order_>> {
template <class Quadrature, class R, class F, class... Args>
typename std::decay<R>::type
operator()(F &&f, R &&init,
const typename Quadrature::template Collection<Args> &... args)
const typename Quadrature::template Collection<Args> &...args)
const noexcept {
return eval(std::forward<F>(f), std::forward<R>(init),
typename Quadrature::size_type{0},
......
......@@ -30,7 +30,7 @@ namespace quadrature {
template <class Quadrature, class R, class F, class... Args>
constexpr typename std::decay<R>::type
integrate(F &&f, R &&init,
const typename Quadrature::template Collection<Args> &... args) {
const typename Quadrature::template Collection<Args> &...args) {
return IntegrateTrait<Quadrature>().template operator()<Quadrature>(
std::forward<F>(f), std::forward<R>(init), args...);
}
......
......@@ -133,7 +133,7 @@ def to_initializer_list(values: Any) -> str:
if isinstance(values, (list, tuple)):
result = ", ".join([to_initializer_list(element) for element in values])
return "{{" + result + (", " if result.endswith("}") else "") + "}}"
return "{:+.16f}".format(float(values))
return f"{float(values):+.16f}"
def quadrature_definition(order: int, dimension: int) -> str:
......@@ -149,14 +149,9 @@ def quadrature_definition(order: int, dimension: int) -> str:
weights = compute_gaussian_weights_in_dimension(order, dimension)
return (
"AE108_ELEMENTS_QUADRATURE_DEFINE("
"QuadratureType::Cube, {}, {}, {}, {{{}, {}}}"
");".format(
dimension,
2 * order - 1,
len(nodes),
to_initializer_list(nodes),
to_initializer_list(weights),
)
f"QuadratureType::Cube, {dimension}, {2 * order - 1}, {len(nodes)}, "
f"{{{to_initializer_list(nodes)}, {to_initializer_list(weights)}}}"
");"
)
......
{
"executable": [
"examples",
"ae108-examples-GeneralizedNonlinearSolver"
],
"compare_stdout": "numeric",
"mpi_processes": [
1,
3
]
"executable": [
"examples",
"ae108-examples-GeneralizedNonlinearSolver"
],
"args": [
"-ksp_type",
"fgmres"
],
"compare_stdout": "numeric",
"mpi_processes": [
1,
3
]
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment