[831] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // $Id: G4KnotVector.hh,v 1.10 2007/05/11 13:49:31 gcosmo Exp $ |
---|
[850] | 28 | // GEANT4 tag $Name: HEAD $ |
---|
[831] | 29 | // |
---|
| 30 | // ---------------------------------------------------------------------- |
---|
| 31 | // Class G4KnotVector |
---|
| 32 | // |
---|
| 33 | // Class description: |
---|
| 34 | // |
---|
| 35 | // Utility class for operations on a vector of knots. |
---|
| 36 | |
---|
| 37 | // Authors: J.Sulkimo, P.Urban. |
---|
| 38 | // Revisions by: L.Broglia, G.Cosmo. |
---|
| 39 | // ---------------------------------------------------------------------- |
---|
| 40 | #ifndef __KNOTVECTOR_H |
---|
| 41 | #define __KNOTVECTOR_H |
---|
| 42 | |
---|
| 43 | #include <cmath> |
---|
| 44 | #include "geomdefs.hh" |
---|
| 45 | |
---|
| 46 | class G4KnotVector |
---|
| 47 | { |
---|
| 48 | |
---|
| 49 | public: // with description |
---|
| 50 | |
---|
| 51 | G4KnotVector(); |
---|
| 52 | G4KnotVector(G4int sz); |
---|
| 53 | ~G4KnotVector(); |
---|
| 54 | // Constructors & destructor. |
---|
| 55 | |
---|
| 56 | G4KnotVector(const G4KnotVector& orig); |
---|
| 57 | // Copy constructor. |
---|
| 58 | |
---|
| 59 | G4KnotVector& operator=(const G4KnotVector& right); |
---|
| 60 | // Assignment operator. |
---|
| 61 | |
---|
| 62 | inline G4int GetSize() const; |
---|
| 63 | // Gets number of knots. |
---|
| 64 | |
---|
| 65 | inline G4double GetKnot(G4int knot_number) const; |
---|
| 66 | // Retrieves knot from knot vector index knot_number. |
---|
| 67 | |
---|
| 68 | inline void PutKnot(G4int knot_number, G4double value); |
---|
| 69 | // Sets knot vector index knot_number to value. |
---|
| 70 | |
---|
| 71 | G4KnotVector* MultiplyKnotVector(G4int num, G4double value); |
---|
| 72 | // Adds the internal knots to the new knot vector. |
---|
| 73 | |
---|
| 74 | G4double* MergeKnotVector(const G4double *knots_to_add, G4int add_size); |
---|
| 75 | // Creates the new vector by merging the old vector with the |
---|
| 76 | // knots in the vector knots_to_add. |
---|
| 77 | |
---|
| 78 | G4int CheckKnotVector(G4double val) const; |
---|
| 79 | // Finds out how many times val occurs in the knot vector. |
---|
| 80 | |
---|
| 81 | void ExtractKnotVector(G4KnotVector* kv, G4int upper, G4int lower); |
---|
| 82 | // Copies either the first half or the second half of |
---|
| 83 | // the new knot vector values to the knot vectors of the |
---|
| 84 | // new surfaces created by splitting. |
---|
| 85 | |
---|
| 86 | G4int GetKnotIndex(G4double k_value, G4int order) const; |
---|
| 87 | // Searches the knot vector for the value and returns the index |
---|
| 88 | // This is used in the evaluation of the intersection to find |
---|
| 89 | // out between which knots the intersection point is on the b-spline |
---|
| 90 | // surface. |
---|
| 91 | |
---|
| 92 | private: |
---|
| 93 | |
---|
| 94 | inline G4double ApxEq(G4double x, G4double y) const; |
---|
| 95 | |
---|
| 96 | private: |
---|
| 97 | |
---|
| 98 | G4int k_size; |
---|
| 99 | // Number of knots. |
---|
| 100 | |
---|
| 101 | G4double *knots; |
---|
| 102 | // Knot vector. |
---|
| 103 | |
---|
| 104 | G4double kCarTolerance; |
---|
| 105 | // Surface thickness. |
---|
| 106 | |
---|
| 107 | }; |
---|
| 108 | |
---|
| 109 | #include "G4KnotVector.icc" |
---|
| 110 | |
---|
| 111 | #endif |
---|