| 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 |
/// @file BuildParallelFields.h |
| 12 |
/// @author Willem Deconinck |
| 13 |
/// @date June 2014 |
| 14 |
|
| 15 |
#pragma once |
| 16 |
|
| 17 |
#include "atlas/library/config.h" |
| 18 |
#include "atlas/mesh/Mesh.h" |
| 19 |
|
| 20 |
namespace atlas { |
| 21 |
namespace mesh { |
| 22 |
class Nodes; |
| 23 |
} |
| 24 |
} // namespace atlas |
| 25 |
|
| 26 |
namespace atlas { |
| 27 |
namespace mesh { |
| 28 |
namespace actions { |
| 29 |
|
| 30 |
/* |
| 31 |
* Build all parallel fields in the mesh |
| 32 |
* - calls build_nodes_parallel_fields() |
| 33 |
*/ |
| 34 |
void build_parallel_fields(Mesh& mesh); |
| 35 |
|
| 36 |
/* |
| 37 |
* Build parallel fields for the "nodes" function space if they don't exist. |
| 38 |
* - glb_idx: create unique indices for non-positive values |
| 39 |
* - partition: set to mpi::rank() for negative values |
| 40 |
* - remote_idx: rebuild from scratch |
| 41 |
*/ |
| 42 |
void build_nodes_parallel_fields(Mesh& mesh); |
| 43 |
void build_nodes_parallel_fields(mesh::Nodes& nodes); // deprecated (WARNING: does not change MPI scope) |
| 44 |
|
| 45 |
/* |
| 46 |
* Build parallel fields for the "edges" function space if they don't exist. |
| 47 |
* - glb_idx: create unique indices for non-positive values |
| 48 |
* - partition: set to partition of node with lowest glb_idx |
| 49 |
* - remote_idx: rebuild from scratch |
| 50 |
* |
| 51 |
* TODO: Make sure that the edge-partition is at least one of the partition |
| 52 |
* numbers of the |
| 53 |
* neighbouring elements. |
| 54 |
* Because of this problem, the size of the halo should be set to 2 |
| 55 |
* instead of 1!!! |
| 56 |
*/ |
| 57 |
void build_edges_parallel_fields(Mesh& mesh); |
| 58 |
|
| 59 |
void build_cells_parallel_fields(Mesh& mesh); |
| 60 |
|
| 61 |
void renumber_nodes_glb_idx(Mesh& mesh); |
| 62 |
void renumber_nodes_glb_idx(mesh::Nodes& nodes); // deprecated (WARNING: does not change MPI scope) |
| 63 |
|
| 64 |
// ------------------------------------------------------------------ |
| 65 |
// C wrapper interfaces to C++ routines |
| 66 |
|
| 67 |
extern "C" { |
| 68 |
void atlas__build_parallel_fields(Mesh::Implementation* mesh); |
| 69 |
void atlas__build_nodes_parallel_fields(mesh::Nodes* nodes); |
| 70 |
void atlas__build_edges_parallel_fields(Mesh::Implementation* mesh); |
| 71 |
void atlas__renumber_nodes_glb_idx(mesh::Nodes* nodes); |
| 72 |
} |
| 73 |
|
| 74 |
// ------------------------------------------------------------------ |
| 75 |
|
| 76 |
} // namespace actions |
| 77 |
} // namespace mesh |
| 78 |
} // namespace atlas |