コード例 #1
0
ファイル: XFEMCutElem.C プロジェクト: aeslaughter/moose
void
XFEMCutElem::getWeightMultipliers(MooseArray<Real> & weights,
                                  QBase * qrule,
                                  Xfem::XFEM_QRULE xfem_qrule,
                                  const MooseArray<Point> & q_points)
{
  if (!_have_weights)
    computeXFEMWeights(qrule, xfem_qrule, q_points);

  weights.resize(_new_weights.size());
  for (unsigned int qp = 0; qp < _new_weights.size(); ++qp)
    weights[qp] = _new_weights[qp];
}
コード例 #2
0
ファイル: Assembly.C プロジェクト: Jieun2/moose
void
Assembly::reinitNeighborAtReference(const Elem * neighbor, const std::vector<Point> & reference_points)
{
  unsigned int neighbor_dim = neighbor->dim();

  // reinit neighbor element
  for (std::map<FEType, FEBase *>::iterator it = _fe_neighbor[neighbor_dim].begin(); it != _fe_neighbor[neighbor_dim].end(); ++it)
  {
    FEBase * fe_neighbor = it->second;
    FEType fe_type = it->first;
    FEShapeData * fesd = _fe_shape_data_face_neighbor[fe_type];

    it->second->reinit(neighbor, &reference_points);

    _current_fe_neighbor[it->first] = it->second;

    fesd->_phi.shallowCopy(const_cast<std::vector<std::vector<Real> > &>(fe_neighbor->get_phi()));
    fesd->_grad_phi.shallowCopy(const_cast<std::vector<std::vector<RealGradient> > &>(fe_neighbor->get_dphi()));
    if (_need_second_derivative[fe_type])
      fesd->_second_phi.shallowCopy(const_cast<std::vector<std::vector<RealTensor> > &>(fe_neighbor->get_d2phi()));
  }

  ArbitraryQuadrature * neighbor_rule = _holder_qrule_neighbor[neighbor_dim];
  neighbor_rule->setPoints(reference_points);
  setNeighborQRule(neighbor_rule, neighbor_dim);

  _current_neighbor_elem = neighbor;

  // Calculate the volume of the neighbor

  FEType fe_type (neighbor->default_order() , LAGRANGE);
  AutoPtr<FEBase> fe (FEBase::build(neighbor->dim(), fe_type));

  const std::vector<Real> & JxW = fe->get_JxW();
  const std::vector<Point> & q_points = fe->get_xyz();

  // The default quadrature rule should integrate the mass matrix,
  // thus it should be plenty to compute the area
  QGauss qrule (neighbor->dim(), fe_type.default_quadrature_order());
  fe->attach_quadrature_rule(&qrule);
  fe->reinit(neighbor);

  // set the coord transformation
  MooseArray<Real> coord;
  coord.resize(qrule.n_points());
  switch (_coord_type) // coord type should be the same for the neighbor
  {
  case Moose::COORD_XYZ:
    for (unsigned int qp = 0; qp < qrule.n_points(); qp++)
      coord[qp] = 1.;
    break;

  case Moose::COORD_RZ:
    for (unsigned int qp = 0; qp < qrule.n_points(); qp++)
      coord[qp] = 2 * M_PI * q_points[qp](0);
    break;

  case Moose::COORD_RSPHERICAL:
    for (unsigned int qp = 0; qp < qrule.n_points(); qp++)
      coord[qp] = 4 * M_PI * q_points[qp](0) * q_points[qp](0);
    break;

  default:
    mooseError("Unknown coordinate system");
    break;
  }

  _current_neighbor_volume = 0.;
  for (unsigned int qp = 0; qp < qrule.n_points(); qp++)
    _current_neighbor_volume += JxW[qp] * coord[qp];

  coord.release();
}