Commit 37dbc358 authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

[cleanup] use ADL for std::swap

parent f0250941
......@@ -4,7 +4,6 @@ set(modules
DumuxDoxygen.cmake
DumuxMacros.cmake
DumuxTestMacros.cmake
FindGstat.cmake
FindValgrind.cmake)
FindGstat.cmake)
include(GNUInstallDirs)
install(FILES ${modules} DESTINATION ${DUNE_INSTALL_MODULEDIR})
#
# Module that checks whether Valgrind's header memcheck.h is present
#
# Variables used by this module which you may want to set:
# VALGRIND_ROOT Path list to search for memcheck.h
#
# Sets the follwing variable:
#
# Valgrind_FOUND True if Valgrind was found
# VALGRIND_INCLUDE_DIR Path to Valgrind's include dirs.
# look for header files, only at positions given by the user
find_path(VALGRIND_INCLUDE_DIR
NAMES "valgrind/memcheck.h"
PATHS ${VALGRIND_ROOT}
PATH_SUFFIXES "include"
NO_DEFAULT_PATH
)
# look for header files, including default paths
find_path(VALGRIND_INCLUDE_DIR
NAMES "valgrind/memcheck.h"
PATH_SUFFIXES "include"
)
# handle package arguments
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
"Valgrind"
DEFAULT_MSG
VALGRIND_INCLUDE_DIR
)
# set HAVE_VALGRIND for config.h
set(HAVE_VALGRIND ${Valgrind_FOUND})
# register all Valgrind related flags
if(Valgrind_FOUND)
dune_register_package_flags(INCLUDE_DIRS "${VALGRIND_INCLUDE_DIR}")
endif()
......@@ -153,7 +153,10 @@ int invertQuadraticPolynomial(SolContainer &sol,
// sort the result
if (sol[0] > sol[1])
std::swap(sol[0], sol[1]);
{
using std::swap;
swap(sol[0], sol[1]);
}
return 2; // two real roots
}
......
......@@ -240,9 +240,10 @@ public:
// make sure that x0 is smaller than x1
if (x0 > x1)
std::swap(x0, x1);
assert(x0 < x1);
{
using std::swap;
swap(x0, x1);
}
// corner case where the whole spline is a constant
if (moment_(0) == 0 &&
......
......@@ -171,7 +171,10 @@ protected:
downstreamIdx_ = face().j;
if (normalVelocity() < 0)
std::swap(upstreamIdx_, downstreamIdx_);
{
using std::swap;
swap(upstreamIdx_, downstreamIdx_);
}
}
public:
......
......@@ -899,7 +899,10 @@ public:
int i = referenceElement.subEntity(scvfIdx, dim-1, 0, dim);
int j = referenceElement.subEntity(scvfIdx, dim-1, 1, dim);
if (numScvf == 4 && (i == 2 || j == 2))
std::swap(i, j);
{
using std::swap;
swap(i, j);
}
scvFace.i = i;
scvFace.j = j;
......
......@@ -519,7 +519,10 @@ public:
assert(phaseIdx == gPhaseIdx);
if (compIIdx != AirIdx)
std::swap(compIIdx, compJIdx);
{
using std::swap;
swap(compIIdx, compJIdx);
}
Scalar result = 0.0;
if(compJIdx == H2OIdx)
......
......@@ -477,7 +477,10 @@ public:
assert(0 <= compJIdx && compJIdx < numComponents);
if (compIIdx > compJIdx)
std::swap(compIIdx, compJIdx);
{
using std::swap;
swap(compIIdx, compJIdx);
}
Scalar temperature = fluidState.temperature(phaseIdx);
Scalar pressure = fluidState.pressure(phaseIdx);
......
......@@ -572,7 +572,10 @@ public:
int compJIdx)
{
if (compIIdx > compJIdx)
std::swap(compIIdx, compJIdx);
{
using std::swap;
swap(compIIdx, compJIdx);
}
#ifndef NDEBUG
if (compIIdx == compJIdx ||
......
......@@ -563,7 +563,10 @@ public:
Valgrind::SetUndefined(undefined);
if (compIIdx > compJIdx)
std::swap(compIIdx, compJIdx);
{
using std::swap;
swap(compIIdx, compJIdx);
}
#ifndef NDEBUG
if (compIIdx == compJIdx ||
......
......@@ -626,7 +626,10 @@ public:
{
if (compIIdx > compJIdx)
std::swap(compIIdx, compJIdx);
{
using std::swap;
swap(compIIdx, compJIdx);
}
#ifndef NDEBUG
if (compIIdx == compJIdx ||
......
......@@ -416,8 +416,8 @@ protected:
if (KmvpNormal_ < 0)
{
std::swap(upstreamIdx_,
downstreamIdx_);
using std::swap;
swap(upstreamIdx_, downstreamIdx_);
}
volumeFlux_ = KmvpNormal_;
......
......@@ -455,7 +455,10 @@ void FV3dPressure2P2CAdaptive<TypeTag>::initializeMatrixRowSize()
// check if relation not already added
IntPair intPair(eIdxGlobalI,additionalIdx2);
if(eIdxGlobalI > additionalIdx2)
std::swap(intPair.first, intPair.second);
{
using std::swap;
swap(intPair.first, intPair.second);
}
range = addionalRelations.equal_range(intPair.first);
for (rangeIt=range.first; range.first!=range.second
and rangeIt!=range.second; ++rangeIt)
......@@ -478,7 +481,10 @@ void FV3dPressure2P2CAdaptive<TypeTag>::initializeMatrixRowSize()
// check if relation not already added
IntPair intPair(eIdxGlobalI,additionalIdx3);
if(eIdxGlobalI > additionalIdx3)
std::swap(intPair.first, intPair.second);
{
using std::swap;
swap(intPair.first, intPair.second);
}
range = addionalRelations.equal_range(intPair.first);
for (rangeIt=range.first; range.first!=range.second
and rangeIt!=range.second; ++rangeIt)
......@@ -516,7 +522,10 @@ void FV3dPressure2P2CAdaptive<TypeTag>::initializeMatrixRowSize()
// check if relation not already added
IntPair intPair(eIdxGlobalJ,additionalIdx2);
if(eIdxGlobalJ > additionalIdx2)
std::swap(intPair.first, intPair.second);
{
using std::swap;
swap(intPair.first, intPair.second);
}
range = addionalRelations.equal_range(intPair.first);
for (rangeIt=range.first; range.first!=range.second
and rangeIt!=range.second; ++rangeIt)
......@@ -539,7 +548,10 @@ void FV3dPressure2P2CAdaptive<TypeTag>::initializeMatrixRowSize()
// check if relation not already added
IntPair intPair(eIdxGlobalJ,additionalIdx3);
if(eIdxGlobalJ > additionalIdx3)
std::swap(intPair.first, intPair.second);
{
using std::swap;
swap(intPair.first, intPair.second);
}
range = addionalRelations.equal_range(intPair.first);
for (rangeIt=range.first; range.first!=range.second
and rangeIt!=range.second; ++rangeIt)
......@@ -2486,7 +2498,8 @@ int FV3dPressure2P2CAdaptive<TypeTag>::transmissibilityAdapter_(const Intersecti
// a) reverse direction
additionalT *= -1;
// b) swap cell I and J
std::swap(additionalT[0], additionalT[1]);
using std::swap;
swap(additionalT[0], additionalT[1]);
}
return caseL;
......
......@@ -149,8 +149,8 @@ public:
if (vDarcyFracture_[phaseIdx] < 0)
{
std::swap(upstreamFractureIdx[phaseIdx],
downstreamFractureIdx[phaseIdx]);
using std::swap;
swap(upstreamFractureIdx[phaseIdx], downstreamFractureIdx[phaseIdx]);
}
}
}
......
......@@ -112,7 +112,7 @@ public:
const FVElementGeometry &fvElemGeom,
int scvIdx) const
{
FieldMatrix permMatrix = 0.0;
FieldMatrix permMatrix(0.0);
// intrinsic permeability
permMatrix[0][0] = 1e-9;
......
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