// // Software License for AMDiS // // Copyright (c) 2010 Dresden University of Technology // All rights reserved. // Authors: Simon Vey, Thomas Witkowski et al. // // This file is part of AMDiS // // See also license.opensource.txt in the distribution. #include #include "FixVec.h" #include "DOFVector.h" #include "BasisFunction.h" #include "Lagrange.h" namespace AMDiS { /****************************************************************************/ /* Lagrangian basisfunctions of order 0-4; these */ /* functions are evaluated in barycentric coordinates; the derivatives */ /* are those corresponding to these barycentric coordinates. */ /****************************************************************************/ BasisFunction::BasisFunction(std::string name_, int dim_, int degree_) : name(name_), degree(degree_), dim(dim_) { nDOF = new DimVec(dim, DEFAULT_VALUE, -1); dow = Global::getGeo(WORLD); } BasisFunction::~BasisFunction() { delete nDOF; } const WorldMatrix& BasisFunction::evalD2Uh(const DimVec& lambda, const DimVec >& grd_lambda, const ElementVector& uh_loc, WorldMatrix* D2_uh) const { static WorldMatrix D2(DEFAULT_VALUE, 0.0); DimMat D2_b(dim, DEFAULT_VALUE, 0.0); DimMat D2_tmp(dim, DEFAULT_VALUE, 0.0); WorldMatrix *val = D2_uh ? D2_uh : &D2; for (int i = 0; i < nBasFcts; i++) { (*(*d2Phi)[i])(lambda, D2_b); for (int k = 0; k < dim + 1; k++) for (int l = 0; l < dim + 1; l++) D2_tmp[k][l] += uh_loc[i] * D2_b[k][l]; } for (int i = 0; i < dow; i++) for (int j = 0; j < dow; j++) { (*val)[i][j] = 0.0; for (int k = 0; k < dim + 1; k++) for (int l = 0; l < dim + 1; l++) (*val)[i][j] += grd_lambda[k][i] * grd_lambda[l][j] * D2_tmp[k][l]; } return ((*val)); } int BasisFunction::getNumberOfDofs(int i) const { return (*nDOF)[i]; } }