LR-splines  0.5
Public Member Functions | Static Protected Member Functions | Protected Attributes
LR::LRSpline Class Reference

#include <LRSpline/LRSpline.h>

Inheritance diagram for LR::LRSpline:
LR::Streamable LR::LRSplineSurface LR::LRSplineVolume

List of all members.

Public Member Functions

 LRSpline ()
virtual void generateIDs () const
int nBasisFunctions () const
 returns the number of B-splines (basisfunctions) in this LR-spline object
int nElements () const
 returns the number of elements
int dimension () const
 returns the number of components that the control points have (spatial dimension)
int nVariate () const
 returns the number of local knot vectors for each B-spline (parametric dimension)
int order (int i) const
 returns the polynomial order (degree + 1) in the given parametric direction
double startparam (int i) const
 returns the start parameter of the given parametric direction
double endparam (int i) const
 returns the end parameter of the given parametric direction
bool rational () const
 should always return false as rational LR splines is not yet implemented
void getEdgeFunctions (std::vector< Basisfunction * > &edgeFunctions, parameterEdge edge, int depth=1) const
void getEdgeElements (std::vector< Element * > &edgeElements, parameterEdge edge) const
virtual void getBezierElement (int iEl, std::vector< double > &controlPoints) const =0
virtual void getBezierExtraction (int iEl, std::vector< double > &extractMatrix) const =0
std::vector< Element * >::iterator elementBegin ()
std::vector< Element * >::iterator elementEnd ()
HashSet_iterator< Basisfunction * > basisBegin ()
HashSet_iterator< Basisfunction * > basisEnd ()
HashSet_const_iterator
< Basisfunction * > 
basisBegin () const
HashSet_const_iterator
< Basisfunction * > 
basisEnd () const
const HashSet< Basisfunction * > & getAllBasisfunctions () const
const std::vector< Element * > & getAllElements () const
ElementgetElement (int i)
const ElementgetElement (int i) const
BasisfunctiongetBasisfunction (int iBasis)
const BasisfunctiongetBasisfunction (int iBasis) const
virtual void refineBasisFunction (int index)=0
virtual void refineBasisFunction (const std::vector< int > &indices)=0
virtual void refineElement (int index)=0
virtual void refineElement (const std::vector< int > &indices)=0
virtual void refineByDimensionIncrease (const std::vector< double > &error, double beta)=0
void setRefStrat (enum refinementStrategy strat)
void setRefSymmetry (int symmetry)
void setRefMultiplicity (int mult)
void setMaxTjoints (int n)
void setCloseGaps (bool doClose)
void setMaxAspectRatio (double r, bool aposterioriFix=true)
virtual bool setControlPoints (std::vector< double > &cps)
virtual void rebuildDimension (int dimvalue)
virtual bool isLinearIndepByOverloading (bool verbose)=0
virtual bool isLinearIndepByMappingMatrix (bool verbose) const =0
virtual void read (std::istream &is)
virtual void write (std::ostream &os) const

Static Protected Member Functions

static std::vector< double > getUniformKnotVector (int n, int p)
template<typename RandomIterator >
static std::vector< double > getGrevillePoints (RandomIterator knotStart, RandomIterator knotEnd)

Protected Attributes

int dim_
bool rational_
std::vector< double > start_
std::vector< double > end_
 parametric start coordinate (2 components for surfaces, 3 for volumes)
std::vector< int > order_
 parametric stop coordinate (2 components for surfaces, 3 for volumes)
std::vector< Basisfunction * > basisVector
 polynomial order (degree + 1) in each parametric direction (2 or 3 components)
HashSet< Basisfunction * > basis_
std::vector< Element * > element_
enum refinementStrategy refStrat_
int refKnotlineMult_
int symmetry_
int maxTjoints_
bool doCloseGaps_
bool doAspectRatioFix_
double maxAspectRatio_
int lastElementEvaluation

Detailed Description

Definition at line 39 of file LRSpline.h.


Constructor & Destructor Documentation

Definition at line 7 of file LRSpline.cpp.

References dim_, element_, and lastElementEvaluation.

                   {
        dim_      = 0;
        element_.resize(0);
        lastElementEvaluation = -1;
}

Member Function Documentation

Definition at line 75 of file LRSpline.h.

References basis_, and HashSet< T >::begin().

Referenced by main().

{ return basis_.begin();   };

Definition at line 77 of file LRSpline.h.

References basis_, and HashSet< T >::begin().

{ return basis_.begin();   };

Definition at line 76 of file LRSpline.h.

References basis_, and HashSet< T >::end().

{ return basis_.end();     };

Definition at line 78 of file LRSpline.h.

References basis_, and HashSet< T >::end().

{ return basis_.end();     };
int LR::LRSpline::dimension ( ) const [inline]

returns the number of components that the control points have (spatial dimension)

Definition at line 53 of file LRSpline.h.

References dim_.

{ return dim_           ; };
std::vector<Element*>::iterator LR::LRSpline::elementBegin ( ) [inline]

Definition at line 73 of file LRSpline.h.

References element_.

Referenced by main().

{ return element_.begin(); };
std::vector<Element*>::iterator LR::LRSpline::elementEnd ( ) [inline]

Definition at line 74 of file LRSpline.h.

References element_.

Referenced by main().

{ return element_.end();   };
double LR::LRSpline::endparam ( int  i) const [inline]

returns the end parameter of the given parametric direction

Definition at line 61 of file LRSpline.h.

References end_.

{ return end_[i]        ; };
void LR::LRSpline::generateIDs ( ) const [virtual]

Definition at line 13 of file LRSpline.cpp.

References basis_, and element_.

Referenced by LR::LRSplineSurface::copy(), LR::LRSplineVolume::copy(), main(), LR::LRSplineSurface::write(), and LR::LRSplineVolume::write().

                                 {
        uint i=0;
        for(Basisfunction *b : basis_)
                b->setId(i++);
        for(i=0; i<element_.size(); i++) 
                element_[i]->setId(i);
}

Definition at line 79 of file LRSpline.h.

References basis_.

Referenced by main().

{ return basis_ ;          };
const std::vector<Element*>& LR::LRSpline::getAllElements ( ) const [inline]

Definition at line 80 of file LRSpline.h.

References element_.

Referenced by main().

{ return element_ ;        };
Basisfunction* LR::LRSpline::getBasisfunction ( int  iBasis) [inline]

Definition at line 85 of file LRSpline.h.

References basis_, HashSet< T >::begin(), and HashSet< T >::size().

Referenced by main(), LR::LRSplineSurface::refineByDimensionIncrease(), and LR::LRSplineVolume::refineByDimensionIncrease().

                                                    {
                if(iBasis<0 || iBasis>=basis_.size())
                        return NULL;
                HashSet_iterator<Basisfunction*> it=basis_.begin(); 
                for(int i=0; i<iBasis; i++)
                        ++it;
                return *it;
        }
const Basisfunction* LR::LRSpline::getBasisfunction ( int  iBasis) const [inline]

Definition at line 93 of file LRSpline.h.

References basis_, HashSet< T >::begin(), and HashSet< T >::size().

                                                                {
                if(iBasis<0 || iBasis>=basis_.size())
                        return NULL;
                HashSet_const_iterator<Basisfunction*> it=basis_.begin(); 
                for(int i=0; i<iBasis; i++)
                        ++it;
                return *it;
        }
virtual void LR::LRSpline::getBezierElement ( int  iEl,
std::vector< double > &  controlPoints 
) const [pure virtual]
virtual void LR::LRSpline::getBezierExtraction ( int  iEl,
std::vector< double > &  extractMatrix 
) const [pure virtual]
void LR::LRSpline::getEdgeElements ( std::vector< Element * > &  edgeElements,
parameterEdge  edge 
) const

Definition at line 50 of file LRSpline.cpp.

References basis_, HashSet< T >::begin(), LR::BOTTOM, LR::EAST, element_, end_, LR::NORTH, nVariate(), LR::SOUTH, start_, LR::TOP, and LR::WEST.

                                                                                            {
        edgeElements.clear();
        bool trivariate = (**basis_.begin()).nVariate() == 3;
        for(Element * el : element_) {
                bool ok = true;
                if( edge & WEST )
                        if(el->getParmin(0) != start_[0]) 
                                ok = false;
                if( edge & EAST )
                        if(el->getParmax(0) != end_[0]) 
                                ok = false;
                if( edge & SOUTH )
                        if(el->getParmin(1) != start_[1]) 
                                ok = false;
                if( edge & NORTH )
                        if(el->getParmax(1) != end_[1]) 
                                ok = false;
                if( trivariate && (edge & BOTTOM) )
                        if(el->getParmin(2) != start_[2]) 
                                ok = false;
                if( trivariate && (edge & TOP ) )
                        if(el->getParmax(2) != end_[2]) 
                                ok = false;

                if(ok)
                        edgeElements.push_back(el);
        }
}
void LR::LRSpline::getEdgeFunctions ( std::vector< Basisfunction * > &  edgeFunctions,
parameterEdge  edge,
int  depth = 1 
) const

Definition at line 21 of file LRSpline.cpp.

References basis_, HashSet< T >::begin(), LR::BOTTOM, LR::EAST, end_, LR::NORTH, nVariate(), order_, LR::SOUTH, start_, LR::TOP, and LR::WEST.

                                                                                                             {
        edgeFunctions.clear();
        bool trivariate = (**basis_.begin()).nVariate() == 3;
        for(Basisfunction *b : basis_) {
                bool ok = true;
                if( edge & WEST )
                        if((*b)[0][order_[0]-depth] != start_[0]) 
                                ok = false;
                if( edge & EAST )
                        if((*b)[0][depth] != end_[0]) 
                                ok = false;
                if( edge & SOUTH )
                        if((*b)[1][order_[1]-depth] != start_[1]) 
                                ok = false;
                if( edge & NORTH )
                        if((*b)[1][depth] != end_[1]) 
                                ok = false;
                if( trivariate && (edge & BOTTOM) )
                        if((*b)[2][order_[2]-depth] != start_[2]) 
                                ok = false;
                if( trivariate && (edge & TOP ) )
                        if((*b)[2][depth] != end_[2]) 
                                ok = false;

                if(ok)
                        edgeFunctions.push_back(b);
        }
}
Element* LR::LRSpline::getElement ( int  i) [inline]

Definition at line 83 of file LRSpline.h.

References element_.

Referenced by main().

{ return element_[i]; };
const Element* LR::LRSpline::getElement ( int  i) const [inline]

Definition at line 84 of file LRSpline.h.

References element_.

{ return element_[i]; };
template<typename RandomIterator >
static std::vector<double> LR::LRSpline::getGrevillePoints ( RandomIterator  knotStart,
RandomIterator  knotEnd 
) [inline, static, protected]

Definition at line 171 of file LRSpline.h.

Referenced by LR::LRSplineSurface::LRSplineSurface(), and LR::LRSplineVolume::LRSplineVolume().

                                                                                                     {
                RandomIterator knot = knotStart;
                int p=0;
                while(*knot == *knotStart) {
                        knot++;
                        p++;
                }
                int n = (knotEnd-knotStart)-p;

                std::vector<double> result(n);
                for(int i=0; i<n; i++) {
                        result[i] = 0.0;
                        for(int j=i+1; j<i+p; j++)
                                result[i] +=  *(knotStart+j);
                        result[i] /= (p-1);
                }
                return result;
        }
static std::vector<double> LR::LRSpline::getUniformKnotVector ( int  n,
int  p 
) [inline, static, protected]

Definition at line 157 of file LRSpline.h.

Referenced by LR::LRSplineSurface::LRSplineSurface(), and LR::LRSplineVolume::LRSplineVolume().

                                                                    {
                std::vector<double> result(n+p);
                int k=0;
                double max = n-p+1;
                for(int i=0; i<p-1; i++)
                        result[k++] = 0.0;
                for(int i=0; i<n-p+2; i++)
                        result[k++] = 1.0*i/max;
                for(int i=0; i<p-1; i++)
                        result[k++] = 1.0;
                return result;
        }
virtual bool LR::LRSpline::isLinearIndepByMappingMatrix ( bool  verbose) const [pure virtual]
virtual bool LR::LRSpline::isLinearIndepByOverloading ( bool  verbose) [pure virtual]
int LR::LRSpline::nBasisFunctions ( ) const [inline]

returns the number of B-splines (basisfunctions) in this LR-spline object

Definition at line 49 of file LRSpline.h.

References basis_, and HashSet< T >::size().

Referenced by main().

{ return basis_.size()  ; }; 
int LR::LRSpline::nElements ( ) const [inline]

returns the number of elements

Definition at line 51 of file LRSpline.h.

References element_.

Referenced by main(), LR::LRSplineSurface::read(), and LR::LRSplineVolume::read().

{ return element_.size(); };
int LR::LRSpline::nVariate ( ) const [inline]

returns the number of local knot vectors for each B-spline (parametric dimension)

Definition at line 55 of file LRSpline.h.

References start_.

Referenced by getEdgeElements(), and getEdgeFunctions().

{ return start_.size()  ; };
int LR::LRSpline::order ( int  i) const [inline]

returns the polynomial order (degree + 1) in the given parametric direction

Definition at line 57 of file LRSpline.h.

References order_.

Referenced by main().

{ return order_[i]      ; };
bool LR::LRSpline::rational ( ) const [inline]

should always return false as rational LR splines is not yet implemented

Definition at line 63 of file LRSpline.h.

References rational_.

Referenced by LR::LRSplineSurface::initCore(), and LR::LRSplineVolume::initCore().

{ return rational_      ; };
virtual void LR::LRSpline::read ( std::istream &  is) [inline, virtual]

Implements LR::Streamable.

Reimplemented in LR::LRSplineVolume, and LR::LRSplineSurface.

Definition at line 129 of file LRSpline.h.

{ };
void LR::LRSpline::rebuildDimension ( int  dimvalue) [virtual]

Definition at line 94 of file LRSpline.cpp.

References basis_, and dim_.

Referenced by main().

                                            {
        for(Basisfunction *b : basis_)
                b->setDimension(dimvalue);
        dim_ = dimvalue;
}
virtual void LR::LRSpline::refineBasisFunction ( int  index) [pure virtual]

Implemented in LR::LRSplineVolume, and LR::LRSplineSurface.

Referenced by main().

virtual void LR::LRSpline::refineBasisFunction ( const std::vector< int > &  indices) [pure virtual]
virtual void LR::LRSpline::refineByDimensionIncrease ( const std::vector< double > &  error,
double  beta 
) [pure virtual]
virtual void LR::LRSpline::refineElement ( int  index) [pure virtual]

Implemented in LR::LRSplineVolume, and LR::LRSplineSurface.

Referenced by main().

virtual void LR::LRSpline::refineElement ( const std::vector< int > &  indices) [pure virtual]
void LR::LRSpline::setCloseGaps ( bool  doClose) [inline]

Definition at line 114 of file LRSpline.h.

References doCloseGaps_.

{ doCloseGaps_     = doClose;  };
bool LR::LRSpline::setControlPoints ( std::vector< double > &  cps) [virtual]

Definition at line 79 of file LRSpline.cpp.

References basis_, HashSet< T >::begin(), dim_, HashSet< T >::end(), and HashSet< T >::size().

                                                                {
        if(controlpoints.size() != dim_*basis_.size())
                return false;
        
        std::vector<double>::iterator newCP = controlpoints.begin();

        HashSet_iterator<Basisfunction*> bit;
        for(bit=basis_.begin(); bit!=basis_.end(); ++bit) {
                std::vector<double>::iterator cp = (**bit).cp();
                for(int i=0; i<dim_; i++, cp++, newCP++)
                        *cp = *newCP;
        }
        return true;
}
void LR::LRSpline::setMaxAspectRatio ( double  r,
bool  aposterioriFix = true 
) [inline]

Definition at line 115 of file LRSpline.h.

References doAspectRatioFix_, and maxAspectRatio_.

                                                                   {
                maxAspectRatio_ = r;
                doAspectRatioFix_ = aposterioriFix;
        }
void LR::LRSpline::setMaxTjoints ( int  n) [inline]

Definition at line 113 of file LRSpline.h.

References maxTjoints_.

{ maxTjoints_      = n;        };
void LR::LRSpline::setRefMultiplicity ( int  mult) [inline]

Definition at line 112 of file LRSpline.h.

References refKnotlineMult_.

Referenced by main().

{ refKnotlineMult_ = mult;     };
void LR::LRSpline::setRefStrat ( enum refinementStrategy  strat) [inline]

Definition at line 110 of file LRSpline.h.

References refStrat_.

Referenced by main().

{ refStrat_        = strat;    };
void LR::LRSpline::setRefSymmetry ( int  symmetry) [inline]

Definition at line 111 of file LRSpline.h.

References symmetry_.

{ this->symmetry_  = symmetry; };
double LR::LRSpline::startparam ( int  i) const [inline]

returns the start parameter of the given parametric direction

Definition at line 59 of file LRSpline.h.

References start_.

Referenced by main().

{ return start_[i]      ; };
virtual void LR::LRSpline::write ( std::ostream &  os) const [inline, virtual]

Implements LR::Streamable.

Reimplemented in LR::LRSplineVolume, and LR::LRSplineSurface.

Definition at line 130 of file LRSpline.h.

{ };

Member Data Documentation

std::vector<Basisfunction*> LR::LRSpline::basisVector [protected]

polynomial order (degree + 1) in each parametric direction (2 or 3 components)

Definition at line 141 of file LRSpline.h.

Referenced by LR::LRSplineSurface::copy(), LR::LRSplineVolume::copy(), LR::LRSplineSurface::read(), and LR::LRSplineVolume::read().

int LR::LRSpline::dim_ [protected]
bool LR::LRSpline::doCloseGaps_ [protected]
std::vector<Element*> LR::LRSpline::element_ [protected]

Definition at line 143 of file LRSpline.h.

Referenced by LR::LRSplineSurface::closeGaps(), LR::LRSplineSurface::computeBasis(), LR::LRSplineVolume::computeBasis(), LR::LRSplineSurface::copy(), LR::LRSplineVolume::copy(), elementBegin(), elementEnd(), LR::LRSplineSurface::enforceMaxAspectRatio(), LR::LRSplineSurface::enforceMaxTjoints(), generateIDs(), getAllElements(), LR::LRSplineSurface::getBezierElement(), LR::LRSplineVolume::getBezierElement(), LR::LRSplineSurface::getBezierExtraction(), LR::LRSplineVolume::getBezierExtraction(), LR::LRSplineSurface::getDiagonalElements(), LR::LRSplineVolume::getDiagonalElements(), getEdgeElements(), getElement(), LR::LRSplineSurface::getElementContaining(), LR::LRSplineVolume::getElementContaining(), LR::LRSplineSurface::getFullspanLines(), LR::LRSplineVolume::getFullspanRects(), LR::LRSplineSurface::getMinspanLines(), LR::LRSplineVolume::getMinspanRects(), LR::LRSplineSurface::initCore(), LR::LRSplineVolume::initCore(), LR::LRSplineVolume::insert_line(), LR::LRSplineSurface::insert_line(), LR::LRSplineSurface::isLinearIndepByOverloading(), LR::LRSplineVolume::isLinearIndepByOverloading(), LRSpline(), LR::LRSplineSurface::LRSplineSurface(), LR::LRSplineVolume::LRSplineVolume(), LR::LRSplineSurface::makeIntegerKnots(), nElements(), LR::LRSplineSurface::point(), LR::LRSplineVolume::point(), LR::LRSplineSurface::printElements(), LR::LRSplineVolume::printElements(), LR::LRSplineSurface::read(), LR::LRSplineVolume::read(), LR::LRSplineSurface::refineByDimensionIncrease(), LR::LRSplineVolume::refineByDimensionIncrease(), LR::LRSplineSurface::updateSupport(), LR::LRSplineVolume::updateSupport(), LR::LRSplineSurface::write(), LR::LRSplineVolume::write(), LR::LRSplineSurface::writePostscriptElements(), LR::LRSplineSurface::writePostscriptMesh(), LR::LRSplineSurface::~LRSplineSurface(), and LR::LRSplineVolume::~LRSplineVolume().

std::vector<double> LR::LRSpline::end_ [protected]
int LR::LRSpline::lastElementEvaluation [mutable, protected]
double LR::LRSpline::maxAspectRatio_ [protected]
int LR::LRSpline::maxTjoints_ [protected]
std::vector<int> LR::LRSpline::order_ [protected]
bool LR::LRSpline::rational_ [protected]
std::vector<double> LR::LRSpline::start_ [protected]
int LR::LRSpline::symmetry_ [protected]

The documentation for this class was generated from the following files: