MOAB: Mesh Oriented datABase  (version 5.4.1)
Util.hpp
Go to the documentation of this file.
00001 /**
00002  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
00003  * storing and accessing finite element mesh data.
00004  *
00005  * Copyright 2004 Sandia Corporation.  Under the terms of Contract
00006  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
00007  * retains certain rights in this software.
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  *
00014  */
00015 
00016 #ifndef MB_UTIL_HPP
00017 #define MB_UTIL_HPP
00018 
00019 #include "moab/MOABConfig.h"
00020 #include "moab/Forward.hpp"
00021 #include "moab/CartVect.hpp"
00022 
00023 #include <cmath>
00024 #if defined MOAB_HAVE_ISFINITE
00025 #define moab_isfinite( f ) isfinite( f )
00026 #elif defined MOAB_HAVE_STDISFINITE
00027 #include <cmath>
00028 #define moab_isfinite( f ) std::isfinite( f )
00029 #elif defined MOAB_HAVE_FINITE
00030 #define moab_isfinite( f ) finite( f )
00031 #else
00032 #define moab_isfinite( f ) ( !std::isinf( double( f ) ) && !std::isnan( double( f ) ) )
00033 #endif
00034 
00035 namespace moab
00036 {
00037 
00038 /** \class Util
00039  *
00040  * \brief Utility functions for computational geometry and mathematical calculations
00041  */
00042 class Util
00043 {
00044   public:
00045     template < typename T >
00046     static bool is_finite( T value );
00047 
00048     static void normal( Interface* MB, EntityHandle handle, double& x, double& y, double& z );
00049 
00050     static void centroid( Interface* MB, EntityHandle handle, CartVect& coord );
00051 
00052     // static void edge_centers(Interface *MB, EntityHandle handle, std::vector<CartVect>
00053     // &coords_list);
00054 
00055     // static void face_centers(Interface *MB, EntityHandle handle, std::vector<CartVect>
00056     // &coords_list);
00057 
00058   private:
00059     Util() {}
00060 };
00061 
00062 template < typename T >
00063 inline bool Util::is_finite( T value )
00064 {
00065     return moab_isfinite( (double)value );
00066 }
00067 
00068 }  // namespace moab
00069 
00070 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines