Liebe Gitlab-Nutzer, lieber Gitlab-Nutzer, es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Ein Anmelden über dieses erzeugt ein neues Konto. Das alte Konto ist über den Reiter "Standard" erreichbar. Die Administratoren

Dear Gitlab user, it is now possible to log in to our service using the ZIH login/LDAP. Logging in via this will create a new account. The old account can be accessed via the "Standard" tab. The administrators

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

some minor error corrected in master

parent 083a5c96
......@@ -2,7 +2,7 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0)
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(AMDiS)
if (USE_NEW_CMAKE AND ${CMAKE_VERSION} VERSION_GREATER "3.0")
if (USE_NEW_CMAKE AND ${CMAKE_VERSION} VERSION_GREATER "3.2")
# Experimental implementation of new CMakeLists.txt
# Can be selected by calling cmake -DUSE_NEW_CMAKE=ON .
# Use only if you know what you are doing :-)
......
......@@ -5,7 +5,7 @@
* Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
* Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
*
* Authors:
* Authors:
* Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
......@@ -15,7 +15,7 @@
* This file is part of AMDiS
*
* See also license.opensource.txt in the distribution.
*
*
******************************************************************************/
......@@ -31,21 +31,22 @@
#include "traits/category.hpp"
#include "traits/at.hpp"
#include "traits/resize.hpp"
#include <boost/static_assert.hpp>
#include <boost/mpl/bool.hpp>
namespace AMDiS
namespace AMDiS
{
struct _unknown {};
namespace expressions
namespace expressions
{
/// Expressions that extracts the values of a DOFVector at QPs
template<typename Vector, typename Name, typename Enable = void>
struct ValueOf : public LazyOperatorTermBase {};
template<typename T, typename Name>
struct ValueOf<DOFVector<T>, Name> : public LazyOperatorTermBase
{
......@@ -64,7 +65,7 @@ namespace AMDiS
{
feSpaces.insert(vecDV->getFeSpace());
}
inline int getDegree() const
{
return vecDV->getFeSpace()->getBasisFcts()->getDegree();
......@@ -72,7 +73,7 @@ namespace AMDiS
template<typename OT>
inline void initElement(OT* ot, const ElInfo* elInfo,
SubAssembler* subAssembler, Quadrature *quad,
SubAssembler* subAssembler, Quadrature *quad,
const BasisFunction *basisFct = NULL)
{
if (ot && subAssembler)
......@@ -81,14 +82,14 @@ namespace AMDiS
vecDV->getVecAtQPs(elInfo, quad, NULL, vec);
else if (basisFct) {
const BasisFunction *localBasisFct = vecDV->getFeSpace()->getBasisFcts();
// get coefficients of DOFVector
coeff.change_dim(localBasisFct->getNumber());
vecDV->getLocalVector(elInfo->getElement(), coeff);
// eval basisfunctions of DOFVector at coords of given basisFct
size_t nBasisFct = basisFct->getNumber();
vec.change_dim(nBasisFct);
vec.change_dim(nBasisFct);
for (size_t i = 0; i < nBasisFct; i++)
vec[i] = localBasisFct->evalUh(*basisFct->getCoords(i), coeff);
}
......@@ -97,7 +98,7 @@ namespace AMDiS
template<typename OT>
inline void initElement(OT* ot, const ElInfo* smallElInfo, const ElInfo* largeElInfo,
SubAssembler* subAssembler, Quadrature *quad,
SubAssembler* subAssembler, Quadrature *quad,
const BasisFunction *basisFct = NULL)
{
if (ot && subAssembler)
......@@ -106,29 +107,29 @@ namespace AMDiS
vecDV->getVecAtQPs(smallElInfo, largeElInfo, quad, NULL, vec);
else if (basisFct) {
const BasisFunction *localBasisFct = vecDV->getFeSpace()->getBasisFcts();
// get coefficients of DOFVector
coeff.change_dim(localBasisFct->getNumber());
vecDV->getLocalVector(smallElInfo->getElement(), coeff);
// eval basisfunctions of DOFVector at coords of given basisFct
size_t nBasisFct = basisFct->getNumber();
vec.change_dim(nBasisFct);
vec.change_dim(nBasisFct);
for (size_t i = 0; i < nBasisFct; i++)
vec[i] = localBasisFct->evalUh(*basisFct->getCoords(i), coeff);
}
}
inline value_type operator()(const int& iq) const { return vec[iq]; }
std::string str() const { return std::string("value(") + vecDV->getName() + ")"; }
};
/// Expressions that extracts the matrix-value of a Matrix<DOFVector> at QPs
template<template<class> class Matrix, typename T, typename Name>
struct ValueOf<Matrix<DOFVector<T>*>, Name,
typename enable_if< traits::is_matrix<Matrix<T> > >::type >
struct ValueOf<Matrix<DOFVector<T>*>, Name,
typename enable_if< traits::is_matrix<Matrix<T> > >::type >
: public LazyOperatorTermBase
{
typedef Matrix<T> value_type;
......@@ -138,7 +139,7 @@ namespace AMDiS
mutable mtl::dense_vector<value_type> vec;
mutable Matrix<mtl::dense_vector<T> > coeff;
ValueOf(Matrix<DOFVector<T>*> const& vector) : vecDV(vector)
ValueOf(Matrix<DOFVector<T>*> const& vector) : vecDV(vector)
{
resize(coeff, num_rows(vecDV), num_cols(vecDV));
}
......@@ -150,7 +151,7 @@ namespace AMDiS
for (size_t j = 0; j < num_cols(vecDV); j++)
feSpaces.insert(at(vecDV, i, j)->getFeSpace());
}
inline int getDegree() const
{
return at(vecDV, 0, 0)->getFeSpace()->getBasisFcts()->getDegree();
......@@ -158,7 +159,7 @@ namespace AMDiS
template<typename OT>
inline void initElement(OT* ot, const ElInfo* elInfo,
SubAssembler* subAssembler, Quadrature *quad,
SubAssembler* subAssembler, Quadrature *quad,
const BasisFunction *basisFct = NULL)
{
Matrix<mtl::dense_vector<T> > helper; resize(helper, num_rows(vecDV), num_cols(vecDV));
......@@ -167,17 +168,17 @@ namespace AMDiS
if (ot && subAssembler)
ot->getVectorAtQPs(at(vecDV, i, j), elInfo, subAssembler, quad, at(helper, i, j));
else if (quad)
at(vecDV, i, j)->getVecAtQPs(elInfo, quad, NULL, at(helper, i, j));
at(vecDV, i, j)->getVecAtQPs(elInfo, quad, NULL, at(helper, i, j));
else if (basisFct) {
const BasisFunction *localBasisFct = at(vecDV, i, j)->getFeSpace()->getBasisFcts();
// get coefficients of DOFVector
at(coeff, i, j).change_dim(localBasisFct->getNumber());
at(vecDV, i, j)->getLocalVector(elInfo->getElement(), at(coeff, i, j));
// eval basisfunctions of DOFVector at coords of given basisFct
size_t nBasisFct = basisFct->getNumber();
at(helper, i, j).change_dim(nBasisFct);
at(helper, i, j).change_dim(nBasisFct);
for (size_t k = 0; k < nBasisFct; k++)
at(helper, i, j)[k] = localBasisFct->evalUh(*basisFct->getCoords(k), at(coeff, i, j));
}
......@@ -198,22 +199,22 @@ namespace AMDiS
template<typename OT>
inline void initElement(OT* ot, const ElInfo* smallElInfo, const ElInfo* largeElInfo,
SubAssembler* subAssembler, Quadrature *quad,
SubAssembler* subAssembler, Quadrature *quad,
const BasisFunction *basisFct = NULL)
{
{
initElement(ot, smallElInfo, subAssembler, quad, basisFct);
}
inline value_type operator()(const int& iq) const { return vec[iq]; }
std::string str() const { return std::string("value_(") + at(vecDV, 0, 0)->getName() + ")"; }
};
/// Expressions that extracts the vector-value of a Vector<DOFVector> at QPs
template<template<class> class Vector, typename T, typename Name>
struct ValueOf<Vector<DOFVector<T>*>, Name,
typename boost::enable_if<typename traits::is_vector<Vector<T> >::type>::type >
struct ValueOf<Vector<DOFVector<T>*>, Name,
typename boost::enable_if<typename traits::is_vector<Vector<T> >::type>::type >
: public LazyOperatorTermBase
{
typedef Vector<T> value_type;
......@@ -223,7 +224,7 @@ namespace AMDiS
mutable mtl::dense_vector<value_type> vec;
mutable Vector<mtl::dense_vector<T> > coeff;
ValueOf(Vector<DOFVector<T>*>& vector) : vecDV(vector)
ValueOf(Vector<DOFVector<T>*>& vector) : vecDV(vector)
{
resize(coeff, num_rows(vecDV));
}
......@@ -234,7 +235,7 @@ namespace AMDiS
for (size_t i = 0; i < num_rows(vecDV); i++)
feSpaces.insert(at(vecDV, i)->getFeSpace());
}
inline int getDegree() const
{
return at(vecDV, 0)->getFeSpace()->getBasisFcts()->getDegree();
......@@ -242,7 +243,7 @@ namespace AMDiS
template<typename OT>
inline void initElement(OT* ot, const ElInfo* elInfo,
SubAssembler* subAssembler, Quadrature *quad,
SubAssembler* subAssembler, Quadrature *quad,
const BasisFunction *basisFct = NULL)
{
Vector<mtl::dense_vector<T> > helper; resize(helper, num_rows(vecDV));
......@@ -250,17 +251,17 @@ namespace AMDiS
if (ot && subAssembler)
ot->getVectorAtQPs(at(vecDV, i), elInfo, subAssembler, quad, at(helper, i));
else if (quad)
at(vecDV, i)->getVecAtQPs(elInfo, quad, NULL, at(helper, i));
at(vecDV, i)->getVecAtQPs(elInfo, quad, NULL, at(helper, i));
else if (basisFct) {
const BasisFunction *localBasisFct = at(vecDV, i)->getFeSpace()->getBasisFcts();
// get coefficients of DOFVector
at(coeff, i).change_dim(localBasisFct->getNumber());
at(vecDV, i)->getLocalVector(elInfo->getElement(), at(coeff, i));
// eval basisfunctions of DOFVector at coords of given basisFct
size_t nBasisFct = basisFct->getNumber();
at(helper, i).change_dim(nBasisFct);
at(helper, i).change_dim(nBasisFct);
for (size_t j = 0; j < nBasisFct; j++)
at(helper, i)[j] = localBasisFct->evalUh(*basisFct->getCoords(j), at(coeff, i));
}
......@@ -277,22 +278,22 @@ namespace AMDiS
template<typename OT>
inline void initElement(OT* ot, const ElInfo* smallElInfo, const ElInfo* largeElInfo,
SubAssembler* subAssembler, Quadrature *quad,
SubAssembler* subAssembler, Quadrature *quad,
const BasisFunction *basisFct = NULL)
{
{
initElement(ot, smallElInfo, subAssembler, quad, basisFct);
}
inline value_type operator()(const int& iq) const { return vec[iq]; }
std::string str() const { return std::string("value_(") + at(vecDV, 0)->getName() + ")"; }
};
/// Expression that extracts the component of a vector-values DOFVector at QPs
template<typename Vector>
struct ComponentOf : public LazyOperatorTermBase {};
template<template<class> class Vector, typename T>
struct ComponentOf<DOFVector<Vector<T> > > : public LazyOperatorTermBase
{
......@@ -311,7 +312,7 @@ namespace AMDiS
{
feSpaces.insert(vecDV->getFeSpace());
}
inline int getDegree() const
{
return vecDV->getFeSpace()->getBasisFcts()->getDegree();
......@@ -319,7 +320,7 @@ namespace AMDiS
template<typename OT>
inline void initElement(OT* ot, const ElInfo* elInfo,
SubAssembler* subAssembler, Quadrature *quad,
SubAssembler* subAssembler, Quadrature *quad,
const BasisFunction *basisFct = NULL)
{
if (ot && subAssembler)
......@@ -328,14 +329,14 @@ namespace AMDiS
vecDV->getVecAtQPs(elInfo, quad, NULL, vec);
else if (basisFct) {
const BasisFunction *localBasisFct = vecDV->getFeSpace()->getBasisFcts();
// get coefficients of DOFVector
coeff.change_dim(localBasisFct->getNumber());
vecDV->getLocalVector(elInfo->getElement(), coeff);
// eval basisfunctions of DOFVector at coords of given basisFct
size_t nBasisFct = basisFct->getNumber();
vec.change_dim(nBasisFct);
vec.change_dim(nBasisFct);
for (size_t i = 0; i < nBasisFct; i++)
vec[i] = localBasisFct->evalUh(*basisFct->getCoords(i), coeff);
}
......@@ -344,7 +345,7 @@ namespace AMDiS
template<typename OT>
inline void initElement(OT* ot, const ElInfo* smallElInfo, const ElInfo* largeElInfo,
SubAssembler* subAssembler, Quadrature *quad,
SubAssembler* subAssembler, Quadrature *quad,
const BasisFunction *basisFct = NULL)
{
if (ot && subAssembler)
......@@ -353,21 +354,21 @@ namespace AMDiS
vecDV->getVecAtQPs(smallElInfo, largeElInfo, quad, NULL, vec);
else if (basisFct) {
const BasisFunction *localBasisFct = vecDV->getFeSpace()->getBasisFcts();
// get coefficients of DOFVector
coeff.change_dim(localBasisFct->getNumber());
vecDV->getLocalVector(smallElInfo->getElement(), coeff);
// eval basisfunctions of DOFVector at coords of given basisFct
size_t nBasisFct = basisFct->getNumber();
vec.change_dim(nBasisFct);
vec.change_dim(nBasisFct);
for (size_t i = 0; i < nBasisFct; i++)
vec[i] = localBasisFct->evalUh(*basisFct->getCoords(i), coeff);
}
}
inline value_type operator()(const int& iq) const { return vec[iq][I]; }
std::string str() const { return std::string("comp<") + boost::lexical_cast<std::string>(I) + ">(" + vecDV->getName() + ")"; }
};
......@@ -379,57 +380,57 @@ namespace AMDiS
// with Name
template<typename Name, typename T>
expressions::ValueOf<DOFVector<T>, Name > valueOf(DOFVector<T>& vector)
expressions::ValueOf<DOFVector<T>, Name > valueOf(DOFVector<T>& vector)
{ return expressions::ValueOf<DOFVector<T>, Name >(vector); }
template<typename Name, typename T>
expressions::ValueOf<DOFVector<T>, Name > valueOf(DOFVector<T>* vector)
expressions::ValueOf<DOFVector<T>, Name > valueOf(DOFVector<T>* vector)
{ return expressions::ValueOf<DOFVector<T>, Name >(vector); }
template<typename Name, template<class> class Matrix, typename T>
typename boost::enable_if<typename traits::is_matrix<Matrix<T> >::type,
typename boost::enable_if<typename traits::is_matrix<Matrix<T> >::type,
expressions::ValueOf<Matrix<DOFVector<T>*>, Name > >::type
valueOf(Matrix<DOFVector<T>*> &mat)
valueOf(Matrix<DOFVector<T>*> &mat)
{ return expressions::ValueOf<Matrix<DOFVector<T>*>, Name >(mat); }
template<typename Name, template<class> class Vector, typename T>
typename boost::enable_if<typename traits::is_vector<Vector<T> >::type,
typename boost::enable_if<typename traits::is_vector<Vector<T> >::type,
expressions::ValueOf<Vector<DOFVector<T>*>, Name > >::type
valueOf(Vector<DOFVector<T>*> &vector)
valueOf(Vector<DOFVector<T>*> &vector)
{ return expressions::ValueOf<Vector<DOFVector<T>*>, Name >(vector); }
// without Name
template<typename T>
expressions::ValueOf<DOFVector<T>, _unknown > valueOf(DOFVector<T>& vector)
expressions::ValueOf<DOFVector<T>, _unknown > valueOf(DOFVector<T>& vector)
{ return expressions::ValueOf<DOFVector<T>, _unknown >(vector); }
template<typename T>
expressions::ValueOf<DOFVector<T>, _unknown > valueOf(DOFVector<T>* vector)
expressions::ValueOf<DOFVector<T>, _unknown > valueOf(DOFVector<T>* vector)
{ return expressions::ValueOf<DOFVector<T>, _unknown >(vector); }
template<template<class> class Matrix, typename T>
typename boost::enable_if<typename traits::is_matrix<Matrix<T> >::type,
typename boost::enable_if<typename traits::is_matrix<Matrix<T> >::type,
expressions::ValueOf<Matrix<DOFVector<T>*>, _unknown > >::type
valueOf(Matrix<DOFVector<T>*> &mat)
valueOf(Matrix<DOFVector<T>*> &mat)
{ return expressions::ValueOf<Matrix<DOFVector<T>*>, _unknown >(mat); }
template<template<class> class Vector, typename T>
typename boost::enable_if<typename traits::is_vector<Vector<T> >::type,
typename boost::enable_if<typename traits::is_vector<Vector<T> >::type,
expressions::ValueOf<Vector<DOFVector<T>*>, _unknown > >::type
valueOf(Vector<DOFVector<T>*> &vector)
valueOf(Vector<DOFVector<T>*> &vector)
{ return expressions::ValueOf<Vector<DOFVector<T>*>, _unknown >(vector); }
// component of a DOFVector<Vector>
// ___________________________________________________________________________
template<template<class> class Vector, typename T>
expressions::ComponentOf<DOFVector<Vector<T> > > componentOf(DOFVector<Vector<T> >& vector, int I)
expressions::ComponentOf<DOFVector<Vector<T> > > componentOf(DOFVector<Vector<T> >& vector, int I)
{ return expressions::ComponentOf<DOFVector<Vector<T> > >(vector, I); }
template<template<class> class Vector, typename T>
expressions::ComponentOf<DOFVector<Vector<T> > > componentOf(DOFVector<Vector<T> >* vector, int I)
expressions::ComponentOf<DOFVector<Vector<T> > > componentOf(DOFVector<Vector<T> >* vector, int I)
{ return expressions::ComponentOf<DOFVector<Vector<T> > >(vector, I); }
} // end namespace AMDiS
......
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