Commit 64021684 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Changes in interface designs.

parent c2460445
......@@ -140,6 +140,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PETSC_DIR = @PETSC_DIR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
......
......@@ -1578,10 +1578,27 @@ linux*)
# before this can be enabled.
hardcode_into_libs=yes
# find out which ABI we are using
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.$ac_objext` in
*64-bit*)
libsuff=64
sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
;;
esac
fi
rm -rf conftest*
;;
esac
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
......@@ -4288,6 +4305,9 @@ CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
# Is the compiler the GNU C compiler?
with_gcc=$_LT_AC_TAGVAR(GCC, $1)
gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\`
gcc_ver=\`gcc -dumpversion\`
# An ERE matcher.
EGREP=$lt_EGREP
......@@ -4421,11 +4441,11 @@ striplib=$lt_striplib
# Dependencies to place before the objects being linked to create a
# shared library.
predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
predep_objects=\`echo $lt_[]_LT_AC_TAGVAR(predep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place after the objects being linked to create a
# shared library.
postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
postdep_objects=\`echo $lt_[]_LT_AC_TAGVAR(postdep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place before the objects being linked to create a
# shared library.
......@@ -4437,7 +4457,7 @@ postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
# The library search path used internally by the compiler when linking
# a shared library.
compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
compiler_lib_search_path=\`echo $lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Method to check whether dependent libraries are shared objects.
deplibs_check_method=$lt_deplibs_check_method
......@@ -4517,7 +4537,7 @@ variables_saved_for_relink="$variables_saved_for_relink"
link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
# Compile-time system search path for libraries
sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
......@@ -6353,6 +6373,7 @@ do
done
done
done
IFS=$as_save_IFS
lt_ac_max=0
lt_ac_count=0
# Add /usr/xpg4/bin/sed as it is typically found on Solaris
......@@ -6385,6 +6406,7 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
done
])
SED=$lt_cv_path_SED
AC_SUBST([SED])
AC_MSG_RESULT([$SED])
])
......
......@@ -423,6 +423,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PETSC_DIR = @PETSC_DIR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
......
......@@ -68,42 +68,34 @@ namespace AMDiS {
return nrm;
}
double
ElementL1Norm_DOF::calcElNorm(ElInfo *elInfo,
const double &det,
const double &fac)
double ElementL1Norm_DOF::calcElNorm(ElInfo *elInfo,
const double &det,
const double &fac)
{
double val = 0.0;
const double *dofAtQPs = dofVec->getVecAtQPs(elInfo,
q,
NULL,
NULL);
mtl::dense_vector<double> dofAtQPs(q->getNumPoints());
dofVec->getVecAtQPs(elInfo, q, NULL, dofAtQPs);
for (int iq = 0; iq < nQPts; ++iq) {
for (int iq = 0; iq < nQPts; ++iq)
val += q->getWeight(iq) * fabs(dofAtQPs[iq]);
}
double nrm = det * val;
return nrm;
return det * val;
}
double
ElementL2Norm_DOF::calcElNorm(ElInfo *elInfo,
const double &det,
const double &fac)
double ElementL2Norm_DOF::calcElNorm(ElInfo *elInfo,
const double &det,
const double &fac)
{
double val = 0.0;
const double *dofAtQPs = dofVec->getVecAtQPs(elInfo,
q,
NULL,
NULL);
mtl::dense_vector<double> dofAtQPs(q->getNumPoints());
dofVec->getVecAtQPs(elInfo, q, NULL, dofAtQPs);
for (int iq = 0; iq < nQPts; ++iq) {
for (int iq = 0; iq < nQPts; ++iq)
val += q->getWeight(iq) * sqr(dofAtQPs[iq]);
}
double nrm = det * val;
return nrm;
return det * val;
}
double
......@@ -131,17 +123,15 @@ namespace AMDiS {
return nrm;
}
double
ElementL2Err::calcElNorm(ElInfo *elInfo,
const double &det,
const double &fac)
double ElementL2Err::calcElNorm(ElInfo *elInfo,
const double &det,
const double &fac)
{
double val = 0.0;
double val_nrm = 0.0;
const double *uhAtQPs = uh->getVecAtQPs(elInfo,
q,
NULL,
NULL);
mtl::dense_vector<double> uhAtQPs(q->getNumPoints());
uh->getVecAtQPs(elInfo, q, NULL, uhAtQPs);
WorldVector<double> worldCoordsAtQP;
for (int iq = 0; iq < nQPts; ++iq) {
......@@ -160,10 +150,10 @@ namespace AMDiS {
return err;
}
double
ElementH1Err::calcElNorm(ElInfo *elInfo,
const double &det,
const double &fac)
double ElementH1Err::calcElNorm(ElInfo *elInfo,
const double &det,
const double &fac)
{
double val = 0.0;
double val_nrm = 0.0;
......
......@@ -36,18 +36,18 @@ void CompositeFEMMethods::setPosLsToFct(DOFVector<double> *dof,
const BasisFunction *basisFcts = dof->getFeSpace()->getBasisFcts();
const DOFAdmin *admin = dof->getFeSpace()->getAdmin();
const int dim = dof->getFeSpace()->getMesh()->getDim();
const double *locVec;
const DegreeOfFreedom *locInd;
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(dof->getFeSpace()->getMesh(), -1,
Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS);
ElementVector locVec(basisFcts->getNumber());
while (elInfo) {
const Element *el = elInfo->getElement();
// Get level set function values for all vertices of element.
locVec = lsFct_dof->getLocalVector(el, NULL);
lsFct_dof->getLocalVector(el, locVec);
// Get dof indices of vertices.
locInd = basisFcts->getLocalIndices(el, admin, NULL);
......
This diff is collapsed.
......@@ -92,7 +92,11 @@ namespace AMDiS {
lastVecEl = lastMatEl = NULL;
if ((el != lastMatEl && el != lastVecEl) || !operat->isOptimized())
initElement(smallElInfo, largeElInfo);
if (smallElInfo == colElInfo)
initElement(smallElInfo);
else
initElement(smallElInfo, largeElInfo);
if (el != lastMatEl || !operat->isOptimized()) {
if (rememberElMat)
......@@ -165,15 +169,18 @@ namespace AMDiS {
smallElInfo->getSubElemCoordsMat(rowFeSpace->getBasisFcts()->getDegree());
if (smallElInfo == colElInfo)
tmpMat = m * mat;
else
tmpMat = mat * trans(m);
tmpMat = m * mat;
else
tmpMat = mat;
// else
// tmpMat = mat * trans(m);
mat = tmpMat;
}
if (rememberElMat && &userMat != &elementMatrix)
userMat += factor * elementMatrix;
userMat += factor * elementMatrix;
}
......@@ -292,9 +299,9 @@ namespace AMDiS {
FUNCNAME("Assembler::matVecAssemble()");
Element *el = elInfo->getElement();
std::vector<double> uhOldLoc(operat->uhOld->getFeSpace() == rowFeSpace ? nRow : nCol);
ElementVector uhOldLoc(operat->uhOld->getFeSpace() == rowFeSpace ? nRow : nCol);
operat->uhOld->getLocalVector(el, &(uhOldLoc[0]));
operat->uhOld->getLocalVector(el, uhOldLoc);
if (el != lastMatEl) {
set_to_zero(elementMatrix);
......@@ -328,9 +335,9 @@ namespace AMDiS {
const BasisFunction *basFcts = rowFeSpace->getBasisFcts();
int nBasFcts = basFcts->getNumber();
std::vector<double> uhOldLoc(nBasFcts);
ElementVector uhOldLoc(nBasFcts);
operat->uhOld->getLocalVector(auxEl, &(uhOldLoc[0]));
operat->uhOld->getLocalVector(auxEl, uhOldLoc);
if (mainEl != lastMatEl) {
set_to_zero(elementMatrix);
......
......@@ -51,7 +51,7 @@ namespace AMDiS {
/****************************************************************************/
double BasisFunction::evalUh(const DimVec<double>& lambda,
const double *uh_loc) const
const ElementVector& uh_loc) const
{
double val = 0.0;
......@@ -63,7 +63,7 @@ namespace AMDiS {
const WorldVector<double>& BasisFunction::evalUh(const DimVec<double>& lambda,
const WorldVector<double> *uh_loc,
const mtl::dense_vector<WorldVector<double> >& uh_loc,
WorldVector<double>* values) const
{
static WorldVector<double> Values(DEFAULT_VALUE, 0.0);
......@@ -84,7 +84,7 @@ namespace AMDiS {
const WorldVector<double>& BasisFunction::evalGrdUh(const DimVec<double>& lambda,
const DimVec<WorldVector<double> >& grd_lambda,
const double *uh_loc,
const ElementVector& uh_loc,
WorldVector<double>* val) const
{
TEST_EXIT_DBG(val)("return value is NULL\n");
......@@ -113,6 +113,7 @@ namespace AMDiS {
return ((*val));
}
const WorldMatrix<double>& BasisFunction::evalD2Uh(const DimVec<double>& lambda,
const DimVec<WorldVector<double> >& grd_lambda,
const double *uh_loc, WorldMatrix<double>* D2_uh) const
......
......@@ -307,7 +307,7 @@ namespace AMDiS {
* Evaluates elements value at barycentric coordinates lambda with local
* coefficient vector uh.
*/
double evalUh(const DimVec<double>& lambda, const double* uh) const;
double evalUh(const DimVec<double>& lambda, const ElementVector& uh) const;
/** \brief
* Evaluates elements value at barycentric coordinates lambda with local
......@@ -316,7 +316,7 @@ namespace AMDiS {
* will be overwritten after the next call.
*/
const WorldVector<double>& evalUh(const DimVec<double>& lambda,
const WorldVector<double>* uh,
const mtl::dense_vector<WorldVector<double> >& uh,
WorldVector<double>* val) const;
/** \brief
......@@ -328,7 +328,8 @@ namespace AMDiS {
*/
const WorldVector<double>& evalGrdUh(const DimVec<double>& lambda,
const DimVec<WorldVector<double> >& Lambda,
const double* uh, WorldVector<double>* val) const;
const ElementVector& uh,
WorldVector<double>* val) const;
/** \brief
* Evaluates the second derivative at barycentric coordinates lambda.
......
......@@ -245,8 +245,10 @@ namespace AMDiS {
std::vector<Operator*>::iterator it = operators.begin();
std::vector<double*>::iterator factorIt = operatorFactor.begin();
for (; it != operators.end(); ++it, ++factorIt)
if ((*it)->getNeedDualTraverse() == false)
if ((*it)->getNeedDualTraverse() == false) {
// MSG("OP NO NEED DT!\n");
(*it)->getElementMatrix(elInfo, elementMatrix, *factorIt ? **factorIt : 1.0);
}
if (factor != 1.0)
elementMatrix *= factor;
......
......@@ -105,7 +105,7 @@ namespace AMDiS {
for (int i = 0; i < nDofs; i++)
bary.push_back(basFcts->getCoords(i));
double *localUh = new double[basFcts->getNumber()];
ElementVector localUh(basFcts->getNumber());
// traverse mesh
std::vector<bool> visited(getUsedSize(), false);
......@@ -135,8 +135,6 @@ namespace AMDiS {
elInfo = stack.traverseNext(elInfo);
}
delete [] localUh;
return result;
}
......@@ -184,7 +182,7 @@ namespace AMDiS {
Mesh::CALL_LEAF_EL | Mesh::FILL_DET |
Mesh::FILL_GRD_LAMBDA | Mesh::FILL_COORDS);
double *localUh = new double[basFcts->getNumber()];
ElementVector localUh(basFcts->getNumber());
while (elInfo) {
double det = elInfo->getDet();
......@@ -202,8 +200,6 @@ namespace AMDiS {
elInfo = stack.traverseNext(elInfo);
}
delete [] localUh;
DOFVector<double>::Iterator volIt(&volume, USED_DOFS);
DOFVector<WorldVector<double> >::Iterator grdIt(result, USED_DOFS);
......@@ -252,8 +248,8 @@ namespace AMDiS {
result = grd;
}
double *localVec = localVectors[myRank];
getLocalVector(elInfo->getElement(), localVec);
const ElementVector& localVec = localVectors[myRank];
getLocalVector(elInfo->getElement(), const_cast<ElementVector&>(localVec));
DimVec<double> &grd1 = *grdTmp[myRank];
int parts = Global::getGeo(PARTS, dim);
......@@ -338,8 +334,8 @@ namespace AMDiS {
result = grd;
}
double *localVec = localVectors[myRank];
getLocalVector(largeElInfo->getElement(), localVec);
const ElementVector& localVec = localVectors[myRank];
getLocalVector(largeElInfo->getElement(), const_cast<ElementVector&>(localVec));
const BasisFunction *basFcts = feSpace->getBasisFcts();
mtl::dense2D<double> &m = smallElInfo->getSubElemCoordsMat(basFcts->getDegree());
......@@ -417,8 +413,8 @@ namespace AMDiS {
result = vec;
}
double *localVec = localVectors[myRank];
getLocalVector(el, localVec);
const ElementVector& localVec = localVectors[myRank];
getLocalVector(el, const_cast<ElementVector&>(localVec));
DimMat<double> D2Tmp(dim, DEFAULT_VALUE, 0.0);
int parts = Global::getGeo(PARTS, dim);
......@@ -491,7 +487,7 @@ namespace AMDiS {
this->set(0.0);
DegreeOfFreedom *myLocalIndices = localIndices[omp_get_thread_num()];
double *sourceLocalCoeffs = new double[nSourceBasisFcts];
ElementVector sourceLocalCoeffs(nSourceBasisFcts);
if (feSpace->getMesh() == sourceFeSpace->getMesh()) {
DimVec<double> *coords = NULL;
......@@ -556,13 +552,12 @@ namespace AMDiS {
dualStack.traverseNext(&elInfo1, &elInfo2, &elInfoSmall, &elInfoLarge);
}
}
delete [] sourceLocalCoeffs;
}
template<>
void DOFVector<WorldVector<double> >::interpol(DOFVector<WorldVector<double> > *v, double factor)
void DOFVector<WorldVector<double> >::interpol(DOFVector<WorldVector<double> > *v,
double factor)
{
WorldVector<double> nul(DEFAULT_VALUE,0.0);
......@@ -582,18 +577,15 @@ namespace AMDiS {
if (feSpace->getMesh() == vFeSpace->getMesh()) {
DegreeOfFreedom *myLocalIndices = localIndices[omp_get_thread_num()];
WorldVector<double> *vLocalCoeffs = new WorldVector<double>[vNumBasFcts];
mtl::dense_vector<WorldVector<double> > vLocalCoeffs(vNumBasFcts);
Mesh *mesh = feSpace->getMesh();
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(mesh, -1,
Mesh::CALL_LEAF_EL |
Mesh::FILL_COORDS);
ElInfo *elInfo =
stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS);
while (elInfo) {
Element *el = elInfo->getElement();
basFcts->getLocalIndices(el, feSpace->getAdmin(), myLocalIndices);
v->getLocalVector(el, vLocalCoeffs);
for (int i = 0; i < numBasFcts; i++) {
......@@ -604,8 +596,6 @@ namespace AMDiS {
}
elInfo = stack.traverseNext(elInfo);
}
delete [] vLocalCoeffs;
} else {
ERROR_EXIT("not yet for dual traverse\n");
}
......@@ -681,10 +671,11 @@ namespace AMDiS {
Flag fillFlag = Mesh::CALL_LEAF_EL | Mesh::FILL_GRD_LAMBDA | Mesh::FILL_COORDS;
ElInfo *elInfo = stack.traverseFirst(mesh, -1, fillFlag);
WorldVector<double> grd;
ElementVector localUh(basFcts->getNumber());
while (elInfo) {
const DegreeOfFreedom **dof = elInfo->getElement()->getDOF();
const double *localUh = getLocalVector(elInfo->getElement(), NULL);
getLocalVector(elInfo->getElement(), localUh);
const DimVec<WorldVector<double> > &grdLambda = elInfo->getGrdLambda();
int localDOFNr = 0;
......@@ -748,14 +739,14 @@ namespace AMDiS {
template<>
const double *DOFVectorBase<double>::getVecAtQPs(const ElInfo *smallElInfo,
const ElInfo *largeElInfo,
const Quadrature *quad,
const FastQuadrature *quadFast,
double *vecAtQPs) const
void DOFVectorBase<double>::getVecAtQPs(const ElInfo *smallElInfo,
const ElInfo *largeElInfo,
const Quadrature *quad,
const FastQuadrature *quadFast,
mtl::dense_vector<double>& vecAtQPs) const
{
FUNCNAME("DOFVector<double>::getVecAtQPs()");
TEST_EXIT_DBG(quad || quadFast)("neither quad nor quadFast defined\n");
if (quad && quadFast)
......@@ -766,42 +757,28 @@ namespace AMDiS {
("invalid basis functions");
if (smallElInfo->getMesh() == feSpace->getMesh())
return getVecAtQPs(smallElInfo, quad, quadFast, vecAtQPs);
return getVecAtQPs(smallElInfo, quad, quadFast, vecAtQPs);
const BasisFunction *basFcts = feSpace->getBasisFcts();
int nPoints =
quadFast ? quadFast->getQuadrature()->getNumPoints() : quad->getNumPoints();
static double *localvec = NULL;
double *result;
if (vecAtQPs) {
result = vecAtQPs;
} else {
if (localvec)
delete [] localvec;
localvec = new double[nPoints];
for (int i = 0; i < nPoints; i++)
localvec[i] = 0.0;
result = localvec;
}
double *localVec = localVectors[omp_get_thread_num()];
getLocalVector(largeElInfo->getElement(), localVec);
vecAtQPs.change_dim(nPoints);
const ElementVector &localVec = localVectors[omp_get_thread_num()];
getLocalVector(largeElInfo->getElement(), const_cast<ElementVector&>(localVec));
mtl::dense2D<double> &m = smallElInfo->getSubElemCoordsMat(basFcts->getDegree());
for (int i = 0; i < nPoints; i++) {
result[i] = 0.0;
vecAtQPs[i] = 0.0;
for (int j = 0; j < nBasFcts; j++) {
double val = 0.0;
for (int k = 0; k < nBasFcts; k++)
val += m[j][k] * (*(basFcts->getPhi(k)))(quad->getLambda(i));
result[i] += localVec[j] * val;
vecAtQPs[i] += val;
}
}
return const_cast<const double*>(result);
}
......@@ -894,28 +871,28 @@ namespace AMDiS {
TEST_EXIT(fct)("No function defined!\n");
int deg = std::max(fct->getDegree(), 2 * vec1.getFeSpace()->getBasisFcts()->getDegree());
int deg = std::max(fct->getDegree(),
2 * vec1.getFeSpace()->getBasisFcts()->getDegree());
Quadrature* quad =
Quadrature::provideQuadrature(vec1.getFeSpace()->getMesh()->getDim(), deg);
FastQuadrature *fastQuad =
FastQuadrature::provideFastQuadrature(vec1.getFeSpace()->getBasisFcts(), *quad, INIT_PHI);
std::vector<double> qp1(fastQuad->getNumPoints());
std::vector<double> qp2(fastQuad->getNumPoints());
mtl::dense_vector<double> qp1(fastQuad->getNumPoints());
mtl::dense_vector<double> qp2(fastQuad->getNumPoints());
double value = 0.0;
Flag traverseFlag = Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS | Mesh::FILL_DET;
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(vec1.getFeSpace()->getMesh(), -1, traverseFlag);
while (elInfo) {
double det = elInfo->getDet();
double tmp = 0.0;
vec1.getVecAtQPs(elInfo, quad, fastQuad, &(qp1[0]));
vec2.getVecAtQPs(elInfo, quad, fastQuad, &(qp2[0]));
vec1.getVecAtQPs(elInfo, quad, fastQuad, qp1);
vec2.getVecAtQPs(elInfo, quad, fastQuad, qp2);
double tmp = 0.0;
for (int iq = 0; iq < fastQuad->getNumPoints(); iq++)
tmp += fastQuad->getWeight(iq) * (*fct)(qp1[iq], qp2[iq]);
value += tmp * det;
tmp += fastQuad->getWeight(iq) * (*fct)(qp1[iq], qp2[iq]);
value += tmp * elInfo->getDet();
elInfo = stack.traverseNext(elInfo);
}
......@@ -932,14 +909,15 @@ namespace AMDiS {
TEST_EXIT(fct)("No function defined!\n");