TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Joint.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 <Joint.h>
17#include <Domaine.h>
18
19Implemente_instanciable_32_64(Joint_32_64,"Joint_32_64",Frontiere);
20
21// ***************************************************************
22// Implementation of the Joint_32_64 class
23// ***************************************************************
24
25/*! @brief Writes the joint to an output stream.
26 *
27 * We write:
28 * - the boundary
29 * - the neighboring PE
30 * - the thickness
31 * - the vertices
32 *
33 */
34template <typename _SIZE_>
36{
37 Frontiere_t::printOn(s) ;
38 s << "format_joint_250507" << finl;
39 s << PEvoisin_ << finl;
40 s << epaisseur_ << finl;
41 s << joint_item(JOINT_ITEM::SOMMET).items_communs() << finl;
42 s << joint_item(JOINT_ITEM::ELEMENT).items_distants() << finl;
43 return s ;
44}
45
46/*! @brief Reads a joint from an input stream.
47 *
48 */
49template <typename _SIZE_>
51{
52 Frontiere_t::readOn(s) ;
53 Nom format;
54 s >> format;
55 if (format!="format_joint_250507")
56 {
58 {
59 Cerr << "The format of .Zones is not recognized because probably too old." << finl;
60 Cerr << "Split your mesh with an executable which is more recent" << finl;
61 Cerr << "than the version 1.5.2 build 240507." << finl;
62 }
64 }
65 s >> PEvoisin_;
66 s >> epaisseur_;
67 s >> set_joint_item(JOINT_ITEM::SOMMET).set_items_communs();
68 s >> set_joint_item(JOINT_ITEM::ELEMENT).set_items_distants();
69 return s ;
70}
71
72/*! @brief
73 *
74 */
75template <typename _SIZE_>
77{
78 this->faces().dimensionner(i);
79 this->faces().voisins() = -1;
80 this->faces().les_sommets() = -1;
81}
82
83
84/*! @brief Adds faces to the boundary (to the joint). See Frontiere::ajouter_faces(const IntTab&).
85 *
86 * @param sommets Array containing the vertex indices of the faces to add.
87 */
88template <typename _SIZE_>
90{
91 this->faces().ajouter(sommets);
92 this->faces().voisins() = -1;
93}
94
95/*! @brief Returns the joint information for a given geometric item type, for filling the structures.
96 *
97 * These structures are generally filled by the Scatter class. Notable exceptions:
98 * Domaine_VDF and Domaine_VF for face renumbering.
99 *
100 * @param item The geometric item type.
101 * @return Reference to the corresponding Joint_Items structure.
102 */
103template <typename _SIZE_>
105{
106 switch(item)
107 {
108 case JOINT_ITEM::SOMMET:
109 return joint_sommets_;
110 case JOINT_ITEM::ELEMENT:
111 return joint_elements_;
112 case JOINT_ITEM::FACE:
113 return joint_faces_;
114 case JOINT_ITEM::ARETE:
115 return joint_aretes_;
116 case JOINT_ITEM::FACE_FRONT:
117 return joint_faces_front_;
118 default:
119 Cerr << "Error in Joint_32_64<_SIZE_>::set_joint_item, invalid item number : " << (int)item << finl;
121 }
122 return joint_sommets_; // never arrive here
123}
124
125/*! @brief Returns the joint information for the requested type (read-only).
126 *
127 * @param item The geometric item type.
128 * @return Const reference to the corresponding Joint_Items structure.
129 */
130template <typename _SIZE_>
132{
133 switch(item)
134 {
135 case JOINT_ITEM::SOMMET:
136 return joint_sommets_;
137 case JOINT_ITEM::ELEMENT:
138 return joint_elements_;
139 case JOINT_ITEM::FACE:
140 return joint_faces_;
141 case JOINT_ITEM::ARETE:
142 return joint_aretes_;
143 case JOINT_ITEM::FACE_FRONT:
144 return joint_faces_front_;
145 default:
146 Cerr << "Error in Joint_32_64<_SIZE_>::set_joint_item, invalid item number : " << (int)item << finl;
148 }
149 return joint_sommets_; // never arrive here
150}
151
152
153template class Joint_32_64<int>;
154#if INT_is_64_ == 2
155template class Joint_32_64<trustIdType>;
156#endif
157
158
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Faces_t & faces() const
Definition Frontiere.h:54
The Joint class is a Frontiere that contains the joint faces and vertices with the neighboring domain...
Definition Joint.h:34
const Joint_Items_t & joint_item(JOINT_ITEM type) const
Returns the joint information for the requested type (read-only).
Definition Joint.cpp:131
Joint_Items_32_64< _SIZE_ > Joint_Items_t
Definition Joint.h:44
void dimensionner(int)
Definition Joint.cpp:76
Joint_Items_t & set_joint_item(JOINT_ITEM type)
Returns the joint information for a given geometric item type, for filling the structures.
Definition Joint.cpp:104
IntTab_T< _SIZE_ > IntTab_t
Definition Joint.h:42
void ajouter_faces(const IntTab_t &)
Adds faces to the boundary (to the joint). See Frontiere::ajouter_faces(const IntTab&).
Definition Joint.cpp:89
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
Definition Process.cpp:82
Base class for output streams.
Definition Sortie.h:52