MOAB: Mesh Oriented datABase  (version 5.3.1)
EdgeSizeSimpleImplicit.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 /**\class moab::EdgeSizeSimpleImplicit
00017  *
00018  * This is an simple example edge evaluator tha subdivides edges based
00019  * on their midpoint's distance to a simple, fixed-form implicit surface
00020  * written as \f$ x^T A x + B x + C \f$ where \f$x\f$ is a column vector of
00021  * holding the edge midpoint coordinates, \f$A\f$ is a symmetric 3x3 matrix,
00022  * \f$B\f$ is a 1x3 row vector, and \f$C\f$ is a scalar.
00023  * Whenever the implicit function divided by half of the edge length is smaller than
00024  * some minimum ratio (which defaults to 1), the edge is marked for subdivision.
00025  *
00026  * \author David Thompson
00027  *
00028  * \date 19 November 2007
00029  */
00030 #ifndef MOAB_EDGE_SIZE_SIMPLE_IMPLICIT_HPP
00031 #define MOAB_EDGE_SIZE_SIMPLE_IMPLICIT_HPP
00032 
00033 #include "EdgeSizeEvaluator.hpp"
00034 
00035 namespace moab
00036 {
00037 
00038 class EdgeSizeSimpleImplicit : public EdgeSizeEvaluator
00039 {
00040   public:
00041     /// Construct an evaluator.
00042     EdgeSizeSimpleImplicit();
00043     /// Destruction is virtual so subclasses may clean up after refinement.
00044     virtual ~EdgeSizeSimpleImplicit();
00045 
00046     /** \brief Given an edge of length L, true when edge midpoint is within $\alpha^2$ of
00047      * $\left(\frac{2f(x,y,z)}{L}\right)^2$.
00048      */
00049     virtual bool evaluate_edge( const double* p0, const void* t0, double* p1, void* t1, const double* p2,
00050                                 const void* t2 );
00051 
00052     /// Set the 10 coefficients of the implicit function. The vector contains the entries of A,
00053     /// followed by B, followed by C.
00054     virtual void set_implicit_function( double* coeffs );
00055     /// Get the 10 coefficients of the implicit function. The vector contains the entries of A,
00056     /// followed by B, followed by C.
00057     void get_implicit_function( double*& coeffs );
00058 
00059     /// Set the threshold ratio of function value to half-edge length that triggers subdivision.
00060     virtual void set_ratio( double r )
00061     {
00062         this->ratio = r;
00063     }
00064     /// Get the threshold ratio of function value to half-edge length that triggers subdivision.
00065     double get_ratio()
00066     {
00067         return this->ratio;
00068     }
00069 
00070   protected:
00071     double coeffA[6];
00072     double coeffB[3];
00073     double coeffC;
00074     double ratio;
00075 };
00076 
00077 }  // namespace moab
00078 
00079 #endif  // MOAB_EDGE_SIZE_SIMPLE_IMPLICIT_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines