Loading [MathJax]/extensions/tex2jax.js
Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Util.hpp
Go to the documentation of this file.
1 /** 2  * MOAB, a Mesh-Oriented datABase, is a software component for creating, 3  * storing and accessing finite element mesh data. 4  * 5  * Copyright 2004 Sandia Corporation. Under the terms of Contract 6  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 7  * retains certain rights in this software. 8  * 9  * This library is free software; you can redistribute it and/or 10  * modify it under the terms of the GNU Lesser General Public 11  * License as published by the Free Software Foundation; either 12  * version 2.1 of the License, or (at your option) any later version. 13  * 14  */ 15  16 #ifndef MB_UTIL_HPP 17 #define MB_UTIL_HPP 18  19 #include "moab/MOABConfig.h" 20 #include "moab/Forward.hpp" 21 #include "moab/CartVect.hpp" 22  23 #include <cmath> 24 #if defined MOAB_HAVE_ISFINITE 25 #define moab_isfinite( f ) isfinite( f ) 26 #elif defined MOAB_HAVE_STDISFINITE 27 #include <cmath> 28 #define moab_isfinite( f ) std::isfinite( f ) 29 #elif defined MOAB_HAVE_FINITE 30 #define moab_isfinite( f ) finite( f ) 31 #else 32 #define moab_isfinite( f ) ( !std::isinf( double( f ) ) && !std::isnan( double( f ) ) ) 33 #endif 34  35 namespace moab 36 { 37  38 /** \class Util 39  * 40  * \brief Utility functions for computational geometry and mathematical calculations 41  */ 42 class Util 43 { 44  public: 45  template < typename T > 46  static bool is_finite( T value ); 47  48  static void normal( Interface* MB, EntityHandle handle, double& x, double& y, double& z ); 49  50  static void centroid( Interface* MB, EntityHandle handle, CartVect& coord ); 51  52  // static void edge_centers(Interface *MB, EntityHandle handle, std::vector<CartVect> 53  // &coords_list); 54  55  // static void face_centers(Interface *MB, EntityHandle handle, std::vector<CartVect> 56  // &coords_list); 57  58  private: 59  Util() {} 60 }; 61  62 template < typename T > 63 inline bool Util::is_finite( T value ) 64 { 65  return moab_isfinite( (double)value ); 66 } 67  68 } // namespace moab 69  70 #endif