MOAB: Mesh Oriented datABase  (version 5.4.1)
Settings.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2007 Sandia National Laboratories.  Developed at the
00005     University of Wisconsin--Madison under SNL contract number
00006     624796.  The U.S. Government and the University of Wisconsin
00007     retain certain rights to 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     This library is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017     Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     (lgpl.txt) along with this library; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00023     (2009) [email protected]
00024 
00025   ***************************************************************** */
00026 
00027 /** \file Settings.hpp
00028  *  \brief
00029  *  \author Jason Kraftcheck
00030  */
00031 
00032 #ifndef MSQ_SETTINGS_HPP
00033 #define MSQ_SETTINGS_HPP
00034 
00035 #include "Mesquite.hpp"
00036 #include <cstdlib>  // for size_t
00037 
00038 namespace MBMesquite
00039 {
00040 
00041 class MappingFunction;
00042 class MappingFunction2D;
00043 class MappingFunction3D;
00044 struct SettingData;
00045 
00046 class MESQUITE_EXPORT Settings
00047 {
00048   public:
00049     //! Initialize to default settings.
00050     Settings();
00051     //! Copy existing settings
00052     Settings( const Settings& other );
00053     ~Settings();
00054     //! Copy existing settings.
00055     Settings& operator=( const Settings& other );
00056 
00057     //! Set the mapping function for a single element topology.
00058     void set_mapping_function( const MappingFunction* func );
00059     void set_mapping_function( const MappingFunction2D* func );
00060     void set_mapping_function( const MappingFunction3D* func );
00061     //! Set the mapping function for one or more element topologies.
00062     void set_mapping_functions( const MappingFunction* const array[], size_t array_size );
00063     void set_mapping_functions( const MappingFunction2D* const array[], size_t array_size );
00064     void set_mapping_functions( const MappingFunction3D* const array[], size_t array_size );
00065     //! Get the mapping function for an element topology.
00066     const MappingFunction* get_mapping_function( EntityTopology element_type ) const;
00067     const MappingFunction2D* get_mapping_function_2D( EntityTopology element_type ) const;
00068     const MappingFunction3D* get_mapping_function_3D( EntityTopology element_type ) const;
00069 
00070     enum FixedVertexMode
00071     {
00072         FIXED_FLAG = 4,    //!< Ask application which vertices are fixed by
00073                            //!< calling Mesh::vertices_get_fixed_flag
00074         FIXED_VERTEX = 0,  //!< Treat all vertices for which the mesh domain
00075                            //!< is topologically 0-dimensional as fixed.
00076         FIXED_CURVE = 1,   //!< Treat all vertices for which the mesh domain
00077                            //!< is topologically 1-dimensional as fixed.
00078         FIXED_SURFACE = 2  //!< Treat all vertices for which the corresponding
00079                            //!< mesh domain has a topological dimension *less than*
00080                            //!< or equal to 2 as fixed.
00081     };
00082     //! Change how Mesquite determines which vertices are fixed.
00083     void set_fixed_vertex_mode( FixedVertexMode mode );
00084     //! Get the setting for how Mesquite determines which vertices are fixed.
00085     FixedVertexMode get_fixed_vertex_mode() const;
00086 
00087     enum HigherOrderSlaveMode
00088     {
00089         SLAVE_NONE,  //!< All higher-order nodes are treated either
00090                      //!< as fixed or as free variables in the optimization.
00091 
00092         SLAVE_ALL,  //!< Treat all non-fixed higher-order nodes as slave
00093                     //!< vertices.  The node location will be updated
00094                     //!< automatically to the position of the mapping
00095                     //!< function evaluated at the logical location of
00096                     //!< the node evaluated as if the element did not
00097                     //!< contain the node.
00098 
00099         SLAVE_CALCULATED,  //!< A utility (e.g. SlaveBoundaryVertices) will be
00100                            //!< inserted into the instruction queue that will
00101                            //!< determine which vertices are slaved and store
00102                            //!< that state as the appropriate bit in the vertex
00103                            //!< byte.
00104 
00105         SLAVE_FLAG  //!< The results of a call to Mesh::vertices_get_slaved_flag
00106                     //!< will be used to establish free vs. slaved.
00107     };
00108 
00109     //! Set the slaved higher-order node setting.
00110     void set_slaved_ho_node_mode( HigherOrderSlaveMode mode );
00111     //! Get the slaved higher-order node setting.
00112     HigherOrderSlaveMode get_slaved_ho_node_mode() const;
00113 
00114     /**\brief Generate SIGFPE whenever a floating point exception occurs
00115      *
00116      * Generate a FPE signal when overflow, divbyzero, etc. occur
00117      * during floating-point arithmatic.  This is intended for debugging
00118      * purposes only, as enabling this will typically result in a
00119      * crash when such arithmatic errors occur.
00120      *
00121      * If this option is enabled, Mesquite will attempt to set
00122      * platform-specific flags such that a SIGFPE is generated for
00123      * floating point errors while the instruction queue is running.
00124      * If this option ins disabled, Mesquite will not change the
00125      * flags.  There is no option to explicitly disable such flags
00126      * because that is the default behavior on most platforms, and
00127      * presumably if the application has enabled such flags it makes
00128      * little sense to disable them while Mesquite is running.
00129      *
00130      * This functionality may not be supported on all platforms.  If
00131      * it is not supported, this option has no effect.
00132      */
00133     void trap_floating_point_exception( bool enable );
00134     bool trap_floating_point_exception() const;
00135 
00136   private:
00137     SettingData* mData;
00138 };
00139 
00140 }  // namespace MBMesquite
00141 
00142 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines