Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:04

0001 // Created by: Peter KURNEV
0002 // Copyright (c) 2010-2014 OPEN CASCADE SAS
0003 // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
0004 // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
0005 //                         EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
0006 //
0007 // This file is part of Open CASCADE Technology software library.
0008 //
0009 // This library is free software; you can redistribute it and/or modify it under
0010 // the terms of the GNU Lesser General Public License version 2.1 as published
0011 // by the Free Software Foundation, with special exception defined in the file
0012 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0013 // distribution for complete text of the license and disclaimer of any warranty.
0014 //
0015 // Alternatively, this file may be used under the terms of Open CASCADE
0016 // commercial license or contractual agreement.
0017 
0018 #ifndef _BOPDS_Iterator_HeaderFile
0019 #define _BOPDS_Iterator_HeaderFile
0020 
0021 #include <Standard.hxx>
0022 #include <Standard_DefineAlloc.hxx>
0023 #include <Standard_Handle.hxx>
0024 
0025 #include <Standard_Integer.hxx>
0026 #include <BOPDS_PDS.hxx>
0027 #include <BOPDS_VectorOfVectorOfPair.hxx>
0028 #include <BOPTools_BoxTree.hxx>
0029 #include <NCollection_BaseAllocator.hxx>
0030 #include <Precision.hxx>
0031 #include <TopAbs_ShapeEnum.hxx>
0032 class IntTools_Context;
0033 
0034 //! The class BOPDS_Iterator is
0035 //! 1.to compute intersections between BRep sub-shapes
0036 //! of arguments of an operation (see the class BOPDS_DS)
0037 //! in terms of theirs bounding boxes
0038 //! 2.provides interface to iterate the pairs of
0039 //! intersected sub-shapes of given type
0040 class BOPDS_Iterator 
0041 {
0042 public:
0043 
0044   DEFINE_STANDARD_ALLOC
0045 
0046   //! Empty constructor
0047   Standard_EXPORT BOPDS_Iterator();
0048   Standard_EXPORT virtual ~BOPDS_Iterator();
0049 
0050   //! Constructor
0051   //! @param theAllocator the allocator to manage the memory
0052   Standard_EXPORT BOPDS_Iterator(const Handle(NCollection_BaseAllocator)& theAllocator);
0053 
0054   //! Modifier
0055   //! Sets the data structure <pDS> to process
0056   Standard_EXPORT void SetDS (const BOPDS_PDS& pDS);
0057 
0058   //! Selector
0059   //! Returns the data structure
0060   Standard_EXPORT const BOPDS_DS& DS() const;
0061 
0062   //! Initializes the  iterator
0063   //! theType1 - the first type of shape
0064   //! theType2 - the second type of shape
0065   Standard_EXPORT void Initialize (const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType2);
0066 
0067   //! Returns  true if still there are pairs
0068   //! of intersected shapes
0069   Standard_EXPORT Standard_Boolean More() const;
0070 
0071   //! Moves iterations ahead
0072   Standard_EXPORT void Next();
0073 
0074   //! Returns indices (DS) of intersected shapes
0075   //! theIndex1 - the index of the first shape
0076   //! theIndex2 - the index of the second shape
0077   Standard_EXPORT void Value (Standard_Integer& theIndex1,
0078                               Standard_Integer& theIndex2) const;
0079 
0080   //! Perform the intersection algorithm and prepare
0081   //! the results to be used
0082   Standard_EXPORT virtual void Prepare(const Handle(IntTools_Context)& theCtx = Handle(IntTools_Context)(),
0083                                        const Standard_Boolean theCheckOBB = Standard_False,
0084                                        const Standard_Real theFuzzyValue = Precision::Confusion());
0085 
0086   //! Updates the tree of Bounding Boxes with increased boxes and
0087   //! intersects such elements with the tree.
0088   Standard_EXPORT void IntersectExt(const TColStd_MapOfInteger& theIndicies);
0089 
0090   //! Returns the number of intersections founded
0091   Standard_EXPORT Standard_Integer ExpectedLength() const;
0092 
0093   //! Returns the block length
0094   Standard_EXPORT Standard_Integer BlockLength() const;
0095 
0096   //! Set the flag of parallel processing
0097   //! if <theFlag> is true  the parallel processing is switched on
0098   //! if <theFlag> is false the parallel processing is switched off
0099   Standard_EXPORT void SetRunParallel (const Standard_Boolean theFlag);
0100 
0101   //! Returns the flag of parallel processing
0102   Standard_EXPORT Standard_Boolean RunParallel() const;
0103 
0104 
0105 public: //! @name Number of extra interfering types
0106 
0107   // Extra lists contain only V/V, V/E, V/F interfering pairs.
0108   // Although E/E is also initialized (but never filled) for code simplicity.
0109   static Standard_Integer NbExtInterfs() { return 4; }
0110 
0111 protected: //! @name Protected methods for bounding boxes intersection
0112 
0113   //! Intersects the Bounding boxes of sub-shapes of the arguments with the tree
0114   //! and saves the interfering pairs for further geometrical intersection.
0115   Standard_EXPORT virtual void Intersect(const Handle(IntTools_Context)& theCtx = Handle(IntTools_Context)(),
0116                                          const Standard_Boolean theCheckOBB = Standard_False,
0117                                          const Standard_Real theFuzzyValue = Precision::Confusion());
0118 
0119 protected: //! @name Fields
0120 
0121   Handle(NCollection_BaseAllocator) myAllocator; //!< Allocator
0122   Standard_Integer myLength;                     //!< Length of the intersection vector of
0123                                                  //! particular intersection type
0124   BOPDS_PDS myDS;                                //!< Data Structure
0125   BOPDS_VectorOfVectorOfPair myLists;            //!< Pairs with interfering bounding boxes
0126   BOPDS_VectorOfPair::Iterator myIterator;       //!< Iterator on each interfering type
0127   Standard_Boolean myRunParallel;                //!< Flag for parallel processing
0128   BOPDS_VectorOfVectorOfPair myExtLists;         //!< Extra pairs of sub-shapes found after
0129                                                  //! intersection of increased sub-shapes
0130   Standard_Boolean myUseExt;                     //!< Information flag for using the extra lists
0131 
0132 };
0133 
0134 #endif // _BOPDS_Iterator_HeaderFile