Back to index

salome-med  6.5.0
InterpKernelGeo2DComposedEdge.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __INTERPKERNELGEO2DCOMPOSEDNODE_HXX__
00021 #define __INTERPKERNELGEO2DCOMPOSEDNODE_HXX__
00022 
00023 #include "INTERPKERNELDefines.hxx"
00024 
00025 #include <set>
00026 #include <list>
00027 #include <vector>
00028 #include <ostream>
00029 
00030 namespace INTERP_KERNEL
00031 {
00032   class Node;
00033   class Edge;
00034   class Bounds;
00035   class ElementaryEdge;
00036   class IteratorOnComposedEdge;
00037 
00038   class INTERPKERNEL_EXPORT ComposedEdge
00039   {
00040     friend class IteratorOnComposedEdge;
00041   public:
00042     ComposedEdge() { }
00043     ComposedEdge(const ComposedEdge& other);
00044     ComposedEdge(int sz):_sub_edges(sz) { }
00045     static void Delete(ComposedEdge *pt) { delete pt; }
00046     static void SoftDelete(ComposedEdge *pt) { pt->_sub_edges.clear(); delete pt; }
00047     void reverse();
00048     int recursiveSize() const { return (int)_sub_edges.size(); }
00049     bool presenceOfOn() const;
00050     bool presenceOfQuadraticEdge() const;
00051     void initLocations() const;
00052     ComposedEdge *clone() const;
00053     bool isNodeIn(Node *n) const;
00054     double getArea() const;
00055     double getPerimeter() const;
00056     double getHydraulicDiameter() const;
00057     void getBarycenter(double *bary) const;
00058     void getBarycenterGeneral(double *bary) const;
00059     double normalize(ComposedEdge *other, double& xBary, double& yBary);
00060     double normalizeExt(ComposedEdge *other, double& xBary, double& yBary);
00061     void unApplyGlobalSimilarityExt(ComposedEdge& other, double xBary, double yBary, double fact);
00062     void fillBounds(Bounds& output) const;
00063     void applySimilarity(double xBary, double yBary, double dimChar);
00064     void applyGlobalSimilarity(double xBary, double yBary, double dimChar);
00065     void applyGlobalSimilarity2(ComposedEdge *other, double xBary, double yBary, double dimChar);
00066     void dispatchPerimeter(double& partConsidered) const;
00067     void dispatchPerimeterExcl(double& partConsidered, double& commonPart) const;
00068     double dispatchPerimeterAdv(const ComposedEdge& father, std::vector<double>& result) const;
00069     void getAllNodes(std::set<Node *>& output) const;
00070     void getBarycenter(double *bary, double& weigh) const;
00071     bool completed() const { return getEndNode()==getStartNode(); }
00072     void setValueAt(int i, Edge *e, bool direction=true);
00073     double getCommonLengthWith(const ComposedEdge& other) const;
00074     void clear();
00075     bool empty() const { return _sub_edges.empty(); }
00076     ElementaryEdge *front() const { return _sub_edges.front(); }
00077     ElementaryEdge *back() const { return _sub_edges.back(); }
00078     void resize(int i) { _sub_edges.resize(i); }
00079     void pushBack(Edge *edge, bool direction=true);
00080     void pushBack(ElementaryEdge *elem);
00081     void pushBack(ComposedEdge *elem);
00082     int size() const { return (int)_sub_edges.size(); }
00083     ElementaryEdge *operator[](int i) const;
00084     Node *getEndNode() const;
00085     Node *getStartNode() const;
00086     bool changeEndNodeWith(Node *node) const;
00087     bool changeStartNodeWith(Node *node) const;
00088     void dumpInXfigFile(std::ostream& stream, int resolution, const Bounds& box) const;
00089     bool isInOrOut(Node *nodeToTest) const;
00090     bool getDirection() const;
00091     bool intresincEqCoarse(const Edge *other) const;
00092   private:
00093     std::list<ElementaryEdge *>* getListBehind() { return &_sub_edges; }
00094   protected:
00095     ~ComposedEdge();
00096   private:
00097     void clearAll(std::list<ElementaryEdge *>::iterator startToDel);
00098   protected:
00099     std::list<ElementaryEdge *> _sub_edges;
00100   };
00101 }
00102 
00103 #endif