tfel
Loading...
Searching...
No Matches
mfront::DSLBase Struct Referenceabstract

base structure for domain specific languages More...

#include </home/runner/work/tfel/tfel/mfront/include/MFront/DSLBase.hxx>

Inheritance diagram for mfront::DSLBase:
mfront::AbstractDSL tfel::utilities::CxxTokenizer tfel::utilities::CxxTokenizerOptions mfront::BehaviourDSLCommon mfront::MaterialPropertyDSL mfront::ModelDSLCommon mfront::BehaviourDSLBase< DefaultDSLBase > mfront::BehaviourDSLBase< ImplicitDSLBase > mfront::BehaviourDSLBase< IsotropicBehaviourDSLBase > mfront::BehaviourDSLBase< RungeKuttaDSLBase > mfront::BehaviourDSLBase< Child > mfront::ModelDSLBase< ModelDSL > mfront::ModelDSLBase< Child > mfront::DefaultDSLBase mfront::ImplicitDSLBase mfront::IsotropicBehaviourDSLBase mfront::RungeKuttaDSLBase mfront::ModelDSL mfront::DefaultCZMDSL mfront::DefaultDSL mfront::DefaultFiniteStrainDSL mfront::DefaultGenericBehaviourDSL mfront::DefaultModelDSL mfront::ImplicitCZMDSL mfront::ImplicitDSL mfront::ImplicitDSLII mfront::ImplicitFiniteStrainDSL mfront::ImplicitGenericBehaviourDSL mfront::ImplicitModelDSL mfront::IsotropicMisesCreepDSL mfront::IsotropicMisesPlasticFlowDSL mfront::IsotropicStrainHardeningMisesCreepDSL mfront::MultipleIsotropicMisesFlowsDSL mfront::RungeKuttaDSL mfront::RungeKuttaFiniteStrainDSL mfront::RungeKuttaGenericBehaviourDSL mfront::RungeKuttaModelDSL

Classes

struct  VariableModifier
 An helper structure used by the BehaviourDSLCommon class to modify the code provided by the user. More...
struct  WordAnalyser
 An helper structure used by the DSLBase class to modify the code provided by the user. More...
struct  CodeBlockParserOptions
 options passed to the readNextBlock member More...

Public Member Functions

std::vector< DSLOptionDescription > getDSLOptions () const override
const FileDescription & getFileDescription () const final
const TargetsDescription & getTargetsDescription () const override
virtual void openFile (const std::string &, const std::vector< std::string > &, const std::map< std::string, std::string > &)
 open a file and add given external instructions at the beginning
Public Member Functions inherited from mfront::AbstractDSL
virtual DSLTarget getTargetType () const =0
virtual const MaterialKnowledgeDescription & getMaterialKnowledgeDescription () const =0
virtual std::string getMaterialKnowledgeIdentifier () const =0
virtual std::string getMaterialName () const =0
virtual std::string getOverridableVariableNameByExternalName (const std::string &) const =0
virtual std::map< std::string, double > getOverridenParameters () const =0
virtual void analyseFile (const std::string &, const std::vector< std::string > &, const std::map< std::string, std::string > &)=0
 analyse a file
virtual void analyseString (const std::string &)=0
 analyse the specified string.
virtual void importFile (const std::string &, const std::vector< std::string > &, const std::map< std::string, std::string > &)=0
 import a file
virtual void endsInputFileProcessing ()=0
 method called at the end of the input file processing.
virtual void makeConsistencyChecks () const =0
 method called after processing the input file processing.
virtual void generateOutputFiles ()=0
 treat the specified file.
virtual void setInterfaces (const std::set< std::string > &)=0
 set list of interfaces
virtual void getKeywordsList (std::vector< std::string > &) const =0
 return the list of keywords usable with this parser
virtual ~AbstractDSL ()
 destructor
Public Member Functions inherited from tfel::utilities::CxxTokenizer
 CxxTokenizer ()
 default constructor
 CxxTokenizer (const CxxTokenizerOptions &)
 constructor with options
 CxxTokenizer (const std::string &)
 constructor from a file
 CxxTokenizer (const std::string &, const CxxTokenizerOptions &)
 constructor from a file
template<typename InputIterator>
void import (const InputIterator, const InputIterator)
 import the specified tokens
void parseString (const std::string &)
 analyse the string given all previous tokens are erased
void openFile (const std::string &)
 import the specified file
void printFileTokens (std::ostream &) const
 print the stored tokens to the specified stream
void setCStyleCommentOpened (const bool)
 assume that a C-style comment was opened at the beginning of the processing. This is usefull when parsing a file line by line
bool isCStyleCommentOpened () const
void setRawStringOpened (const bool)
 assume that a raw string was opened at the beginning of the processing.
void setRawStringDelimiter (std::string_view)
 set the raw string deliminter. This assume that a raw string was opened at the beginning of the processing, i.e. sets the rawStringOpened boolean to true.
bool isRawStringOpened () const
std::string getCurrentRawStringDelimiter () const noexcept
void stripComments ()
 remove all comment tokens
void clear ()
 clear the object
void treatCharAsString (const bool)
 set if char tokens shall be treated as string tokens
void keepCommentBoundaries (const bool)
 set if the comment boundaries must be left in the resulting tokens.
void treatDotAsSeparator (const bool)
 set if '.' shall be treated as as sperator
void treatPlusAsSeparator (const bool)
 set if '+' shall be treated as as sperator
void treatMinusAsSeparator (const bool)
 set if '-' shall be treated as as sperator
void mergeStrings (const bool)
 set if successive strings shall be merged
void extractNumbers (const bool)
 set if tokens shall be split to extract numbers
void addSeparator (const std::string &)
 add a new separator
void substitute (const std::map< std::string, std::string > &)
 apply the given substitutions by calling replace_all on the values hold by the standard and string tokens.
bool empty () const
const_iterator begin () const
const_iterator end () const
const_iterator cbegin () const
const_iterator cend () const
const Token & operator[] (const size_type) const
size_type size () const
virtual ~CxxTokenizer ()
 destructor

Static Public Member Functions

static tfel::utilities::DataMapValidator getDSLOptionsValidator ()
Static Public Member Functions inherited from tfel::utilities::CxxTokenizer
static bool isValidIdentifier (std::string_view, const IsValidIdentifierOptions &)
static bool isValidIdentifier (std::string_view, const bool=true)
static void checkNotEndOfLine (const std::string &, const_iterator &, const const_iterator)
 an helper method throwing an exception if the given iterator is egal to the third argument (which shall point after the last token of the line)
static void checkNotEndOfLine (const std::string &, const std::string &, const_iterator &, const const_iterator)
 an helper method throwing an exception if the given iterator is egal to the fourth argument (which shall point after the last token of the line)
static void readSpecifiedToken (const std::string &, const std::string &, const_iterator &, const const_iterator)
 an helper method throwing an exception if the given iterator is egal to the fourth argument (which shall point after the last token of the line) or if the given token is not equal to the expected value
static unsigned int readUnsignedInt (const_iterator &, const const_iterator)
 an helper method to extract an unsigned int from the given token
static std::string readString (const_iterator &, const const_iterator)
 an helper method to extract a string from the given token
static std::vector< std::string > readArray (const std::string &, const_iterator &, const const_iterator)
 an helper method to extract a set of values from the given as an array
static void readArray (const std::string &, std::vector< std::string > &, const_iterator &, const const_iterator)
 an helper method to extract a set of values from the given as an array
static std::vector< Token > readList (const std::string &, const std::string &, const std::string &, const_iterator &, const const_iterator)
 extract a list of token
static void readList (std::vector< Token > &, const std::string &, const std::string &, const std::string &, const_iterator &, const const_iterator)
 extract a list of token
static std::vector< std::string > readStringArray (const_iterator &, const const_iterator)
 an helper method to extract a set of values from the given as an array
static double readDouble (const_iterator &, const const_iterator)
 an helper method to extract a double from the given token
static int readInt (const_iterator &, const const_iterator)
 an helper method to extract a int from the given token

Static Public Attributes

static const char *const defaultOutOfBoundsPolicyOption
 standard option name
static const char *const runtimeModificationOfTheOutOfBoundsPolicyOption
 standard option name
static const char *const parametersAsStaticVariablesOption
 standard option name
static const char *const initializationFromFileOption
 standard option name
static const char *const validatorOption
 standard option name
static const char *const buildIdentifierOption
 standard option name
static const char *const overridingParameters
 standard option
static const char *const disableRuntimeChecksOption
 standard option name
static const char *const compatibilityModeOption
 standard option name

Protected Member Functions

 DSLBase (const DSLOptions &)
 constructor
virtual void addExternalMFrontFile (const std::string &, const std::vector< std::string > &, const tfel::utilities::DataMap &)=0
 add a dependency to an external MFront file
virtual DSLOptions buildDSLOptions () const =0
virtual void reserveName (const std::string &)=0
 register a name.
virtual bool isNameReserved (const std::string &) const =0
 look if a name is reserved
virtual void overrideMaterialKnowledgeIdentifier (const std::string &)
 specify the name of the implementation before parsing the MFront source file. Any name specified in the MFront file, through the @Law, @Behaviour or @Model keywords, will be ignored.
virtual void overrideMaterialName (const std::string &)
 specify the name of the material before parsing the MFront source file. Any material name specified with the @Material keyword will be ignored.
virtual void overrideAuthorName (const std::string &)
 specify the name of the author before parsing the MFront source file. Any author' name specified with the @Author keyword will be ignored.
virtual void overrideDate (const std::string &)
 specify the date of the MFront implementation before parsing the MFront source file. Any date specified with the @Date keyword will be ignored.
virtual void overrideDescription (const std::string &)
 specify the description of the MFront implementation before parsing the MFront source file. Any description specified with the @Description keyword will be ignored.
virtual void overrideUnitSystem (const std::string &)
 specify the unit system of the MFront implementation before parsing the MFront source file. Any unit system specified with the @UnitSystem keyword will be ignored.
virtual void overrideByAParameter (const std::string &, const double)=0
 specify that the given variable must be overriden by a parameter.
virtual void addStaticVariableDescription (const StaticVariableDescription &)=0
 add a static variable description
virtual std::map< std::string, int > getIntegerConstants () const =0
virtual int getIntegerConstant (const std::string &) const =0
virtual std::string getClassName () const =0
virtual void addMaterialLaw (const std::string &)=0
 add a material law
virtual void appendToIncludes (const std::string &)=0
 append the given code to the includes
virtual void appendToMembers (const std::string &)=0
 append the given code to the members
virtual void appendToPrivateCode (const std::string &)=0
 append the given code to the private code
virtual void appendToSources (const std::string &)=0
 append the given code to the sources
void checkNotEndOfFile (const std::string &, const std::string &="") const
 check that the end of file in not reached yet
void readSpecifiedToken (const std::string &, const std::string &)
 read a specified token and advance to the next token
void throwRuntimeError (const std::string &, const std::string &) const
 throw an std::runtime_error
std::string readUntilEndOfInstruction ()
unsigned short readUnsignedShort (const std::string &)
void readNextBlock (CodeBlock &, CodeBlock &, const CodeBlockParserOptions &, const CodeBlockParserOptions &)
 parse the next code block twice.
CodeBlock readNextBlock (const CodeBlockParserOptions &)
std::string readOnlyOneToken ()
 read one token and increment "current"
template<typename T>
std::pair< bool, T > readInitialisationValue (const std::string &, const bool)
virtual bool useQt () const =0
virtual void disableQuantitiesUsageIfNotAlreadySet ()=0
 disable the usage of quantities if not already set
virtual SupportedTypes::TypeParsingOptions getTypeParsingOptions () const
 return the type parsing options used by the DSL
std::string readType ()
 read a C++ type
std::optional< std::string > readVariableTypeIfPresent ()
 read a C++ type if present
bool readSafeOptionTypeIfPresent ()
unsigned int readArrayOfVariablesSize (const std::string &, const bool)
void readVarList (VariableDescriptionContainer &, const std::string &, const bool)
void readVarList (VariableDescriptionContainer &, const bool)
bool readBooleanValue (const std::string &)
std::string readString (const std::string &)
std::vector< std::string > readArrayOfString (const std::string &)
std::vector< double > readArrayOfDouble (const std::string &)
std::vector< std::string > readStringOrArrayOfString (const std::string &)
void readList (std::vector< tfel::utilities::Token > &, const std::string &, const std::string &, const std::string &, const bool)
 extract a list of token
std::vector< tfel::utilities::Token > readList (const std::string &, const std::string &, const std::string &, const bool)
std::string readSpecifiedValue (const std::string &, const std::string &)
std::vector< std::string > readSpecifiedValues (const std::string &, const std::string &, const std::string &)
std::vector< std::string > readSpecifiedValues (const std::string &, const std::vector< std::string > &)
std::pair< std::string, VariableBoundsDescription > readVariableBounds ()
 read the bounds associated to a variable
virtual void callMFront (const std::vector< std::string > &, const std::vector< std::string > &, const tfel::utilities::DataMap &)
virtual std::shared_ptr< MaterialPropertyDescription > handleMaterialPropertyDescription (const std::string &)
 This function handles a material property treated as a dependency of the current file.
virtual void setMaterial (const std::string &)=0
 set the material described by the implementation
virtual void setUnitSystem (const std::string_view)=0
 set the unit system
virtual void setMaterialKnowledgeIdentifier (const std::string &)=0
 set the name of the implementation, i.e. the material property' name, the behaviour' name or the model' name.
virtual void setAuthor (const std::string &)
 set the author of the implementation
virtual void setDate (const std::string &)
 set the date at which the implementation has been written
virtual void setDescription (const std::string &)
 set the description of the MFront file
virtual void treatMaterial ()
 treat the @Material keyword
virtual void treatUnitSystem ()
 treat the @UnitSystem keyword
virtual void treatMFront ()
 handle the @MFront keyword
virtual void treatImport ()
 handle the @Import keyword
virtual void treatMaterialLaw ()
 handle the @MaterialLaw keyword
virtual void treatLink ()
 handle the @Link keyword
virtual void treatTFELLibraries ()
 handle the @TFELLibraries keyword
virtual void treatAuthor ()
 handle the @Author keyword
virtual void treatDate ()
 handle the @Data keyword
virtual void treatIncludes ()
 handle the @Includes keyword
virtual void treatSources ()
 handle the @Sources keyword
virtual void treatPrivate ()
 handle the @Private keyword
virtual void treatMembers ()
 handle the @Members keyword
virtual void treatDSL ()
 handle the @DSL or @Parser keyword
virtual void treatStaticVar ()
 handle the @StaticVar keyword
virtual void treatIntegerConstant ()
 handle the @IntegerConstant keyword
virtual void treatDescription ()
 handle the @Description keyword
virtual void treatLonelySeparator ()
 handle the @LonelySeparator keyword
virtual void ignoreKeyWord (const std::string &)
virtual void treatUnknownKeyword ()
 treat an unknown keyword
virtual void completeTargetsDescription ()
 this method must be called at the end of the treatment:
virtual void registerIntegerConstant (const std::string &, const size_t, const int)
 register an integer constant.
double readDouble ()
 extract a double from the current token
 ~DSLBase () override
 destructor
Protected Member Functions inherited from tfel::utilities::CxxTokenizer
virtual void parseStream (std::istream &, Token::size_type &, const std::string &)
 tokenize the lines of a stream
virtual void splitLine (const std::string &, const Token::size_type)
virtual void parseChar (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type)
virtual void parseString (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type, const char)
virtual void parseCComment (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type)
virtual void parseCxxComment (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type)
virtual void try_join (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type, const char)
virtual void try_join (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type, const char, const char)
virtual void parseNumber (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type)
 read a number
virtual void parsePreprocessorDirective (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const std::string::const_iterator, const Token::size_type)
virtual void parseStandardLine (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const std::string::const_iterator, const Token::size_type)
virtual void parseRawString (Token::size_type &, std::string::const_iterator &, const std::string::const_iterator, const Token::size_type, const Token::size_type)
 read the contents of a raw string literal, which starts at the current iterator, past the opening R"delim( prefix
Protected Member Functions inherited from tfel::utilities::CxxTokenizerOptions
 CxxTokenizerOptions ()
 default constructor
 CxxTokenizerOptions (const CxxTokenizerOptions &)
 copy constructor
 CxxTokenizerOptions (CxxTokenizerOptions &&) noexcept
 move constructor
CxxTokenizerOptions & operator= (const CxxTokenizerOptions &)
 standard assignement
CxxTokenizerOptions & operator= (CxxTokenizerOptions &&) noexcept
 move assignement
 ~CxxTokenizerOptions ()
 destructor

Static Protected Member Functions

static std::vector< std::string > getDefaultReservedNames ()
static void handleDSLOptions (MaterialKnowledgeDescription &, const DSLOptions &)
 handle DSL options
static DSLOptions buildCommonDSLOptions (const MaterialKnowledgeDescription &)
 extract common options
Static Protected Member Functions inherited from tfel::utilities::CxxTokenizer
static bool isValidFunctionIdentifier (const std::string &, const bool=true)

Protected Attributes

FileDescription fd
 description of the file treated
TargetsDescription td
 main targets description
std::vector< std::string > ldflags
 additional linker flags
std::vector< std::string > additional_libraries_sources
 additional libraries's sources
std::vector< std::string > link_libraries
 additional link libraries
std::vector< std::string > link_directories
 additional link directories
std::vector< TargetsDescription > atds
 auxiliary target descriptions
TokensContainer::const_iterator current
 current position in the input stream
std::string currentComment
 current comment This is the user comment associated with the current keyword, if any.
std::string overriden_implementation_name
 overriden implementation name
std::string overriden_material
 overriden material
std::string overriden_author
 overriden author
std::string overriden_date
 overriden date
std::string overriden_description
 overriden description
