*/
MGVertexDoFs ();
- /**
- * Destructor.
- */
- ~MGVertexDoFs ();
-
/**
* A function that is called to allocate the necessary amount of memory to
* store the indices of the DoFs that live on this vertex for the given
* The starting offset of the DoFs that belong to a @p level are given by
* <code>dofs_per_vertex * (level-coarsest_level)</code>.
*/
- types::global_dof_index *indices;
+ std::unique_ptr<types::global_dof_index[]> indices;
};
/**
DoFHandler<dim, spacedim>::MGVertexDoFs::MGVertexDoFs ()
:
coarsest_level (numbers::invalid_unsigned_int),
- finest_level (0),
- indices (nullptr)
+ finest_level (0)
{}
-template <int dim, int spacedim>
-DoFHandler<dim, spacedim>::MGVertexDoFs::~MGVertexDoFs ()
-{
- delete[] indices;
-}
-
-
-
template <int dim, int spacedim>
void DoFHandler<dim, spacedim>::MGVertexDoFs::init (const unsigned int cl,
const unsigned int fl,
const unsigned int n_dofs_per_vertex)
{
- if (indices != nullptr)
- {
- delete[] indices;
- indices = nullptr;
- }
-
coarsest_level = cl;
finest_level = fl;
dofs_per_vertex = n_dofs_per_vertex;
const unsigned int n_levels = finest_level - coarsest_level + 1;
const unsigned int n_indices = n_levels * dofs_per_vertex;
- indices = new types::global_dof_index[n_indices];
- std::fill (indices, indices+n_indices, numbers::invalid_dof_index);
+ indices.reset (new types::global_dof_index[n_indices]);
+ std::fill (indices.get(), indices.get()+n_indices,
+ numbers::invalid_dof_index);
}
+ else
+ indices.reset ();
}