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

use value template instead of ::value

parent de0b3746
......@@ -19,7 +19,7 @@ namespace AMDiS
class PetscVector
{
template <class A>
using AssignMode = std::conditional_t<std::is_same<A,Assigner::plus_assign>::value,
using AssignMode = std::conditional_t<std::is_same_v<A,Assigner::plus_assign>,
std::integral_constant<::InsertMode, ADD_VALUES>,
std::integral_constant<::InsertMode, INSERT_VALUES>>;
......@@ -190,7 +190,7 @@ namespace AMDiS
template <class IndexRange, class LocalValues, class MaskRange, class Assign>
void scatter(IndexRange const& localInd, LocalValues const& localVal, MaskRange const& mask, Assign)
{
static_assert(std::is_same<typename LocalValues::value_type, PetscScalar>::value, "");
static_assert(std::is_same_v<typename LocalValues::value_type, PetscScalar>, "");
assert(initialized_);
assert(localInd.size() == localVal.size());
......@@ -203,7 +203,7 @@ namespace AMDiS
for (; ind_it != std::end(localInd); ++mask_it, ++ind_it)
globalInd.push_back(*mask_it ? dofMap_.global(flatMultiIndex(*ind_it)) : -1);
if (! std::is_same<MaskRange, FakeContainer<bool,true>>::value)
if (!std::is_same_v<MaskRange, FakeContainer<bool,true>>)
VecSetOption(vector_, VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
VecSetValues(vector_, globalInd.size(), globalInd.data(), localVal.data(), AssignMode<Assign>::value);
......
......@@ -54,7 +54,7 @@ namespace AMDiS
static_assert(RN::isLeaf && CN::isLeaf,
"Operator can be applied to Leaf-Nodes only." );
static_assert(std::is_same<FiniteElementType_t<RN>, FiniteElementType_t<CN>>{},
static_assert(std::is_same_v<FiniteElementType_t<RN>, FiniteElementType_t<CN>>,
"Galerkin operator requires equal finite elements for test and trial space." );
using RangeFieldType = typename NodeQuadCache<RN>::Traits::RangeFieldType;
......@@ -200,7 +200,7 @@ namespace AMDiS
template <class T>
static FieldVector<T,dow> makeB(FieldVector<T,1>&& b) { return FieldVector<T,dow>(T(b)); }
template <class T, std::enable_if_t<std::is_arithmetic<T>::value, int> = 0>
template <class T, std::enable_if_t<std::is_arithmetic_v<T>, int> = 0>
static FieldVector<T,dow> makeB(T b) { return FieldVector<T,dow>(b); }
private:
......
......@@ -41,7 +41,7 @@ namespace AMDiS
static_assert(RN::isPower && CN::isPower,
"Operator can be applied to Power-Nodes only.");
const bool sameFE = std::is_same<FiniteElementType_t<RN>, FiniteElementType_t<CN>>::value;
const bool sameFE = std::is_same_v<FiniteElementType_t<RN>, FiniteElementType_t<CN>>;
const bool sameNode = rowNode.treeIndex() == colNode.treeIndex();
auto const& quad = this->getQuadratureRule(contextGeo.type(), rowNode, colNode);
......
......@@ -45,7 +45,7 @@ namespace AMDiS
static_assert(RN::isLeaf && CN::isLeaf,
"Operator can be applied to Leaf-Nodes only.");
const bool sameFE = std::is_same<FiniteElementType_t<RN>, FiniteElementType_t<CN>>::value;
const bool sameFE = std::is_same_v<FiniteElementType_t<RN>, FiniteElementType_t<CN>>;
const bool sameNode = rowNode.treeIndex() == colNode.treeIndex();
using Category = ValueCategory_t<typename GridFct::Range>;
......
......@@ -37,7 +37,7 @@ namespace AMDiS
template <class CG, class RN, class CN, class Mat>
void getElementMatrix(CG const& contextGeo, RN const& rowNode, CN const& colNode, Mat& elementMatrix)
{
const bool sameFE = std::is_same<FiniteElementType_t<RN>, FiniteElementType_t<CN>>::value;
const bool sameFE = std::is_same_v<FiniteElementType_t<RN>, FiniteElementType_t<CN>>;
const bool sameNode = rowNode.treeIndex() == colNode.treeIndex();
auto const& quad = this->getQuadratureRule(contextGeo.type(), rowNode, colNode);
......
......@@ -47,13 +47,13 @@ namespace AMDiS
static_assert( (RN::CHILDREN == CN::CHILDREN), "" );
// theoretically the restriction of the same nr of childs would not be necessary
const bool sameFE = std::is_same<FiniteElementType_t<RN>, FiniteElementType_t<CN>>::value;
const bool sameFE = std::is_same_v<FiniteElementType_t<RN>, FiniteElementType_t<CN>>;
const bool sameNode = rowNode.treeIndex() == colNode.treeIndex();
using Category = ValueCategory_t<expr_value_type>;
auto const& quad = this->getQuadratureRule(contextGeo.type(), rowNode, colNode);
if (sameFE && sameNode && std::is_same<Category,tag::scalar>::value)
if (sameFE && sameNode && std::is_same_v<Category,tag::scalar>)
getElementMatrixOptimized(contextGeo, quad, rowNode, colNode, elementMatrix, Category{});
else
getElementMatrixStandard(contextGeo, quad, rowNode, colNode, elementMatrix, Category{});
......
......@@ -66,7 +66,7 @@ namespace AMDiS
{
using LocalBasis = typename BasisNode::FiniteElement::Traits::LocalBasisType;
static_assert(std::is_same<typename LocalBasis::Traits::DomainFieldType, typename Geometry::ctype>::value,
static_assert(std::is_same_v<typename LocalBasis::Traits::DomainFieldType, typename Geometry::ctype>,
"LocalToGlobalBasisAdapter: LocalBasis must use the same ctype as Geometry");
static_assert(std::size_t(LocalBasis::Traits::dimDomain) == std::size_t(Geometry::mydimension),
......
......@@ -37,7 +37,7 @@ int main()
auto node = localView.tree();
AMDIS_TEST_EQ( polynomialDegree(node), k+1 ); // maximum over all polynomial degrees
static_assert( std::is_same<tag::unknown, FiniteElementType_t<decltype(node)>>::value, "" );
static_assert( std::is_same_v<tag::unknown, FiniteElementType_t<decltype(node)>>, "" );
auto v_node = TypeTree::child(node, _0);
AMDIS_TEST_EQ( polynomialDegree(v_node), k+1 );
......
......@@ -30,7 +30,7 @@ int main(int argc, char** argv)
AMDIS_TEST_EQ(one, 1);
constexpr auto op1a_0 = partial(op1a, index_t<0>{});
AMDIS_TEST((std::is_same<decltype(op1a_0), decltype(op0a)>::value));
AMDIS_TEST((std::is_same_v<decltype(op1a_0), decltype(op0a)>));
constexpr Operation::Id op2;
AMDIS_TEST_EQ(op2(7), 7);
......
......@@ -37,15 +37,15 @@ int main()
auto node = localView.tree();
using NodeRange = Dune::TupleVector<FieldVector<double,2>, FieldVector<double,1>>;
static_assert( std::is_same<NodeRange, RangeType_t<decltype(node)>>::value, "" );
static_assert( std::is_same_v<NodeRange, RangeType_t<decltype(node)>>, "" );
auto v_node = TypeTree::child(node, _0);
using VNodeRange = FieldVector<double,2>;
static_assert( std::is_same<VNodeRange, RangeType_t<decltype(v_node)>>::value, "" );
static_assert( std::is_same_v<VNodeRange, RangeType_t<decltype(v_node)>>, "" );
auto p_node = TypeTree::child(node, _1);
using PNodeRange = FieldVector<double,1>;
static_assert( std::is_same<PNodeRange, RangeType_t<decltype(p_node)>>::value, "" );
static_assert( std::is_same_v<PNodeRange, RangeType_t<decltype(p_node)>>, "" );
}
return report_errors();
......
......@@ -102,7 +102,7 @@ namespace AMDiS
/// Tests whether the value of an expression is approximately equal to an expected value
// implementation for scalars
template <class T1, class T2,
std::enable_if_t<std::is_arithmetic<T1>::value && std::is_arithmetic<T2>::value, int>* = nullptr>
std::enable_if_t<std::is_arithmetic_v<T1> && std::is_arithmetic_v<T2>, int>* = nullptr>
inline void _test_approx(T1 const& expr_value, T2 const& value,
char const* expr_str, char const* value_str, char const* file, size_t line)
{
......
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