예제 #1
0
void Polynomial::operator *= (const Field & x) {
  if(!x.zero() && !zero()) {
    Polynomial temp(*this);
    Term aterm(temp.tip());
    aterm.Coefficient() *= x;
    Copy<Term> copyterm(aterm);
    temp.Removetip();
    setToZero();
    PolynomialRep5 * q = new PolynomialRep5(copyterm,x,temp);
    addIntoSet(q);
  };
#ifdef POLYNOMIAL_USE_LIST
    putAllInList();
#endif
};
예제 #2
0
void Polynomial::doubleProduct(const Monomial & x,
        const Polynomial &  poly,const Monomial & y) {
  if(&poly==this) DBG();
  setToZero();
  if(!poly.zero())  {
    Polynomial temp(poly);
    Term aterm(x);
    aterm *= temp.tip();
    aterm.MonomialPart() *= y;
    Copy<Term> copyterm(aterm);
    temp.Removetip();
    PolynomialRep4 * p = new PolynomialRep4(copyterm,x,temp,y); 
    d_set.insert(p);
#ifdef POLYNOMIAL_USE_LIST
    putAllInList();
#endif
  };
};  
예제 #3
0
void HeatEqResid<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{

//// workset.print(std::cout);


  typedef Intrepid::FunctionSpaceTools FST;

  // Since Intrepid will later perform calculations on the entire workset size
  // and not just the used portion, we must fill the excess with reasonable
  // values. Leaving this out leads to floating point exceptions !!!
  for (std::size_t cell=workset.numCells; cell < worksetSize; ++cell)
    for (std::size_t qp=0; qp < numQPs; ++qp){
      ThermalCond(cell,qp) = 0.0;
      for (std::size_t i=0; i < numDims; ++i){
        flux(cell,qp,i) = 0.0;
        TGrad(cell,qp,i) = 0.0;
      }
    }

  FST::scalarMultiplyDataData<ScalarT> (flux, ThermalCond, TGrad);

  FST::integrate<ScalarT>(TResidual, flux, wGradBF, Intrepid::COMP_CPP, false); // "false" overwrites

  if (haveSource) {

    for (std::size_t cell=workset.numCells; cell < worksetSize; ++cell)
      for (std::size_t qp=0; qp < numQPs; ++qp)
        Source(cell,qp) = 0.0;

    for (int i =0; i< Source.dimension(0); i++)
     for (int j =0; j< Source.dimension(1); j++)
        Source(i,j) *= -1.0;
    FST::integrate<ScalarT>(TResidual, Source, wBF, Intrepid::COMP_CPP, true); // "true" sums into
  }

  if (workset.transientTerms && enableTransient){

    for (std::size_t cell=workset.numCells; cell < worksetSize; ++cell)
      for (std::size_t qp=0; qp < numQPs; ++qp)
        Tdot(cell,qp) = 0.0;

    FST::integrate<ScalarT>(TResidual, Tdot, wBF, Intrepid::COMP_CPP, true); // "true" sums into

  }

  if (haveConvection)  {
    Intrepid::FieldContainer<ScalarT> convection(worksetSize, numQPs);

    for (std::size_t cell=workset.numCells; cell < worksetSize; ++cell)
      for (std::size_t qp=0; qp < numQPs; ++qp)
        convection(cell,qp) = 0.0;

    for (std::size_t cell=0; cell < workset.numCells; ++cell) {
      for (std::size_t qp=0; qp < numQPs; ++qp) {
        convection(cell,qp) = 0.0;
        for (std::size_t i=0; i < numDims; ++i) {
          if (haverhoCp)
            convection(cell,qp) += rhoCp(cell,qp) * convectionVels[i] * TGrad(cell,qp,i);
          else
            convection(cell,qp) += convectionVels[i] * TGrad(cell,qp,i);
        }
      }
    }

    FST::integrate<ScalarT>(TResidual, convection, wBF, Intrepid::COMP_CPP, true); // "true" sums into
  }


  if (haveAbsorption) {

    // Since Intrepid will later perform calculations on the entire workset size
    // and not just the used portion, we must fill the excess with reasonable
    // values. Leaving this out leads to floating point exceptions !!!
    for (std::size_t cell=workset.numCells; cell < worksetSize; ++cell)
      for (std::size_t qp=0; qp < numQPs; ++qp){
        aterm(cell,qp) = 0.0;
        Absorption(cell,qp) = 0.0;
        Temperature(cell,qp) = 0.0;
      }

    FST::scalarMultiplyDataData<ScalarT> (aterm, Absorption, Temperature);
    FST::integrate<ScalarT>(TResidual, aterm, wBF, Intrepid::COMP_CPP, true); 
  }

//TResidual.print(std::cout, true);

}