Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4KnotVector.hh
Go to the documentation of this file.
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$
28 //
29 // ----------------------------------------------------------------------
30 // Class G4KnotVector
31 //
32 // Class description:
33 //
34 // Utility class for operations on a vector of knots.
35 
36 // Authors: J.Sulkimo, P.Urban.
37 // Revisions by: L.Broglia, G.Cosmo.
38 // ----------------------------------------------------------------------
39 #ifndef __KNOTVECTOR_H
40 #define __KNOTVECTOR_H
41 
42 #include <cmath>
43 #include "geomdefs.hh"
44 
46 {
47 
48  public: // with description
49 
50  G4KnotVector();
51  G4KnotVector(G4int sz);
52  ~G4KnotVector();
53  // Constructors & destructor.
54 
55  G4KnotVector(const G4KnotVector& orig);
56  // Copy constructor.
57 
59  // Assignment operator.
60 
61  inline G4int GetSize() const;
62  // Gets number of knots.
63 
64  inline G4double GetKnot(G4int knot_number) const;
65  // Retrieves knot from knot vector index knot_number.
66 
67  inline void PutKnot(G4int knot_number, G4double value);
68  // Sets knot vector index knot_number to value.
69 
71  // Adds the internal knots to the new knot vector.
72 
73  G4double* MergeKnotVector(const G4double *knots_to_add, G4int add_size);
74  // Creates the new vector by merging the old vector with the
75  // knots in the vector knots_to_add.
76 
77  G4int CheckKnotVector(G4double val) const;
78  // Finds out how many times val occurs in the knot vector.
79 
80  void ExtractKnotVector(G4KnotVector* kv, G4int upper, G4int lower);
81  // Copies either the first half or the second half of
82  // the new knot vector values to the knot vectors of the
83  // new surfaces created by splitting.
84 
85  G4int GetKnotIndex(G4double k_value, G4int order) const;
86  // Searches the knot vector for the value and returns the index
87  // This is used in the evaluation of the intersection to find
88  // out between which knots the intersection point is on the b-spline
89  // surface.
90 
91  private:
92 
93  inline G4double ApxEq(G4double x, G4double y) const;
94 
95  private:
96 
97  G4int k_size;
98  // Number of knots.
99 
100  G4double *knots;
101  // Knot vector.
102 
103  G4double kCarTolerance;
104  // Surface thickness.
105 
106 };
107 
108 #include "G4KnotVector.icc"
109 
110 #endif