Overture  Version 25
CompositeSurface.h
Go to the documentation of this file.
1 #ifndef COMPOSITE_SURFACE_H
2 #define COMPOSITE_SURFACE_H
3 
4 #include "Mapping.h"
5 #include "ListOfMappingRC.h"
6 
10 class CompositeTopology;
11 
12 //---------------------------------------------------------------
13 // Define a Composite Surface consisting of a set of Mappings
14 //---------------------------------------------------------------
15 class CompositeSurface : public Mapping
16 {
17  public:
18 
20 
21  // Copy constructor is deep by default
22  CompositeSurface( const CompositeSurface &, const CopyType copyType=DEEP );
23 
25 
27 
28 
29  // return the Mapping that represents a subSurface
30  Mapping & operator []( const int & subSurfaceIndex ); // why is subSurfaceIndex passed by reference???
31 
32  // add a surface to the composite surface
33  int add( Mapping & surface,
34  const int & surfaceID = -1 );
35 
36  int findBoundaryCurves(int & numberOfBoundaryCurves, Mapping **& boundaryCurves );
37 
38  virtual int get( const GenericDataBase & dir, const aString & name); // get from a database file
39 
40  aString getClassName() const { return CompositeSurface::className; }
41 
42  aString getColour( const int & surfaceNumber ) const;
43 
44  CompositeTopology* getCompositeTopology(bool alloc=false) ;
45 
46 // this function is needed in ogshow/plotCompositeSurface.C
47  int getNormals(const intArray & subSurfaceIndex, const realArray & xr, realArray & normal) const;
48 
49  int &getSignForNormal(int s) const;
50 
51  // get the tolerance
52  real getTolerance() const;
53 
54  // determine if points are inside or outside a (closed) triangulation using ray tracing
55  int insideOrOutside( realArray & x, IntegerArray & inside );
56 
57  // Is this surface visible?
58  int isVisible(const int & surfaceNumber) const;
59 
61 
62  virtual void map( const realArray & r,
63  realArray & x,
66 
67  int numberOfSubSurfaces() const;
68 
69  int printStatistics(FILE *file=stdout);
70 
71  // project points onto the surface
72  void oldProject( intArray & subSurfaceIndex,
73  realArray & x,
74  realArray & rProject,
75  realArray & xProject,
76  realArray & xrProject,
78  const intArray & ignoreThisSubSurface = Overture::nullIntegerDistributedArray() );
79 
80  // project points onto the surface
81  int project( realArray & x, MappingProjectionParameters & mpParameters );
82 
83  // project points onto the surface, old interface:
84  void project( intArray & subSurfaceIndex,
85  realArray & x,
86  realArray & rProject,
87  realArray & xProject,
88  realArray & xrProject,
90  const intArray & ignoreThisSubSurface = Overture::nullIntegerDistributedArray(),
91  bool invertUntrimmedSurface = false );
92 
93  virtual int put( GenericDataBase & dir, const aString & name) const; // put to a database file
94 
95 
96  // refine the grid spacing or trianglation of a sub-surface
97  int refineSubSurface( const int s );
98 
99  // remove a surface from the composite surface
100  int remove( const int & surfaceNumber );
101 
102  // recompute the bounding box
103  void recomputeBoundingBox();
104 
105  // set the colour of a subSurface.
106  int setColour( const int & surfaceNumber, const aString & colour );
107 
108  // set the visibility
109  int setIsVisible(const int & surfaceNumber, const bool & trueOrFalse=TRUE);
110 
111  // set the tolerance for how well the surfaces match (may come from the CAD file)
112  int setTolerance(real tol);
113 
114  int update( MappingInformation & mapInfo ) ;
115 
116  void updateTopology();
117 
118 
120 {
122 };
123 
124 IntegerArray dList; // int i; DisplayListContents j; dList(j,i) == display list number for surface i, feature j
125 
126 void
127 eraseCompositeSurface(GenericGraphicsInterface &gi, int surface = -1);
128 
129 bool
130 isTopologyDetermined() const { return topologyDetermined; }
131 
132 //kkc try to automagically compute the topology
134 
135 int
136 getSurfaceID(int s) const { return surfaceIdentifier(s); }
137 
138 bool plotGhostLines; // normally we do NOT plot ghost lines (takes too long for trimmed surafces)
139 
140 protected:
141  void initialize();
142  void findNearbySurfaces( const int & s,
143  realArray & r,
144  const bool & doubleCheck,
145  IntegerArray & consistent,
146  IntegerArray & inconsistent );
147  int findOutwardTangent( Mapping & map, const realArray & r, const realArray & x, realArray & outwardTangent );
148 
149  IntegerArray visible; // is a sub surface visible
150  IntegerArray surfaceIdentifier; // user defined identifier for the surface
151  aString *surfaceColour; // colour for the subSurface.
152  real tolerance; // holds tolerance for surfaces (from IGES file for example)
153 
155  {
161  };
163 
164 
165  private:
166 
167  aString className;
168  int numberOfSurfaces;
169 
170  ListOfMappingRC surfaces; // list of surfaces
171 
172  CompositeTopology *compositeTopology;
173  IntegerArray signForNormal; // multiply normal by this (+1,-1) so that all normals are consistent
174  bool topologyDetermined;
175  void
176  determineTopology();
177 
178  private:
179 
180  //
181  // Virtual member functions used only through class ReferenceCounting:
182  //
184  { return operator=((CompositeSurface &)x); }
185  virtual void reference( const ReferenceCounting& x)
186  { reference((CompositeSurface &)x); } // *** Conversion to this class for the virtual = ****
187  virtual ReferenceCounting* virtualConstructor( const CopyType ct = DEEP ) const
188  { return ::new CompositeSurface(*this, ct); }
189 
190 };
191 
192 
193 #endif