20 #include "pism/frontretreat/util/IcebergRemover.hh"
21 #include "pism/util/connected_components.hh"
22 #include "pism/util/Mask.hh"
23 #include "pism/util/error_handling.hh"
24 #include "pism/util/Grid.hh"
25 #include "pism/util/array/CellType.hh"
26 #include "pism/util/petscwrappers/Vec.hh"
33 m_iceberg_mask(m_grid,
"iceberg_mask"){
54 mask_grounded_ice = 1,
55 mask_floating_ice = 2;
64 for (
auto p =
m_grid->points(); p; p.next()) {
65 const int i = p.i(), j = p.j();
75 for (
auto p =
m_grid->points(); p; p.next()) {
76 const int i = p.i(), j = p.j();
78 if (bc_mask(i, j) > 0.5 and cell_type.
icy(i, j)) {
107 for (
auto p =
m_grid->points(); p; p.next()) {
108 const int i = p.i(), j = p.j();
111 ice_thickness(i,j) = 0.0;
const std::shared_ptr< const Grid > m_grid
grid used by this component
A class defining a common interface for most PISM sub-models.
void failed()
Indicates a failure of a parallel section.
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
void get_from_proc0(petsc::Vec &onp0)
Gets a local Array2 from processor 0.
void set(double c)
Result: v[j] <- c for all j.
std::shared_ptr< petsc::Vec > allocate_proc0_copy() const
void put_on_proc0(petsc::Vec &onp0) const
Puts a local array::Scalar on processor 0.
void update_ghosts()
Updates ghost points.
bool floating_ice(int i, int j) const
bool grounded_ice(int i, int j) const
bool icy(int i, int j) const
std::shared_ptr< petsc::Vec > m_mask_p0
array::Scalar m_iceberg_mask
virtual void update_impl(const array::Scalar &bc_mask, array::CellType1 &cell_type, array::Scalar &ice_thickness)
void update(const array::Scalar &bc_mask, array::CellType1 &cell_type, array::Scalar &ice_thickness)
IcebergRemover(std::shared_ptr< const Grid > g)
Wrapper around VecGetArray and VecRestoreArray.
void label_connected_components(double *image, int nrows, int ncols, bool identify_icebergs, int mask_grounded, int first_label)