Commit ac9e1f4c authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Merge branch 'issue/fix_merge_errors' into 'master'

fix problems after merge

See merge request !259
parents 4e161587 5522fcd3
Pipeline #5700 passed with stage
in 54 minutes and 45 seconds
......@@ -16,7 +16,7 @@ dune-2.7:
- dunecontrol --current make -j2 examples
dune-git-clang:
image: registry.dune-project.org/docker/ci/dune:git-ubuntu-18.04-clang-6-17
image: registry.dune-project.org/docker/ci/dune:git-debian-10-clang-7-libcpp-17
script:
- duneci-standard-test
- dunecontrol --current make -j2 examples
......
## Master (will become release v0.4)
- Restructuring of local operators. Introduce (global) `Operator` class and use type-erasure
for the storage of `LocalOperator`s in the operator list. In the `GridFunctionLocalOperator`
the local-function is passed to the `assemble()` method directly.
- Move recursive algorithms to subdirectoy `amdis/algorithm/`
- Rename `Recursive::Apply` into `Recursive::Map`
## Release v0.3
See release notes on https://gitlab.mn.tu-dresden.de/amdis/amdis-core/-/releases/v0.3
\ No newline at end of file
......@@ -42,7 +42,7 @@ assemble(RowLocalView const& rowLocalView, ColLocalView const& colLocalView,
elementMatrix_ = 0;
auto const& gv = this->rowBasis().gridView();
GlobalContext context{gv, rowLocalView.element(), rowLocalView.element().geometry()};
GlobalContext<TYPEOF(gv)> context{gv, rowLocalView.element(), rowLocalView.element().geometry()};
Traversal::forEachNode(rowLocalView.treeCache(), [&](auto const& rowNode, auto rowTp) {
Traversal::forEachNode(colLocalView.treeCache(), [&](auto const& colNode, auto colTp) {
......
......@@ -58,7 +58,7 @@ namespace AMDiS
};
/// Constructor. Stores pointer to localContext, element, and geometry.
ContextGeometry(LocalContext const& localContext, Element const& element, Geometry const& geometry)
ContextGeometry(LC const& localContext, Element const& element, Geometry const& geometry)
: localContext_(&localContext)
, element_(&element)
, geometry_(&geometry)
......@@ -175,7 +175,7 @@ namespace AMDiS
};
/// Constructor. Stores a copy of gridView and a pointer to element and geometry.
GlobalContext(GridView const& gridView, Element const& element,
GlobalContext(GV const& gridView, Element const& element,
Geometry const& geometry)
: gridView_(gridView)
, element_(&element)
......
......@@ -36,7 +36,7 @@ assemble(LocalView const& localView, LocalOperators& localOperators)
elementVector_ = 0;
auto const& gv = this->basis().gridView();
GlobalContext context{gv, localView.element(), localView.element().geometry()};
GlobalContext<TYPEOF(gv)> context{gv, localView.element(), localView.element().geometry()};
Traversal::forEachNode(localView.treeCache(), [&](auto const& node, auto tp) {
auto& rhsOp = localOperators[tp];
......
......@@ -93,13 +93,13 @@ namespace AMDiS
namespace Recursive
{
template <class T>
struct ForEach<ISTLBlockVector<T>> : ForEach<VectorBase<ISTLBlockVector<T>>> {};
struct ForEach<MTLVector<T>> : ForEach<VectorBase<MTLVector<T>>> {};
template <class T>
struct Transform<ISTLBlockVector<T>> : Transform<VectorBase<ISTLBlockVector<T>>> {};
struct Transform<MTLVector<T>> : Transform<VectorBase<MTLVector<T>>> {};
template <class T>
struct InnerProduct<ISTLBlockVector<T>> : InnerProduct<VectorBase<ISTLBlockVector<T>>> {};
struct InnerProduct<MTLVector<T>> : InnerProduct<VectorBase<MTLVector<T>>> {};
} // end namespace Recursive
} // end namespace AMDiS
......@@ -224,7 +224,7 @@ namespace AMDiS
assert(localGhostedVec != nullptr);
// A pointer to a contiguous array that contains this processor's portion of the vector data.
PetscScalar *ptr;
PetscScalar* ptr;
VecGetArray(localGhostedVec, &ptr);
for (auto const& dof : localInd)
......@@ -250,7 +250,7 @@ namespace AMDiS
void forEachLocal(Func&& f) const
{
// A pointer to a contiguous array that contains this processor's portion of the vector data.
PetscScalar *ptr;
PetscScalar const* ptr;
VecGetArrayRead(vector_, &ptr);
for (size_type i = 0; i < localSize(); ++i)
......@@ -281,7 +281,7 @@ namespace AMDiS
static void transformLocal(PetscVector& vecOut, Operation op, VecIns const&... vecIn)
{
PetscScalar *ptrOut;
std::array<PetscScalar*,sizeof...(VecIns)> ptrsIn{};
std::array<PetscScalar const*,sizeof...(VecIns)> ptrsIn{};
// Obtain ptrs to internal local arrays
VecGetArray(vecOut.vector_, &ptrOut);
......@@ -289,7 +289,7 @@ namespace AMDiS
VecGetArrayRead(std::get<ii>(std::tie(vecIn...)).vector_, &ptrsIn[ii]);
});
for (size_type i = 0; i < localSize(); ++i) {
for (size_type i = 0; i < vecOut.localSize(); ++i) {
auto idx = vecOut.dofMap_.dofToLocal(i);
Ranges::applyIndices<sizeof...(VecIns)>([&](auto... ii) {
ptrOut[idx] = op(ptrsIn[ii][idx]...);
......@@ -306,15 +306,16 @@ namespace AMDiS
/// Perform the `op1(init, op2(value1, value2))` on the local elements of [in1] and [in2]
// [[not collective]]
template <class T, class BinOp1, class BinOp2>
static T innerProductLocal (PetscVector const& in1, PetscVector const& in2, T init, BinOp1 op1, BinOp2 op2)
static T innerProductLocal(PetscVector const& in1, PetscVector const& in2, T init, BinOp1 op1, BinOp2 op2)
{
PetscScalar *ptr1, *ptr2;
PetscScalar const* ptr1;
PetscScalar const* ptr2;
// Obtain ptrs to internal local arrays
VecGetArrayRead(in1.vector_, &ptr1);
VecGetArrayRead(in2.vector_, &ptr2);
for (size_type i = 0; i < localSize(); ++i) {
for (size_type i = 0; i < in1.localSize(); ++i) {
auto idx = in1.dofMap_.dofToLocal(i);
init = op1(std::move(init), op2(ptr1[idx], ptr2[idx]));
}
......@@ -322,6 +323,8 @@ namespace AMDiS
// Restore array obtained with VecGetArrayRead()
VecRestoreArrayRead(in1.vector_, &ptr1);
VecRestoreArrayRead(in2.vector_, &ptr2);
return init;
}
/// Set all entries to \p value, including the ghost entries
......@@ -419,7 +422,7 @@ namespace AMDiS
struct InnerProduct<PetscVector<DofMap>>
{
template <class T, class BinOp1, class BinOp2>
static T impl (PetscVector<DofMap> const& in1, PetscVector<DofMap> const& in2, T init, BinOp1 op1, BinOp2 op2)
static T impl(PetscVector<DofMap> const& in1, PetscVector<DofMap> const& in2, T init, BinOp1 op1, BinOp2 op2)
{
return PetscVector<DofMap>::innerProductLocal(in1, in2, std::move(init), op1, op2);
}
......
# set(DUNE_MAX_TEST_CORES 4)
# additional compiler option for CMAKE_BUILD_TYPE=RelWithDebInfo only for gcc
set(NoVarTrackingAssignments $<$<AND:$<CONFIG:RelWithDebInfo>,$<CXX_COMPILER_ID:GNU>>:-fno-var-tracking-assignments>)
dune_add_test(SOURCES AdaptInfoTest.cpp
LINK_LIBRARIES amdis)
......@@ -10,10 +13,11 @@ foreach(_GRID RANGE 7)
dune_add_test(NAME "BackupRestoreTest_${_GRID}"
SOURCES BackupRestoreTest.cpp
COMPILE_DEFINITIONS "GRID_ID=${_GRID}"
COMPILE_FLAGS "-fno-var-tracking-assignments"
LABELS "BackupRestore"
LINK_LIBRARIES amdis)
add_dune_alberta_flags(GRIDDIM 2 WORLDDIM 2 "BackupRestoreTest_${_GRID}")
target_compile_options(BackupRestoreTest_${_GRID} PRIVATE
${NoVarTrackingAssignments})
endforeach()
unset(_GRID)
......@@ -105,12 +109,13 @@ foreach(_GRID RANGE 6)
dune_add_test(NAME "ParallelIndexSetTest_${_GRID}"
SOURCES ParallelIndexSetTest.cpp
COMPILE_DEFINITIONS "GRID_ID=${_GRID}"
COMPILE_FLAGS "-fno-var-tracking-assignments"
LABELS "ParallelIndexSetTest"
LINK_LIBRARIES amdis
MPI_RANKS 2 3 4
TIMEOUT 300
CMAKE_GUARD MPI_FOUND)
target_compile_options(ParallelIndexSetTest_${_GRID} PRIVATE
${NoVarTrackingAssignments})
endforeach()
unset(_GRID)
endif()
......
......@@ -24,9 +24,9 @@ void test_local_operator(LOp&& lop, LocalView const& localView, MatVec& matVec,
[[maybe_unused]] auto context = [&]{
if constexpr(Dune::Std::is_detected_v<IsOperatorList,LOp>)
return GlobalContext{gridView, element, geometry};
return GlobalContext<TYPEOF(gridView)>{gridView, element, geometry};
else
return ContextGeometry{element, element, geometry};
return ContextGeometry<TYPEOF(element)>{element, element, geometry};
}();
lop.bind(element);
......
Markdown is supported
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