Beispiel #1
0
ShapeFunction::ShapeFunction(int nsf, const MasterElement &master)
  : sftable(master.ngauss_sets()),
    sfcache(master.ngauss_sets()),
    nfunctions(nsf)
{
  for(int i=0; i<master.ngauss_sets(); i++) {
    sftable[i] = new ShapeFunctionTable(master.ngauss(i), nsf);
    sfcache[i] = new ShapeFunctionCache(master.ngauss(i), nsf);
  }
}
Beispiel #2
0
void ShapeFunction::precompute(const MasterElement &master) {
  // Use the virtual functions that evaluate the shapefunction at
  // arbitrary points to store its values at the Gauss points.

  // loop over integration orders (sets of gauss points)
  for(int ord=0; ord<master.ngauss_sets(); ord++) {

    const GaussPtTable &gptable = master.gptable(ord);

    sftable[ord] = new ShapeFunctionTable(gptable.size(), nfunctions);
    std::vector<DoubleVec> &f_table = sftable[ord]->f_table;
    std::vector<std::vector<DoubleVec> > &df_table =
      sftable[ord]->df_table;

    // loop over gausspoints
    for(std::vector<GaussPtData>::size_type g=0; g<gptable.size(); g++) {
      MasterCoord mpos = gptable[g].position;
      for(ShapeFunctionIndex n=0; n<nfunctions; ++n) { // loop over sf's
	f_table[g][n] = value(n, mpos);
	DoubleVec &dftemp = df_table[g][n];
	for(SpaceIndex j=0; j<DIM; ++j) // loop over spatial dimensions
	  dftemp[j] = masterderiv(n, j, mpos);
      }
    }
  }
}