std::string overriden_unit_system
 overriden unit system
Protected Attributes inherited from tfel::utilities::CxxTokenizer
std::vector< std::string > additional_separators
TokensContainer tokens
 list of tokens read
std::map< Token::size_type, std::string > comments
 store the comments which have been removed by the stripComments method. The key of the map is the line a comment starts on and the value is the values of the comments of this line, in the order they appear in the line, separated by a space character.
bool cStyleCommentOpened = false
 if true, a cStyle comment what opened when the last line treatment was finised
bool rawStringOpened = false
std::string currentRawStringDelimiter
 name of the current delimiter for a raw string
Protected Attributes inherited from tfel::utilities::CxxTokenizerOptions
bool bKeepCommentBoundaries = false
 if true, keep the comment boundaries
bool shallMergeStrings = false
 if true, successive strings are merged
bool allowStrayHashCharacter = false
 allow stray hash character
bool treatHashCharacterAsCommentDelimiter = false
 the hash character can start a comment, as in python, shell, etc..
bool allowStrayBackSlash = false
 allow stray backslash
bool treatPreprocessorDirectives = true
 treat preprocessor directives
bool treatStrings = true
 treat strings and characters If false, the ' and '"' are treated as indivdual tokens
bool treatNumbers = true
 extract number
bool treatCComments = true
 treat comments
bool treatCxxComments = true
 treat comments
bool joinCxxTwoCharactersSeparators = true
bool graveAccentAsSeparator = true
 strings and characters
bool charAsString = false
bool dotAsSeparator = true
 treat . as a separator
bool plusAsSeparator = true
 treat + as a separator
bool minusAsSeparator = true
 treat - as a separator
bool addCurlyBraces = false
 add curly braces at the beginning and at the end of the file

Additional Inherited Members

Public Types inherited from mfront::AbstractDSL
enum  DSLTarget { MATERIALPROPERTYDSL , BEHAVIOURDSL , MODELDSL }
 list of dsl targets
using DSLOptions = tfel::utilities::DataMap
 a simple alias
Public Types inherited from tfel::utilities::CxxTokenizer
using TokensContainer = std::vector<Token>
 a simple alias
using const_iterator = TokensContainer::const_iterator
 a simple alias
using size_type = TokensContainer::size_type
 a simple alias

Detailed Description

base structure for domain specific languages

Constructor & Destructor Documentation

◆ DSLBase()

mfront::DSLBase::DSLBase ( const DSLOptions & )
explicitprotected

constructor

Parameters
[in]optsoptions passed to the DSL

Member Function Documentation

◆ addExternalMFrontFile()

virtual void mfront::DSLBase::addExternalMFrontFile ( const std::string & ,
const std::vector< std::string > & ,
const tfel::utilities::DataMap &  )
protectedpure virtual

add a dependency to an external MFront file

Parameters
[in]ffile path
[in]interfaceslist of interfaces used to treat the file

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ addMaterialLaw()

virtual void mfront::DSLBase::addMaterialLaw ( const std::string & )
protectedpure virtual

add a material law

Parameters
[in]m: added material law name

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ addStaticVariableDescription()

virtual void mfront::DSLBase::addStaticVariableDescription ( const StaticVariableDescription & )
protectedpure virtual

add a static variable description

Parameters
[in]v: variable description

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ appendToIncludes()

virtual void mfront::DSLBase::appendToIncludes ( const std::string & )
protectedpure virtual

append the given code to the includes

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ appendToMembers()

virtual void mfront::DSLBase::appendToMembers ( const std::string & )
protectedpure virtual

append the given code to the members

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ appendToPrivateCode()

virtual void mfront::DSLBase::appendToPrivateCode ( const std::string & )
protectedpure virtual

append the given code to the private code

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ appendToSources()

virtual void mfront::DSLBase::appendToSources ( const std::string & )
protectedpure virtual

append the given code to the sources

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ buildCommonDSLOptions()

DSLOptions mfront::DSLBase::buildCommonDSLOptions ( const MaterialKnowledgeDescription & )
staticprotected

extract common options

Parameters
[in]dmaterial knowledge description

◆ callMFront()

virtual void mfront::DSLBase::callMFront ( const std::vector< std::string > & ,
const std::vector< std::string > & ,
const tfel::utilities::DataMap &  )
protectedvirtual

call mfront in a subprocess

Parameters
[in]files: list of files
[in]interfaces: list of interfaces
[in]dsl_optionsDSL options

◆ checkNotEndOfFile()

void mfront::DSLBase::checkNotEndOfFile ( const std::string & ,
const std::string & = "" ) const
protected

