@@ -78,13 +78,13 @@ namespace fastscapelib
78
78
79
79
80
80
template <class S , unsigned int N>
81
- class trimesh_xt ;
81
+ class trimesh ;
82
82
83
83
/* *
84
84
* 2-d triangular mesh specialized types.
85
85
*/
86
86
template <class S , unsigned int N>
87
- struct grid_inner_types <trimesh_xt <S, N>>
87
+ struct grid_inner_types <trimesh <S, N>>
88
88
{
89
89
static constexpr bool is_structured = false ;
90
90
static constexpr bool is_uniform = false ;
@@ -107,11 +107,11 @@ namespace fastscapelib
107
107
* @tparam S The xtensor container selector for data array members.
108
108
* @tparam N The maximum number of node neighbors.
109
109
*/
110
- template <class S , unsigned int N = 20 >
111
- class trimesh_xt : public grid <trimesh_xt <S, N>>
110
+ template <class S = xt_selector , unsigned int N = 20 >
111
+ class trimesh : public grid <trimesh <S, N>>
112
112
{
113
113
public:
114
- using self_type = trimesh_xt <S, N>;
114
+ using self_type = trimesh <S, N>;
115
115
using base_type = grid<self_type>;
116
116
117
117
using grid_data_type = typename base_type::grid_data_type;
@@ -133,13 +133,13 @@ namespace fastscapelib
133
133
using nodes_status_map_type = typename std::map<size_type, node_status>;
134
134
using nodes_status_array_type = fixed_shape_container_t <container_selector, node_status, 1 >;
135
135
136
- trimesh_xt (const points_type& points,
137
- const triangles_type& triangles,
138
- const nodes_status_map_type& nodes_status = {});
136
+ trimesh (const points_type& points,
137
+ const triangles_type& triangles,
138
+ const nodes_status_map_type& nodes_status = {});
139
139
140
- trimesh_xt (const points_type& points,
141
- const triangles_type& triangles,
142
- const nodes_status_array_type& nodes_status);
140
+ trimesh (const points_type& points,
141
+ const triangles_type& triangles,
142
+ const nodes_status_array_type& nodes_status);
143
143
144
144
protected:
145
145
using neighbors_distances_impl_type = typename base_type::neighbors_distances_impl_type;
@@ -195,9 +195,9 @@ namespace fastscapelib
195
195
* by more than one triangle).
196
196
*/
197
197
template <class S , unsigned int N>
198
- trimesh_xt <S, N>::trimesh_xt (const points_type& points,
199
- const triangles_type& triangles,
200
- const nodes_status_map_type& nodes_status)
198
+ trimesh <S, N>::trimesh (const points_type& points,
199
+ const triangles_type& triangles,
200
+ const nodes_status_map_type& nodes_status)
201
201
: base_type(0 )
202
202
, m_nodes_points(points)
203
203
{
@@ -215,9 +215,9 @@ namespace fastscapelib
215
215
* @param nodes_status The status of all nodes on the mesh (array of shape [N]).
216
216
*/
217
217
template <class S , unsigned int N>
218
- trimesh_xt <S, N>::trimesh_xt (const points_type& points,
219
- const triangles_type& triangles,
220
- const nodes_status_array_type& nodes_status)
218
+ trimesh <S, N>::trimesh (const points_type& points,
219
+ const triangles_type& triangles,
220
+ const nodes_status_array_type& nodes_status)
221
221
: base_type(0 )
222
222
, m_nodes_points(points)
223
223
{
@@ -229,8 +229,7 @@ namespace fastscapelib
229
229
// @}
230
230
231
231
template <class S , unsigned int N>
232
- void trimesh_xt<S, N>::set_size_shape(const points_type& points,
233
- const triangles_type& triangles)
232
+ void trimesh<S, N>::set_size_shape(const points_type& points, const triangles_type& triangles)
234
233
{
235
234
if (points.shape ()[1 ] != 2 )
236
235
{
@@ -246,7 +245,7 @@ namespace fastscapelib
246
245
}
247
246
248
247
template <class S , unsigned int N>
249
- void trimesh_xt <S, N>::set_neighbors(const points_type& points, const triangles_type& triangles)
248
+ void trimesh <S, N>::set_neighbors(const points_type& points, const triangles_type& triangles)
250
249
{
251
250
// extract and count triangle edges
252
251
@@ -306,8 +305,7 @@ namespace fastscapelib
306
305
}
307
306
308
307
template <class S , unsigned int N>
309
- void trimesh_xt<S, N>::set_nodes_areas(const points_type& points,
310
- const triangles_type& triangles)
308
+ void trimesh<S, N>::set_nodes_areas(const points_type& points, const triangles_type& triangles)
311
309
{
312
310
size_type n_points = points.shape ()[0 ];
313
311
size_type n_triangles = triangles.shape ()[0 ];
@@ -378,7 +376,7 @@ namespace fastscapelib
378
376
}
379
377
380
378
template <class S , unsigned int N>
381
- void trimesh_xt <S, N>::set_nodes_status(const nodes_status_map_type& nodes_status)
379
+ void trimesh <S, N>::set_nodes_status(const nodes_status_map_type& nodes_status)
382
380
{
383
381
nodes_status_type temp_nodes_status (m_shape, node_status::core);
384
382
@@ -408,7 +406,7 @@ namespace fastscapelib
408
406
}
409
407
410
408
template <class S , unsigned int N>
411
- void trimesh_xt <S, N>::set_nodes_status(const nodes_status_array_type& nodes_status)
409
+ void trimesh <S, N>::set_nodes_status(const nodes_status_array_type& nodes_status)
412
410
{
413
411
if (!xt::same_shape (nodes_status.shape (), m_shape))
414
412
{
@@ -419,27 +417,27 @@ namespace fastscapelib
419
417
}
420
418
421
419
template <class S , unsigned int N>
422
- inline auto trimesh_xt <S, N>::neighbors_count_impl(const size_type& idx) const -> size_type
420
+ inline auto trimesh <S, N>::neighbors_count_impl(const size_type& idx) const -> size_type
423
421
{
424
422
return m_neighbors_indices[idx].size ();
425
423
}
426
424
427
425
template <class S , unsigned int N>
428
- inline auto trimesh_xt <S, N>::nodes_areas_impl() const -> areas_type
426
+ inline auto trimesh <S, N>::nodes_areas_impl() const -> areas_type
429
427
{
430
428
return m_nodes_areas;
431
429
}
432
430
433
431
template <class S , unsigned int N>
434
- inline auto trimesh_xt <S, N>::nodes_areas_impl(const size_type& idx) const noexcept
432
+ inline auto trimesh <S, N>::nodes_areas_impl(const size_type& idx) const noexcept
435
433
-> grid_data_type
436
434
{
437
435
return m_nodes_areas (idx);
438
436
}
439
437
440
438
template <class S , unsigned int N>
441
- void trimesh_xt <S, N>::neighbors_indices_impl(neighbors_indices_impl_type& neighbors,
442
- const size_type& idx) const
439
+ void trimesh <S, N>::neighbors_indices_impl(neighbors_indices_impl_type& neighbors,
440
+ const size_type& idx) const
443
441
{
444
442
const auto & size = m_neighbors_indices[idx].size ();
445
443
neighbors.resize (size);
@@ -451,30 +449,18 @@ namespace fastscapelib
451
449
}
452
450
453
451
template <class S , unsigned int N>
454
- auto trimesh_xt <S, N>::neighbors_distances_impl(const size_type& idx) const
452
+ auto trimesh <S, N>::neighbors_distances_impl(const size_type& idx) const
455
453
-> const neighbors_distances_impl_type&
456
454
{
457
455
return m_neighbors_distances[idx];
458
456
}
459
457
460
458
461
459
template <class S , unsigned int N>
462
- constexpr std::size_t trimesh_xt <S, N>::dimension_impl() noexcept
460
+ constexpr std::size_t trimesh <S, N>::dimension_impl() noexcept
463
461
{
464
462
return 2 ;
465
463
}
466
-
467
- /* *
468
- * @typedef trimesh
469
- *
470
- * \rst
471
- * Alias template on ``trimesh_xt`` with :cpp:type:`xt::xtensor`
472
- * used as array container type for data members.
473
- *
474
- * This is mainly for convenience when using in C++ applications.
475
- * \endrst
476
- */
477
- using trimesh = trimesh_xt<xt_selector>;
478
464
}
479
465
480
466
#endif // FASTSCAPELIB_GRID_TRIMESH_H
0 commit comments