TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Fermeture_Systeme_Binaire.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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 <Fermeture_Systeme_Binaire.h>
17#include <Param.h>
18
19Implemente_instanciable(Fermeture_Systeme_Binaire, "Systeme_Binaire|Binary_System", Fermeture_Phase_field_base);
20
22{
23 return os << que_suis_je() << " " << le_nom() << finl;
24}
25
27{
28 Cerr << "Reading the " << que_suis_je() << " closures ..." << finl;
31
32 Param param(que_suis_je());
33 param.ajouter("alpha", &alpha_, Param::REQUIRED);
34 param.ajouter("multiplicateur_de_kappa", &mult_kappa_, Param::REQUIRED);
35 param.ajouter("beta", &beta_, Param::REQUIRED);
36 param.ajouter("kappa", &kappa_, Param::REQUIRED);
37 param.ajouter_non_std("potentiel_chimique", (this), Param::REQUIRED);
38 param.ajouter_non_std("kappa_variable", (this), Param::REQUIRED);
39 param.lire_avec_accolades_depuis(is);
40
41 if (type_kappa_ == 1)
42 kappa_ind_ = 1;
43 else if (type_kappa_ == 0)
44 kappa_ind_ = 0;
45
46 return is;
47}
48
50{
51 Motcle motlu;
52 if (mot == "potentiel_chimique")
53 {
54 is >> motlu;
55 if (motlu != "{")
56 {
57 Cerr << "Fermeture_Systeme_Binaire::readOn: We are expecting { after potentiel_chimique instead of " << motlu << finl;
59 }
60 Motcle temp_potentiel_chimique;
61 is >> temp_potentiel_chimique;
62 if (temp_potentiel_chimique == "defaut")
64 else if (temp_potentiel_chimique == "fonction")
65 {
66 potentiel_chimique_expr_.lire_f(is, 1);
68 }
69 else
70 {
71 Cerr << "Fermeture_Systeme_Binaire::readOn: " << temp_potentiel_chimique << " is not a valid keyword in potentiel_chimique block" << finl;
73 }
74 is >> motlu;
75 if (motlu != "}")
76 {
77 Cerr << "Fermeture_Systeme_Binaire::readOn: We are expecting } at the end of potentiel_chimique block instead of " << motlu << finl;
79 }
80 return 1;
81 }
82 else if (mot == "kappa_variable")
83 {
84 is >> motlu;
85 if (motlu != "{")
86 {
87 Cerr << "Fermeture_Systeme_Binaire::readOn: We are expecting { at the end of kappa_variable block instead of " << motlu << finl;
89 }
90 Motcle temp_type_kappa;
91 is >> temp_type_kappa;
92 if (temp_type_kappa == "non")
93 type_kappa_ = 0;
94 else
95 {
96 type_kappa_ = 1;
97 if (temp_type_kappa == "defaut")
99 else if (temp_type_kappa == "fonction")
100 {
101 kappa_forme_expr_.lire_f(is, 1);
103 }
104 else
105 {
106 Cerr << "Fermeture_Systeme_Binaire::readOn: " << temp_type_kappa << " is not a valid keyword in kappa_variable block" << finl;
107 Cerr << "You can specify only non, defaut or fonction expression for kappa_variable" << finl;
109 }
110 }
111 is >> motlu;
112 if (motlu != "}")
113 {
114 Cerr << "Fermeture_Systeme_Binaire::readOn: We are expecting } at the end of kappa_variable block instead of " << motlu << finl;
116 }
117 return 1;
118 }
119 return -1;
120}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
double kappa_func_c_general(const double) const
double(Fermeture_Phase_field_base::* kappa_func_c)(const double) const
double(Fermeture_Phase_field_base::* dWdc)(const double) const
double kappa_func_c_defaut(const double) const
double dWdc_defaut(const double) const
double dWdc_general(const double) const
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
A character string (Nom) in uppercase.
Definition Motcle.h:26
friend class Entree
Definition Objet_U.h:71
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 const Nom & le_nom() const
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Objet_U.cpp:317
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
@ REQUIRED
Definition Param.h:115
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