MOAB: Mesh Oriented datABase  (version 5.2.1)
VerdictWrapper.hpp
Go to the documentation of this file.
00001 /*
00002  * VerdictWrapper.hpp
00003  *
00004  *  Created on: Nov 18, 2014
00005  *      Author: iulian
00006  */
00007 
00008 #ifndef SRC_VERDICT_MOAB_VERDICTWRAPPER_HPP_
00009 #define SRC_VERDICT_MOAB_VERDICTWRAPPER_HPP_
00010 
00011 #include <map>
00012 
00013 namespace moab
00014 {
00015 
00016 class Interface;
00017 
00018 enum QualityType
00019 {
00020     // order exactly from HexMetricVals
00021     MB_UNDEFINED_QUALITY = -1,
00022     MB_EDGE_RATIO        = 0,  // 0  MBHEX, MBTET,                    MBQUAD,  MBTRI
00023     MB_MAX_EDGE_RATIO,         // 1  MBHEX,                           MBQUAD
00024     MB_SKEW,                   // 2  MBHEX,                           MBQUAD
00025     MB_TAPER,                  // 3  MBHEX,                           MBQUAD
00026     MB_VOLUME,                 // 4  MBHEX, MBTET, MBPRISM, MBKNIFE
00027     MB_STRETCH,                // 5  MBHEX,                           MBQUAD
00028     MB_DIAGONAL,               // 6  MBHEX,
00029     MB_DIMENSION,              // 7  MBHEX,
00030     MB_ODDY,                   // 8  MBHEX,                           MBQUAD
00031     MB_MED_ASPECT_FROBENIUS,   // 9  MBHEX,                           MBQUAD
00032     MB_MAX_ASPECT_FROBENIUS,   // 10 MBHEX, MBTET (aspect_frobenius)  MBQUAD,  MBTRI
00033                                // (aspect_frobenius)
00034     MB_CONDITION,              // 11 MBHEX, MBTET,                    MBQUAD,  MBTRI
00035     MB_JACOBIAN,               // 12 MBHEX, MBTET,                    MBQUAD
00036     MB_SCALED_JACOBIAN,        // 13 MBHEX, MBTET,                    MBQUAD,  MBTRI
00037     MB_SHEAR,                  // 14 MBHEX,                           MBQUAD,  MBTRI
00038     MB_SHAPE,                  // 15 MBHEX, MBTET,                    MBQUAD,  MBTRI
00039     MB_RELATIVE_SIZE_SQUARED,  // 16 MBHEX, MBTET,                    MBQUAD,  MBTRI
00040     MB_SHAPE_AND_SIZE,         // 17 MBHEX, MBTET,                    MBQUAD
00041     MB_SHEAR_AND_SIZE,         // 18 MBHEX,                           MBQUAD
00042     MB_DISTORTION,             // 19 MBHEX, MBTET,                    MBQUAD
00043                                // length for edge:
00044     MB_LENGTH,                 // 20 only for MBEDGE
00045                                // specific to tets
00046     MB_RADIUS_RATIO,           // 21        MBTET,                    MBQUAD,  MBTRI
00047     MB_ASPECT_BETA,            // 22        MBTET
00048     MB_ASPECT_RATIO,           // 23        MBTET,                    MBQUAD,  MBTRI
00049     MB_ASPECT_GAMMA,           // 24        MBTET
00050     MB_MINIMUM_ANGLE,          // 25        MBTET,                    MBQUAD,  MBTRI
00051     MB_COLLAPSE_RATIO,         // 26        MBTET
00052                                // specific to quads
00053     MB_WARPAGE,                // 27                                  MBQUAD
00054     MB_AREA,                   // 28                                  MBQUAD,  MBTRI
00055     MB_MAXIMUM_ANGLE,          // 29                                  MBQUAD,  MBTRI
00056     MB_QUALITY_COUNT           // used to size the arrays
00057 
00058 };
00059 
00060 inline std::string QualityType_ToString( QualityType qtype )
00061 {
00062     switch( qtype )
00063     {
00064         case MB_UNDEFINED_QUALITY:
00065             return "MB_UNDEFINED_QUALITY";
00066         case MB_EDGE_RATIO:
00067             return "MB_EDGE_RATIO";
00068         case MB_MAX_EDGE_RATIO:
00069             return "MB_MAX_EDGE_RATIO";
00070         case MB_SKEW:
00071             return "MB_SKEW";
00072         case MB_TAPER:
00073             return "MB_TAPER";
00074         case MB_VOLUME:
00075             return "MB_VOLUME";
00076         case MB_STRETCH:
00077             return "MB_STRETCH";
00078         case MB_DIAGONAL:
00079             return "MB_DIAGONAL";
00080         case MB_DIMENSION:
00081             return "MB_DIMENSION";
00082         case MB_ODDY:
00083             return "MB_ODDY";
00084         case MB_MED_ASPECT_FROBENIUS:
00085             return "MB_MED_ASPECT_FROBENIUS";
00086         case MB_MAX_ASPECT_FROBENIUS:
00087             return "MB_MAX_ASPECT_FROBENIUS";
00088         case MB_CONDITION:
00089             return "MB_CONDITION";
00090         case MB_JACOBIAN:
00091             return "MB_JACOBIAN";
00092         case MB_SCALED_JACOBIAN:
00093             return "MB_SCALED_JACOBIAN";
00094         case MB_SHEAR:
00095             return "MB_SHEAR";
00096         case MB_SHAPE:
00097             return "MB_SHAPE";
00098         case MB_RELATIVE_SIZE_SQUARED:
00099             return "MB_RELATIVE_SIZE_SQUARED";
00100         case MB_SHAPE_AND_SIZE:
00101             return "MB_SHAPE_AND_SIZE";
00102         case MB_SHEAR_AND_SIZE:
00103             return "MB_SHEAR_AND_SIZE";
00104         case MB_DISTORTION:
00105             return "MB_DISTORTION";
00106         case MB_LENGTH:
00107             return "MB_LENGTH";
00108         case MB_RADIUS_RATIO:
00109             return "MB_RADIUS_RATIO";
00110         case MB_ASPECT_BETA:
00111             return "MB_ASPECT_BETA";
00112         case MB_ASPECT_RATIO:
00113             return "MB_ASPECT_RATIO";
00114         case MB_ASPECT_GAMMA:
00115             return "MB_ASPECT_GAMMA";
00116         case MB_MINIMUM_ANGLE:
00117             return "MB_MINIMUM_ANGLE";
00118         case MB_COLLAPSE_RATIO:
00119             return "MB_COLLAPSE_RATIO";
00120         case MB_WARPAGE:
00121             return "MB_WARPAGE";
00122         case MB_AREA:
00123             return "MB_AREA";
00124         case MB_MAXIMUM_ANGLE:
00125             return "MB_MAXIMUM_ANGLE";
00126         default:
00127             return "MB_QUALITY_COUNT";
00128     }
00129 }
00130 
00131 class VerdictWrapper
00132 {
00133   public:
00134     VerdictWrapper( Interface* mb );
00135     virtual ~VerdictWrapper();
00136     //! return a quality for an entity
00137     /** compute the quality for an element; the coordinates and number of nodes can be passed
00138      * if available
00139     \param  eh element entity handle.
00140     \param q quality requested
00141     \param quality output
00142     \param num_nodes optional, number of vertices
00143     \param coords options, interleaved coordinates
00144     return MB_SUCCESS
00145     Example: \code
00146     EntityHandle hex;
00147     double jac;
00148     rval = quality_measure(hex, MB_JACOBIAN, jac); \endcode
00149     */
00150     ErrorCode quality_measure( EntityHandle eh, QualityType q, double& quality, int num_nodes = 0,
00151                                EntityType etype = MBMAXTYPE, double* coords = NULL );
00152     //! return a quality name
00153     /** return quality name (convert an enum QualityType to a string)
00154     \param  q quality type
00155     return string
00156     Example: \code
00157 
00158     const char * name = quality_name(MB_JACOBIAN); \endcode
00159     */
00160     const char* quality_name( QualityType q );
00161     //! return a string with entity type name
00162     const char* entity_type_name( EntityType etype );
00163     //! return an int with total available qualities for type
00164     int num_qualities( EntityType etype );
00165     //! return true if quality possible
00166     int possible_quality( EntityType et, QualityType q );
00167     // relative size needs a base size, that is set at global level, one for each major type (hex,
00168     // tet, quad, tri)
00169     ErrorCode set_size( double size );
00170     //! return all qualities for an element
00171     /** compute all qualities for an element
00172       \param  eh element entity handle.
00173       \param qs list of QualityType
00174       \param qualities list of qualities
00175       return MB_SUCCESS
00176       Example: \code
00177       EntityHandle hex;
00178       std::vector<QualityType> qs;
00179       std::vector<double> qualities;
00180       all_quality_measures(hex, qs, qualities); \endcode
00181       */
00182     ErrorCode all_quality_measures( EntityHandle eh, std::map< QualityType, double >& qualities );
00183 
00184   private:
00185     Interface* mbImpl;
00186 };
00187 }  // namespace moab
00188 #endif /* SRC_VERDICT_MOAB_VERDICTWRAPPER_HPP_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines