TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Groupes_Faces.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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#include <Groupes_Faces.h>
17
18Implemente_instanciable_32_64(Groupes_Faces_32_64, "Groupes_Faces", LIST(Groupe_Faces_32_64<_T_>));
19
20template <typename _SIZE_>
22
23template <typename _SIZE_>
25
26/*! @brief Associates a domain to all Groupe_Faces objects in the list.
27 *
28 * @param (Domaine& un_domaine) the domain to associate with the Groupe_Faces objects in the list
29 */
30template <typename _SIZE_>
32{
33 for (auto& itr : *this) itr.associer_domaine(un_domaine);
34}
35
36/*! @brief Returns the total number of faces contained in the list of Groupe_Faces, i.
37 *
38 * e. the sum of all
39 * faces of all Groupe_Faces objects contained in
40 * the list.
41 *
42 * @return (int) the total number of faces contained in the list of Groupe_Faces
43 */
44template <typename _SIZE_>
46{
47 int_t nombre = 0;
48 for (const auto &itr : *this) nombre += itr.nb_faces();
49
50 return nombre;
51}
52
53/*! @brief Returns the total number of faces of the specified type contained in the list of Groupe_Faces,
54 *
55 * i.e. the sum of all faces of the specified type
56 * of all Groupe_Faces objects contained in
57 * the list.
58 *
59 * @param (Type_Face type) the type of faces to count
60 * @return (int) the total number of faces of the specified type contained in the list of Groupe_Faces
61 */
62template <typename _SIZE_>
64{
65 int_t nombre = 0;
66 for (const auto &itr : *this)
67 if (type == itr.faces().type_face()) nombre += itr.nb_faces();
68
69 return nombre;
70}
71
72/*! Updates the face group indices using an inverse table: reverse_index[old_index] = new_index.
73 * Necessary when face indices have been modified.
74 */
75template <typename _SIZE_>
77{
78 for (auto &itr : *this)
79 {
80 ArrOfInt_t& indices_faces = itr.get_indices_faces();
81 const int_t nbfaces2 = indices_faces.size_array();
82 assert(nbfaces2 == itr.nb_faces());
83 for (int_t i = 0; i < nbfaces2; i++)
84 {
85 const int_t old = indices_faces[i]; // old local index
86 indices_faces[i] = reverse_index[old];
87 }
88 }
89}
90
91
92template class Groupes_Faces_32_64<int>;
93#if INT_is_64_ == 2
95#endif
96
97
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Groupe_Face class — represents a selection of faces read from a med file.
Groupes_Faces class — represents a list of Groupe_Faces objects.
Domaine_32_64< _SIZE_ > Domaine_t
ArrOfInt_T< _SIZE_ > ArrOfInt_t
void associer_domaine(const Domaine_t &)
Associates a domain to all Groupe_Faces objects in the list.
void renumerote(ArrOfInt_t &reverse_index)
int_t nb_faces() const
Returns the total number of faces contained in the list of Groupe_Faces, i.
Base class for output streams.
Definition Sortie.h:52
_SIZE_ size_array() const