| 1 |
/* |
| 2 |
* (C) Copyright 2013 ECMWF. |
| 3 |
* |
| 4 |
* This software is licensed under the terms of the Apache Licence Version 2.0 |
| 5 |
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
| 6 |
* In applying this licence, ECMWF does not waive the privileges and immunities |
| 7 |
* granted to it by virtue of its status as an intergovernmental organisation |
| 8 |
* nor does it submit to any jurisdiction. |
| 9 |
*/ |
| 10 |
|
| 11 |
#pragma once |
| 12 |
|
| 13 |
#include <vector> |
| 14 |
|
| 15 |
#include "atlas/library/config.h" |
| 16 |
#include "atlas/numerics/Nabla.h" |
| 17 |
|
| 18 |
namespace atlas { |
| 19 |
namespace numerics { |
| 20 |
namespace fvm { |
| 21 |
class Method; |
| 22 |
} |
| 23 |
} // namespace numerics |
| 24 |
} // namespace atlas |
| 25 |
|
| 26 |
namespace atlas { |
| 27 |
class Field; |
| 28 |
} |
| 29 |
|
| 30 |
namespace atlas { |
| 31 |
namespace numerics { |
| 32 |
namespace fvm { |
| 33 |
|
| 34 |
#ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 35 |
class Nabla : public atlas::numerics::NablaImpl { |
| 36 |
public: |
| 37 |
Nabla(const atlas::numerics::Method&, const eckit::Parametrisation&); |
| 38 |
virtual ~Nabla() override; |
| 39 |
|
| 40 |
virtual void gradient(const Field& scalar, Field& grad) const override; |
| 41 |
virtual void divergence(const Field& vector, Field& div) const override; |
| 42 |
virtual void curl(const Field& vector, Field& curl) const override; |
| 43 |
virtual void laplacian(const Field& scalar, Field& laplacian) const override; |
| 44 |
|
| 45 |
virtual const FunctionSpace& functionspace() const override; |
| 46 |
|
| 47 |
private: |
| 48 |
void setup(); |
| 49 |
|
| 50 |
void gradient_of_scalar(const Field& scalar, Field& grad) const; |
| 51 |
void gradient_of_vector(const Field& vector, Field& grad) const; |
| 52 |
|
| 53 |
private: |
| 54 |
fvm::Method const* fvm_; |
| 55 |
std::vector<idx_t> pole_edges_; |
| 56 |
int metric_approach_{0}; |
| 57 |
}; |
| 58 |
#endif |
| 59 |
// ------------------------------------------------------------------ |
| 60 |
|
| 61 |
} // namespace fvm |
| 62 |
} // namespace numerics |
| 63 |
} // namespace atlas |