if (deg==0) return;
- // Create Legendre basis for the
- // space D_xi Q_k
- std::vector<AnisotropicPolynomials<dim>* > polynomials(dim);
+ // Create Legendre basis for the space D_xi Q_k
+ std::unique_ptr<AnisotropicPolynomials<dim>> polynomials[dim];
for (unsigned int dd=0; dd<dim; ++dd)
{
std::vector<std::vector<Polynomials::Polynomial<double> > > poly(dim);
poly[d] = Polynomials::Legendre::generate_complete_basis(deg);
poly[dd] = Polynomials::Legendre::generate_complete_basis(deg-1);
- polynomials[dd] = new AnisotropicPolynomials<dim>(poly);
+ polynomials[dd] = std_cxx14::make_unique<AnisotropicPolynomials<dim>>(poly);
}
interior_weights.reinit(TableIndices<3>(n_interior_points, polynomials[0]->n(), dim));
* polynomials[d]->compute_value(i,cell_quadrature.point(k));
}
- for (unsigned int d=0; d<dim; ++d)
- delete polynomials[d];
-
Assert (current == this->generalized_support_points.size(),
ExcInternalError());
}
if (this->degree == 1) return;
- // Create Legendre basis for the
- // space D_xi Q_k. Here, we cannot
+ // Create Legendre basis for the space D_xi Q_k. Here, we cannot
// use the shape functions
- std::vector<AnisotropicPolynomials<dim>* > polynomials(dim);
+ std::unique_ptr<AnisotropicPolynomials<dim>> polynomials[dim];
for (unsigned int dd=0; dd<dim; ++dd)
{
std::vector<std::vector<Polynomials::Polynomial<double> > > poly(dim);
poly[d] = Polynomials::Legendre::generate_complete_basis(this->degree-1);
poly[dd] = Polynomials::Legendre::generate_complete_basis(this->degree-2);
- polynomials[dd] = new AnisotropicPolynomials<dim>(poly);
+ polynomials[dd] = std_cxx14::make_unique<AnisotropicPolynomials<dim>>(poly);
}
QGauss<dim> q_cell(this->degree);
* polynomials[d]->compute_value(i_weight, q_sub.point(k));
}
}
-
- for (unsigned int d=0; d<dim; ++d)
- delete polynomials[d];
}
for (unsigned int d=0; d<dim; ++d)
{
- QAnisotropic<dim> *quadrature;
- if (dim == 1) quadrature = new QAnisotropic<dim>(high);
- if (dim == 2) quadrature = new QAnisotropic<dim>(((d==0) ? low : high),
- ((d==1) ? low : high));
- if (dim == 3) quadrature = new QAnisotropic<dim>(((d==0) ? low : high),
- ((d==1) ? low : high),
- ((d==2) ? low : high));
- Assert(dim<=3, ExcNotImplemented());
+ std::unique_ptr<QAnisotropic<dim>> quadrature;
+ switch (dim)
+ {
+ case 1:
+ quadrature = std_cxx14::make_unique<QAnisotropic<dim>>(high);
+ break;
+ case 2:
+ quadrature = std_cxx14::make_unique<QAnisotropic<dim>>(((d==0) ? low : high),
+ ((d==1) ? low : high));
+ break;
+ case 3:
+ quadrature = std_cxx14::make_unique<QAnisotropic<dim>>(((d==0) ? low : high),
+ ((d==1) ? low : high),
+ ((d==2) ? low : high));
+ break;
+ default:
+ Assert(false, ExcNotImplemented());
+ }
for (unsigned int k=0; k<quadrature->size(); ++k)
this->generalized_support_points[current++] = quadrature->point(k);
- delete quadrature;
}
Assert (current == this->dofs_per_cell, ExcInternalError());
}