Debian Codegraph @

src/atlas/mesh/detail/MeshBuilderIntf.cc

raw
1 /*
2 * (C) Copyright 2023 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 #include "atlas/mesh/detail/MeshBuilderIntf.h"
12 #include "atlas/runtime/Exception.h"
13 #include "atlas/runtime/Log.h"
14
15 namespace atlas {
16 namespace mesh {
17
18 //----------------------------------------------------------------------------------------------------------------------
19 // C wrapper interfaces to C++ routines
20
21 TriangularMeshBuilder* atlas__TriangularMeshBuilder__new() {
22 return new TriangularMeshBuilder();
23 }
24
25 void atlas__TriangularMeshBuilder__delete(TriangularMeshBuilder* This) {
26 ATLAS_ASSERT(This != nullptr, "Cannot access uninitialisd atlas_TriangularMeshBuilder");
27 delete This;
28 }
29
30 Mesh::Implementation* atlas__TriangularMeshBuilder__operator(TriangularMeshBuilder* This,
31 size_t nb_nodes, const gidx_t node_global_index[],
32 const double x[], const double y[], size_t xstride, size_t ystride,
33 const double lon[], const double lat[], size_t lonstride, size_t latstride,
34 size_t nb_triags, const gidx_t triangle_global_index[], const gidx_t triangle_nodes_global_index[],
35 gidx_t global_index_base) {
36
37 ATLAS_ASSERT(This != nullptr, "Cannot access uninitialisd atlas_TriangularMeshBuilder");
38
39 Mesh::Implementation* m;
40 {
41 Mesh mesh = This->operator()(nb_nodes, node_global_index,
42 x, y, xstride, ystride,
43 lon, lat, lonstride, latstride,
44 nb_triags, triangle_global_index, triangle_nodes_global_index,
45 global_index_base);
46 mesh.get()->attach();
47 m = mesh.get();
48 }
49 m->detach();
50 return m;
51 }
52
53 //----------------------------------------------------------------------------------------------------------------------
54
55 } // namespace mesh
56 } // namespace atlas