Skip to content
Snippets Groups Projects
Commit e5d9c860 authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler
Browse files

moved and renamed the local evaluations

parent 9abdf8fb
No related branches found
No related tags found
No related merge requests found
Showing with 267 additions and 133 deletions
......@@ -45,8 +45,9 @@ AC_CONFIG_FILES([
dune/detailed-discretizations/discreteoperator/local/Makefile
dune/detailed-discretizations/discreteoperator/local/codim0/Makefile
dune/detailed-discretizations/evaluation/Makefile
dune/detailed-discretizations/evaluation/binary/Makefile
dune/detailed-discretizations/evaluation/unary/Makefile
dune/detailed-discretizations/evaluation/local/Makefile
dune/detailed-discretizations/evaluation/local/binary/Makefile
dune/detailed-discretizations/evaluation/local/unary/Makefile
dune/detailed-discretizations/mapper/Makefile
dune/detailed-discretizations/mapper/continuous/Makefile
examples/Makefile
......
SUBDIRS = binary unary
SUBDIRS = local
include $(top_srcdir)/am/global-rules
#ifndef DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_BINARY_IPDGFLUXES_HH
#define DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_BINARY_IPDGFLUXES_HH
namespace Dune {
namespace DetailedDiscretizations {
namespace Evaluation {
namespace Binary {
namespace IPDGFluxes {
/**
\brief This represents the operation \f$a\nabla u \nabla v\f$.
\f$a\f$ is a given scalar function (in this case 1) and \f$u\f$ and \f$u\f$ may be local functions, i.e.
ansatz- and testfunctions.
\tparam FunctionSpaceImp
Type of the function space, where \f$f\f$, \f$u\f$ and \f$v\f$ live in.
**/
template <class FunctionSpaceImp>
class JumpMeanPenalty
{
public:
typedef FunctionSpaceImp FunctionSpaceType;
typedef JumpMeanPenalty<FunctionSpaceType> ThisType;
typedef typename FunctionSpaceType::DomainType DomainType;
typedef typename FunctionSpaceType::RangeType RangeType;
typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
typedef Dune::FemTools::Function::Runtime<FunctionSpaceType> InducingFunctionType;
//! constructor, takes the inducing functions expression as a runtime parameter
JumpMeanPenalty(const std::string expression = "[1.0;1.0;1.0]", const int order = 1)
: inducingFunction_(expression)
, order_(std::max(0, order))
{
}
//! copy constructor
JumpMeanPenalty(const ThisType& other)
: inducingFunction_(other.inducingFunction())
, order_(other.order())
{
}
//! returns the inducing function
InducingFunctionType inducingFunction() const
{
return inducingFunction_;
}
unsigned int order() const
{
return order_;
}
template <class LocalAnsatzBaseFunctionSetType, class LocalTestBaseFunctionSetType, class LocalMatrixType>
void evaluate(const LocalAnsatzBaseFunctionSetType& localAnsatzBaseFunctionSet,
const LocalTestBaseFunctionSetType& localTestBaseFunctionSet, const DomainType& localPointEntity,
const DomainType& localPointNeighbour, const DomainType& unitOuterNormal, LocalMatrixType& ret) const
{
// get global point
const DomainType globalPoint = localAnsatzBaseFunctionSet.entity().geometry().global(localPointEntity);
// evaluate first gradient
const unsigned int rows = localAnsatzBaseFunctionSet.size();
std::vector<JacobianRangeType> gradientLocalAnsatzBaseFunctionSet(rows, JacobianRangeType(0.0));
localAnsatzBaseFunctionSet.jacobian(localPointEntity, gradientLocalAnsatzBaseFunctionSet);
// evaluate second gradient
const unsigned int cols = localTestBaseFunctionSet.size();
std::vector<JacobianRangeType> gradientLocalTestBaseFunctionSet(cols, JacobianRangeType(0.0));
localTestBaseFunctionSet.jacobian(localPointNeighbour, gradientLocalTestBaseFunctionSet);
// evaluate inducing function
RangeType functionValue(0.0);
inducingFunction_.evaluate(globalPoint, functionValue);
// do loop over all ansatz and test basefunctions
assert(ret.rows() == rows);
assert(ret.cols() == cols);
for (unsigned int i = 0; i < rows; ++i) {
for (unsigned int j = 0; j < cols; ++j) {
const RangeFieldType gradientProduct =
gradientLocalAnsatzBaseFunctionSet[i][0] * gradientLocalTestBaseFunctionSet[j][0];
ret[i][j] = functionValue * gradientProduct;
}
}
}
private:
//! assignment operator
ThisType& operator=(const ThisType&);
const InducingFunctionType inducingFunction_;
unsigned int order_;
}; // end class JumpMeanPenalty
} // end namespace IPDGFluxes
} // end namespace Binary
} // end namespace Evaluation
} // end namespace DetailedDiscretizations
} // end namespace Dune
#endif // DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_BINARY_IPDGFLUXES_HH
SUBDIRS = binary quaternary unary
include $(top_srcdir)/am/global-rules
#ifndef DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_BINARY_ELLIPTIC_HH
#define DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_BINARY_ELLIPTIC_HH
#ifndef DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_LOCAL_BINARY_ELLIPTIC_HH
#define DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_LOCAL_BINARY_ELLIPTIC_HH
// dune-helper-tools includes
#include <dune/helper-tools/function/runtime.hh>
......@@ -10,6 +10,8 @@ namespace DetailedDiscretizations {
namespace Evaluation {
namespace Local {
namespace Binary {
/**
......@@ -82,9 +84,9 @@ public:
* \return \f$a(x)\nabla u(x) \nabla v(x)\f$
**/
template <class LocalAnsatzBaseFunctionSetType, class LocalTestBaseFunctionSetType, class LocalMatrixType>
void evaluate(const LocalAnsatzBaseFunctionSetType& localAnsatzBaseFunctionSet,
const LocalTestBaseFunctionSetType& localTestBaseFunctionSet, const DomainType& localPoint,
LocalMatrixType& ret) const
void evaluateLocal(const LocalAnsatzBaseFunctionSetType& localAnsatzBaseFunctionSet,
const LocalTestBaseFunctionSetType& localTestBaseFunctionSet, const DomainType& localPoint,
LocalMatrixType& ret) const
{
// get global point
const DomainType globalPoint = localAnsatzBaseFunctionSet.entity().geometry().global(localPoint);
......@@ -113,7 +115,7 @@ public:
ret[i][j] = functionValue * gradientProduct;
}
}
}
} // end method evaluateLocal
private:
//! assignment operator
......@@ -125,10 +127,12 @@ private:
} // end namespace Binary
} // end namespace Local
} // end namespace Evaluation
} // end namespace DetailedDiscretizations
} // end namespace Dune
#endif // DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_BINARY_ELLIPTIC_HH
#endif // DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_LOCAL_BINARY_ELLIPTIC_HH
evaluation_quaternary_includedir = $(includedir)/dune/detailed-discretizations/evaluation/quaternary
evaluation_quaternary_include_HEADERS = ipdgfluxes.hh
include $(top_srcdir)/am/global-rules
#ifndef DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_LOCAL_QUATERNARY_IPDGFLUXES_HH
#define DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_LOCAL_QUATERNARY_IPDGFLUXES_HH
namespace Dune {
namespace DetailedDiscretizations {
namespace Evaluation {
namespace Local {
namespace Quaternary {
template <class FunctionSpaceImp>
class IPDGFluxesInner
{
public:
typedef FunctionSpaceImp FunctionSpaceType;
typedef IPDGFluxesInner<FunctionSpaceType> ThisType;
typedef typename FunctionSpaceType::DomainType DomainType;
typedef typename FunctionSpaceType::RangeType RangeType;
typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
typedef Dune::FemTools::Function::Runtime<FunctionSpaceType> InducingFunctionType;
//! constructor, takes the inducing functions expression as a runtime parameter
IPDGFluxesInner(const std::string expression = "[1.0;1.0;1.0]", const int order = 1)
: inducingFunction_(expression)
, order_(std::max(0, order))
{
}
//! copy constructor
IPDGFluxesInner(const ThisType& other)
: inducingFunction_(other.inducingFunction())
, order_(other.order())
{
}
//! returns the inducing function
InducingFunctionType inducingFunction() const
{
return inducingFunction_;
}
unsigned int order() const
{
return order_;
}
/**
\attention Assumes, that the return matrices are empty, because we do multiple += !
**/
template <class LocalAnsatzBaseFunctionSetEntityType, class LocalAnsatzBaseFunctionSetNeighbourType,
class LocalTestBaseFunctionSetEntityType, class LocalTestBaseFunctionSetNeighbourType,
class IntersectionType, class LocalMatrixType>
void evaluateLocal(const LocalAnsatzBaseFunctionSetEntityType& localAnsatzBaseFunctionSetEntity,
const LocalAnsatzBaseFunctionSetNeighbourType& localAnsatzBaseFunctionSetNeighbour,
const LocalTestBaseFunctionSetEntityType& localTestBaseFunctionSetEntity,
const LocalTestBaseFunctionSetNeighbourType& localTestBaseFunctionSetNeighbour,
const IntersectionType& intersection, const DomainType& localPointEntity,
const DomainType& localPointNeighbour, LocalMatrixType& entityEntityRet,
LocalMatrixType& entityNeighbourRet, LocalMatrixType& neighbourEntityRet,
LocalMatrixType& neighbourNeighbourRet) const
{
// some stuff
const DomainType globalPoint = localAnsatzBaseFunctionSet.entity().geometry().global(localPointEntity);
const DomainType unitOuterNormal = intersection.unitOuterNormal();
// evaluate ansatz entity basefunctionset
const unsigned int rowsEntity = localAnsatzBaseFunctionSetEntity.size();
std::vector<RangeType> localAnsatzBaseFunctionSetEntityEvaluations(rowsEntity, RangeType(0.0));
std::vector<JacobianRangeType> localAnsatzBaseFunctionSetEntityGradients(rowsEntity, JacobianRangeType(0.0));
localAnsatzBaseFunctionSetEntity.evaluate(localPointEntity, localAnsatzBaseFunctionSetEntityEvaluations);
localAnsatzBaseFunctionSetEntity.jacobian(localPointEntity, localAnsatzBaseFunctionSetEntityGradients);
// evaluate ansatz neighbour basefunctionset
const unsigned int rowsNeighbour = localAnsatzBaseFunctionSetNeighbour.size();
std::vector<RangeType> localAnsatzBaseFunctionSetNeighbourEvaluations(rowsNeighbour, RangeType(0.0));
std::vector<JacobianRangeType> localAnsatzBaseFunctionSetNeighbourGradients(rowsNeighbour, JacobianRangeType(0.0));
localAnsatzBaseFunctionSetNeighbour.evaluate(localPointEntity, localAnsatzBaseFunctionSetNeighbourEvaluations);
localAnsatzBaseFunctionSetNeighbour.jacobian(localPointEntity, localAnsatzBaseFunctionSetNeighbourGradients);
// evaluate test entity basefunctionset
const unsigned int colsEntity = localTestBaseFunctionSetEntity.size();
std::vector<RangeType> localTestBaseFunctionSetEntityEvaluations(colsEntity, RangeType(0.0));
std::vector<JacobianRangeType> localTestBaseFunctionSetEntityGradients(colsEntity, JacobianRangeType(0.0));
localTestBaseFunctionSetEntity.evaluate(localPointEntity, localTestBaseFunctionSetEntityEvaluations);
localTestBaseFunctionSetEntity.jacobian(localPointEntity, localTestBaseFunctionSetEntityGradients);
// evaluate test entity basefunctionset
const unsigned int colsNeighbour = localTestBaseFunctionSetNeighbour.size();
std::vector<RangeType> localTestBaseFunctionSetNeighbourEvaluations(colsNeighbour, RangeType(0.0));
std::vector<JacobianRangeType> localTestBaseFunctionSetNeighbourGradients(colsNeighbour, JacobianRangeType(0.0));
localTestBaseFunctionSetNeighbour.evaluate(localPointNeighbour, localTestBaseFunctionSetNeighbourEvaluations);
localTestBaseFunctionSetNeighbour.jacobian(localPointNeighbour, localTestBaseFunctionSetNeighbourGradients);
// evaluate inducing function
RangeType functionValue(0.0);
inducingFunction_.evaluate(globalPoint, functionValue);
// evaluate penalty parameter
const RangeFieldType penaltyParameter = 1.0 / std::pow(intersection.geometry().volume(), 1.0);
// entity entity combinations
// do loop over all ansatz and test basefunctions
assert(entityEntityRet.rows() == rowsEntity);
assert(entityEntityRet.cols() == colsEntity);
for (unsigned int i = 0; i < rowsEntity; ++i) {
for (unsigned int j = 0; j < colsEntity; ++j) {
{
const RangeFieldType gradientTimesNormal = localTestBaseFunctionSetEntityGradients[j][0] * unitOuterNormal;
const RangeType gradientTimesNormalTimesEvaluation =
localAnsatzBaseFunctionSetEntityEvaluations[i] * gradientTimesNormal;
entityEntityRet[i][j] += -0.5 * functionValue * gradientTimesNormalTimesEvaluation;
}
{
const RangeFieldType normalTimesGradient = unitOuterNormal * localAnsatzBaseFunctionSetEntityGradients[i][0];
const RangeType evalautionTimesNormalTimesGradient =
localTestBaseFunctionSetEntityEvaluations[j] * normalTimesGradient;
entityEntityRet[i][j] += -0.5 * functionValue * evalautionTimesNormalTimesGradient;
}
{
const RangeFieldType evalautionTimesEvaluation =
localAnsatzBaseFunctionSetEntityEvaluations[i] * localTestBaseFunctionSetEntityEvaluations[j];
entityEntityRet[i][j] += penaltyParameter * evalautionTimesEvaluation;
}
}
} // done entity entity combinations
// do entity neighbour combinations
assert(entityNeighbourRet.rows() == rowsEntity);
assert(entityNeighbourRet.cols() == colsNeighbour);
for (unsigned int i = 0; i < rowsEntity; ++i) {
for (unsigned int j = 0; j < colsNeighbour; ++j) {
{
const RangeFieldType gradientTimesNormal = localTestBaseFunctionSetNeighbourGradients[j][0] * unitOuterNormal;
const RangeType evaluationTimesGradientTimesNormal =
localAnsatzBaseFunctionSetEntityEvaluations[i] * gradientTimesNormal;
entityNeighbourRet[i][j] += -0.5 * functionValue * evaluationTimesGradientTimesNormal;
}
{
const RangeFieldType normalTimesGradient = unitOuterNormal * localAnsatzBaseFunctionSetEntityGradients[i][0];
const RangeType evaluationTimesNormalTimesGradient =
localTestBaseFunctionSetNeighbourEvaluations[j] * normalTimesGradient;
entityNeighbourRet[i][j] += 0.5 * functionValue * evaluationTimesNormalTimesGradient;
}
{
const RangeFieldType evaluationTimesEvaluation =
localTestBaseFunctionSetNeighbourEvaluations[j] * localAnsatzBaseFunctionSetEntityEvaluations[i];
entityNeighbourRet[i][j] += -1.0 * penaltyParameter * evaluationTimesEvaluation;
}
}
} // done entity neighbour combinations
// do neighbour entity combinations
assert(neighbourEntityRet.rows() == rowsNeighbour);
assert(neighbourEntityRet.cols() == colsEntity);
for (unsigned int i = 0; i < rowsNeighbour; ++i) {
for (unsigned int j = 0; j < colsEntity; ++j) {
{
const RangeFieldType gradientTimesNormal = localTestBaseFunctionSetEntityGradients[j][0] * unitOuterNormal;
const RangeType gradientTimesNormalTimesEvaluation =
localAnsatzBaseFunctionSetNeighbourEvaluations[i] * gradientTimesNormal;
neighbourEntityRet[i][j] += 0.5 * functionValue * gradientTimesNormalTimesEvaluation;
}
{
const RangeFieldType normalTimesGradient =
unitOuterNormal * localAnsatzBaseFunctionSetNeighbourGradients[i][0];
const RangeType evaluationTimesNormalTimesGradient =
localTestBaseFunctionSetEntityEvaluations[j] * normalTimesGradient;
neighbourEntityRet[i][j] += -0.5 * functionValue * evaluationTimesNormalTimesGradient;
}
{
const RangeFieldType evaluationTimesEvalaution =
localTestBaseFunctionSetEntityEvaluations[j] * localAnsatzBaseFunctionSetNeighbourEvaluations[i];
neighbourEntityRet[i][j] += -1.0 * penaltyParameter * evaluationTimesEvalaution;
}
}
} // done neighbour entity combinations
// do neighbour neighbour combinations
assert(neighbourNeighbourRet.rows() == rowsNeighbour);
assert(neighbourNeighbourRet.cols() == colsNeighbour);
for (unsigned int i = 0; i < rowsNeighbour; ++i) {
for (unsigned int j = 0; j < colsNeighbour; ++j) {
{
const RangeFieldType gradientTimesNormal = localTestBaseFunctionSetNeighbourGradients[j][0] * unitOuterNormal;
const RangeType gradientTimesNormalTimesEvalaution =
localAnsatzBaseFunctionSetNeighbourEvaluations[i] * gradientTimesNormal;
neighbourNeighbourRet[i][j] += 0.5 * functionValue * gradientTimesNormalTimesEvalaution;
}
{
const RangeFieldType normalTimesGradient =
unitOuterNormal * localAnsatzBaseFunctionSetNeighbourGradients[i][0];
const RangeType evaluationTimesNormalTimesGradient =
localTestBaseFunctionSetNeighbourEvaluations[j] * normalTimesGradient;
neighbourNeighbourRet[i][j] += 0.5 * functionValue * evaluationTimesNormalTimesGradient;
}
{
const RangeFieldType evaluationTimesEvaluation =
localTestBaseFunctionSetNeighbourEvaluations[j] * localAnsatzBaseFunctionSetNeighbourEvaluations[i];
neighbourNeighbourRet[i][j] += penaltyParameter * evaluationTimesEvaluation;
}
}
} // done neighbour neighbour combinations
} // end method evaluateLocal
private:
//! assignment operator
ThisType& operator=(const ThisType&);
const InducingFunctionType inducingFunction_;
unsigned int order_;
}; // end class IPDGFluxesInner
} // end namespace Quaternary
} // end namespace Local
} // end namespace Evaluation
} // end namespace DetailedDiscretizations
} // end namespace Dune
#endif // DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_LOCAL_QUATERNARY_IPDGFLUXES_HH
#ifndef DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_UNARY_SCALE_HH
#define DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_UNARY_SCALE_HH
#ifndef DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_LOCAL_UNARY_SCALE_HH
#define DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_LOCAL_UNARY_SCALE_HH
// dune-helper-tools includes
#include <dune/helper-tools/function/runtime.hh>
......@@ -10,6 +10,8 @@ namespace DetailedDiscretizations {
namespace Evaluation {
namespace Local {
namespace Unary {
/**
......@@ -74,8 +76,8 @@ public:
\return \f$f(x)v(x)\f$
**/
template <class LocalTestBaseFunctionSetType, class LocalVectorType>
void evaluate(const LocalTestBaseFunctionSetType& localTestBaseFunctionSet, const DomainType& localPoint,
LocalVectorType& ret) const
void evaluateLocal(const LocalTestBaseFunctionSetType& localTestBaseFunctionSet, const DomainType& localPoint,
LocalVectorType& ret) const
{
// get global point
const DomainType globalPoint = localTestBaseFunctionSet.entity().geometry().global(localPoint);
......@@ -94,7 +96,7 @@ public:
for (unsigned int i = 0; i < size; ++i) {
ret[i] = functionValue * valuesLocalBaseFunctionSet[i];
}
}
} // end method evalauteLocal
private:
//! assignment operator
......@@ -106,10 +108,12 @@ private:
} // end namespace Unary
} // end namespace Local
} // end namespace Evaluation
} // end namespace DetailedDiscretizations
} // end namespace Dune
#endif // DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_UNARY_SCALE_HH
#endif // DUNE_DETAILED_DISCRETIZATIONS_EVALUATION_LOCAL_UNARY_SCALE_HH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment