Debian Codegraph @

src/atlas/functionspace/Locate.h

raw
1 /*
2 * (C) Copyright 2025 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 "atlas/parallel/Locate.h"
14 #include "atlas/field/Field.h"
15
16 namespace atlas::functionspace {
17
18 class Locator : public ::atlas::parallel::Locator {
19 public:
20 Locator(const FunctionSpace& fs);
21
22 using ::atlas::parallel::Locator::locate;
23 void locate(
24 // input
25 span<const gidx_t> global_index, const gidx_t global_index_base,
26 // output
27 span<int> partition, const int partition_base,
28 span<idx_t> remote_index, const idx_t remote_index_base) const override;
29
30 private:
31 vector<int> distribution_array_;
32 std::function<int(size_t)> distribution_function_;
33 size_t distribution_size_;
34 const Field fs_global_index_;
35 const Field fs_ghost_;
36 std::string mpi_comm_;
37 };
38
39 } // namespace atlas::functionspace