1 /*! 2 * \file mfront/src/CastemOutOfBoundsPolicy.cxx 3 * \brief 4 * \author Thomas Helfer 5 * \brief 11 jan 2010 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<cstdlib> 15 #include<cstring> 16 #include"MFront/Castem/CastemOutOfBoundsPolicy.hxx" 17 18 namespace castem 19 { 20 21 const CastemOutOfBoundsPolicy& getCastemOutOfBoundsPolicy()22 CastemOutOfBoundsPolicy::getCastemOutOfBoundsPolicy() 23 { 24 static CastemOutOfBoundsPolicy u; 25 return u; 26 } // end of getCastemOutOfBoundsPolicy 27 CastemOutOfBoundsPolicy()28 CastemOutOfBoundsPolicy::CastemOutOfBoundsPolicy() 29 : policy(tfel::material::None) 30 { 31 const char * const p = ::getenv("CASTEM_OUT_OF_BOUNDS_POLICY"); 32 if(p!=nullptr){ 33 if(strcmp(p,"STRICT")==0){ 34 this->policy = tfel::material::Strict; 35 } else if (strcmp(p,"WARNING")==0){ 36 this->policy = tfel::material::Warning; 37 } 38 } 39 } // end of CastemOutOfBoundsPolicy::CastemOutOfBoundsPolicy 40 41 tfel::material::OutOfBoundsPolicy getOutOfBoundsPolicy() const42 CastemOutOfBoundsPolicy::getOutOfBoundsPolicy() const 43 { 44 return this->policy; 45 } // end of CastemOutOfBoundsPolicy::getOutOfBoundsPolicy 46 47 48 } // end of namespace castem 49