Loading [MathJax]/extensions/tex2jax.js
PISM, A Parallel Ice Sheet Model 2.2.2-d6b3a29ca committed by Constantine Khrulev on 2025-03-28
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Vector.hh
Go to the documentation of this file.
1/* Copyright (C) 2020, 2021, 2022, 2023 PISM Authors
2 *
3 * This file is part of PISM.
4 *
5 * PISM is free software; you can redistribute it and/or modify it under the
6 * terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with PISM; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#ifndef PISM_ARRAY_VECTOR_HH
20#define PISM_ARRAY_VECTOR_HH
21
22#include "pism/util/array/Array2D.hh"
23#include "pism/util/Vector2d.hh"
24
25namespace pism {
26namespace array {
27
28class Scalar;
29
30/** Class for storing and accessing 2D vector fields
31*/
32class Vector : public array::Array2D<pism::Vector2d> {
33public:
34 Vector(std::shared_ptr<const Grid> grid, const std::string &short_name);
35
36 virtual ~Vector() = default;
37
38 std::shared_ptr<Vector> duplicate() const;
39protected:
40 Vector(std::shared_ptr<const Grid> grid, const std::string &name,
41 unsigned int stencil_width);
42};
43
44class Vector1 : public Vector {
45public:
46 Vector1(std::shared_ptr<const Grid> grid, const std::string &name);
47
50protected:
51 Vector1(std::shared_ptr<const Grid> grid, const std::string &name,
52 unsigned int stencil_width);
53};
54
55class Vector2 : public Vector1 {
56public:
57 Vector2(std::shared_ptr<const Grid> grid, const std::string &name);
58};
59
60void compute_magnitude(const array::Vector &input, array::Scalar &result);
61
62} // end of namespace array
63} // end of namespace pism
64
65#endif /* PISM_ARRAY_VECTOR_HH */
This class represents a 2D vector field (such as ice velocity) at a certain grid point.
Definition Vector2d.hh:29
stencils::Star< pism::Vector2d > star(int i, int j) const
Definition Array2D.hh:79
stencils::Box< pism::Vector2d > box(int i, int j) const
Definition Array2D.hh:93
A storage vector combining related fields in a struct.
Definition Array2D.hh:32
std::shared_ptr< const Grid > grid() const
Definition Array.cc:131
unsigned int stencil_width() const
Get the stencil width of the current Array. Returns 0 if ghosts are not available.
Definition Array.cc:302
virtual ~Vector()=default
std::shared_ptr< Vector > duplicate() const
Definition Vector.cc:50
void compute_magnitude(const array::Vector &input, array::Scalar &result)
Definition Scalar.cc:66