Esempio n. 1
0
float getx(float x,float y){
	float x1,f1,f2;
	f1= x*x + x*y - 10 ;
	f2= y + 3*x*y*y - 57;
	x1=-df2y(y,x)*f1+df1y(y)*f2;
	return(x1/detJ(x,y));
}
float gety(float x,float y) {
    float y1,f1,f2;
    f1=x*x+x*y;
    f2=y+3*x*y*y;
    y1=-df2x(x,y)*f1+df1x(x,y)*f2;
    return(y1/detJ(x,y));
}
float getx(float x,float y) {
    float x1,f1,f2;
    f1=x*x+x*y;
    f2=y+3*x*y*y;
    x1=df2y(y,x)*f1-df1y(x)*f2;
    return(x1/detJ(x,y));
}
void ComputeHierarchicBasis<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{

  // do some work to get the pumi discretization and the apf mesh
  // this is so we can use the pumi mesh database to compute
  // mesh / basis function quantities.
  Teuchos::RCP<Albany::AbstractDiscretization> discretization =
    app->getDiscretization();

  Teuchos::RCP<Albany::PUMIDiscretization> pumiDiscretization =
    Teuchos::rcp_dynamic_cast<Albany::PUMIDiscretization>(discretization);

  Teuchos::RCP<Albany::PUMIMeshStruct> pumiMeshStruct =
    pumiDiscretization->getPUMIMeshStruct();

  // get the element block index
  // this will allow us to index into buckets
  ebIndex = pumiMeshStruct->ebNameToIndex[workset.EBName];

  // get the buckets
  // this is the elements of the apf mesh indexed by
  // buckets[Elem Block Index][Cell Index]
  buckets = pumiDiscretization->getBuckets();
  
  // get the apf mesh
  // this is used for a variety of apf things
  mesh = pumiMeshStruct->getMesh();

  // get the apf heirarchic shape
  // this is used to get shape function values / gradients
  shape = apf::getHierarchic(polynomialOrder);

  for (int cell=0; cell < workset.numCells; ++cell)
  {

    // get the apf objects associated with this cell
    apf::MeshEntity* element = buckets[ebIndex][cell];
    apf::MeshElement* meshElement = apf::createMeshElement(mesh, element);

    for (int qp=0; qp < numQPs; ++qp)
    {
      
      // get the parametric value of the current integration point
      apf::getIntPoint(meshElement, cubatureDegree, qp, point);

      // set the jacobian determinant
      detJ(cell, qp) = apf::getDV(meshElement, point);
      assert( detJ(cell, qp) > 0.0 );

      // get the integration point weight associated with this qp
      double w = apf::getIntWeight(meshElement, cubatureDegree, qp);

      // weight the determinant of the jacobian by the qp weight
      weightedDV(cell, qp) = w * detJ(cell,qp);

      // get the shape function values and gradients at this point
      apf::getBF(shape, meshElement, point, bf);
      apf::getGradBF(shape, meshElement, point, gbf);

      for (int node=0; node < numNodes; ++node)
      {
        BF(cell, node, qp) = bf[node];
        wBF(cell, node, qp) = weightedDV(cell, qp) * bf[node];
        for (int dim=0; dim < numDims; ++dim)
        {
          GradBF(cell, node, qp, dim) = gbf[node][dim];
          wGradBF(cell, node, qp, dim) = weightedDV(cell,qp) * gbf[node][dim];
        }
      }

    }

    // do some memory cleanup to keep everyone happy
    apf::destroyMeshElement(meshElement);

  }

}