1 /*!
2  * \file  mfront/src/ImplicitGenericBehaviourDSL.cxx
3  * \brief
4  * \author Thomas Helfer
5  * \brief 18 févr. 2013
6  * \copyright Copyright (C) 2006-2018 CEA/DEN, EDF R&D. All rights
7  * reserved.
8  * This project is publicly released under either the GNU GPL Licence
9  * or the CECILL-A licence. A copy of thoses licences are delivered
10  * with the sources of TFEL. CEA or EDF may also distribute this
11  * project under specific licensing conditions.
12  */
13 
14 #include"MFront/ImplicitGenericBehaviourDSL.hxx"
15 
16 namespace mfront{
17 
ImplicitGenericBehaviourDSL()18   ImplicitGenericBehaviourDSL::ImplicitGenericBehaviourDSL() {
19     this->mb.setDSLName("ImplicitGenericBehaviour");
20     this->mb.declareAsGenericBehaviour();
21     this->registerNewCallBack("@Gradient",
22                               &ImplicitGenericBehaviourDSL::treatGradient);
23     this->registerNewCallBack(
24         "@ThermodynamicForce",
25         &ImplicitGenericBehaviourDSL::treatThermodynamicForce);
26     this->registerNewCallBack(
27         "@Flux", &ImplicitGenericBehaviourDSL::treatThermodynamicForce);
28     this->registerNewCallBack(
29         "@TangentOperatorBlock",
30         &ImplicitGenericBehaviourDSL::treatTangentOperatorBlock);
31     this->registerNewCallBack(
32         "@TangentOperatorBlocks",
33         &ImplicitGenericBehaviourDSL::treatTangentOperatorBlocks);
34     this->registerNewCallBack(
35         "@AdditionalTangentOperatorBlock",
36         &ImplicitGenericBehaviourDSL::treatAdditionalTangentOperatorBlock);
37     this->registerNewCallBack(
38         "@AdditionalTangentOperatorBlocks",
39         &ImplicitGenericBehaviourDSL::treatAdditionalTangentOperatorBlocks);
40     this->registerNewCallBack(
41         "@ComputeThermodynamicForces",
42         &ImplicitGenericBehaviourDSL::treatComputeThermodynamicForces);
43     this->registerNewCallBack(
44         "@ComputeFinalThermodynamicForces",
45         &ImplicitGenericBehaviourDSL::treatComputeFinalThermodynamicForces);
46   }  // end of ImplicitGenericBehaviourDSL::ImplicitGenericBehaviourDSL
47 
getName()48   std::string ImplicitGenericBehaviourDSL::getName() {
49     return "ImplicitGenericBehaviourDSL";
50   } // end of ImplicitGenericBehaviourDSL::getName
51 
getDescription()52   std::string ImplicitGenericBehaviourDSL::getDescription() {
53     return "this dsl provides a generic integrator based on a theta method.";
54   } // end of ImplicitGenericBehaviourDSL::getDescription
55 
getCodeBlockTemplate(const std::string & c,const MFrontTemplateGenerationOptions & o) const56   std::string ImplicitGenericBehaviourDSL::getCodeBlockTemplate(
57       const std::string& c, const MFrontTemplateGenerationOptions& o) const {
58     if (c == BehaviourData::ComputeThermodynamicForces) {
59       return "@ComputeThermodynamicForces{}\n";
60     }
61     return ImplicitDSLBase::getCodeBlockTemplate(c, o);
62   }  // end of ImplicitGenericBehaviourDSL::getCodeBlockTemplate
63 
getBehaviourDSLDescription() const64   BehaviourDSLDescription ImplicitGenericBehaviourDSL::getBehaviourDSLDescription() const {
65     auto d = BehaviourDSLDescription();
66     d.integrationScheme = IntegrationScheme::IMPLICITSCHEME;
67     d.typicalCodeBlocks = {BehaviourData::ComputePredictionOperator,
68                            BehaviourData::ComputePredictor,
69                            BehaviourData::ComputeThermodynamicForces,
70                            BehaviourData::Integrator,
71                            BehaviourData::ComputeTangentOperator};
72     d.minimalMFrontFileBody = "@Integrator{}\n\n";
73     return d;
74   }  // end of ImplicitGenericBehaviourDSL::getBehaviourDSLDescription
75 
76   ImplicitGenericBehaviourDSL::~ImplicitGenericBehaviourDSL() noexcept =
77           default;
78 
79 } // end of namespace mfront
80