TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Point.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 <Point.h>
17#include <Domaine.h>
18
19Implemente_instanciable_32_64(Point_32_64,"Point",Elem_geom_base_32_64<_T_>);
20// XD point points point NO_BRACE Point as class-daughter of Points.
21
22/*! @brief Does nothing.
23 *
24 * @param (Sortie& s) an output stream
25 * @return (Sortie&) the output stream
26 */
27template<typename _SIZE_>
29{
30 return s;
31}
32
33
34/*! @brief Does nothing.
35 *
36 * @param (Entree& s) an input stream
37 * @return (Entree&) the input stream
38 */
39template<typename _SIZE_>
41{
42 return s;
43}
44
45/*! @brief Returns the LML name of a point element = "VOXEL8".
46 *
47 * @return (Nom&) always equal to "VOXEL8"
48 */
49template<typename _SIZE_>
51{
52 static Nom nom="POINT";
53 return nom;
54}
55
56
57/*! @brief Returns 1 if element ielem of the domain associated with the geometric element contains the point
58 *
59 * with coordinates specified by parameter "pos".
60 * Returns 0 otherwise.
61 *
62 * @param (DoubleVect& pos) coordinates of the point to locate
63 * @param (int element) the index of the domain element in which the point is searched.
64 * @return (int) 1 if the point belongs to element "element", 0 otherwise
65 */
66template<typename _SIZE_>
67int Point_32_64<_SIZE_>::contient(const ArrOfDouble& pos, int_t element ) const
68{
69 assert(pos.size_array()==this->dimension);
70
71 const Domaine_t& dom=this->mon_dom.valeur();
72 const IntTab_t& elem=dom.les_elems();
73 int ok=1;
74 for (int d=0; (d<3)&&(ok==1); d++)
75 {
76 double ps = dom.coord(elem(element,0), d);
77 double pv = pos[d];
78 if( !est_egal(ps,pv)) ok=0;
79 }
80 return ok;
81}
82
83/*! @brief Returns 1 if the vertices specified by parameter "pos" are the vertices of element "element" of the domain associated with
84 *
85 * the geometric element.
86 *
87 * @param (IntVect& pos) the vertex indices to compare with those of element "element"
88 * @param (int element) the index of the domain element whose vertices are to be compared
89 * @return (int) 1 if the vertices passed as parameter are those of the specified element, 0 otherwise
90 */
91template<typename _SIZE_>
93{
94 abort();
95
96 assert(pos.size_array()==1);
97 const Domaine_t& dom=this->mon_dom.valeur();
98 if((dom.sommet_elem(element,0)==pos[0])&&
99 (dom.sommet_elem(element,1)==pos[1]))
100 return 1;
101 else
102 return 0;
103}
104
105
106/*! @brief voir ElemGeomBase::get_tab_faces_sommets_locaux
107 */
108template<typename _SIZE_>
110{
111 faces_som_local.resize(1,1);
112 faces_som_local[0]=0;
113 return 1;
114}
115
116
117
118template class Point_32_64<int>;
119#if INT_is_64_ == 2
120template class Point_32_64<trustIdType>;
121#endif
122
IntTab_t & les_elems()
Definition Domaine.h:129
double coord(int_t i, int j) const
Definition Domaine.h:110
int_t sommet_elem(int_t i, int j) const
Returns the (global) number of the j-th vertex of the i-th element.
Definition Domaine.h:136
Class Elem_geom_base This class is the base class for the definition of elements.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
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
Class Point: represents the geometric element point.
Definition Point.h:29
int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const override
voir ElemGeomBase::get_tab_faces_sommets_locaux
Definition Point.cpp:109
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
Definition Point.h:37
int contient(const ArrOfDouble &pos, int_t elem) const override
Returns 1 if element ielem of the domain associated with the geometric element contains the point.
Definition Point.cpp:67
const Nom & nom_lml() const override
Returns the LML name of a point element = "VOXEL8".
Definition Point.cpp:50
Domaine_32_64< _SIZE_ > Domaine_t
Definition Point.h:39
IntTab_T< _SIZE_ > IntTab_t
Definition Point.h:36
_SIZE_ int_t
Definition Point.h:35
static void abort()
Abort routine for TRUST on a fatal error.
Definition Process.cpp:573
Base class for output streams.
Definition Sortie.h:52
_SIZE_ size_array() const
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469