check that the end of file in not reached yet

Parameters
[in]mcalling method name
[in]eerror message

◆ completeTargetsDescription()

virtual void mfront::DSLBase::completeTargetsDescription ( )
protectedvirtual

this method must be called at the end of the treatment:

  • to set each libraries defined the auxiliary targets as dependencies of the librairies defined in the main one. -
  • merge the auxiliary targets descriptions into the main one.
  • clear the auxiliary targets descriptions

◆ disableQuantitiesUsageIfNotAlreadySet()

virtual void mfront::DSLBase::disableQuantitiesUsageIfNotAlreadySet ( )
protectedpure virtual

disable the usage of quantities if not already set

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ getClassName()

virtual std::string mfront::DSLBase::getClassName ( ) const
nodiscardprotectedpure virtual
Returns
the name of the generated class

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ getDefaultReservedNames()

std::vector< std::string > mfront::DSLBase::getDefaultReservedNames ( )
staticprotected
Returns
a list of names that shall be reserved

◆ getDSLOptions()

std::vector< DSLOptionDescription > mfront::DSLBase::getDSLOptions ( ) const
nodiscardoverridevirtual
Returns
the list of options accepted by the DSL

Implements mfront::AbstractDSL.

◆ getDSLOptionsValidator()

tfel::utilities::DataMapValidator mfront::DSLBase::getDSLOptionsValidator ( )
static
Returns
a validator for the options passed to the DSL

◆ getFileDescription()

const FileDescription & mfront::DSLBase::getFileDescription ( ) const
nodiscardfinalvirtual
Returns
the file description associated with the treated file

Implements mfront::AbstractDSL.

◆ getIntegerConstant()

virtual int mfront::DSLBase::getIntegerConstant ( const std::string & ) const
nodiscardprotectedpure virtual
Returns
the value of an integer constant
Parameters
[in]nvariable name

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ getIntegerConstants()

virtual std::map< std::string, int > mfront::DSLBase::getIntegerConstants ( ) const
nodiscardprotectedpure virtual
Returns
all the integer constants (static variables of the integer type)

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ getTargetsDescription()

const TargetsDescription & mfront::DSLBase::getTargetsDescription ( ) const
nodiscardoverridevirtual
Returns
the target description
Note
This method shall be called after the analyseFile or analyseString methods.

Implements mfront::AbstractDSL.

◆ handleDSLOptions()

void mfront::DSLBase::handleDSLOptions ( MaterialKnowledgeDescription & ,
const DSLOptions &  )
staticprotected

handle DSL options

Parameters
[in]dmaterial knowledge description
[in]optsoptions

◆ handleMaterialPropertyDescription()

virtual std::shared_ptr< MaterialPropertyDescription > mfront::DSLBase::handleMaterialPropertyDescription ( const std::string & )
nodiscardprotectedvirtual

This function handles a material property treated as a dependency of the current file.

This function:

  • analyse the given file using the MaterialPropertyDSL
  • register the function name generated by the MFront interface
  • add the function name to the list of material laws used by the current file
  • declared the headers generated by the MFront interface for inclusion
  • launch mfront in a sub-process to generate the source files associated with this material property and have them compiled when mandatory (done by the callMFront method).
Parameters
[in]f: file in which the material law is implemented. This must be the full path.

Reimplemented in mfront::BehaviourDSLCommon.

◆ isNameReserved()

virtual bool mfront::DSLBase::isNameReserved ( const std::string & ) const
nodiscardprotectedpure virtual

look if a name is reserved

Parameters
[in]n: name

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ openFile()

virtual void mfront::DSLBase::openFile ( const std::string & ,
const std::vector< std::string > & ,
const std::map< std::string, std::string > &  )
virtual

open a file and add given external instructions at the beginning

Parameters
[in]f: file
[in]ecmds: external commands
[in]s: substitutions patterns inserted (those substitutions are given through command-line options such as --@YYY@=XXX)

◆ overrideAuthorName()

virtual void mfront::DSLBase::overrideAuthorName ( const std::string & )
protectedvirtual

specify the name of the author before parsing the MFront source file. Any author' name specified with the @Author keyword will be ignored.

Parameters
[in]aauthor' name

◆ overrideByAParameter()

virtual void mfront::DSLBase::overrideByAParameter ( const std::string & ,
const double  )
protectedpure virtual

specify that the given variable must be overriden by a parameter.

Parameters
[in]nvariable name
[in]vvariable value

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ overrideDate()

virtual void mfront::DSLBase::overrideDate ( const std::string & )
protectedvirtual

