Skip to content

Commit

Permalink
Give the SphericalShell class a permanent manifold object.
Browse files Browse the repository at this point in the history
  • Loading branch information
bangerth committed Nov 15, 2023
1 parent 280517f commit 5a8c325
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
28 changes: 28 additions & 0 deletions include/aspect/geometry_model/spherical_shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ namespace aspect
*/
SphericalShell() = default;

/**
* Initialization function. This function is called once at the
* beginning of the program after parse_parameters is run and after
* the SimulatorAccess (if applicable) is initialized.
* This function calls the initialize function of the manifold
* with a pointer to the initial topography model obtained
* from SimulatorAccess.
*/
void initialize () override;

/**
* Generate a coarse mesh for the geometry described by this class.
*/
Expand Down Expand Up @@ -375,6 +385,24 @@ namespace aspect
* Flag whether the 2D quarter shell is periodic in phi.
*/
bool periodic;

/**
* An object that describes the geometry. This pointer is
* initialized in the initialize() function, and serves as the manifold
* object that the triangulation is later given in create_coarse_mesh()
* where the triangulation clones it.
*
* The object is marked as 'const' to make it clear that it should not
* be modified once created. That is because the triangulation copies it,
* and modifying the current object will not have any impact on the
* manifold used by the triangulation.
*/
std::unique_ptr<const internal::SphericalManifoldWithTopography<dim>> manifold;

/**
* Give a symbolic name to the manifold id to be used by this class.
*/
static const types::manifold_id my_manifold_id = 99;
};
}
}
Expand Down
13 changes: 11 additions & 2 deletions source/geometry_model/spherical_shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ namespace aspect



template <int dim>
void
SphericalShell<dim>::initialize ()
{
manifold = std::make_unique<internal::SphericalManifoldWithTopography<dim>>();
}



template <int dim>
void
SphericalShell<dim>::
Expand Down Expand Up @@ -328,7 +337,7 @@ namespace aspect

// Use a manifold description for all cells. Use manifold_id 99 in order
// not to step on the boundary indicators used below.
coarse_grid.set_manifold (99, internal::SphericalManifoldWithTopography<dim>());
coarse_grid.set_manifold (my_manifold_id, *manifold);
set_manifold_ids(coarse_grid);
}

Expand All @@ -339,7 +348,7 @@ namespace aspect
SphericalShell<dim>::set_manifold_ids (parallel::distributed::Triangulation<dim> &triangulation) const
{
for (const auto &cell : triangulation.active_cell_iterators())
cell->set_all_manifold_ids (99);
cell->set_all_manifold_ids (my_manifold_id);
}


Expand Down

0 comments on commit 5a8c325

Please sign in to comment.