22#include "pism/util/petscwrappers/DM.hh"
23#include "pism/util/connected_components/label_components.hh"
25#include "pism/frontretreat/util/IcebergRemoverFEM.hh"
27#include "pism/util/fem/Element.hh"
28#include "pism/util/array/CellType.hh"
29#include "pism/util/Mask.hh"
30#include "pism/util/Interpolation1D.hh"
31#include "pism/util/fem/Quadrature.hh"
38 m_mask(grid,
"temporary_mask") {
71 mask_grounded_ice = 1,
72 mask_floating_ice = 2;
88 for (
auto p =
m_grid->points(); p; p.next()) {
89 const int i = p.i(), j = p.j();
105 bool grounded =
true;
110 m_iceberg_mask(i, j) = grounded ? mask_grounded_ice : mask_floating_ice;
128 auto da =
m_grid->get_dm(1, 0);
129 PetscErrorCode ierr = DMDAGetLocalInfo(*da, &info);
131 throw std::runtime_error(
"Failed to get DMDA info");
139 double mask_iceberg[] = {1.0, 1.0, 1.0, 1.0};
140 double mask_grounded[] = {-1.0, -1.0, -1.0, -1.0};
143 for (
int j = info.gys; j < info.gys + info.gym - 1; j++) {
144 for (
int i = info.gxs; i < info.gxs + info.gxm - 1; i++) {
159 bool grounded =
true;
177 list.add(ice_thickness);
179 for (
auto p =
m_grid->points(); p; p.next()) {
180 const int i = p.i(), j = p.j();
183 ice_thickness(i,j) = 0.0;
const std::shared_ptr< const Grid > m_grid
grid used by this component
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
void set_interpolation_type(InterpolationType type)
void set(double c)
Result: v[j] <- c for all j.
void update_ghosts()
Updates ghost points.
unsigned int stencil_width() const
Get the stencil width of the current Array. Returns 0 if ghosts are not available.
int as_int(int i, int j) const
IcebergRemoverFEM(std::shared_ptr< const Grid > g)
void update_impl(const array::Scalar &bc_mask, array::CellType1 &cell_type, array::Scalar &ice_thickness)
array::Scalar1 m_iceberg_mask
void reset(int i, int j)
Initialize the Element to element (i, j) for the purposes of inserting into global residual and Jacob...
void add_contribution(const T *local, T **y_global) const
Add the values of element-local contributions y to the global vector y_global.
void nodal_values(const array::Scalar &x_global, int *result) const
Get nodal values of an integer mask.
Q1 element with sides parallel to X and Y axes.
The 1-point Gaussian quadrature on the square [-1,1]*[-1,1].
void label_isolated(array::Scalar1 &mask, int reachable)
bool icy(int M)
Ice-filled cell (grounded or floating).
bool grounded(int M)
Grounded cell (grounded ice or ice-free).