specify the date of the MFront implementation before parsing the MFront source file. Any date specified with the @Date keyword will be ignored.

Parameters
[in]ddate

◆ overrideDescription()

virtual void mfront::DSLBase::overrideDescription ( const std::string & )
protectedvirtual

specify the description of the MFront implementation before parsing the MFront source file. Any description specified with the @Description keyword will be ignored.

Parameters
[in]ddescription

◆ overrideMaterialKnowledgeIdentifier()

virtual void mfront::DSLBase::overrideMaterialKnowledgeIdentifier ( const std::string & )
protectedvirtual

specify the name of the implementation before parsing the MFront source file. Any name specified in the MFront file, through the @Law, @Behaviour or @Model keywords, will be ignored.

Parameters
[in]iname of the implementation

◆ overrideMaterialName()

virtual void mfront::DSLBase::overrideMaterialName ( const std::string & )
protectedvirtual

specify the name of the material before parsing the MFront source file. Any material name specified with the @Material keyword will be ignored.

Parameters
[in]mmaterial' name

◆ overrideUnitSystem()

virtual void mfront::DSLBase::overrideUnitSystem ( const std::string & )
protectedvirtual

specify the unit system of the MFront implementation before parsing the MFront source file. Any unit system specified with the @UnitSystem keyword will be ignored.

Parameters
[in]sunit system

◆ readArrayOfDouble()

std::vector< double > mfront::DSLBase::readArrayOfDouble ( const std::string & )
nodiscardprotected

extract an array of double starting from the current token and go the token following the end of the array

Parameters
[in]m: calling method name (used for error message)
Returns
the extracted array of doubles

◆ readArrayOfString()

std::vector< std::string > mfront::DSLBase::readArrayOfString ( const std::string & )
nodiscardprotected

extract an array of string starting from the current token and go the token following the end of the array

Parameters
[in]m: calling method name (used for error message)
Returns
the extracted array of strings

◆ readArrayOfVariablesSize()

unsigned int mfront::DSLBase::readArrayOfVariablesSize ( const std::string & ,
const bool  )
nodiscardprotected
Returns
the size of an array of variables, or 1 if the variable are not defined as an array.
Parameters
[in]nvariable name
[in]ballow arrays of variables to be defined

◆ readBooleanValue()

bool mfront::DSLBase::readBooleanValue ( const std::string & )
nodiscardprotected

extract a boolean value from the current token and go the next token

Parameters
[in]m: calling method name (used for error message)
Returns
the boolean value read

◆ readList() [1/2]

std::vector< tfel::utilities::Token > mfront::DSLBase::readList ( const std::string & ,
const std::string & ,
const std::string & ,
const bool  )
nodiscardprotected
Returns
a list of token
Parameters
[in]m: calling method name (used for error message)
[in]db: beginning delimiter
[in]de: end delimiter
[in]b: if the current value is not the beginning delimiter (or is past the end of the file), nothing is returned if this parameter is true. An exception is thrown otherwise

◆ readList() [2/2]

void mfront::DSLBase::readList ( std::vector< tfel::utilities::Token > & ,
const std::string & ,
const std::string & ,
const std::string & ,
const bool  )
protected

extract a list of token

Parameters
[out]l: list read
[in]m: calling method name (used for error message)
[in]db: beginning delimiter
[in]de: end delimiter
[in]b: if the current value is not the beginning delimiter (or is past the end of the file), nothing is returned if this parameter is true. An exception is thrown otherwise

◆ readNextBlock() [1/2]

void mfront::DSLBase::readNextBlock ( CodeBlock & ,
CodeBlock & ,
const CodeBlockParserOptions & ,
const CodeBlockParserOptions &  )
protected

parse the next code block twice.

Parameters
[out]res1: resulting code block with the first option set.
[out]res2: resulting code block with the second option set.
[in]o1: first option set.
[in]o2: second option set.

◆ readNextBlock() [2/2]

CodeBlock mfront::DSLBase::readNextBlock ( const CodeBlockParserOptions & )
nodiscardprotected
Returns
the code block read.
Parameters
[in]o: options

◆ readSafeOptionTypeIfPresent()

bool mfront::DSLBase::readSafeOptionTypeIfPresent ( )
nodiscardprotected
Returns
true if the next tokens are '<safe>', false otherwise

◆ readSpecifiedToken()

void mfront::DSLBase::readSpecifiedToken ( const std::string & ,
const std::string &  )
protected

read a specified token and advance to the next token

Parameters
[in]mcalling method name
[in]vexpected value

◆ readString()

