1 /* ***************************************************************** 2 MESQUITE -- The Mesh Quality Improvement Toolkit 3 4 Copyright 2007 Sandia National Laboratories. Developed at the 5 University of Wisconsin--Madison under SNL contract number 6 624796. The U.S. Government and the University of Wisconsin 7 retain certain rights to 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 This library is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 Lesser General Public License for more details. 18 19 You should have received a copy of the GNU Lesser General Public License 20 (lgpl.txt) along with this library; if not, write to the Free Software 21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 23 (2009) kraftche@cae.wisc.edu 24 25 ***************************************************************** */ 26 27 28 /** \file Settings.hpp 29 * \brief 30 * \author Jason Kraftcheck 31 */ 32 33 #ifndef MSQ_SETTINGS_HPP 34 #define MSQ_SETTINGS_HPP 35 36 #include "Mesquite.hpp" 37 #include <stdlib.h> // for size_t 38 39 namespace MBMesquite { 40 41 class MappingFunction; 42 class MappingFunction2D; 43 class MappingFunction3D; 44 struct SettingData; 45 46 class MESQUITE_EXPORT Settings { 47 public: 48 //! Initialize to default settings. 49 Settings(); 50 //! Copy existing settings 51 Settings( const Settings& other ); 52 ~Settings(); 53 //! Copy existing settings. 54 Settings& operator=( const Settings& other ); 55 56 //! Set the mapping function for a single element topology. 57 void set_mapping_function( const MappingFunction* func ); 58 void set_mapping_function( const MappingFunction2D* func ); 59 void set_mapping_function( const MappingFunction3D* func ); 60 //! Set the mapping function for one or more element topologies. 61 void set_mapping_functions( const MappingFunction* const array[], size_t array_size ); 62 void set_mapping_functions( const MappingFunction2D* const array[], size_t array_size ); 63 void set_mapping_functions( const MappingFunction3D* const array[], size_t array_size ); 64 //! Get the mapping function for an element topology. 65 const MappingFunction* get_mapping_function( EntityTopology element_type ) const; 66 const MappingFunction2D* get_mapping_function_2D( EntityTopology element_type ) const; 67 const MappingFunction3D* get_mapping_function_3D( EntityTopology element_type ) const; 68 69 enum FixedVertexMode { 70 FIXED_FLAG = 4, //!< Ask application which vertices are fixed by 71 //!< calling Mesh::vertices_get_fixed_flag 72 FIXED_VERTEX = 0, //!< Treat all vertices for which the mesh domain 73 //!< is topologically 0-dimensional as fixed. 74 FIXED_CURVE = 1, //!< Treat all vertices for which the mesh domain 75 //!< is topologically 1-dimensional as fixed. 76 FIXED_SURFACE = 2 //!< Treat all vertices for which the corresponding 77 //!< mesh domain has a topological dimension *less than* 78 //!< or equal to 2 as fixed. 79 }; 80 //! Change how Mesquite determines which vertices are fixed. 81 void set_fixed_vertex_mode( FixedVertexMode mode ); 82 //! Get the setting for how Mesquite determines which vertices are fixed. 83 FixedVertexMode get_fixed_vertex_mode() const; 84 85 enum HigherOrderSlaveMode { 86 SLAVE_NONE, //!< All higher-order nodes are treated either 87 //!< as fixed or as free variables in the optimization. 88 89 SLAVE_ALL, //!< Treat all non-fixed higher-order nodes as slave 90 //!< vertices. The node location will be updated 91 //!< automatically to the position of the mapping 92 //!< function evaluated at the logical location of 93 //!< the node evaluated as if the element did not 94 //!< contain the node. 95 96 SLAVE_CALCULATED, //!< A utility (e.g. SlaveBoundaryVertices) will be 97 //!< inserted into the instruction queue that will 98 //!< determine which vertices are slaved and store 99 //!< that state as the appropriate bit in the vertex 100 //!< byte. 101 102 SLAVE_FLAG //!< The results of a call to Mesh::vertices_get_slaved_flag 103 //!< will be used to establish free vs. slaved. 104 }; 105 106 //! Set the slaved higher-order node setting. 107 void set_slaved_ho_node_mode( HigherOrderSlaveMode mode ); 108 //! Get the slaved higher-order node setting. 109 HigherOrderSlaveMode get_slaved_ho_node_mode() const; 110 111 /**\brief Generate SIGFPE whenever a floating point exception occurs 112 * 113 * Generate a FPE signal when overflow, divbyzero, etc. occur 114 * during floating-point arithmatic. This is intended for debugging 115 * purposes only, as enabling this will typically result in a 116 * crash when such arithmatic errors occur. 117 * 118 * If this option is enabled, Mesquite will attempt to set 119 * platform-specific flags such that a SIGFPE is generated for 120 * floating point errors while the instruction queue is running. 121 * If this option ins disabled, Mesquite will not change the 122 * flags. There is no option to explicitly disable such flags 123 * because that is the default behavior on most platforms, and 124 * presumably if the application has enabled such flags it makes 125 * little sense to disable them while Mesquite is running. 126 * 127 * This functionality may not be supported on all platforms. If 128 * it is not supported, this option has no effect. 129 */ 130 void trap_floating_point_exception( bool enable ); 131 bool trap_floating_point_exception() const; 132 133 private: 134 135 SettingData* mData; 136 }; 137 138 139 } // namespace MBMesquite 140 141 #endif 142