shape_doc 0.1
solver_implicit< C, V > Struct Template Reference

#include <solver_implicit.hpp>

List of all members.

Public Types

Public Member Functions

Static Public Member Functions

Static Public Attributes


Detailed Description

template<class C, class V>
struct mmx::shape::solver_implicit< C, V >

Definition at line 49 of file solver_implicit.hpp.


Member Typedef Documentation

typedef bounding_box<C,Ref> BoundingBox

Definition at line 53 of file solver_implicit.hpp.

typedef box_face<C,Ref> BoxFace

Definition at line 54 of file solver_implicit.hpp.

typedef vertex<C,V> Point

Definition at line 52 of file solver_implicit.hpp.


Member Function Documentation

static void common_edge_point ( Seq< Point * > &  lp,
const MultivariateDenseBernstein &  p,
const BoxFace E,
const BoundingBox bx1,
const BoundingBox bx2 
) [inline, static]

Definition at line 280 of file solver_implicit.hpp.

References box_face< C, V >::cvar(), box_face< C, V >::lower(), mmx::shape::lower(), mmx::max(), mmx::min(), box_face< C, V >::new_point(), box_face< C, V >::side(), mmx::solve(), mmx::shape_ssi::up(), box_face< C, V >::upper(), and mmx::shape::upper().

                                                   {
      MultivariateDenseBernstein f;

      tensor::face(f,p,E.cvar(0),E.side(0));

      polynomial<double, with<Bernstein> > dw(1,f.size()-1), up(1,f.size()-1);
      for(unsigned i=0; i<f.size();i++) {
        up[i]= upper(f[i]); 
        dw[i]= lower(f[i]);
           //up[i]=dw[i]=f[i];
      }

      double 
        U = std::max( E.lower(bx1), E.lower(bx2) ) ,
        V = std::min( E.upper(bx1), E.upper(bx2) ) ;

      Seq<double> sol;

      solver< double, Sleeve<Approximate> >::solve(sol,dw,up,U,V);

      sol.sort();// sort from smaller to bigger

      Approximate approx;
      for(unsigned i=0;i<sol.size(); i++) 
          {
            lp<< E.new_point(bx1,sol[i]);
          }  
    }
static void edge_point ( Seq< Point * > &  lp,
const MultivariateDenseBernstein &  p,
const BoxFace E,
const BoundingBox bx 
) [inline, static]

Definition at line 91 of file solver_implicit.hpp.

References box_face< C, V >::cvar(), box_face< C, V >::is_valid(), box_face< C, V >::lower(), mmx::shape::lower(), box_face< C, V >::new_point(), box_face< C, V >::side(), mmx::solve(), mmx::shape_ssi::up(), box_face< C, V >::upper(), and mmx::shape::upper().

Referenced by cell2d_algebraic_curve< C, V >::cell2d_algebraic_curve().

                                          {
      MultivariateDenseBernstein f;

      tensor::face(f,p,E.cvar(0),E.side(0));

      polynomial<double, with<Bernstein> > dw(1,f.size()-1), up(1,f.size()-1);
      for(unsigned i=0; i<f.size();i++) {
        up[i]= upper(f[i]); 
        dw[i]= lower(f[i]);
      }

      double 
        U = E.lower(bx),
        V = E.upper(bx);

      Seq<double> sol;
      solver< double, Sleeve<Approximate> >::solve(sol,dw,up,U,V);

      // std::cout<<"****U= "<<U<<std::endl;
      // std::cout<<"****V= "<<V<<std::endl;
      // std::cout<<"***dw= "<<dw<<std::endl;
      // std::cout<<"***up= "<<up<<std::endl;
      // std::cout<<"******Sols : "<<sol.size()<<std::endl;

      Approximate approx;
      std::vector<double> pt(3);
      for(unsigned i=0;i<sol.size(); i++) 
        if(E.is_valid(bx, sol[i], approx.eps)) {
          lp<< E.new_point(bx,sol[i]);
        }
    }
static int edge_sign_var ( const MultivariateDenseBernstein &  p,
const BoxFace E 
) [inline, static]

Definition at line 127 of file solver_implicit.hpp.

References box_face< C, V >::cvar(), and box_face< C, V >::side().

                                       {
      MultivariateDenseBernstein f;
      tensor::face(f,p,E.cvar(0),E.side(0));
      return sign_variation(f.begin(), f.end());

  }
static void extremal ( Seq< Point * > &  sol,
const Polynomial &  pol,
const BoundingBox b 
) [inline, static]

Definition at line 197 of file solver_implicit.hpp.

References solver_implicit< C, V >::new_point(), Polynomial, bounding_box< C, V >::xmax(), bounding_box< C, V >::xmin(), bounding_box< C, V >::ymax(), and bounding_box< C, V >::ymin().

Referenced by cell2d_algebraic_curve< C, V >::cell2d_algebraic_curve(), and mmx::shape::extremal().

                                                                    {
    
      typedef polynomial< double, with<Bernstein> >  MultivariateDenseBernstein;

      // typedef Polynomial MultivariateDenseBernstein;


      typedef polynomial< GMP::rational, with<Bernstein> > MultivariateDenseBernsteinQ;
      
      Seq<mmx::GMP::rational> bx;
      bx<<as<mmx::GMP::rational>(b.xmin());
      bx<<as<mmx::GMP::rational>(b.xmax());
      bx<<as<mmx::GMP::rational>(b.ymin());
      bx<<as<mmx::GMP::rational>(b.ymax());


      //tensor::bernstein<mmx::GMP::rational> P(pol.rep(),bx);
      //typename Polynomial::Scalar mx = as<typename Polynomial::Scalar>(array::max_abs(P));
      //Polynomial Pol=pol/mx, dxpol = diff(Pol,0), dypol = diff(Pol,1);

      Polynomial dxpol = diff(pol,0), dypol = diff(pol,1);
      tensor::bernstein<mmx::GMP::rational>
         dxP(dxpol.rep(),bx),dyP(dypol.rep(),bx);
      
      MultivariateDenseBernstein dxp,dyp;
      let::assign(dxp.rep(), dxP);
      let::assign(dyp.rep(), dyP);

      Seq<MultivariateDenseBernstein> sys;
      //      Seq<MultivariateDenseBernsteinQ> sys;
      sys<<dxp<<dyp;

      solver<double, ProjRd<SBD_RDRDL> > slv;

      std::vector<double> res; 
      slv.solve_bernstein(res,sys);

      double x_sc= (b.xmax()-b.xmin()), y_sc= (b.ymax()-b.ymin());
      for(unsigned i=0;i<res.size();i+=2) {
        sol << new_point(b.xmin()+res[i]*x_sc, b.ymin()+res[i+1]*y_sc, 0.0);
      }
    }
static void face_point ( Seq< Point * > &  sol,
const Seq< MultivariateDenseBernstein > &  eqs,
const BoxFace F,
const BoundingBox bx 
) [inline, static]

Definition at line 136 of file solver_implicit.hpp.

References box_face< C, V >::cvar(), box_face< C, V >::is_valid(), box_face< C, V >::new_point(), Polynomial, and box_face< C, V >::side().

Referenced by cell3d_algebraic_curve< C, V >::cell3d_algebraic_curve().

                                         {
      
      typedef polynomial< double, with<Bernstein> > Polynomial;

      Polynomial f, p;
      Seq<Polynomial> sys;
      for(unsigned i=0;i< eqs.size(); i++) {
        let::assign(p.rep(), eqs[i].rep());
        tensor::face(f.rep(), p.rep(), F.cvar(0), F.side(0));
        sys<<f;
      }

      solver<double, ProjRd<SBD_RDRDL> > slv;
      std::vector<double> res; 
      slv.solve_bernstein(res,sys);
      Approximate approx;

      for(int i=0;i<(int)res.size()-1;i+=2) {

//      if (res[i]<approx.eps) res[i]=0;
//      else if (res[i]>1-approx.eps) res[i]=1;

//      if (res[i+1]<approx.eps) res[i+1]=0;
//      else if (res[i+1]>1-approx.eps) res[i+1]=1;

        Point * p = F.new_point(bx, res[i], res[i+1]);
        if (F.is_valid(*p, bx))  sol<< p;
        //      else delete p;
      }
    }
static void intersection ( Seq< Point * > &  sol,
const Polynomial &  f1,
const Polynomial &  f2,
const BoundingBox bx 
) [inline, static]

Definition at line 171 of file solver_implicit.hpp.

References solver_implicit< C, V >::new_point(), bounding_box< C, V >::xmax(), bounding_box< C, V >::xmin(), bounding_box< C, V >::ymax(), and bounding_box< C, V >::ymin().

                                                                         {

      typedef polynomial< double, with<Bernstein> > MultivariateDenseBernstein;
      MultivariateDenseBernstein p1, p2;

      
      let::assign(p1.rep(), f1.rep() );
      let::assign(p2.rep(), f2.rep() );
      
      Seq<MultivariateDenseBernstein> sys;
      sys<<p1<<p2;

      solver<double, ProjRd<SBD_RDRDL> > slv;
      std::vector<double> res; 
      slv.solve_bernstein(res,sys);

      double x_sc= (bx.xmax()-bx.xmin()), y_sc= (bx.ymax()-bx.ymin());
      for(unsigned i=0;i<res.size();i+=2)
        {
          sol << new_point(bx.xmin()+res[i]*x_sc, bx.ymin()+res[i+1]*y_sc, 0.0);
        }
    }
static Point* new_point ( double  a,
double  b,
double  c 
) [inline, static]
typedef REF_OF ( )
static void singular ( Seq< Point * > &  sol,
const Polynomial &  pol,
const BoundingBox b 
) [inline, static]

Definition at line 242 of file solver_implicit.hpp.

References solver_implicit< C, V >::new_point(), Polynomial, bounding_box< C, V >::xmax(), bounding_box< C, V >::xmin(), bounding_box< C, V >::ymax(), and bounding_box< C, V >::ymin().

                                                                    {

      typedef polynomial< double, with<Bernstein> >        MultivariateDenseBernstein;
      typedef polynomial< GMP::rational, with<Bernstein> > MultivariateDenseBernsteinQ;
      
      Seq<mmx::GMP::rational> bx;
      bx<<as<mmx::GMP::rational>(b.xmin());
      bx<<as<mmx::GMP::rational>(b.xmax());
      bx<<as<mmx::GMP::rational>(b.ymin());
      bx<<as<mmx::GMP::rational>(b.ymax());

      Polynomial dxpol = diff(pol,0), dypol = diff(pol,1);
      tensor::bernstein<mmx::GMP::rational>
         P(pol.rep(),bx), dxP(dxpol.rep(),bx),dyP(dypol.rep(),bx);
      
      MultivariateDenseBernstein p,dxp,dyp;
      let::assign(p.rep()  , P);
      let::assign(dxp.rep(), dxP);
      let::assign(dyp.rep(), dyP);

      Seq<MultivariateDenseBernstein> sys;
      sys<<p<<dxp<<dyp;

      solver<double, ProjRd<SBD_RDRDL> > slv;
      //      solver<ring<double,Bernstein>, ProjRd<SBD_RDRDL> >::eps=1e-10;

      std::vector<double> res; 
      slv.solve_bernstein(res,sys);

      double x_sc= (b.xmax()-b.xmin()), y_sc= (b.ymax()-b.ymin());
      for(unsigned i=0;i<res.size();i+=2) {
        sol << new_point(b.xmin()+res[i]*x_sc, b.ymin()+res[i+1]*y_sc, 0.0);
      }
    }

Member Data Documentation

box_face< C, REF_OF(V) > back_edge [static]

Definition at line 61 of file solver_implicit.hpp.

box_face< C, REF_OF(V) > back_face [static]
box_face< C, REF_OF(V) > east_back_edge [static]

Definition at line 66 of file solver_implicit.hpp.

box_face< C, REF_OF(V) > east_edge [static]
box_face< C, REF_OF(V) > east_face [static]
box_face< C, REF_OF(V) > east_front_edge [static]

Definition at line 71 of file solver_implicit.hpp.

box_face< C, REF_OF(V) > front_edge [static]

Definition at line 60 of file solver_implicit.hpp.

box_face< C, REF_OF(V) > front_face [static]
box_face< C, REF_OF(V) > north_back_edge [static]

Definition at line 63 of file solver_implicit.hpp.

box_face< C, REF_OF(V) > north_east_edge [static]

Definition at line 75 of file solver_implicit.hpp.

box_face< C, REF_OF(V) > north_edge [static]
box_face< C, REF_OF(V) > north_face [static]
box_face< C, REF_OF(V) > north_front_edge [static]

Definition at line 68 of file solver_implicit.hpp.

box_face< C, REF_OF(V) > north_west_edge [static]

Definition at line 73 of file solver_implicit.hpp.

box_face< C, REF_OF(V) > south_back_edge [static]

Definition at line 64 of file solver_implicit.hpp.

box_face< C, REF_OF(V) > south_east_edge [static]

Definition at line 76 of file solver_implicit.hpp.

box_face< C, REF_OF(V) > south_edge [static]
box_face< C, REF_OF(V) > south_face [static]
box_face< C, REF_OF(V) > south_front_edge [static]

Definition at line 69 of file solver_implicit.hpp.

box_face< C, REF_OF(V) > south_west_edge [static]

Definition at line 74 of file solver_implicit.hpp.

box_face< C, REF_OF(V) > west_back_edge [static]

Definition at line 65 of file solver_implicit.hpp.

box_face< C, REF_OF(V) > west_edge [static]
box_face< C, REF_OF(V) > west_face [static]
box_face< C, REF_OF(V) > west_front_edge [static]

Definition at line 70 of file solver_implicit.hpp.


The documentation for this struct was generated from the following file: