TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Extraire_surface_ALE.cpp
1/****************************************************************************
2* Copyright (c) 2023, 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 <Domaine_ALE.h>
17#include <Extraire_surface_ALE.h>
18#include <Probleme_base.h>
19#include <Equation_base.h>
20#include <NettoieNoeuds.h>
21#include <Parser_U.h>
22#include <Domaine.h>
23#include <Domaine_VF.h>
24#include <Param.h>
25
26Implemente_instanciable( Extraire_surface_ALE, "Extraire_surface_ALE", Extraire_surface ) ;
27// XD Extraire_surface_ALE interprete Extraire_surface_ALE BRACE Extraire_surface_ALE in order to extract a surface on a
28// XD_CONT mobile boundary (with ALE desciption). NL2 Keyword to specify that the extract surface is done on a mobile
29// XD_CONT domain. The surface mesh is defined by one or two conditions. The first condition is about elements with
30// XD_CONT Condition_elements. For example: Condition_elements x*x+y*y+z*z<1 NL2 Will define a surface mesh with
31// XD_CONT external faces of the mesh elements inside the sphere of radius 1 located at (0,0,0). The second condition
32// XD_CONT Condition_faces is useful to give a restriction.NL2 By default, the faces from the boundaries are not added
33// XD_CONT to the surface mesh excepted if option avec_les_bords is given (all the boundaries are added), or if the
34// XD_CONT option avec_certains_bords is used to add only some boundaries.
35// XD attr domaine ref_domaine domaine REQ Domain in which faces are saved
36// XD attr probleme ref_Pb_base probleme REQ Problem from which faces should be extracted
37// XD attr condition_elements chaine condition_elements OPT not_set
38// XD attr condition_faces chaine condition_faces OPT not_set
39// XD attr avec_les_bords rien avec_les_bords OPT not_set
40// XD attr avec_certains_bords listchaine avec_certains_bords OPT not_set
42{
43 return Extraire_surface::printOn( os );
44}
45
47{
48 return Extraire_surface::readOn( is );
49}
50/*Entree& Extraire_surface_ALE::interpreter_(Entree& is)
51{
52
53 Extraire_surface::interpreter_(is);
54
55 return is;
56}*/
57
58
60{
61 Nom nom_pb;
62 Nom nom_domaine_surfacique;
63 Nom expr_elements("1"),expr_faces("1");
64 bool avec_les_bords = false;
65 Noms noms_des_bords;
66 Param param(que_suis_je());
67 param.ajouter("Domaine",&nom_domaine_surfacique,Param::REQUIRED);
68 param.ajouter("probleme",&nom_pb,Param::REQUIRED);
69 param.ajouter("condition_elements",&expr_elements);
70 param.ajouter("condition_faces",&expr_faces);
71 param.ajouter_flag("avec_les_bords",&avec_les_bords);
72 param.ajouter("avec_certains_bords",&noms_des_bords);
74
75 associer_domaine(nom_domaine_surfacique);
76 Domaine& domaine_surfacique=domaine();
77
78 if (domaine_surfacique.nb_som_tot()!=0)
79 {
80 Cerr << "Error!" << finl;
81 Cerr <<"The domain " << domaine_surfacique.le_nom() << " can't be used by the Extraire_surface keyword." <<finl;
82 Cerr <<"The domain for Extraire_surface keyword should be empty and created just before." << finl;
84 }
85
86 // on recupere le pb
87 if(! sub_type(Probleme_base, objet(nom_pb)))
88 {
89 Cerr << nom_pb << " is of type " << objet(nom_pb).que_suis_je() << finl;
90 Cerr << "and not of type Probleme_base" << finl;
92 }
93 Probleme_base& pb=ref_cast(Probleme_base, objet(nom_pb));
94 const Domaine_VF& domaine_vf=ref_cast(Domaine_VF,pb.domaine_dis());
95 const Domaine& domaine_volumique = domaine_vf.domaine();
96
97 // Check that actually a Domaine_ALE:
98 if (!(sub_type(Domaine_ALE, domaine_surfacique)))
99 {
100 Cerr << "Extraire_surface_ALE needs a 'Domaine_ALE' object to work with!!" << finl;
101 Process::exit(-1);
102 }
103
104 Domaine_ALE& domaine_surfacique_ale = ref_cast(Domaine_ALE, domaine_surfacique);
105
106 Extraire_surface::extraire_surface_without_cleaning(domaine_surfacique_ale, domaine_volumique,nom_domaine_surfacique,domaine_vf,expr_elements,expr_faces,avec_les_bords,noms_des_bords);
107
108 IntTab les_elems_ref= domaine_surfacique.les_elems();
109 //We save the elements belonging to the surface; it contains the global numerations of the faces.
110 //Because after cleaning the global numerations of the faces will be lost.
111 domaine_surfacique_ale.set_les_elems_extrait_surf_reference(les_elems_ref);
112 NettoieNoeuds::nettoie(domaine_surfacique_ale);
113
114
115 return is;
116}
117
IntTab_t & les_elems()
Definition Domaine.h:129
int_t nb_som_tot() const
Returns the total number of vertices of the domain i.e. the number of real and virtual vertices on th...
Definition Domaine.h:123
void set_les_elems_extrait_surf_reference(const IntTab &)
class Domaine_VF
Definition Domaine_VF.h:44
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
const Domaine & domaine() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Entree & interpreter_(Entree &) override
Class Extraire_surface Reading a file.
static void extraire_surface_without_cleaning(Domaine &domaine_surfacique, const Domaine &domaine_volumique, const Nom &nom_domaine_surfacique, const Domaine_VF &domaine_vf, const Nom &expr_elements, const Nom &expr_faces, bool avec_les_bords, const Noms &noms_des_bords)
static Objet_U & objet(const Nom &)
See Interprete_bloc::objet_global(). BM: the Interprete class is not the best place for this.
static void nettoie(Domaine_t &)
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
An array of character strings (VECT(Nom)).
Definition Noms.h:26
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
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
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter_flag(const char *keyword, const bool *value)
Register a boolean flag whose mere presence switches it to true.
Definition Param.cpp:474
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
@ REQUIRED
Definition Param.h:115
int lire_avec_accolades_depuis(Entree &is)
Parse the parameter block { ... } from is.
Definition Param.cpp:32
class Probleme_base It is a Probleme_U that is not a coupling.
const Domaine_dis_base & domaine_dis() const
Returns the discretized domain associated with the problem (const version).
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52