1 /*! 2 * \file include/TFEL/System/ExternalLibraryManager.hxx 3 * \brief 4 * \author Thomas Helfer 5 * \date 31 Oct 2007 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 #ifndef LIB_EXTERNALLIBRARYMANAGER_HXX 15 #define LIB_EXTERNALLIBRARYMANAGER_HXX 16 17 #include <map> 18 #include <vector> 19 #include <string> 20 21 #if (defined _WIN32 || defined _WIN64) && (!defined __CYGWIN__) 22 #include <windows.h> 23 #ifdef small 24 #undef small 25 #endif /* small */ 26 #endif /* LIB_EXTERNALLIBRARYMANAGER_HXX */ 27 28 #include "TFEL/Config/TFELConfig.hxx" 29 #include "TFEL/Material/OutOfBoundsPolicy.hxx" 30 #include "TFEL/System/ExternalFunctionsPrototypes.hxx" 31 32 namespace tfel { 33 34 namespace system { 35 36 /*! 37 * \brief Structure in charge of loading external function and 38 * retrieving information from shared libraries. 39 */ 40 struct TFELSYSTEM_VISIBILITY_EXPORT ExternalLibraryManager { 41 //! \return the uniq instance of this class 42 static ExternalLibraryManager& getExternalLibraryManager(); 43 /*! 44 * \brief a wrapper around the ::dlopen system call 45 * \param[in] name : name of the library 46 * \param[in] b : boolean allowing ::dlopen to fail. If ::dlopen 47 * fails, a null pointer is returned. This library is *not* 48 * registred. 49 * \return a pointer to the library 50 * \note on success, the pointer is registred in a map using its 51 * name as a key. This name is used in the methods of this call 52 */ 53 #if (defined _WIN32 || defined _WIN64) && (!defined __CYGWIN__) 54 HINSTANCE__* loadLibrary(const std::string&, const bool = false); 55 #else 56 void* loadLibrary(const std::string&, const bool = false); 57 #endif /* LIB_EXTERNALLIBRARYMANAGER_HXX */ 58 /*! 59 * \return the path of a library 60 * \param[in] l: library name 61 */ 62 std::string getLibraryPath(const std::string&); 63 /*! 64 * \return the list of all mfront generated entry points 65 * in a library. 66 * \param[in] l: library name 67 */ 68 std::vector<std::string> getEntryPoints(const std::string&); 69 /*! 70 * \return the material knowledge type of an entry point in a 71 * library. The returned value has the following meaning: 72 * - 0: material property 73 * - 1: behaviour 74 * - 2: model 75 * \param[in] l: library name 76 */ 77 unsigned short getMaterialKnowledgeType(const std::string&, 78 const std::string&); 79 /*! 80 * \param[in] l : name of the library 81 * \param[in] f : name of function or mechanical behaviour 82 * \param[in] p : out of bounds policy value 83 */ 84 void setOutOfBoundsPolicy(const std::string&, 85 const std::string&, 86 const tfel::material::OutOfBoundsPolicy); 87 /*! 88 * \param[in] l : name of the library 89 * \param[in] s : name of function or mechanical behaviour 90 * \param[in] p : parameter name 91 * \param[in] v : value 92 */ 93 void setParameter(const std::string&, 94 const std::string&, 95 const std::string&, 96 const double); 97 /*! 98 * set the value of an integer parameter 99 * \param[in] l : name of the library 100 * \param[in] s : name of function or mechanical behaviour 101 * \param[in] p : parameter name 102 * \param[in] v : value 103 */ 104 void setParameter(const std::string&, 105 const std::string&, 106 const std::string&, 107 const int); 108 /*! 109 * set the value of an unsigned short parameter 110 * \param[in] l : name of the library 111 * \param[in] s : name of function or mechanical behaviour 112 * \param[in] p : parameter name 113 * \param[in] v : value 114 */ 115 void setParameter(const std::string&, 116 const std::string&, 117 const std::string&, 118 const unsigned short); 119 /*! 120 * \param[in] l : name of the library 121 * \param[in] s : name of function or mechanical behaviour 122 * \param[in] h : modelling hypothesis 123 * \param[in] p : parameter name 124 * \param[in] v : value 125 */ 126 void setParameter(const std::string&, 127 const std::string&, 128 const std::string&, 129 const std::string&, 130 const double); 131 /*! 132 * set the value of an integer parameter 133 * \param[in] l : name of the library 134 * \param[in] s : name of function or mechanical behaviour 135 * \param[in] h : modelling hypothesis 136 * \param[in] p : parameter name 137 * \param[in] v : value 138 */ 139 void setParameter(const std::string&, 140 const std::string&, 141 const std::string&, 142 const std::string&, 143 const int); 144 /*! 145 * set the value of an unsigned short parameter 146 * \param[in] l : name of the library 147 * \param[in] s : name of function or mechanical behaviour 148 * \param[in] h : modelling hypothesis 149 * \param[in] p : parameter name 150 * \param[in] v : value 151 */ 152 void setParameter(const std::string&, 153 const std::string&, 154 const std::string&, 155 const std::string&, 156 const unsigned short); 157 /*! 158 * \brief get the default value of a double parameter 159 * \param[in] l : name of the library 160 * \param[in] s : name of function or mechanical behaviour 161 * \param[in] h : modelling hypothesis 162 * \param[in] p : parameter name 163 */ 164 double getRealParameterDefaultValue(const std::string&, 165 const std::string&, 166 const std::string&, 167 const std::string&); 168 /*! 169 * \brief get the default value of an integer parameter 170 * \param[in] l : name of the library 171 * \param[in] s : name of function or mechanical behaviour 172 * \param[in] h : modelling hypothesis 173 * \param[in] p : parameter name 174 */ 175 int getIntegerParameterDefaultValue(const std::string&, 176 const std::string&, 177 const std::string&, 178 const std::string&); 179 /*! 180 * \brief get the default value of an unsigned short parameter 181 * \param[in] l : name of the library 182 * \param[in] s : name of function or mechanical behaviour 183 * \param[in] h : modelling hypothesis 184 * \param[in] p : parameter name 185 */ 186 unsigned short getUnsignedShortParameterDefaultValue(const std::string&, 187 const std::string&, 188 const std::string&, 189 const std::string&); 190 191 /*! 192 * \return true if the given variable has bounds 193 * \param[in] l: name of the library 194 * \param[in] f: name of function or mechanical behaviour 195 * \param[in] h: modelling hypothesis 196 * \param[in] v: variable name 197 */ 198 bool hasBounds(const std::string&, 199 const std::string&, 200 const std::string&, 201 const std::string&); 202 /*! 203 * \return true if the given variable has a lower bound 204 * \param[in] l: name of the library 205 * \param[in] f: name of function or mechanical behaviour 206 * \param[in] h: modelling hypothesis 207 * \param[in] v: variable name 208 */ 209 bool hasLowerBound(const std::string&, 210 const std::string&, 211 const std::string&, 212 const std::string&); 213 /*! 214 * \return true if the given variable has a upper bound 215 * \param[in] l: name of the library 216 * \param[in] f: name of function or mechanical behaviour 217 * \param[in] h: modelling hypothesis 218 * \param[in] v: variable name 219 */ 220 bool hasUpperBound(const std::string&, 221 const std::string&, 222 const std::string&, 223 const std::string&); 224 /*! 225 * \return the lower bound of the given variable 226 * \param[in] l: name of the library 227 * \param[in] f: name of function or mechanical behaviour 228 * \param[in] h: modelling hypothesis 229 * \param[in] v: variable name 230 */ 231 long double getLowerBound(const std::string&, 232 const std::string&, 233 const std::string&, 234 const std::string&); 235 /*! 236 * \return the upper bound of the given variable 237 * \param[in] l: name of the library 238 * \param[in] f: name of function or mechanical behaviour 239 * \param[in] h: modelling hypothesis 240 * \param[in] v: variable name 241 */ 242 long double getUpperBound(const std::string&, 243 const std::string&, 244 const std::string&, 245 const std::string&); 246 /*! 247 * \return true if the given variable has bounds 248 * \param[in] l: name of the library 249 * \param[in] f: name of function or mechanical behaviour 250 * \param[in] h: modelling hypothesis 251 * \param[in] v: variable name 252 */ 253 bool hasPhysicalBounds(const std::string&, 254 const std::string&, 255 const std::string&, 256 const std::string&); 257 /*! 258 * \return true if the given variable has a lower physical bound 259 * \param[in] l: name of the library 260 * \param[in] f: name of function or mechanical behaviour 261 * \param[in] h: modelling hypothesis 262 * \param[in] v: variable name 263 */ 264 bool hasLowerPhysicalBound(const std::string&, 265 const std::string&, 266 const std::string&, 267 const std::string&); 268 /*! 269 * \return true if the given variable has a upper physical bound 270 * \param[in] l: name of the library 271 * \param[in] f: name of function or mechanical behaviour 272 * \param[in] h: modelling hypothesis 273 * \param[in] v: variable name 274 */ 275 bool hasUpperPhysicalBound(const std::string&, 276 const std::string&, 277 const std::string&, 278 const std::string&); 279 /*! 280 * \return the lower bound of the given variable 281 * \param[in] l: name of the library 282 * \param[in] f: name of function or mechanical behaviour 283 * \param[in] h: modelling hypothesis 284 * \param[in] v: variable name 285 */ 286 long double getLowerPhysicalBound(const std::string&, 287 const std::string&, 288 const std::string&, 289 const std::string&); 290 /*! 291 * \return the upper bound of the given variable 292 * \param[in] l: name of the library 293 * \param[in] f: name of function or mechanical behaviour 294 * \param[in] h: modelling hypothesis 295 * \param[in] v: variable name 296 */ 297 long double getUpperPhysicalBound(const std::string&, 298 const std::string&, 299 const std::string&, 300 const std::string&); 301 302 /*! 303 * \return true if the given variable (material property) has bounds 304 * \param[in] l: name of the library 305 * \param[in] f: name of function or mechanical behaviour 306 * \param[in] v: variable name 307 */ 308 bool hasBounds(const std::string&, 309 const std::string&, 310 const std::string&); 311 /*! 312 * \return true if the given variable (material property) has lower bound 313 * \param[in] l: name of the library 314 * \param[in] f: name of function or mechanical behaviour 315 * \param[in] v: variable name 316 */ 317 bool hasLowerBound(const std::string&, 318 const std::string&, 319 const std::string&); 320 /*! 321 * \return true if the given variable (material property) has a upper 322 * bound 323 * \param[in] l: name of the library 324 * \param[in] f: name of function or mechanical behaviour 325 * \param[in] v: variable name 326 */ 327 bool hasUpperBound(const std::string&, 328 const std::string&, 329 const std::string&); 330 /*! 331 * \return the lower bound of the given variable (material property) 332 * \param[in] l: name of the library 333 * \param[in] f: name of function or mechanical behaviour 334 * \param[in] v: variable name 335 */ 336 long double getLowerBound(const std::string&, 337 const std::string&, 338 const std::string&); 339 /*! 340 * \return the upper bound of the given variable (material property) 341 * \param[in] l: name of the library 342 * \param[in] f: name of function or mechanical behaviour 343 * \param[in] v: variable name 344 */ 345 long double getUpperBound(const std::string&, 346 const std::string&, 347 const std::string&); 348 /*! 349 * \return true if the given variable (material property) has physical 350 * bounds 351 * \param[in] l: name of the library 352 * \param[in] f: name of function or mechanical behaviour 353 * \param[in] v: variable name 354 */ 355 bool hasPhysicalBounds(const std::string&, 356 const std::string&, 357 const std::string&); 358 /*! 359 * \return true if the given variable (material property) has a lower 360 * physical bound 361 * \param[in] l: name of the library 362 * \param[in] f: name of function or mechanical behaviour 363 * \param[in] v: variable name 364 */ 365 bool hasLowerPhysicalBound(const std::string&, 366 const std::string&, 367 const std::string&); 368 /*! 369 * \return true if the given variable (material property) has a upper 370 * physical bound 371 * \param[in] l: name of the library 372 * \param[in] f: name of function or mechanical behaviour 373 * \param[in] v: variable name 374 */ 375 bool hasUpperPhysicalBound(const std::string&, 376 const std::string&, 377 const std::string&); 378 /*! 379 * \return the lower bound of the given variable (material property) 380 * \param[in] l: name of the library 381 * \param[in] f: name of function or mechanical behaviour 382 * \param[in] v: variable name 383 */ 384 long double getLowerPhysicalBound(const std::string&, 385 const std::string&, 386 const std::string&); 387 /*! 388 * \return the upper bound of the given variable (material property) 389 * \param[in] l: name of the library 390 * \param[in] f: name of function or mechanical behaviour 391 * \param[in] v: variable name 392 */ 393 long double getUpperPhysicalBound(const std::string&, 394 const std::string&, 395 const std::string&); 396 397 /*! 398 * \return the TFEL version used to generate the given entry 399 * point. 400 * \param[in] l: name of the library 401 * \param[in] s: name of function or mechanical behaviour 402 * This function looks for the symbol s+'_tfel_version' in the 403 * library and expect it to a pointer to characters. 404 * If the symbol is not found, an empty string is returned. 405 */ 406 std::string getTFELVersion(const std::string&, const std::string&); 407 /*! 408 * \return the src of the function or the mechanical behaviour 409 * \param[in] l: name of the library 410 * \param[in] s: name of function or mechanical behaviour 411 * This function looks for the symbol s+'_src' in the library 412 * and expect it to a pointer to characters. 413 * If the symbol is not found, an empty string is returned. 414 */ 415 std::string getSource(const std::string&, const std::string&); 416 /*! 417 * \return the interface of the function or the mechanical behaviour 418 * \param[in] l: name of the library 419 * \param[in] s: name of function or mechanical behaviour 420 * This function looks for the symbol s+'_mfront_interface' in the library 421 * and expect it to a pointer to characters. 422 * If the symbol is not found, an empty string is returned. 423 */ 424 std::string getInterface(const std::string&, const std::string&); 425 /*! 426 * \return the material associated with the entry point 427 * \param[in] l: name of the library 428 * \param[in] s: name of function or mechanical behaviour 429 * This function looks for the symbol s+'_mfront_material' in the library 430 * and expect it to a pointer to characters. 431 * If the symbol is not found, an empty string is returned. 432 */ 433 std::string getMaterial(const std::string&, const std::string&); 434 /*! 435 * \return the list of supported modelling hypotheses 436 * \param[in] l : name of the library 437 * \param[in] s : name of function or mechanical behaviour 438 * This function looks for the symbol s+'_ModellingHypotheses' 439 * in the library and expect it to a pointer to characters. If 440 * the symbol is not found, an empty vector is returned. 441 */ 442 std::vector<std::string> getSupportedModellingHypotheses( 443 const std::string&, const std::string&); 444 /*! 445 * \param[in] l : name of the library 446 * \param[in] s : symbol name 447 */ 448 bool contains(const std::string&, const std::string&); 449 /*! 450 * \return the build id associated with the current symbol, if any. 451 * \param[in] l : name of the library 452 * \param[in] s : symbol name 453 */ 454 std::string getBuildId(const std::string&, const std::string&); 455 /*! 456 * \param[in] l : name of the library 457 * \param[in] f : function name 458 */ 459 unsigned short getMaterialPropertyNumberOfVariables(const std::string&, 460 const std::string&); 461 /*! 462 * \param[in] l : name of the library 463 * \param[in] f : function name 464 */ 465 std::vector<std::string> getMaterialPropertyVariables(const std::string&, 466 const std::string&); 467 /*! 468 * \param[out] n: names of the variables 469 * \param[in] l : name of the library 470 * \param[in] f : function name 471 */ 472 void getMaterialPropertyVariables(std::vector<std::string>&, 473 const std::string&, 474 const std::string&); 475 /*! 476 * \param[in] l: name of the library 477 * \param[in] f: function name 478 */ 479 GenericBehaviourFctPtr getGenericBehaviourFunction(const std::string&, 480 const std::string&); 481 /*! 482 * \brief return a function used for rotate the gradients from 483 * the global frame to the material frame. 484 * \param[in] l: name of the library 485 * \param[in] f: function name 486 */ 487 GenericBehaviourRotateGradientsFctPtr 488 getGenericBehaviourRotateGradientsFunction(const std::string&, 489 const std::string&); 490 /*! 491 * \brief return a function used for rotate an array of gradients from 492 * the global frame to the material frame. 493 * \param[in] l: name of the library 494 * \param[in] f: function name 495 */ 496 GenericBehaviourRotateArrayOfGradientsFctPtr 497 getGenericBehaviourRotateArrayOfGradientsFunction(const std::string&, 498 const std::string&); 499 /*! 500 * \brief return a function used for rotate the thermodynamic forces from 501 * the material frame to the global frame. 502 * \param[in] l: name of the library 503 * \param[in] f: function name 504 */ 505 GenericBehaviourRotateThermodynamicForcesFctPtr 506 getGenericBehaviourRotateThermodynamicForcesFunction(const std::string&, 507 const std::string&); 508 /*! 509 * \brief return a function used for rotate an array of thermodynamic 510 * forces from the material frame to the global frame. 511 * \param[in] l: name of the library 512 * \param[in] f: function name 513 */ 514 GenericBehaviourRotateArrayOfThermodynamicForcesFctPtr 515 getGenericBehaviourRotateArrayOfThermodynamicForcesFunction( 516 const std::string&, const std::string&); 517 /*! 518 * \return a function used for rotate the tangent operator blocks from 519 * the material frame to the global frame. 520 * \param[in] l: name of the library 521 * \param[in] f: function name 522 */ 523 GenericBehaviourRotateTangentOperatorBlocksFctPtr 524 getGenericBehaviourRotateTangentOperatorBlocksFunction( 525 const std::string&, const std::string&); 526 /*! 527 * \return a function used for rotate an array of tangent operator blocks 528 * from the material frame to the global frame. 529 * \param[in] l: name of the library 530 * \param[in] f: function name 531 */ 532 GenericBehaviourRotateArrayOfTangentOperatorBlocksFctPtr 533 getGenericBehaviourRotateArrayOfTangentOperatorBlocksFunction( 534 const std::string&, const std::string&); 535 /*! 536 * \param[in] l : name of the library 537 * \param[in] f : function name 538 */ 539 unsigned short getCyranoMaterialPropertyNumberOfVariables( 540 const std::string&, const std::string&); 541 /*! 542 * \param[in] l : name of the library 543 * \param[in] f : function name 544 */ 545 std::vector<std::string> getCyranoMaterialPropertyVariables( 546 const std::string&, const std::string&); 547 /*! 548 * \param[out] n: names of the variables 549 * \param[in] l : name of the library 550 * \param[in] f : function name 551 */ 552 void getCyranoMaterialPropertyVariables(std::vector<std::string>&, 553 const std::string&, 554 const std::string&); 555 /*! 556 * \param[in] l : name of the library 557 * \param[in] f : law name 558 */ 559 CyranoMaterialPropertyPtr getCyranoMaterialProperty(const std::string&, 560 const std::string&); 561 /*! 562 * \param[in] l : name of the library 563 * \param[in] f : law name 564 */ 565 CyranoBehaviourPtr getCyranoFunction(const std::string&, 566 const std::string&); 567 /*! 568 * \param[in] l : name of the library 569 * \param[in] f : law name 570 */ 571 AsterFctPtr getAsterFunction(const std::string&, const std::string&); 572 /*! 573 * \param[in] l : name of the library 574 * \param[in] f : law name 575 */ 576 EuroplexusFctPtr getEuroplexusFunction(const std::string&, 577 const std::string&); 578 /*! 579 * \param[in] l : name of the library 580 * \param[in] f : law name 581 */ 582 CastemFctPtr getCastemExternalBehaviourFunction(const std::string&, 583 const std::string&); 584 /*! 585 * \param[in] l : name of the library 586 * \param[in] f : law name 587 */ 588 AbaqusFctPtr getAbaqusExternalBehaviourFunction(const std::string&, 589 const std::string&); 590 /*! 591 * \param[in] l : name of the library 592 * \param[in] f : law name 593 */ 594 AnsysFctPtr getAnsysExternalBehaviourFunction(const std::string&, 595 const std::string&); 596 /*! 597 * \param[in] l : name of the library 598 * \param[in] f : law name 599 */ 600 AbaqusExplicitFctPtr getAbaqusExplicitExternalBehaviourFunction( 601 const std::string&, const std::string&); 602 /*! 603 * \param[in] l : name of the library 604 * \param[in] f : law name 605 */ 606 CalculiXFctPtr getCalculiXExternalBehaviourFunction(const std::string&, 607 const std::string&); 608 /*! 609 * \param[in] l : name of the library 610 * \param[in] f : law name 611 */ 612 DianaFEAFctPtr getDianaFEAExternalBehaviourFunction(const std::string&, 613 const std::string&); 614 /*! 615 * \note the loadLibrary must have already been called with this name 616 */ 617 bool isUMATBehaviourUsableInPurelyImplicitResolution(const std::string&, 618 const std::string&, 619 const std::string&); 620 /*! 621 * \return the type of the behaviour 622 * \see MechanicalBehaviourBase::BehaviourType 623 * The value returned has the following meaning: 624 * - 0: general behaviour 625 * - 1: strain based behaviour 626 * - 2: standard finite strain behaviour 627 * - 3: cohesive zone model 628 * \param[in] l : name of the library 629 * \param[in] f : law name 630 */ 631 unsigned short getUMATBehaviourType(const std::string&, 632 const std::string&); 633 /*! 634 * \return the kinematic assumption used by the behaviour 635 * \see MechanicalBehaviourBase::Kinematic 636 * The value returned has the following meaning: 637 * - 0: undefined kinematic 638 * - 1: standard small strain behaviour kinematic 639 * - 2: cohesive zone model kinematic 640 * - 3: standard finite strain kinematic (F-Cauchy) 641 * - 4: ptest finite strain kinematic (eto-pk1) 642 * - 5: Green-Lagrange strain 643 * - 6: Miehe Apel Lambrecht logarithmic strain framework 644 * \param[in] l : name of the library 645 * \param[in] f : law name 646 */ 647 unsigned short getUMATBehaviourKinematic(const std::string&, 648 const std::string&); 649 /*! 650 * \return the symmetry of the behaviour (isotropic or 651 * orthotropic) If the returned value is 0, the behaviour is 652 * isotropic. If the returned value is 1, the behaviour is 653 * orthotropic. 654 * \param[in] l : name of the library 655 * \param[in] f : law name 656 */ 657 unsigned short getUMATSymmetryType(const std::string&, 658 const std::string&); 659 /*! 660 * \return the symmetry of the elastic behaviour (isotropic or 661 * orthotropic) If the returned value is 0, the behaviour is 662 * isotropic. If the returned value is 1, the behaviour is 663 * orthotropic. 664 * \param[in] l : name of the library 665 * \param[in] f : law name 666 */ 667 unsigned short getUMATElasticSymmetryType(const std::string&, 668 const std::string&); 669 670 /*! 671 * \return true if the umat behaviour uses the generic plane stress 672 * algorithm 673 * \param[in] l : name of the library 674 * \param[in] f : law name 675 */ 676 bool checkIfUMATBehaviourUsesGenericPlaneStressAlgorithm( 677 const std::string&, const std::string&); 678 /*! 679 * \param[in] l : name of the library 680 * \param[in] f : law name 681 */ 682 std::vector<std::string> getUMATGradientsNames(const std::string&, 683 const std::string&); 684 /*! 685 * A type is associated to an integer as follows: 686 * - 0: scalar 687 * - 1: symmetric tensor 688 * - 2: vector (size of the space dimension) 689 * - 3: unsymmetric tensor 690 * 691 * \param[in] l : name of the library 692 * \param[in] f : law name 693 */ 694 std::vector<int> getUMATGradientsTypes(const std::string&, 695 const std::string&); 696 /*! 697 * \param[in] l : name of the library 698 * \param[in] f : law name 699 */ 700 std::vector<std::string> getUMATDrivingVariablesNames(const std::string&, 701 const std::string&); 702 /*! 703 * A type is associated to an integer as follows: 704 * - 0: scalar 705 * - 1: symmetric tensor 706 * - 2: vector (size of the space dimension) 707 * - 3: unsymmetric tensor 708 * 709 * \param[in] l : name of the library 710 * \param[in] f : law name 711 */ 712 std::vector<int> getUMATDrivingVariablesTypes(const std::string&, 713 const std::string&); 714 /*! 715 * \param[in] l : name of the library 716 * \param[in] f : law name 717 */ 718 std::vector<std::string> getUMATThermodynamicForcesNames( 719 const std::string&, const std::string&); 720 /*! 721 * A type is associated to an integer as follows: 722 * - 0: scalar 723 * - 1: symmetric tensor 724 * - 2: vector (size of the space dimension) 725 * - 3: unsymmetric tensor 726 * 727 * \param[in] l : name of the library 728 * \param[in] f : law name 729 */ 730 std::vector<int> getUMATThermodynamicForcesTypes(const std::string&, 731 const std::string&); 732 /*! 733 * \return the name of blocks in the tangent operator. 734 * \param[in] l : name of the library 735 * \param[in] f : law name 736 */ 737 std::vector<std::pair<std::string, std::string>> 738 getUMATTangentOperatorBlocksNames(const std::string&, const std::string&); 739 /*! 740 * \brief return the name of entry points for the elastic properties 741 * associated with a behaviour, if any. The kind of entry point (function, 742 * class, etc.) depends on the interface used. 743 * 744 * The size of the returned vector is currently either: 745 * - 0: which means that the behaviour does not export its elastic 746 * properties. 747 * - 2, which means that the elastic behaviour is isotropic. 748 * - 9, which means that the elastic behaviour is orthotropic. 749 * 750 * \param[in] l : name of the library 751 * \param[in] f : law name 752 */ 753 std::vector<std::string> getUMATElasticMaterialPropertiesEntryPoints( 754 const std::string&, const std::string&); 755 /*! 756 * \brief return true if the behaviour computes the internal energy 757 * \param[in] l : name of the library 758 * \param[in] f : law name 759 * \param[in] h : modelling hypothesis 760 */ 761 bool isUMATBehaviourAbleToComputeInternalEnergy(const std::string&, 762 const std::string&, 763 const std::string&); 764 /*! 765 * \brief return true if the behaviour computes the dissipated energy 766 * \param[in] l : name of the library 767 * \param[in] f : law name 768 * \param[in] h : modelling hypothesis 769 */ 770 bool isUMATBehaviourAbleToComputeDissipatedEnergy(const std::string&, 771 const std::string&, 772 const std::string&); 773 /*! 774 * \param[in] l : name of the library 775 * \param[in] f : law name 776 * \param[in] h : modelling hypothesis 777 */ 778 std::vector<std::string> getUMATMaterialPropertiesNames( 779 const std::string&, const std::string&, const std::string&); 780 /*! 781 * \param[in] l : name of the library 782 * \param[in] f : law name 783 * \param[in] h : modelling hypothesis 784 */ 785 std::vector<std::string> getUMATInternalStateVariablesNames( 786 const std::string&, const std::string&, const std::string&); 787 /*! 788 * A type is associated to an integer as follows: 789 * - 0: scalar 790 * - 1: symmetric tensor 791 * - 2: vector (size of the space dimension) 792 * - 3: unsymmetric tensor 793 * 794 * \param[in] l : name of the library 795 * \param[in] f : law name 796 * \param[in] h : modelling hypothesis 797 */ 798 std::vector<int> getUMATInternalStateVariablesTypes(const std::string&, 799 const std::string&, 800 const std::string&); 801 /*! 802 * \param[in] l : name of the library 803 * \param[in] f : law name 804 * \param[in] h : modelling hypothesis 805 */ 806 std::vector<std::string> getUMATExternalStateVariablesNames( 807 const std::string&, const std::string&, const std::string&); 808 /*! 809 * \param[in] l : name of the library 810 * \param[in] f : law name 811 * \param[in] h : modelling hypothesis 812 */ 813 std::vector<std::string> getUMATParametersNames(const std::string&, 814 const std::string&, 815 const std::string&); 816 /*! 817 * \return the types associated with each parameter. The integer 818 * values returned have the following meaning: 819 * 820 * - 0: floatting point value 821 * - 1: integer value 822 * - 2: unsigned short value 823 * 824 * \param[in] l : name of the library 825 * \param[in] f : law name 826 * \param[in] h : modelling hypothesis 827 */ 828 std::vector<int> getUMATParametersTypes(const std::string&, 829 const std::string&, 830 const std::string&); 831 /*! 832 * \return true if a behaviour generated throught the aster 833 * interface requires a offset for the elastic properties 834 * \param[in] l : name of the library 835 * \param[in] f : law name 836 * \param[in] h : modelling hypothesis 837 */ 838 bool getUMATRequiresStiffnessTensor(const std::string&, 839 const std::string&, 840 const std::string&); 841 /*! 842 * \return true if a behaviour generated throught the aster 843 * interface requires a offset for the elastic properties 844 * \param[in] l : name of the library 845 * \param[in] f : law name 846 * \param[in] h : modelling hypothesis 847 */ 848 bool getUMATRequiresThermalExpansionCoefficientTensor(const std::string&, 849 const std::string&, 850 const std::string&); 851 /*! 852 * \return true if a behaviour generated throught the aster 853 * interface saves the tangent operator 854 * \param[in] l : name of the library 855 * \param[in] f : law name 856 */ 857 bool checkIfAsterBehaviourSavesTangentOperator(const std::string&, 858 const std::string&); 859 /*! 860 * \return the aster finite strain formulation. 861 * Possible returned values are: 862 * - 1: `SIMO_MIEHE` 863 * - 2: `GROT_DEP` (total lagrangian) 864 * \param[in] l: name of the library 865 * \param[in] f: law name 866 */ 867 unsigned short getAsterFiniteStrainFormulation(const std::string&, 868 const std::string&); 869 /*! 870 * \return the error message if the behaviour did not converge 871 * \param[in] l: name of the library 872 * \param[in] f: law name 873 */ 874 AsterIntegrationErrorMessageFctPtr 875 getAsterIntegrationErrorMessageFunction(const std::string&, 876 const std::string&); 877 /*! 878 * \return the orthotropy management policy for the Abaqus and 879 * Abaqus/Explicit interface. See the associated documentation 880 * for details. 881 * 882 * The return value has the following meaning: 883 * 884 * - 0: unspecified policy (equivalent to native) 885 * - 1: native policy (equivalent to native) 886 * - 2: mfront policy 887 * 888 * \param[in] l : name of the library 889 * \param[in] f : law name 890 */ 891 unsigned short getAbaqusOrthotropyManagementPolicy(const std::string&, 892 const std::string&); 893 /*! 894 * \param[in] l : name of the library 895 * \param[in] f : function name 896 */ 897 unsigned short getCastemFunctionNumberOfVariables(const std::string&, 898 const std::string&); 899 /*! 900 * \param[in] l : name of the library 901 * \param[in] f : function name 902 */ 903 std::vector<std::string> getCastemFunctionVariables(const std::string&, 904 const std::string&); 905 /*! 906 * \param[in] l : name of the library 907 * \param[in] f : function name 908 */ 909 void getCastemFunctionVariables(std::vector<std::string>&, 910 const std::string&, 911 const std::string&); 912 /*! 913 * load a function from a library 914 * \param l : library name 915 * \param f : function name 916 * \return the function pointer 917 */ 918 CastemFunctionPtr getCastemFunction(const std::string&, 919 const std::string&); 920 921 /*! 922 * load a function from a library 923 * \param l : library name 924 * \param f : function name 925 * \return the function pointer 926 */ 927 CFunction0Ptr getCFunction0(const std::string&, const std::string&); 928 929 /*! 930 * load a function from a library 931 * \param l : library name 932 * \param f : function name 933 * \return the function pointer 934 */ 935 CFunction1Ptr getCFunction1(const std::string&, const std::string&); 936 937 /*! 938 * load a function from a library 939 * \param l : library name 940 * \param f : function name 941 * \return the function pointer 942 */ 943 CFunction2Ptr getCFunction2(const std::string&, const std::string&); 944 945 /*! 946 * load a function from a library 947 * \param l : library name 948 * \param f : function name 949 * \return the function pointer 950 */ 951 CFunction3Ptr getCFunction3(const std::string&, const std::string&); 952 953 /*! 954 * load a function from a library 955 * \param l : library name 956 * \param f : function name 957 * \return the function pointer 958 */ 959 CFunction4Ptr getCFunction4(const std::string&, const std::string&); 960 961 /*! 962 * load a function from a library 963 * \param l : library name 964 * \param f : function name 965 * \return the function pointer 966 */ 967 CFunction5Ptr getCFunction5(const std::string&, const std::string&); 968 969 /*! 970 * load a function from a library 971 * \param l : library name 972 * \param f : function name 973 * \return the function pointer 974 */ 975 CFunction6Ptr getCFunction6(const std::string&, const std::string&); 976 977 /*! 978 * load a function from a library 979 * \param l : library name 980 * \param f : function name 981 * \return the function pointer 982 */ 983 CFunction7Ptr getCFunction7(const std::string&, const std::string&); 984 985 /*! 986 * load a function from a library 987 * \param l : library name 988 * \param f : function name 989 * \return the function pointer 990 */ 991 CFunction8Ptr getCFunction8(const std::string&, const std::string&); 992 993 /*! 994 * load a function from a library 995 * \param l : library name 996 * \param f : function name 997 * \return the function pointer 998 */ 999 CFunction9Ptr getCFunction9(const std::string&, const std::string&); 1000 1001 /*! 1002 * load a function from a library 1003 * \param l : library name 1004 * \param f : function name 1005 * \return the function pointer 1006 */ 1007 CFunction10Ptr getCFunction10(const std::string&, const std::string&); 1008 1009 /*! 1010 * load a function from a library 1011 * \param l : library name 1012 * \param f : function name 1013 * \return the function pointer 1014 */ 1015 CFunction11Ptr getCFunction11(const std::string&, const std::string&); 1016 1017 /*! 1018 * load a function from a library 1019 * \param l : library name 1020 * \param f : function name 1021 * \return the function pointer 1022 */ 1023 CFunction12Ptr getCFunction12(const std::string&, const std::string&); 1024 1025 /*! 1026 * load a function from a library 1027 * \param l : library name 1028 * \param f : function name 1029 * \return the function pointer 1030 */ 1031 CFunction13Ptr getCFunction13(const std::string&, const std::string&); 1032 1033 /*! 1034 * load a function from a library 1035 * \param l : library name 1036 * \param f : function name 1037 * \return the function pointer 1038 */ 1039 CFunction14Ptr getCFunction14(const std::string&, const std::string&); 1040 1041 /*! 1042 * load a function from a library 1043 * \param l : library name 1044 * \param f : function name 1045 * \return the function pointer 1046 */ 1047 CFunction15Ptr getCFunction15(const std::string&, const std::string&); 1048 1049 /*! 1050 * load a function from a library 1051 * \param l : library name 1052 * \param f : function name 1053 * \return the function pointer 1054 */ 1055 FortranFunction0Ptr getFortranFunction0(const std::string&, 1056 const std::string&); 1057 1058 /*! 1059 * load a function from a library 1060 * \param l : library name 1061 * \param f : function name 1062 * \return the function pointer 1063 */ 1064 FortranFunction1Ptr getFortranFunction1(const std::string&, 1065 const std::string&); 1066 1067 /*! 1068 * load a function from a library 1069 * \param l : library name 1070 * \param f : function name 1071 * \return the function pointer 1072 */ 1073 FortranFunction2Ptr getFortranFunction2(const std::string&, 1074 const std::string&); 1075 1076 /*! 1077 * load a function from a library 1078 * \param l : library name 1079 * \param f : function name 1080 * \return the function pointer 1081 */ 1082 FortranFunction3Ptr getFortranFunction3(const std::string&, 1083 const std::string&); 1084 1085 /*! 1086 * load a function from a library 1087 * \param l : library name 1088 * \param f : function name 1089 * \return the function pointer 1090 */ 1091 FortranFunction4Ptr getFortranFunction4(const std::string&, 1092 const std::string&); 1093 1094 /*! 1095 * load a function from a library 1096 * \param l : library name 1097 * \param f : function name 1098 * \return the function pointer 1099 */ 1100 FortranFunction5Ptr getFortranFunction5(const std::string&, 1101 const std::string&); 1102 1103 /*! 1104 * load a function from a library 1105 * \param l : library name 1106 * \param f : function name 1107 * \return the function pointer 1108 */ 1109 FortranFunction6Ptr getFortranFunction6(const std::string&, 1110 const std::string&); 1111 1112 /*! 1113 * load a function from a library 1114 * \param l : library name 1115 * \param f : function name 1116 * \return the function pointer 1117 */ 1118 FortranFunction7Ptr getFortranFunction7(const std::string&, 1119 const std::string&); 1120 1121 /*! 1122 * load a function from a library 1123 * \param l : library name 1124 * \param f : function name 1125 * \return the function pointer 1126 */ 1127 FortranFunction8Ptr getFortranFunction8(const std::string&, 1128 const std::string&); 1129 1130 /*! 1131 * load a function from a library 1132 * \param l : library name 1133 * \param f : function name 1134 * \return the function pointer 1135 */ 1136 FortranFunction9Ptr getFortranFunction9(const std::string&, 1137 const std::string&); 1138 1139 /*! 1140 * load a function from a library 1141 * \param l : library name 1142 * \param f : function name 1143 * \return the function pointer 1144 */ 1145 FortranFunction10Ptr getFortranFunction10(const std::string&, 1146 const std::string&); 1147 1148 /*! 1149 * load a function from a library 1150 * \param l : library name 1151 * \param f : function name 1152 * \return the function pointer 1153 */ 1154 FortranFunction11Ptr getFortranFunction11(const std::string&, 1155 const std::string&); 1156 1157 /*! 1158 * load a function from a library 1159 * \param l : library name 1160 * \param f : function name 1161 * \return the function pointer 1162 */ 1163 FortranFunction12Ptr getFortranFunction12(const std::string&, 1164 const std::string&); 1165 1166 /*! 1167 * load a function from a library 1168 * \param l : library name 1169 * \param f : function name 1170 * \return the function pointer 1171 */ 1172 FortranFunction13Ptr getFortranFunction13(const std::string&, 1173 const std::string&); 1174 1175 /*! 1176 * load a function from a library 1177 * \param l : library name 1178 * \param f : function name 1179 * \return the function pointer 1180 */ 1181 FortranFunction14Ptr getFortranFunction14(const std::string&, 1182 const std::string&); 1183 1184 /*! 1185 * load a function from a library 1186 * \param l : library name 1187 * \param f : function name 1188 * \return the function pointer 1189 */ 1190 FortranFunction15Ptr getFortranFunction15(const std::string&, 1191 const std::string&); 1192 1193 ~ExternalLibraryManager(); 1194 1195 private: 1196 TFEL_VISIBILITY_LOCAL ExternalLibraryManager(); 1197 1198 TFEL_VISIBILITY_LOCAL ExternalLibraryManager( 1199 const ExternalLibraryManager&); 1200 1201 TFEL_VISIBILITY_LOCAL ExternalLibraryManager& operator=( 1202 const ExternalLibraryManager&); 1203 1204 TFEL_VISIBILITY_LOCAL void getUMATNames(std::vector<std::string>&, 1205 const std::string&, 1206 const std::string&, 1207 const std::string&, 1208 const std::string&); 1209 TFEL_VISIBILITY_LOCAL void getUMATTypes(std::vector<int>&, 1210 const std::string&, 1211 const std::string&, 1212 const std::string&, 1213 const std::string&); 1214 1215 #if (defined _WIN32 || defined _WIN64) && (!defined __CYGWIN__) 1216 std::map<std::string, HINSTANCE__*> librairies; 1217 #else 1218 std::map<std::string, void*> librairies; 1219 #endif /* LIB_EXTERNALLIBRARYMANAGER_HXX */ 1220 1221 }; // end of struct LibraryManager 1222 1223 } // end of namespace system 1224 1225 } // end of namespace tfel 1226 1227 #endif /* LIB_EXTERNALLIBRARYMANAGER_HXX */ 1228