TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Reorder_Mesh.h
1/****************************************************************************
2* Copyright (c) 2026, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#ifndef Reorder_Mesh_included
17#define Reorder_Mesh_included
18
19#include <TRUSTTabs_forward.h>
20#include <Objet_U.h>
21#include <Entree.h>
22#include <Domaine.h>
23
24/**! @brief Various methods of reordering Morton / Hilbert
25 * See wiki: https://en.wikipedia.org/wiki/Z-order_curve
26 */
27enum class Reorder_Algo { None, Morton, Hilbert };
28
29/**! @brief Reorder_Mesh allows the user to trigger the renumbering of the mesh entities.
30 *
31 * Renumbering can be done according to a Morton or Hilbert scheme (see Morton curve or Hilbert
32 * curves on Wikipedia) thus improving the data co-localisation, in the following sense:
33 *
34 * - when iterating through the faces of the mesh
35 * - and then retrieving the adjacent elements (indirection via face_voisin typically)
36 * - ensures that the elements that are thus scanned are themselves not too wide spread in memory
37 *
38 * This helps improving memory access performance.
39 * See .cpp file for more explanations on how this works.
40 *
41 * This object is used as a discretisation option - see class Discret_Thyd, member reorder_
42 */
43class Reorder_Mesh: public Objet_U
44{
45 Declare_instanciable(Reorder_Mesh);
46
47public:
48 template<typename _SIZE_>
50
51 template<typename _SIZE_>
52 void compute_renumbering(const DoubleTab_T<_SIZE_>& points, ArrOfInt_T<_SIZE_>& renum) const;
53
54 template<typename _SIZE_>
55 void dump_to_file(const DoubleTab_T<_SIZE_>& points, const std::string& filename) const;
56
57 // Accessors
58 Reorder_Algo algo() const { return algo_; }
59 bool skip_nodes() const { return no_nodes_; }
60 bool skip_elems() const { return no_elems_; }
61 bool skip_faces() const { return no_faces_; }
62 bool is_dump() const { return dump_; }
63
64protected:
65
66 Reorder_Algo algo_ = Reorder_Algo::None; ///< Reordering algorithm
67 bool no_nodes_ = false; ///< Whether to skip vertices in reordering
68 bool no_elems_ = false; ///< Whether to skip elements in reordering
69 bool no_faces_ = false; ///< Whether to skip faces in reordering
70 bool dump_ = false; ///< Whether to dump previous and new positions into text files.
71};
72
73
74#endif
classe Domaine_32_64 un Domaine est un maillage compose d'un ensemble d'elements geometriques de meme...
Definition Domaine.h:62
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
Definition Objet_U.cpp:55
Reorder_Mesh allows the user to trigger the renumbering of the mesh entities.
Reorder_Algo algo_
Reordering algorithm.
bool skip_nodes() const
Reorder_Algo algo() const
bool is_dump() const
void compute_renumbering(const DoubleTab_T< _SIZE_ > &points, ArrOfInt_T< _SIZE_ > &renum) const
void reorder_domain(Domaine_32_64< _SIZE_ > &dom) const
bool no_faces_
Whether to skip faces in reordering.
bool skip_faces() const
bool no_nodes_
Whether to skip vertices in reordering.
bool dump_
Whether to dump previous and new positions into text files.
bool no_elems_
Whether to skip elements in reordering.
bool skip_elems() const
void dump_to_file(const DoubleTab_T< _SIZE_ > &points, const std::string &filename) const