std::string mfront::DSLBase::readString ( const std::string & )
nodiscardprotected

extract a string from the current token and go the next token

Parameters
[in]m: calling method name (used for error message)
Returns
the extracted string

◆ readStringOrArrayOfString()

std::vector< std::string > mfront::DSLBase::readStringOrArrayOfString ( const std::string & )
nodiscardprotected

extract an array of string starting from the current token and go the token following the end of the array

Parameters
[in]m: calling method name (used for error message)
Returns
the extracted array of strings which contains only one element if a string was read

◆ readUnsignedShort()

unsigned short mfront::DSLBase::readUnsignedShort ( const std::string & )
nodiscardprotected

read an unsigned short in the file

Parameters
[in]m: calling method

◆ readUntilEndOfInstruction()

std::string mfront::DSLBase::readUntilEndOfInstruction ( )
nodiscardprotected
Returns
concatenate all the tokens from the current position up to the first ';' token

◆ readVariableBounds()

std::pair< std::string, VariableBoundsDescription > mfront::DSLBase::readVariableBounds ( )
nodiscardprotected

read the bounds associated to a variable

Returns
a pair giving the variable name and the bounds

◆ readVarList() [1/2]

void mfront::DSLBase::readVarList ( VariableDescriptionContainer & ,
const bool  )
protected
Parameters
[in]cont: variable container to wich variables are added
[in]allowArray: allow arrays of variables to be defined

◆ readVarList() [2/2]

void mfront::DSLBase::readVarList ( VariableDescriptionContainer & ,
const std::string & ,
const bool  )
protected
Parameters
[in]cont: variable container to wich variables are added
[in]type: type of the variable
[in]allowArray: allow arrays of variables to be defined

◆ registerIntegerConstant()

virtual void mfront::DSLBase::registerIntegerConstant ( const std::string & ,
const size_t ,
const int  )
protectedvirtual

register an integer constant.

Parameters
[in]nname of the constant
[in]lline number
[in]vvalue

◆ reserveName()

virtual void mfront::DSLBase::reserveName ( const std::string & )
protectedpure virtual

register a name.

Parameters
[in]n: name

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ setMaterial()

virtual void mfront::DSLBase::setMaterial ( const std::string & )
protectedpure virtual

set the material described by the implementation

Parameters
[in]mmaterial name

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ setMaterialKnowledgeIdentifier()

virtual void mfront::DSLBase::setMaterialKnowledgeIdentifier ( const std::string & )
protectedpure virtual

set the name of the implementation, i.e. the material property' name, the behaviour' name or the model' name.

Parameters
[in]iimplementation name

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ setUnitSystem()

virtual void mfront::DSLBase::setUnitSystem ( const std::string_view )
protectedpure virtual

set the unit system

Parameters
[in]sunit system

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

◆ throwRuntimeError()

void mfront::DSLBase::throwRuntimeError ( const std::string & ,
const std::string &  ) const
protected

throw an std::runtime_error

Parameters
[in]mcalling method name
[in]eerror message

◆ treatMembers()

virtual void mfront::DSLBase::treatMembers ( )
protectedvirtual

handle the @Members keyword

Reimplemented in mfront::BehaviourDSLCommon.

◆ treatPrivate()

virtual void mfront::DSLBase::treatPrivate ( )
protectedvirtual

handle the @Private keyword

Reimplemented in mfront::BehaviourDSLCommon.

◆ treatUnknownKeyword()

virtual void mfront::DSLBase::treatUnknownKeyword ( )
protectedvirtual

◆ useQt()

virtual bool mfront::DSLBase::useQt ( ) const
nodiscardprotectedpure virtual
Returns
if the usage of quantities is alllowed

Implemented in mfront::BehaviourDSLCommon, mfront::MaterialPropertyDSL, and mfront::ModelDSLCommon.

Member Data Documentation

◆ currentComment

std::string mfront::DSLBase::currentComment
protected

current comment This is the user comment associated with the current keyword, if any.

Note
This variable is automatically set by parsers before calling the callback associated with the keyword and automatically unset once the callback returns.

◆ td

TargetsDescription mfront::DSLBase::td
protected

main targets description

Targets description are generated by the processing of the input file. However, it is convenient to distinguish during the processing phase:

  • the main targets which directly result from the processing of the current file. Those targets can only completly be defined at the end of the processing.
  • the auxiliary targets descriptions for targets generated indirectly (for example by importing material law using the @MaterialLaw keyword).

Once the input is completely processed, the auxiliary targets descriptions are merged into the main one using the completeTargetsDescription method.


The documentation for this struct was generated from the following files: